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 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

      public void run(String... args) throws Exception
      Specified by:
      run in interface org.springframework.boot.CommandLineRunner
      Throws:
      Exception
    • ingestRymJsons

      @Scheduled(fixedRate=70L, timeUnit=MINUTES) public void 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

      @Scheduled(fixedRate=1000L, timeUnit=DAYS) public void 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

      @Scheduled(fixedRate=1000L, timeUnit=DAYS) public void 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

      @Scheduled(fixedRate=1000L, timeUnit=DAYS) public void ingestFileSpotifyArtistsByAlbum()
      Ingests Spotify artists by album ID from a file.
    • ingestFileSpotifyArtistsByName

      @Scheduled(fixedRate=1000L, timeUnit=DAYS) public void 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

      @Scheduled(fixedRate=70L, timeUnit=MINUTES) public void 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 like Map<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

      @Scheduled(fixedRate=1000L, timeUnit=DAYS) @Transactional public void ingestCityPopulations()
      Ingests city populations from a CSV file.