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

Using environment variables for "--output" will fail if destination folder name starts with a number #2187

Closed hianick closed 4 days ago

hianick commented 1 week ago

System OS

Windows

Python Version

3.8 (CPython)

Install Source

GitHub

Install version / commit hash

4.2.8

Expected Behavior vs Actual Behavior

spotdl --output %music10% download https://open.spotify.com/track/0GrPvrBGrxwrU7rjlwYZiH

This is typically the command I use, but recently I renamed my folders to have a number at the beginning of the name. Before they were "music 10" and now they're "10 music". When I use this command I get an error output.

Steps to reproduce - Ensure to include actual links!

  1. Create a folder anywhere called "1 music"
  2. Create an environment variable for this folder https://imgur.com/a/OwRdlWE
  3. Make sure the env var works by using cd %music% in the cli
  4. Use spotdl --output %music% download https://open.spotify.com/track/0GrPvrBGrxwrU7rjlwYZiH

Traceback

C:\Users\tom>spotdl --output %music10% download https://open.spotify.com/track/0GrPvrBGrxwrU7rjlwYZiH
usage: spotdl [-h]
              [--audio [{youtube,youtube-music,slider-kz,soundcloud,bandcamp,piped} ...]]
              [--lyrics [{genius,musixmatch,azlyrics,synced} ...]]
              [--genius-access-token GENIUS_TOKEN] [--config]
              [--search-query SEARCH_QUERY] [--dont-filter-results]
              [--album-type {single,album}] [--only-verified-results] [--user-auth]
              [--client-id CLIENT_ID] [--client-secret CLIENT_SECRET]
              [--auth-token AUTH_TOKEN] [--cache-path CACHE_PATH] [--no-cache]
              [--max-retries MAX_RETRIES] [--headless] [--use-cache-file]
              [--ffmpeg FFMPEG] [--threads THREADS]
              [--bitrate {auto,disable,8k,16k,24k,32k,40k,48k,64k,80k,96k,112k,128k,160k,192k,224k,256k,320k,0,1,2,3,4,5,6,7,8,9}]
              [--ffmpeg-args FFMPEG_ARGS] [--format {mp3,flac,ogg,opus,m4a,wav}]
              [--save-file SAVE_FILE] [--preload] [--output OUTPUT] [--m3u [M3U]]
              [--cookie-file COOKIE_FILE] [--overwrite {skip,force,metadata}]
              [--restrict [{strict,ascii,none}]] [--print-errors]
              [--save-errors SAVE_ERRORS] [--sponsor-block] [--archive ARCHIVE]
              [--playlist-numbering] [--scan-for-songs] [--fetch-albums]
              [--id3-separator ID3_SEPARATOR] [--ytm-data] [--add-unavailable]
              [--generate-lrc] [--force-update-metadata] [--sync-without-deleting]
              [--max-filename-length MAX_FILENAME_LENGTH] [--yt-dlp-args YT_DLP_ARGS]
              [--detect-formats [{mp3,flac,ogg,opus,m4a,wav} ...]] [--redownload]
              [--skip-album-art] [--ignore-albums [IGNORE_ALBUMS ...]] [--skip-explicit]
              [--proxy PROXY] [--create-skip-file] [--respect-skip-file]
              [--sync-remove-lrc] [--host HOST] [--port PORT] [--keep-alive]
              [--allowed-origins [ALLOWED_ORIGINS ...]] [--web-use-output-dir]
              [--keep-sessions] [--force-update-gui] [--web-gui-repo WEB_GUI_REPO]
              [--web-gui-location WEB_GUI_LOCATION] [--enable-tls]
              [--cert-file CERT_FILE] [--key-file KEY_FILE] [--ca-file CA_FILE]
              [--log-level {CRITICAL,FATAL,ERROR,WARN,WARNING,INFO,MATCH,DEBUG,NOTSET}]
              [--simple-tui] [--log-format LOG_FORMAT] [--download-ffmpeg]
              [--generate-config] [--check-for-updates] [--profile] [--version]
              [{download,save,web,sync,meta,url}] query [query ...]
spotdl: error: argument operation: invalid choice: 'dnb2\\' (choose from 'download', 'save', 'web', 'sync', 'meta', 'url')

C:\Users\tom>

Other details

Windows 10 This is my config, im not sure if I can leave the secret/id, so I removed those. Also, I'm not entirely sure if it's just a number that causes this, I would think something like a symbol might also cause issues.

{
    "client_id": "",
    "client_secret": "",
    "auth_token": null,
    "user_auth": false,
    "headless": false,
    "cache_path": "C:\\Users\\tom\\.spotdl\\.spotipy",
    "no_cache": false,
    "max_retries": 3,
    "use_cache_file": false,
    "audio_providers": [
        "youtube-music",
        "youtube"
    ],
    "lyrics_providers": [
        "genius"
    ],
    "playlist_numbering": false,
    "scan_for_songs": false,
    "m3u": null,
    "output": "{artists} - {title}.{output-ext}",
    "overwrite": "skip",
    "search_query": null,
    "ffmpeg": "ffmpeg",
    "bitrate": "disable",
    "ffmpeg_args": null,
    "format": "opus",
    "save_file": null,
    "filter_results": false,
    "threads": 22,
    "cookie_file": null,
    "restrict": "null",
    "print_errors": true,
    "sponsor_block": false,
    "preload": true,
    "archive": null,
    "load_config": true,
    "log_level": "DEBUG",
    "simple_tui": false,
    "fetch_albums": false,
    "id3_separator": "/",
    "ytm_data": false,
    "add_unavailable": false,
    "generate_lrc": false,
    "force_update_metadata": false,
    "only_verified_results": false,
    "sync_without_deleting": false,
    "max_filename_length": null,
    "yt_dlp_args": null,
    "detect_formats": null,
    "save_errors": null,
    "web_use_output_dir": false,
    "port": 8800,
    "host": "localhost",
    "keep_alive": false,
    "allowed_origins": null,
    "keep_sessions": false
}
xnetcat commented 4 days ago

Try `spotdl download [urls] --options

hianick commented 4 days ago

That didnt work

hianick commented 4 days ago

Why was this closed, this still gave me the same output.