You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Everytime i want to download a song, nevertheless i use an url or a song name i get: Unknown format code 'd' for object of type 'float' in formatter.py
Steps to reproduce - Ensure to include actual links!
type spotdl "trackname" in cmd
Traceback
During handling of the above exception, another exception occurred:
╭──────────────────────────────────────────────── Traceback (most recent call last) ────────────────────────────────────────────────╮
│ C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\console\entry_point.py:137 in console_entry_point │
│ │
│ 134 │ try: │
│ 135 │ │ # Pick the operation to perform │
│ 136 │ │ # based on the name and run it! │
│ ❱ 137 │ │ OPERATIONS[arguments.operation]( │
│ 138 │ │ │ query=arguments.query, │
│ 139 │ │ │ downloader=downloader, │
│ 140 │ │ ) │
│ │
│ C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\console\download.py:33 in download │
│ │
│ 30 │ ) │
│ 31 │ │
│ 32 │ # Download the songs │
│ ❱ 33 │ downloader.download_multiple_songs(songs) │
│ 34 │
│ │
│ C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\download\downloader.py:291 in │
│ download_multiple_songs │
│ │
│ 288 │ │ tasks = [self.pool_download(song) for song in songs] │
│ 289 │ │ │
│ 290 │ │ # Call all task asynchronously, and wait until all are finished │
│ ❱ 291 │ │ results = list(self.loop.run_until_complete(asyncio.gather(*tasks))) │
│ 292 │ │ │
│ 293 │ │ # Print errors │
│ 294 │ │ if self.settings["print_errors"]: │
│ │
│ C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py:664 in run_until_complete │
│ │
│ 661 │ │ if not future.done(): │
│ 662 │ │ │ raise RuntimeError('Event loop stopped before Future completed.') │
│ 663 │ │ │
│ ❱ 664 │ │ return future.result() │
│ 665 │ │
│ 666 │ def stop(self): │
│ 667 │ │ """Stop running the event loop. │
│ │
│ C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\download\downloader.py:363 in pool_download │
│ │
│ 360 │ │ # tasks that cannot acquire semaphore will wait here until it's free │
│ 361 │ │ # only certain amount of tasks can acquire the semaphore at the same time │
│ 362 │ │ async with self.semaphore: │
│ ❱ 363 │ │ │ return await self.loop.run_in_executor(None, self.search_and_download, song) │
│ 364 │ │
│ 365 │ def search(self, song: Song) -> str: │
│ 366 │ │ """ │
│ │
│ C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures\thread.py:58 in run │
│ │
│ 55 │ │ │ return │
│ 56 │ │ │
│ 57 │ │ try: │
│ ❱ 58 │ │ │ result = self.fn(*self.args, **self.kwargs) │
│ 59 │ │ except BaseException as exc: │
│ 60 │ │ │ self.future.set_exception(exc) │
│ 61 │ │ │ # Break a reference cycle with the exception 'exc' │
│ │
│ C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\download\downloader.py:449 in search_and_download │
│ │
│ 446 │ │ except Exception: │
│ 447 │ │ │ song = reinit_song(song) │
│ 448 │ │ │ │
│ ❱ 449 │ │ │ output_file = create_file_name( │
│ 450 │ │ │ │ song=song, │
│ 451 │ │ │ │ template=self.settings["output"], │
│ 452 │ │ │ │ file_extension=self.settings["format"], │
│ │
│ C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\utils\formatter.py:332 in create_file_name │
│ │
│ 329 │ if not template.endswith(".{output-ext}"): │
│ 330 │ │ template += ".{output-ext}" │
│ 331 │ │
│ ❱ 332 │ formatted_string = format_query( │
│ 333 │ │ song=song, │
│ 334 │ │ template=template, │
│ 335 │ │ santitize=True, │
│ │
│ C:\Users\USER\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\utils\formatter.py:235 in format_query │
│ │
│ 232 │ │ "{duration}": song.duration, │
│ 233 │ │ "{year}": song.year, │
│ 234 │ │ "{original-date}": song.date, │
│ ❱ 235 │ │ "{track-number}": f"{song.track_number:02d}" if song.track_number else "", │
│ 236 │ │ "{tracks-count}": song.tracks_count, │
│ 237 │ │ "{isrc}": song.isrc, │
│ 238 │ │ "{track-id}": song.song_id,
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: Unknown format code 'd' for object of type 'float'
Other details
An easy fix would be to change line 235 from "{track-number}": f"{song.track_number:02d}" if song.track_number else "",
to "{track-number}": f"{song.track_number:02f}" if song.track_number else "",
The text was updated successfully, but these errors were encountered:
R3TRO04
added
the
Bug
Unexpected problem or unintended behavior that needs to be fixed
label
Mar 3, 2024
System OS
Windows
Python Version
3.11 (CPython)
Install Source
Termux Installation Script (spotDL provided)
Install version / commit hash
4.2.4
Expected Behavior vs Actual Behavior
Everytime i want to download a song, nevertheless i use an url or a song name i get:
Unknown format code 'd' for object of type 'float'
informatter.py
Steps to reproduce - Ensure to include actual links!
spotdl "trackname"
in cmdTraceback
Other details
An easy fix would be to change line 235 from
"{track-number}": f"{song.track_number:02d}" if song.track_number else "",
to
"{track-number}": f"{song.track_number:02f}" if song.track_number else "",
The text was updated successfully, but these errors were encountered: