Package org.localify.common
Class OneOffStartupTasks
java.lang.Object
org.localify.common.OneOffStartupTasks
- All Implemented Interfaces:
org.springframework.boot.CommandLineRunner
@Component
public class OneOffStartupTasks
extends Object
implements org.springframework.boot.CommandLineRunner
A component for running one-off startup tasks.
This is useful for data ingestion and other tasks that should only be run once.
-
Constructor Summary
ConstructorsConstructorDescriptionOneOffStartupTasks(LocalifyProperties properties, CityRepository cityRepository, UserRepository userRepository, ArtistRepository artistRepository, FileIngest fileIngest, ScraperIngest scraperIngest, SpotifyService spotifyService, ArtistCityRepository artistCityRepository) Constructs a new OneOffStartupTasks. -
Method Summary
Modifier and TypeMethodDescriptionvoidIngests city populations from a CSV file.voidIngests Spotify artists from a file.voidIngests Spotify artists by album ID from a file.voidIngests Spotify artists by name from a file.voidIngests Spotify artists by track ID from a file.voidIngests artist JSONs from Rate Your Music.voidIngests artist origins from a file.void
-
Constructor Details
-
OneOffStartupTasks
@Autowired public OneOffStartupTasks(LocalifyProperties properties, CityRepository cityRepository, UserRepository userRepository, ArtistRepository artistRepository, FileIngest fileIngest, ScraperIngest scraperIngest, SpotifyService spotifyService, ArtistCityRepository artistCityRepository) Constructs a new OneOffStartupTasks.- Parameters:
properties- The application properties.cityRepository- The city repository.userRepository- The user repository.artistRepository- The artist repository.fileIngest- The file ingest service.scraperIngest- The scraper ingest service.spotifyService- The Spotify service.artistCityRepository- The artist-city repository.
-
-
Method Details
-
run
- Specified by:
runin interfaceorg.springframework.boot.CommandLineRunner- Throws:
Exception
-
ingestRymJsons
Ingests artist JSONs from Rate Your Music. This was a one-off method used to ingest artist JSONs from rate your music. These JSONs were generated by Doug from a collection of HTML files scraped en masse by April -
ingestFileSpotifyArtists
Ingests Spotify artists from a file. This was a one-off method used to ingest artists for the SXSW Festival If you'd like to re-use it, provide a txt file of spotify artist IDs, separated by newlines -
ingestFileSpotifyArtistsByTrack
Ingests Spotify artists by track ID from a file. This was a one-off method used to ingest artists for the SXSW Festival, since some of their artists provided links to their top tracks and not their artist profiles. If you'd like to re-use it, provide a txt file of spotify track IDs, separated by newlines -
ingestFileSpotifyArtistsByAlbum
Ingests Spotify artists by album ID from a file. -
ingestFileSpotifyArtistsByName
Ingests Spotify artists by name from a file. This was a one-off method used to ingest the artists from Porchfest, Ithaca If you'd like to re-use it, just provide a txt file with artist names separated by newlines -
ingestSpotifyIdOrigins
Ingests artist origins from a file. This was a one-off method to ingest the artist origins from artists in FoCoMa To re-use it, provide a json file thats shaped likeMap<String, List<String>>where the keys are spotify ids and the values are lists of strings that are City Name, Zone Code (ig Ithaca, NY) why this format? because thats how i formatted the scraper and im lazy. sorry! -
ingestCityPopulations
Ingests city populations from a CSV file.
-