diff --git a/README.md b/README.md index ec102c4..df613e7 100755 --- a/README.md +++ b/README.md @@ -59,26 +59,28 @@ scdl me -f me Use the user profile from the auth_token -l [url] URL can be track/playlist/user -s Download the stream of a user (token needed) - -a Download all tracks of a user (including reposts) + -a Download all tracks of user (including reposts) -t Download all uploads of a user (no reposts) -f Download all favorites of a user -C Download all commented by a user -p Download all playlists of a user - -m Download all liked and owned playlists of a user + -m Download all liked and owned playlists of user -c Continue if a downloaded file already exists -o [offset] Begin with a custom offset - --path [path] Use a custom path for downloaded files - --min-size [min-size] Skip tracks smaller than size (k/m/g) - --max-size [max-size] Skip tracks larger than size (k/m/g) - --hidewarnings Hide Warnings. (use with precaution) - --addtofile Add the artist name to the filename if it isn't in the filename already - --addtimestamp Adds the timestamp of the creation of the track to the title (useful to sort chronologically) - --onlymp3 Download only the mp3 file even if the track is Downloadable - --error Set log level to ERROR + --addtimestamp Add track creation timestamp to filename, which allows for chronological sorting + --addtofile Add artist to filename if missing --debug Set log level to DEBUG + --download-archive [file] Keep track of track IDs in an archive file, and skip already-downloaded files + --error Set log level to ERROR + --extract-artist Set artist tag from title instead of username --hide-progress Hide the wget progress bar - --no-playlist-folder Download playlist tracks into directory, instead of making a playlist subfolder (the default) - --download-archive [file] Store track IDs in an archive file and skip already-downloaded files + --hidewarnings Hide Warnings. (use with precaution) + --max-size [max-size] Skip tracks larger than size (k/m/g) + --min-size [min-size] Skip tracks smaller than size (k/m/g) + --no-playlist-folder Download playlist tracks into main directory, instead of making a playlist subfolder + --onlymp3 Download only the streamable mp3 file, even if track has a Downloadable file + --path [path] Use a custom path for downloaded files + --remove Remove any files not downloaded from execution ``` diff --git a/scdl/scdl.py b/scdl/scdl.py index a6dab30..26acfaf 100755 --- a/scdl/scdl.py +++ b/scdl/scdl.py @@ -7,11 +7,11 @@ Usage: scdl -l [-a | -f | -C | -t | -p][-c][-o ]\ [--hidewarnings][--debug | --error][--path ][--addtofile][--addtimestamp] [--onlymp3][--hide-progress][--min-size ][--max-size ][--remove] -[--no-playlist-folder][--download-archive ] +[--no-playlist-folder][--download-archive ][--extract-artist] scdl me (-s | -a | -f | -t | -p | -m)[-c][-o ]\ [--hidewarnings][--debug | --error][--path ][--addtofile][--addtimestamp] [--onlymp3][--hide-progress][--min-size ][--max-size ][--remove] -[--no-playlist-folder][--download-archive ] +[--no-playlist-folder][--download-archive ][--extract-artist] scdl -h | --help scdl --version @@ -37,6 +37,7 @@ Options: --download-archive [file] Keep track of track IDs in an archive file, and skip already-downloaded files --error Set log level to ERROR + --extract-artist Set artist tag from title instead of username --hide-progress Hide the wget progress bar --hidewarnings Hide Warnings. (use with precaution) --max-size [max-size] Skip tracks larger than size (k/m/g) @@ -606,6 +607,7 @@ def set_metadata(track, filename, album=None): Sets the mp3 file metadata using the Python module Mutagen """ logger.info('Setting tags...') + global arguments artwork_url = track['artwork_url'] user = track['user'] if not artwork_url: @@ -623,9 +625,16 @@ def set_metadata(track, filename, album=None): track_year = track_date.strftime("%Y") track_day_month = track_date.strftime("%d%m") + track['artist'] = user['username'] + if arguments['--extract-artist']: + if '-' in track['title']: + artist_title = track['title'].split('-') + track['artist'] = artist_title[0].strip() + track['title'] = artist_title[1].strip() + audio = mutagen.File(filename) audio['TIT2'] = mutagen.id3.TIT2(encoding=3, text=track['title']) - audio['TPE1'] = mutagen.id3.TPE1(encoding=3, text=user['username']) + audio['TPE1'] = mutagen.id3.TPE1(encoding=3, text=track['artist']) if track['genre']: audio['TCON'] = mutagen.id3.TCON(encoding=3, text=track['genre'])