Ejemplo n.º 1
0
def grab_playlist(playlist_id, deezer: Deezer, playlist=None):
    """crash resistant"""
    if playlist is None:
        playlist = deezer.get_playlist(playlist_id)
        if cc.concurrency:
            return chimera.concurrency.blackhole(playlist, 'playlist')
    print('grabbing deezer playlist %s' % playlist.name)
    # try:
    any_playlist(playlist, deezer, m3u=cc.m3u, log_missing=True)
Ejemplo n.º 2
0
def grab_playlist(playlist_id, gpm):
    playlist_name = input('Playlist Name: ')
    if playlist_name == '':
        playlist_name = None
    playlist = gpm.get_playlist(playlist_id, playlist_name)
    if cc.concurrency:
        return chimera.concurrency.blackhole(playlist, 'playlist')
    print('grabbing gpm playlist %s' % playlist.name)
    any_playlist(playlist, gpm, m3u=cc.m3u, log_missing=True)
Ejemplo n.º 3
0
def grab_saved(session, playlist=None):
    if playlist == None:
        playlist = chimera.spotify.get_user_saved()
    try:
        if cc.concurrency:
            chimera.concurrency.blackhole(playlist, 'playlist')
        else:
            any_playlist(playlist, session, m3u=cc.m3u, log_missing=True)
    except (requests.exceptions.ConnectionError, ConnectionResetError) as e:
        print(30 * '#')
        print('Download crashed restarting...')
        print(30 * '#')
        cli.utils.master_login(**{str(session).lower(): session})
        grab_saved(session, playlist=playlist)
Ejemplo n.º 4
0
def grab_all_playlists(session):
    _playlists = chimera.spotify.get_user_playlists_data()
    if cc.concurrency:
        bar = tqdm(total=len(_playlists), unit='Playlists', ncols=100)

    # blacklist handling
    spotify_blacklist = [s.strip() for s in cc.spotify_blacklist.split(',')]
    _playlists = [x for x in _playlists if x['id'] not in spotify_blacklist]

    missing_tracks = []
    for _playlist in _playlists:
        playlist = chimera.spotify.get_playlist(_playlist['id'])
        # TODO handle missing tracks if conurrency is enabled
        if cc.concurrency:
            bar.update(1)
            chimera.concurrency.blackhole(playlist, 'playlist')
        else:
            missing_tracks.extend(
                any_playlist(playlist, session, m3u=True, log_missing=False)
            )
    if len(missing_tracks) > 0:
        chimera.utils.write_missing_csv('spotify_playlists', missing_tracks)

    if cc.concurrency:
        bar.close()
Ejemplo n.º 5
0
def grab_playlist(playlist_id, session):
    """session is respective active service for
    spotify conversion"""
    try:
        if playlist_id == 'all':
            grab_all_playlists(session)
        else:
            playlist = chimera.spotify.get_playlist(playlist_id)
            if cc.concurrency:
                return chimera.concurrency.blackhole(playlist, 'playlist')
            any_playlist(playlist, session, m3u=cc.m3u, log_missing=True)
    except (requests.exceptions.ConnectionError, ConnectionResetError) as e:
        print(30 * '#')
        print('Download crashed restarting...')
        print(30 * '#')
        grab_playlist(playlist_id, session)
Ejemplo n.º 6
0
def grab_playlist(playlist_id, tidal):
    playlist = tidal.get_playlist(playlist_id)
    if cc.concurrency:
        return chimera.concurrency.blackhole(playlist, 'playlist')
    print('grabbing tidal playlist %s' % playlist.name)
    any_playlist(playlist, tidal, m3u=cc.m3u, log_missing=True)
Ejemplo n.º 7
0
def grab_saved(qobuz: Qobuz):
    playlist = qobuz.get_user_saved()
    any_playlist(playlist, qobuz, m3u=cc.m3u, log_missing=True)
Ejemplo n.º 8
0
def grab_playlist(playlist_id, qobuz):
    playlist = qobuz.get_playlist(playlist_id)
    if cc.concurrency:
        return chimera.concurrency.blackhole(playlist, 'playlist')
    print('grabbing qobuz playlist %s' % playlist.name)
    any_playlist(playlist, qobuz, m3u=cc.m3u, log_missing=True)
Ejemplo n.º 9
0
def grab_playlist(playlist_id, napster: Napster):
    playlist = napster.get_playlist(playlist_id)
    if cc.concurrency:
        return chimera.concurrency.blackhole(playlist, 'playlist')
    print('grabbing napster playlist %s' % playlist.name)
    any_playlist(playlist, napster, m3u=cc.m3u, log_missing=True)