log.debug('Migration type is ' + migration_type) log.info('Exporting data from ' + export_username) if migration_type != 'stations': log.info('Retrieving tracks from ' + export_username) export_tracks = export_api.get_all_songs() # strip out any tracks that are not available on All Access all_tracks = [ t for t in export_tracks if track_has_aa_data(t) and not t.get('deleted') ] if migration_type == 'all' or migration_type == 'ratings': log.info('Retrieving thumbs up tracks from ' + export_username) export_thumbs_up = export_api.get_thumbs_up_songs() # strip out any tracks that are not available on All Access thumbs_up_tracks = [t for t in export_thumbs_up if track_has_aa_data(t)] if migration_type == 'all' or migration_type == 'playlists': log.info('Retrieving playlists from ' + export_username) export_playlists = export_api.get_all_user_playlist_contents() playlists = [p for p in export_playlists if not p.get('deleted')] if migration_type == 'all' or migration_type == 'stations': log.info('Retrieving stations from ' + export_username) export_stations = export_api.get_all_stations() radio_stations = [s for s in export_stations if not s.get('deleted')] log.info('Export complete') export_api.logout()
log.debug('Login successful for ' + import_username) # load the library, playlists, thumbs up tracks, and stations log.debug('Migration type is ' + migration_type) log.info('Exporting data from ' + export_username) if migration_type != 'stations': log.info('Retrieving tracks from ' + export_username) export_tracks = export_api.get_all_songs() # strip out any tracks that are not available on All Access all_tracks = [t for t in export_tracks if track_has_aa_data(t) and not t.get('deleted')] if migration_type == 'all' or migration_type == 'ratings': log.info('Retrieving thumbs up tracks from ' + export_username) export_thumbs_up = export_api.get_thumbs_up_songs() # strip out any tracks that are not available on All Access thumbs_up_tracks = [t for t in export_thumbs_up if track_has_aa_data(t)] if migration_type == 'all' or migration_type == 'playlists': log.info('Retrieving playlists from ' + export_username) export_playlists = export_api.get_all_user_playlist_contents() playlists = [p for p in export_playlists if not p.get('deleted')] if migration_type == 'all' or migration_type == 'stations': log.info('Retrieving stations from ' + export_username) export_stations = export_api.get_all_stations() radio_stations = [s for s in export_stations if not s.get('deleted')] log.info('Export complete') export_api.logout()