Exemplo n.º 1
0
def download_track(cls, track, frame=None, grouping=None):
    """Downloads the track."""
    artist, song = naming_convention(track)

    if song == 'ID':
        return False
    elif frame is not None:
        if frame.match_track(artist, song):
            cls.logger.info(
                'Match found for %s - %s. Not downloading.', artist, song
                )
            return False

    cls.logger.info('Looking for downloads for "%s: %s"', artist, song)
    url, ref, cookies = search(cls, artist, song)

    if url:
        song = cls.download(url, ref, cookies)
        song.set_grouping(grouping)
        cls.logger.info('Moving file to destination: %s', s.DEST)
        shutil.move(song.loc, s.DEST)
        return True
    else:
        cls.logger.info('No url found.')
        return False
Exemplo n.º 2
0
 def __init__(self, string):
     """Sets the values for track.artist and track.name."""
     self.artist, self.title = naming_convention(string)