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.1k stars 1.57k forks source link

Downloaded songs are not placed at Music folder #247

Closed tiago4171 closed 6 years ago

tiago4171 commented 6 years ago

What is the purpose of your issue?

Description

I tried to download some songs today, but seem's that the songs are downloaded and converted successfully but are deleted at the end of the operation and when I try to download it again the script tell me if I want to download it again. So look at this

$ python3.5 spotdl.py -s https://open.spotify.com/track/4dQOR8mMWcrbF0xRRnW5Y6
INFO: Foxes - Youth (Adventure Club Remix) (http://www.youtube.com/watch?v=2XG_0iV2B40)
  3,821,015 Bytes [100.00%] received. Rate: [ 997 KB/s].  ETA: [0 secs]    
INFO: Converting Foxes - Youth - Adventure Club Remix.m4a to mp3
INFO: Applying metadata
$ ls Music/

As you can see the music are download, but not saved at Music/ and in any other place. Now I'll try to download again

$ python3.5 spotdl.py -s https://open.spotify.com/track/4dQOR8mMWcrbF0xRRnW5Y6
INFO: Foxes - Youth (Adventure Club Remix) (http://www.youtube.com/watch?v=2XG_0iV2B40)
WARNING: "Foxes - Youth - Adventure Club Remix.mp3" already exists
INFO: "Foxes - Youth - Adventure Club Remix.mp3" has already been downloaded. Re-download? (y/N): 
  Y
  3,821,015 Bytes [100.00%] received. Rate: [ 989 KB/s].  ETA: [0 secs]    
INFO: Converting Foxes - Youth - Adventure Club Remix.m4a to mp3
INFO: Applying metadata
$ ls -a Music/
./  ../

So the question is, what is happening here? Are you planning to change the folder of the downloaded songs?

Log

$ python3.5 spotdl.py -s https://open.spotify.com/track/4dQOR8mMWcrbF0xRRnW5Y6 -ll debug
DEBUG: Python version: 3.5.3 (default, Jan 19 2017, 14:11:04) 
    [GCC 6.3.0 20170118]
DEBUG: Platform: Linux-4.14.0-0.bpo.3-amd64-x86_64-with-debian-9.3
DEBUG: {'album': None,
     'avconv': False,
     'config': None,
     'download_only_metadata': False,
     'dry_run': False,
     'file_format': '{artist} - {track_name}',
     'folder': '../../../tiago/Scripts/spotify-downloader/Music',
     '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,
     'song': 'https://open.spotify.com/track/4dQOR8mMWcrbF0xRRnW5Y6',
     'username': None}
DEBUG: Fetching metadata for given track URL
DEBUG: Fetching lyrics
DEBUG: {'album': {'album_type': 'single',
               'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/7qRll6DYV06u2VuRPAVqug'},
                            'href': 'https://api.spotify.com/v1/artists/7qRll6DYV06u2VuRPAVqug',
                            'id': '7qRll6DYV06u2VuRPAVqug',
                            'name': 'Foxes',
                            'type': 'artist',
                            'uri': 'spotify:artist:7qRll6DYV06u2VuRPAVqug'}],
               'external_urls': {'spotify': 'https://open.spotify.com/album/7Cbak6BTFKKXlH3dSItZU3'},
               'href': 'https://api.spotify.com/v1/albums/7Cbak6BTFKKXlH3dSItZU3',
               'id': '7Cbak6BTFKKXlH3dSItZU3',
               'images': [{'height': 640,
                           'url': 'https://i.scdn.co/image/6b8674c0d936b14bfeb577748c759c8b1f231029',
                           'width': 640},
                          {'height': 300,
                           'url': 'https://i.scdn.co/image/41ae07d211abc32db72af615d5adf68a97a1d8e9',
                           'width': 300},
                          {'height': 64,
                           'url': 'https://i.scdn.co/image/6001609fab110e68a7e395b2282c061739fb8d09',
                           'width': 64}],
               'name': 'Youth (The Remixes)',
               'release_date': '2013-10-25',
               'release_date_precision': 'day',
               'type': 'album',
               'uri': 'spotify:album:7Cbak6BTFKKXlH3dSItZU3'},
     'artists': [{'external_urls': {'spotify': 'https://open.spotify.com/artist/7qRll6DYV06u2VuRPAVqug'},
                  'href': 'https://api.spotify.com/v1/artists/7qRll6DYV06u2VuRPAVqug',
                  'id': '7qRll6DYV06u2VuRPAVqug',
                  'name': 'Foxes',
                  'type': 'artist',
                  'uri': 'spotify:artist:7qRll6DYV06u2VuRPAVqug'},
                 {'external_urls': {'spotify': 'https://open.spotify.com/artist/4vIDWbhxIjNMXQ18tfmLxS'},
                  'href': 'https://api.spotify.com/v1/artists/4vIDWbhxIjNMXQ18tfmLxS',
                  'id': '4vIDWbhxIjNMXQ18tfmLxS',
                  'name': 'Adventure Club',
                  'type': 'artist',
                  'uri': 'spotify:artist:4vIDWbhxIjNMXQ18tfmLxS'}],
     'copyright': '(P) 2013 Sign Of The Times Limited under exclusive licence to '
                  'Sony Music Entertainment UK Limited',
     'disc_number': 1,
     'duration': 239.226,
     'explicit': False,
     'external_ids': {'isrc': 'GBARL1301187'},
     'external_urls': {'spotify': 'https://open.spotify.com/track/4dQOR8mMWcrbF0xRRnW5Y6'},
     'genre': 'Dance Pop',
     'href': 'https://api.spotify.com/v1/tracks/4dQOR8mMWcrbF0xRRnW5Y6',
     'id': '4dQOR8mMWcrbF0xRRnW5Y6',
     'lyrics': None,
     'name': 'Youth - Adventure Club Remix',
     'popularity': 48,
     'preview_url': 'https://p.scdn.co/mp3-preview/0b89885f2b8a179525253caf465f4cae155a9cc3?cid=4fe3fecfe5334023a1472516cc99d805',
     'publisher': 'Sign Of The Times Records',
     'release_date': '2013-10-25',
     'total_tracks': 4,
     'track_number': 1,
     'type': 'track',
     'uri': 'spotify:track:4dQOR8mMWcrbF0xRRnW5Y6',
     'year': '2013'}
