glomatico / spotify-web-downloader

A Python CLI app for downloading songs/music videos/albums/playlists directly from Spotify.
378 stars 43 forks source link

Are contributions welcome? : ) Show/Episode downloading functionality #51

Closed romazu closed 1 month ago

romazu commented 1 month ago

Hello,

Awesome project you have!

I would like to contribute to the show/episode downloading functionality. I have a working implementation locally, but in order to do this more or less elegantly, I need to refactor the 'cli.py' code quite a bit. Are you okay with that?

How should I test the result? I mean, of course, I'll test it on playlists, albums, and individual tracks, but maybe you have some test suite or procedure, at least in your head?

Also, have you considered adding a license? It would be great.

Looking forward to hearing from you!

romazu commented 1 month ago

I have submitted pull request #52 for refactoring the cli.py script.

romazu commented 1 month ago

I've implemented the episode/show downloading functionality in pull request #53.
Note that this PR is based on the previous one regarding the cli.py refactoring.

Feel free to ask any questions or offer suggestions!

Fate6174 commented 1 month ago

I just needed that functionality and it's so awesome that you implemented this just 1 week ago. Thanks a lot!

That being said, I had an error thrown for the show "Boys Club - Macht & Missbrauch bei Axel Springer" (https://open.spotify.com/show/42A230DwCz7M1Wicnmjx7R), that the metadata_gid dictionary is missing some keys.

[INFO     15:44:47] (Item 1/9 from URL 1/1) Downloading "Boys Club – Macht & Missbrauch bei Axel Springer (Trailer)"
[ERROR    15:44:47] Failed to download "Boys Club – Macht & Missbrauch bei Axel Springer (Trailer)"
Traceback (most recent call last):
  File "/home/_______/.pyenv/versions/spotify-dl2/bin/spotify-web-downloader", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/_______/.pyenv/versions/3.12.2/envs/spotify-dl2/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/_______/.pyenv/versions/3.12.2/envs/spotify-dl2/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/_______/.pyenv/versions/3.12.2/envs/spotify-dl2/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/_______/.pyenv/versions/3.12.2/envs/spotify-dl2/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/_______/git/spotify-web-downloader/spotify_web_downloader/cli.py", line 381, in main
    app.run(
  File "/home/_______/git/spotify-web-downloader/spotify_web_downloader/app.py", line 127, in run
    self.process_episode(queue_progress, queue_item, overwrite, save_cover)
  File "/home/_______/git/spotify-web-downloader/spotify_web_downloader/app.py", line 371, in process_episode
    tags = self.downloader_episode.get_tags(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/_______/git/spotify-web-downloader/spotify_web_downloader/downloader_episode.py", line 98, in get_tags
    "episode": metadata_gid["episode_number"],
               ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'episode_number'

After changing the lines 98 and 99 in get_tags to

            "episode": 0, #metadata_gid["episode_number"],
            "season": 0, #metadata_gid["season_number"],

it worked fine, but of course the season and episode numbers are now just 0. I did not dig deeper to find out why the info is not available in the dictionary, because I'm fine with the result as is. But wanted to let you know anyway. Thanks again!