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
16.91k stars 1.56k forks source link

Error with path template option when the path contain a dot at the beginning or the end of a folder #1414

Closed Djedjeridoo closed 2 years ago

Djedjeridoo commented 2 years ago

System OS

Windows

Python Version

3.9 (CPython)

Install Source

pip / PyPi

Install version / commit hash

3.9.0

Expected Behavior vs Actual Behavior

Under Windows, to create a folder starting with a dot, you must add a dot at the end of the folder. The end dot is automatically deleted. It is not recommended to create a folder ending with a dot, this causes an error in the ntfs addressing.

The simplest solution is to systematically delete the dots at the beginning and at the end of the folder.

Exemple : spotdl https://open.spotify.com/track/3EGhPWuff3qSJ6E3FDQSQZ --path-template "{artist}{album}{artist} - {album} - {title}.{ext}"

Output : FileNotFoundError: [WinError 3] Le chemin d’accès spécifié est introuvable: 'Sigur Rós\Takk...\Sigur Rós - Takk... - Með Blóðnasir.mp3'

Steps to reproduce

open a windows command prompt tape : spotdl https://open.spotify.com/track/3EGhPWuff3qSJ6E3FDQSQZ --path-template "{artist}{album}{artist} - {album} - {title}.{ext}"

Traceback

D:\temp\spotdl>spotdl https://open.spotify.com/track/3EGhPWuff3qSJ6E3FDQSQZ?si=294c80010d8f4e39 --path-template "Musiques\{artist}\{album}\{artist} - {album} - {title}.{ext}"
Fetching Song...
Found YouTube URL for "Sigur Rós - Með Blóðnasir" : https://www.youtube.com/watch?v=BM7sIFg58qE

ffmpeg returned an error (1)
ffmpeg arguments: "-i spotdl-temp\BM7sIFg58qE.webm -codec:a libmp3lame -abr true -q:a 0 -v debug Musiques\Sigur Rós\Takk...\Sigur Rós - Takk... - Með Blóðnasir.mp3"
ffmpeg gave this output:
=====
b"ffmpeg version 4.4-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers\r\n  built with gcc 10.2.0 (Rev6, Built by MSYS2 project)\r\n  configuration: --enable-gpl --enable-version3 --enable-static
--disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2
--enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg
--enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame
--enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband\r\n  libavutil      56. 70.100 / 56. 70.100\r\n  libavcodec
58.134.100 / 58.134.100\r\n  libavformat    58. 76.100 / 58. 76.100\r\n  libavdevice    58. 13.100 / 58. 13.100\r\n  libavfilter     7.110.100 /  7.110.100\r\n  libswscale      5.  9.100 /  5.  9.100\r\n  libswresample   3.  9.100 /  3.
9.100\r\n  libpostproc    55.  9.100 / 55.  9.100\r\nSplitting the commandline.\r\nReading option '-i' ... matched as input url with argument 'spotdl-temp\\BM7sIFg58qE.webm'.\r\nReading option '-codec:a' ... matched as option 'codec'
(codec name) with argument 'libmp3lame'.\r\nReading option '-abr' ... matched as AVOption 'abr' with argument 'true'.\r\nReading option '-q:a' ... matched as option 'q' (use fixed quality scale (VBR)) with argument '0'.\r\nReading
option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.\r\nReading option 'Musiques\\Sigur R\xc3\xb3s\\Takk...\\Sigur R\xc3\xb3s - Takk... - Me\xc3\xb0 Bl\xc3\xb3\xc3\xb0nasir.mp3' ... matched as output
url.\r\nFinished splitting the commandline.\r\nParsing a group of options: global .\r\nApplying option v (set logging level) with argument debug.\r\nSuccessfully parsed a group of options.\r\nParsing a group of options: input url
spotdl-temp\\BM7sIFg58qE.webm.\r\nSuccessfully parsed a group of options.\r\nOpening an input file: spotdl-temp\\BM7sIFg58qE.webm.\r\n[NULL @ 0000022cebffdfc0] Opening 'spotdl-temp\\BM7sIFg58qE.webm' for reading\r\n[file @
0000022cebfff140] Setting default whitelist 'file,crypto,data'\r\n[matroska,webm @ 0000022cebffdfc0] Format matroska,webm probed with size=2048 and score=100\r\nst:0 removing common factor 1000000 from timebase\r\n[matroska,webm @
0000022cebffdfc0] Before avformat_find_stream_info() pos: 515 bytes read:32768 seeks:0 nb_streams:1\r\n[opus @ 0000022cec002800] skip 312/960 samples\r\n[matroska,webm @ 0000022cebffdfc0] All info found\r\n[matroska,webm @
0000022cebffdfc0] After avformat_find_stream_info() pos: 1160 bytes read:32768 seeks:0 frames:1\r\nInput #0, matroska,webm, from 'spotdl-temp\\BM7sIFg58qE.webm':\r\n  Metadata:\r\n    encoder         : google/video-file\r\n  Duration:
00:02:24.44, start: -0.007000, bitrate: 138 kb/s\r\n  Stream #0:0(eng), 1, 1/1000: Audio: opus, 48000 Hz, stereo, fltp, delay 312 (default)\r\nSuccessfully opened the file.\r\nParsing a group of options: output url Musiques\\Sigur
R\xc3\xb3s\\Takk...\\Sigur R\xc3\xb3s - Takk... - Me\xc3\xb0 Bl\xc3\xb3\xc3\xb0nasir.mp3.\r\nApplying option codec:a (codec name) with argument libmp3lame.\r\nApplying option q:a (use fixed quality scale (VBR)) with argument
0.\r\nSuccessfully parsed a group of options.\r\nOpening an output file: Musiques\\Sigur R\xc3\xb3s\\Takk...\\Sigur R\xc3\xb3s - Takk... - Me\xc3\xb0 Bl\xc3\xb3\xc3\xb0nasir.mp3.\r\n[file @ 0000022cec04c640] Setting default whitelist
'file,crypto,data'\r\nMusiques\\Sigur R\xc3\xb3s\\Takk...\\Sigur R\xc3\xb3s - Takk... - Me\xc3\xb0 Bl\xc3\xb3\xc3\xb0nasir.mp3: No such file or directory\r\n[AVIOContext @ 0000022cec0073c0] Statistics: 32768 bytes read, 0 seeks\r\n"
=====

Error: [WinError 3] Le chemin d’accès spécifié est introuvable: 'Musiques\\Sigur Rós\\Takk...\\Sigur Rós - Takk... - Með Blóðnasir.mp3' While Error Tagging: Sigur Rós - Með Blóðnasir
 Traceback (most recent call last):
  File "C:\Python39\lib\site-packages\spotdl\download\downloader.py", line 239, in download_song
    converted_file_path.unlink()
  File "C:\Python39\lib\pathlib.py", line 1354, in unlink
    self._accessor.unlink(self)
FileNotFoundError: [WinError 3] Le chemin d’accès spécifié est introuvable: 'Musiques\\Sigur Rós\\Takk...\\Sigur Rós - Takk... - Með Blóðnasir.mp3'

Sigur Rós - Með Blóðnasir                                                      Error Tagging      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━  95% 0:00:01

Other details

No response

Silverarmor commented 2 years ago

Can reproduce. Note your reproduction command is incorrect and misses the \ to create folders.