DEBUG: query: {'maxResults': 50, 'part': 'snippet', 'type': 'video', 'q': 'Foxes - Youth - Adventure Club Remix'}
DEBUG: query_results: {'maxResults': 50, 'part': 'contentDetails,snippet,statistics', 'id': '2XG_0iV2B40,2hSSQlC1imo,NbmYpy9SNUg,ze8vaaXub8I,CowQDnV9zsM,KpOrPQRlOBg,eyOSU7DeUVc,DBxv1auQQ9Q,yz5ll5rvQ2s,oB7R9xXWyDs,96eizektoQg,PJn0IdMnCuc,QCnnsDBb7gs,EiC46fY-m-Q,pf45vdTyVCY,JkOvdUHvz0o,6ey5WTvokTA,pHkJ5uobzzM,VRQpOann7dg,bFaD8-HbzUs,Wq1JLDrOjCc,oPTg0p41sts,caQ4craAvxs,Bc0QfTVBrIU,Yb4CHJ3JMcg,vOTrhBw9z8A,-fxJxPrFYeY,c3Lu22w3V0w,f54IIqgFMJk,Z0PyxPx7lpc,RoSLcDXsBu8,0I32Va_Ovs8,8AWlmFAZsO4,kFNdzgsCabk,LGjJQoWX5EA,xr_oO4WAXGY,PceqXAYIlqM,-eR2adQr6oE,z3AqubBj6pE,fqm7u72Cfyg,Kv8Gje1yEh0,pYheInojn24,fgpT2DofsK4,gQpJp7F8gYU,rqZqReYlgOk,IH02-iDFWCQ,XIjJmf6Ipls,13S4mVEmKOI,MENmC6AkYgc,CosuSXqSlQw'}
INFO: Foxes - Youth (Adventure Club Remix) (http://www.youtube.com/watch?v=2XG_0iV2B40)
DEBUG: Refining songname from "Foxes - Youth (Adventure Club Remix)" to "Foxes - Youth - Adventure Club Remix"
DEBUG: Cleaning any temp files and checking if "Foxes - Youth - Adventure Club Remix" already exists
DEBUG: Found an already existing song: "Foxes - Youth - Adventure Club Remix.mp3"
DEBUG: Bad message (TypeError('not all arguments converted during string formatting',)): {'funcName': 'check_exists', 'lineno': 38, 'levelname': 'DEBUG', 'process': 5397, 'processName': 'MainProcess', 'relativeCreated': 8231.602430343628, 'pathname': 'spotdl.py', 'module': 'spotdl', 'args': (True,), 'stack_info': None, 'created': 1520445648.8492384, 'name': 'logzero', 'levelno': 10, 'threadName': 'MainThread', 'msecs': 849.238395690918, 'exc_info': None, 'msg': 'Checking if it is already tagged correctly? {}', 'filename': 'spotdl.py', 'exc_text': None, 'thread': 140059647039232}
WARNING: "Foxes - Youth - Adventure Club Remix.mp3" already exists
INFO: "Foxes - Youth - Adventure Club Remix.mp3" has already been downloaded. Re-download? (y/N): 
 y
DEBUG: Downloading from URL: https://r1---sn-uxaxh5g-4vge.googlevideo.com/videoplayback?mv=m&mt=1520445558&ms=au%2Crdu&id=o-AFFVG_1hmyqRQEErTxWwR6G7pVmnbGo_2v72YYrEv_O9&ei=zyigWsn9Gs_XxASEqI5A&pl=30&source=youtube&keepalive=yes&dur=240.535&ip=2804%3Ad45%3Aa1a%3A6100%3A71fe%3A2b46%3Abdc3%3A5964&key=yt6&mn=sn-uxaxh5g-4vge%2Csn-bg07dnle&mm=31%2C29&initcwndbps=113750&pcm2cms=yes&lmt=1481441076008462&c=WEB&gir=yes&fvip=1&expire=1520467247&mime=audio%2Fmp4&requiressl=yes&clen=3821015&ipbits=0&itag=140&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire&beids=%5B9466591%5D&signature=9A86DF1C3D509E17988E3BCD183699A14C2C14D8.CA9A824D4E81B03CE04CF08873DC7A2F9AC0A5DA&ratebypass=yes
DEBUG: Saving to: ../../../tiago/Scripts/spotify-downloader/Music/Foxes - Youth - Adventure Club Remix.m4a
  3,821,015 Bytes [100.00%] received. Rate: [ 992 KB/s].  ETA: [0 secs]    
INFO: Converting Foxes - Youth - Adventure Club Remix.m4a to mp3
DEBUG: ['ffmpeg', '-y', '-i', '../../../tiago/Scripts/spotify-downloader/Music/Foxes - Youth - Adventure Club Remix.m4a', '-codec:v', 'copy', '-codec:a', 'libmp3lame', '-ar', '44100', '-b:a', '192k', '-vn', '../../../tiago/Scripts/spotify-downloader/Music/Foxes - Youth - Adventure Club Remix.mp3']
ffmpeg version 3.2.10-1~deb9u1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
  configuration: --prefix=/usr --extra-version='1~deb9u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../../../tiago/Scripts/spotify-downloader/Music/Foxes - Youth - Adventure Club Remix.m4a':
  Metadata:
    major_brand     : dash
    minor_version   : 0
    compatible_brands: iso6mp41
    creation_time   : 2016-12-11T07:24:35.000000Z
  Duration: 00:04:00.54, start: 0.000000, bitrate: 127 kb/s
    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 5 kb/s (default)
    Metadata:
      creation_time   : 2016-12-11T07:24:35.000000Z
      handler_name    : SoundHandler
Output #0, mp3, to '../../../tiago/Scripts/spotify-downloader/Music/Foxes - Youth - Adventure Club Remix.mp3':
  Metadata:
    major_brand     : dash
    minor_version   : 0
    compatible_brands: iso6mp41
    TSSE            : Lavf57.56.101
    Stream #0:0(und): Audio: mp3 (libmp3lame), 44100 Hz, stereo, fltp, 192 kb/s (default)
    Metadata:
      creation_time   : 2016-12-11T07:24:35.000000Z
      handler_name    : SoundHandler
      encoder         : Lavc57.64.101 libmp3lame
Stream mapping:
  Stream #0:0 -> #0:0 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
size=    5639kB time=00:04:00.53 bitrate= 192.0kbits/s speed=30.7x    
video:0kB audio:5638kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.013233%
INFO: Applying metadata
$ ls -a Music/
./  ../
$ ls Music/
linusg commented 6 years ago

First of all: thanks for this perfectly done report! (not yet sure if it's a bug though) – that doesn't happen every day. :+1:

Let's try this. First of all:

Are you planning to change the folder of the downloaded songs?

Indeed. I thought this was already merged, but apparently not... any progress on your side, @ritiek?

Secondly: it's kind of hard to keep track of what's going on when you only provide a plain $ prompt without the cwd... are you in the directory where spotdl.py is located? Since you pass it as a path to the python binary I assume yes. But why is it putting the songs in ../../../tiago/Scripts/spotify-downloader/Music/ then, relative to your cwd? Actually, is this the case? Are songs you've tried to download in this directory, still relatively from your cwd?

Also make sure you have the newest version, of course. It should be the Music/ directory relative to the directory containing spotdl.py.

https://github.com/ritiek/spotify-downloader/blob/3db04ce63510236c9a7a00f7b30391683c4c31c3/core/handle.py#L17

Does using the -f option work as expected?

For now I'm kind of confused, but I bet we can work this out :smile:

tiago4171 commented 6 years ago

Sorry for that, I was thinking that the path of Script was not important so I suppressed it to just a "$". Sorry Answering the questions, I put all of my scripts on ~/Scripts/ that is why the script is putting the songs in /home/tiago/Scripts/spotify-downloader/Music/. I hope I have clarified your doubts about this.

The -f option work as expected. That surprised me, cause I don't really think that the solution could be so simple. I Tried to put the songs in my Desktop and in the /home/tiago/Scripts/spotify-downloader/Music/ folder and all worked as well. But something is confusing me. If the default folder is the Music folder at the root directory of the script, why I have to use -f to save there and why that stop to working?

linusg commented 6 years ago

No problem at all, normally omitting the path and just showing a dollar sign makes such listings more clear. But thanks for clarifying. Glad to hear at least the -f option works. So now we're asking ourselves the exactly same question: why does it work when setting the path manually but not when the script sets the folder. I'll look over it again and maybe come up with a solution by tomorrow. At least I can try to increase debugging output to narrow down the problem.

AFAIR nobody including me ever had such a problem (reported). So either something strange is going on or we're missing something very obvious here. Or it's really a bad bug. In either case, I'll keep you posted, or Ritiek will come up with a genius solution, wouldn't be the first time 😉

tiago4171 commented 6 years ago

Well, I think I found the problem and I have to confess something, I guess there is my fault. I test a lot of Linux distribuitions, and I just copy the folder in my old home folder to my actual. And I don't have the habit to delete the older home folders. Probably when I ran "git pull" the git identified that I clone the repository at /home/tiago/Scripts first and "updated" the repository there. But the point is that I'm do not using /home/tiago and yes /home/tiagoj. So the songs are saved but in my old home folder.

I'm so sorry for that, that is so embarrassing to me. I Guess I can't sorry enough

Well, But look on the bright side, I could have taken more time to figure it out.

linusg commented 6 years ago

It's fine, thanks for letting us know! 😃 Those things happen... Good it finally works.