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.75k stars 1.62k forks source link

Error on sync when using custom output and saving m3u file #1665

Closed darienn00 closed 2 years ago

darienn00 commented 2 years ago

System OS

Linux

Python Version

3.10 (CPython)

Install Source

pip / PyPi

Install version / commit hash

4.0.4

Expected Behavior vs Actual Behavior

I want to synchronize my songs using the sync option, while updating the m3u file using --m3u FILE.

My songs are playlist-based, so i use --output "{list-name}/{title} - {artists}.{output-ext}" to classify them

I can create the initial synchronization and generate the m3u, but cant resume the sync while using the --m3u FILE.m3u option

spotdl --m3u FILE.m3u sync FILE.spotdl works spotdl --output "{list-name}/{title} - {artists}.{output-ext}" sync FILE.spotdl works spotdl --m3u FILE.m3u --output "{title} - {artists}.{output-ext}" sync FILE.spotdl works

But when using m3u option alongside custom output with {list-name}, it doesn't spotdl --m3u FILE.m3u --output "{list-name}/{title} - {artists}.{output-ext}" sync FILE.spotdl gives the error on traceback

Steps to reproduce - Ensure to include actual links!

Create a synchronization file Try to sync with an existing sync file using the --m3u FILE.m3u option and --output FORMAT, while FORMAT having {list-name} somewhere in it

Traceback

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/apollo/.local/lib/python3.11/site-packages/spotdl/console/entry_point.py:191 in            │
│ entry_point                                                                                      │
│                                                                                                  │
│   190 │   │                                                                                      │
│ ❱ 191 │   │   OPERATIONS[arguments.operation](                                                   │
│   192 │   │   │   query=arguments.query,                                                         │
│                                                                                                  │
│ /home/apollo/.local/lib/python3.11/site-packages/spotdl/console/sync.py:140 in sync              │
│                                                                                                  │
│   139 │   │   if m3u_file:                                                                       │
│ ❱ 140 │   │   │   gen_m3u_files(                                                                 │
│   141 │   │   │   │   query,                                                                     │
│                                                                                                  │
│ /home/apollo/.local/lib/python3.11/site-packages/spotdl/utils/m3u.py:87 in gen_m3u_files         │
│                                                                                                  │
│    86 │   if len(lists) == 0 and "{list" in template:                                            │
│ ❱  87 │   │   raise ValueError(                                                                  │
│    88 │   │   │   "You must provide a playlist/album/artist/saved to use {list} in the templat   │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: You must provide a playlist/album/artist/saved to use {list} in the template.

Other details

No response

xnetcat commented 2 years ago

fixed on dev branch