spotDL / spotify-downloader

Download your Spotify playlists and songs along with album art and metadata (from YouTube if a match is found).
https://spotdl.readthedocs.io/en/latest/
MIT License
17.4k stars 1.6k forks source link

Invalid MultiSpec data, problem with value in meta_tags['publisher'] #376

Closed gnodar01 closed 6 years ago

gnodar01 commented 6 years ago

What is the purpose of your issue?

Description

Was downloading from list when I got this error. All of the other 800+ songs downloaded just fine, only this song seemed to have an issue. #82 seems related, however it's the publisher meta_tag that seems to be causing trouble. Also #148 has the publisher meta_tag as the culprit, but the line giving me trouble is audiofile['TPUB'] = TPUB(encoding=3, text=meta_tags['publisher']) which does not check for the existence of meta_tags['publisher'] so 2f0018adce50851c994868d24a235c24a71d0540 doesn't address my problem. Just to get it working, I temporarily modified line 77 of metadata.py to be:

if meta_tags['publisher']
     audiofile['TPUB'] = TPUB(encoding=3, text=meta_tags['publisher'])

And it "fixed" the issue, in that the song downloaded without throwing an exception, but I'm not familiar with the code so I have no idea if that broke something.

Log

$ spotdl -f /Users/Blah/Desktop --log-level=DEBUG -s https://open.spotify.com/track/77KefznTRqpykM3OnfNo4n DEBUG: Python version: 3.7.0 (default, Sep 18 2018, 18:47:29) [Clang 9.0.0 (clang-900.0.39.2)] DEBUG: Platform: Darwin-16.7.0-x86_64-i386-64bit DEBUG: {'album': None, 'avconv': False, 'config': None, 'download_only_metadata': False, 'dry_run': False, 'file_format': '{artist} - {track_name}', 'folder': '/Users/Blah/Desktop', 'input_ext': '.m4a', 'list': None, 'log_level': 10, 'manual': False, 'music_videos_only': False, 'no_metadata': False, 'no_spaces': False, 'output_ext': '.mp3', 'overwrite': 'prompt', 'playlist': None, 'search_format': '{artist} - {track_name} lyrics', 'song': 'https://open.spotify.com/track/77KefznTRqpykM3OnfNo4n', 'trim_silence': False, 'username': None, 'version': False, 'youtube_api_key': None} DEBUG: Fetching metadata for given track URL DEBUG: Fetching lyrics DEBUG: {'album': {'album_type': 'album', 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/1MBqzcu6aiY7GzP5BfG56T'}, 'href': 'https://api.spotify.com/v1/artists/1MBqzcu6aiY7GzP5BfG56T', 'id': '1MBqzcu6aiY7GzP5BfG56T', 'name': 'La Caution', 'type': 'artist', 'uri': 'spotify:artist:1MBqzcu6aiY7GzP5BfG56T'}], 'external_urls': {'spotify': 'https://open.spotify.com/album/1TerTBDDa1ohaceQSBwd5v'}, 'href': 'https://api.spotify.com/v1/albums/1TerTBDDa1ohaceQSBwd5v', 'id': '1TerTBDDa1ohaceQSBwd5v', 'images': [{'height': 640, 'url': 'https://i.scdn.co/image/662796ec8b7a84246d2586d06eadfa5745bf2e61', 'width': 640}, {'height': 300, 'url': 'https://i.scdn.co/image/6e63cf3164c77b2593f9a261d99426017ea4e5e9', 'width': 300}, {'height': 64, 'url': 'https://i.scdn.co/image/38cd9bc724f976a46843569760c5d6869b850aee', 'width': 64}], 'name': 'Peines de Maures / Arc-en-ciel pour Daltoniens - The ' 'Instrumental Version', 'release_date': '2006-03-13', 'release_date_precision': 'day', 'total_tracks': 23, 'type': 'album', 'uri': 'spotify:album:1TerTBDDa1ohaceQSBwd5v'}, 'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/0W5zsbvbGBjycO9lbJ23xG'}, 'href': 'https://api.spotify.com/v1/artists/0W5zsbvbGBjycO9lbJ23xG', 'id': '0W5zsbvbGBjycO9lbJ23xG', 'name': 'Nikkfurie', 'type': 'artist', 'uri': 'spotify:artist:0W5zsbvbGBjycO9lbJ23xG'}], 'copyright': 'Kerozen Music', 'disc_number': 1, 'duration': 254.674, 'explicit': False, 'external_ids': {'isrc': 'FR8W90500032'}, 'external_urls': {'spotify': 'https://open.spotify.com/track/77KefznTRqpykM3OnfNo4n'}, 'genre': None, 'href': 'https://api.spotify.com/v1/tracks/77KefznTRqpykM3OnfNo4n', 'id': '77KefznTRqpykM3OnfNo4n', 'is_local': False, 'lyrics': None, 'name': 'Thé à la menthe, The lazer dance version', 'popularity': 0, 'preview_url': None, 'publisher': None, 'release_date': '2006-03-13', 'total_tracks': 23, 'track_number': 1, 'type': 'track', 'uri': 'spotify:track:77KefznTRqpykM3OnfNo4n', 'year': '2006'} DEBUG: Opening URL: https://www.youtube.com/results?sp=EgIQAQ%253D%253D&q=Nikkfurie%20-%20Th%C3%A9%20%C3%A0%20la%20menthe%2C%20The%20lazer%20dance%20version%20lyrics INFO: La Caution - Thé à la Menthe - The Laser Dance Song (http://www.youtube.com/watch?v=k4Xx0k_TVY0) DEBUG: Refining songname from "La Caution - Thé à la Menthe - The Laser Dance Song" to "Nikkfurie - Thé à la menthe The lazer dance version" DEBUG: Cleaning any temp files and checking if "Nikkfurie - Thé à la menthe The lazer dance version" already exists DEBUG: Downloading from URL: https://r11---sn-bvvbax-cvne.googlevideo.com/videoplayback?clen=4020131&source=youtube&mv=m&initcwndbps=1561250&fvip=6&c=WEB&lmt=1532651941861728&ms=au%2Crdu&id=o-AGVnVi3r7SVnau7nvKd0i6NJIesAwEYENnkuvHbbhl9H&gir=yes&pl=41&mt=1538230208&mn=sn-bvvbax-cvne%2Csn-ab5szn7l&mm=31%2C29&keepalive=yes&ip=2601%3A184%3A4880%3A9d88%3A2c66%3Af32f%3Af01f%3A59c4&key=yt6&dur=253.074&ei=LIivW-OuCcG18gTDmLqYBA&requiressl=yes&beids=9466588&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&expire=1538251916&itag=140&ipbits=0&mime=audio%2Fmp4&signature=2BF9FDE21EF25CF721676E75CC186960D740CFA7.7A5CF5C8A7237259AF50F10BDE3C8FE0D79A6EB2&ratebypass=yes DEBUG: Saving to: /Users/Blah/Desktop/Nikkfurie - Thé à la menthe The lazer dance version.m4a 4,020,131 Bytes [100.00%] received. Rate: [7730 KB/s]. ETA: [0 secs] INFO: Converting Nikkfurie - Thé à la menthe The lazer dance version.m4a to mp3 DEBUG: ['ffmpeg', '-y', '-i', '/Users/Blah/Desktop/Nikkfurie - Thé à la menthe The lazer dance version.m4a', '-codec:v', 'copy', '-codec:a', 'libmp3lame', '-ar', '44100', '-b:a', '192k', '-vn', '/Users/Blah/Desktop/Nikkfurie - Thé à la menthe The lazer dance version.mp3'] ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers built with Apple LLVM version 9.0.0 (clang-900.0.39.2) configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-nonfree libavutil 56. 14.100 / 56. 14.100 libavcodec 58. 18.100 / 58. 18.100 libavformat 58. 12.100 / 58. 12.100 libavdevice 58. 3.100 / 58. 3.100 libavfilter 7. 16.100 / 7. 16.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 1.100 / 5. 1.100 libswresample 3. 1.100 / 3. 1.100 libpostproc 55. 1.100 / 55. 1.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/Blah/Desktop/Nikkfurie - Thé à la menthe The lazer dance version.m4a': Metadata: major_brand : dash minor_version : 0 compatible_brands: iso6mp41 creation_time : 2018-07-27T00:39:01.000000Z Duration: 00:04:13.07, start: 0.000000, bitrate: 127 kb/s Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 4 kb/s (default) Metadata: creation_time : 2018-07-27T00:39:01.000000Z handler_name : SoundHandler Stream mapping: Stream #0:0 -> #0:0 (aac (native) -> mp3 (libmp3lame)) Press [q] to stop, [?] for help Output #0, mp3, to '/Users/Blah/Desktop/Nikkfurie - Thé à la menthe The lazer dance version.mp3': Metadata: major_brand : dash minor_version : 0 compatible_brands: iso6mp41 TSSE : Lavf58.12.100 Stream #0:0(und): Audio: mp3 (libmp3lame), 44100 Hz, stereo, fltp, 192 kb/s (default) Metadata: creation_time : 2018-07-27T00:39:01.000000Z handler_name : SoundHandler encoder : Lavc58.18.100 libmp3lame size= 5933kB time=00:04:13.07 bitrate= 192.0kbits/s speed=29.7x video:0kB audio:5932kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.012577% INFO: Applying metadata Traceback (most recent call last): File "/usr/local/bin/spotdl", line 11, in sys.exit(main()) File "/usr/local/lib/python3.7/site-packages/spotdl/spotdl.py", line 195, in main download_single(raw_song=const.args.song) File "/usr/local/lib/python3.7/site-packages/spotdl/spotdl.py", line 171, in download_single metadata.embed(os.path.join(const.args.folder, output_song), meta_tags) File "/usr/local/lib/python3.7/site-packages/spotdl/metadata.py", line 34, in embed return embed.as_mp3() File "/usr/local/lib/python3.7/site-packages/spotdl/metadata.py", line 77, in as_mp3 audiofile['TPUB'] = TPUB(encoding=3, text=meta_tags['publisher']) File "/usr/local/lib/python3.7/site-packages/mutagen/id3/_frames.py", line 68, in init kwargs.get(checker.name, checker.default)) File "/usr/local/lib/python3.7/site-packages/mutagen/id3/_frames.py", line 78, in setattr self._setattr(name, checker.validate(self, value)) File "/usr/local/lib/python3.7/site-packages/mutagen/id3/_specs.py", line 539, in validate raise ValueError('Invalid MultiSpec data: %r' % value) ValueError: Invalid MultiSpec data: None

ritiek commented 6 years ago

Yep, we should indeed check if meta_tags['publisher'] is available when embedding metadata here as well. Would you like to submit a PR to fix this? :)

gnodar01 commented 6 years ago

Sure, will do.

ritiek commented 6 years ago

Closed by #377.