Coder Social home page Coder Social logo

spotify-to-pocketcasts's People

Contributors

rv3392 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

itspatrq

spotify-to-pocketcasts's Issues

Clearer error messaging for the missing parameters

At the beginning I had troubles to get the script running because I didn't understand first that the POCKETCASTS_USER was not set (I had set the POCKETCASTS_EMAIL per instructions), because the script kept running and the "No Pocket Casts username given! ..." error message got lost in the output flow. The script stopped later during the execution when there was error caused by the missing user id. It would be better to stop the script immediately when the missing user id is noticed.

Here is an example run:

/Users/-/opt/spotify-to-pocketcasts-master/python spotify_to_pocketcasts.py
No Pocket Casts username given! Please set POCKETCASTS_USER or use the --pocketcasts_user option
Logged In!
Got podcast subscriptions from Spotify.
Processing The Hacker Mind
There are 86 episodes!
There are 8 started episodes!
The Hacker Mind: Syncing 8 episodes from Spotify to Pocketcasts
{'Authorization': 'Bearer None', 'content-length': 27}
b'{"term": "The Hacker Mind"}'
Traceback (most recent call last):
  File "/Users/-/opt/spotify-to-pocketcasts-master/spotify_to_pocketcasts.py", line 109, in <module>
    main()
  File "/Users/-/opt/spotify-to-pocketcasts-master/spotify_to_pocketcasts.py", line 91, in main
    uuid = pocketcasts.search_podcasts_and_get_first_uuid(http, token, podcast.title)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/-/opt/spotify-to-pocketcasts-master/pocketcasts.py", line 57, in search_podcasts_and_get_first_uuid
    search_result = search_podcasts(http, token, term)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/-/opt/spotify-to-pocketcasts-master/pocketcasts.py", line 53, in search_podcasts
    return json.loads(response.data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/-/opt/anaconda3/anaconda3/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/-/opt/anaconda3/anaconda3/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/-/opt/anaconda3/anaconda3/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

It would be better to end the script after the second row:

/Users/-/opt/spotify-to-pocketcasts-master/python spotify_to_pocketcasts.py
No Pocket Casts username given! Please set POCKETCASTS_USER or use the --pocketcasts_user option

Can the package requirements relaxed?

Current requirements.txt
spotipy==2.22.0
urllib3==1.26.14

Is it important, that the packages are exactly those version?

Would these be enough:
spotipy>=2.22.0
urllib3>=1.26.14
(or if the bigger changes of 2.x break things: urllib3>=1.26.14, <2)

If there are several matches for the podcast name, show them in a list and allow users to select the correct one

Most of my podcasts matched correctly but some of them were incorrectly matched. Within the incorrect ones some of them:

  • Were in Spotify but not in the Pocket casts. In those cases I would have wanted to skip the sync instead of trying to sync with incorrect podcast.
  • Were in both Spotify and Pocket casts, but for some reason were incorrectly matched (maybe because they had non us characters in the name or something). In those cases I would have liked to select the correct one from the list.

Fix the environment variables in the README.md

Fix the environment variables in the instructions to match ones used in the code:

  • POCKETCASTS_EMAIL => POCKETCASTS_USER

The linked Spotipy package's documentation uses SPOTIPY in the env variables and the code uses SPOTIFY so either code should be changed or instructions clarified. Also the word "CLIENT" is missing from the variable used for the secret in the code:

  • SPOTIPY_CLIENT_ID => SPOTIFY_CLIENT_ID
  • SPOTIPY_CLIENT_SECRET => SPOTIFY_SECRET
  • SPOTIPY_REDIRECT_URI => SPOTIFY_REDIRECT_URI

Add a testing harness

Before adding any new features, there needs to be a way to test the script without actually logging into Spotify + Pocket Casts and doing a transfer.

This needs to:

  • Mock the relevant Spotify APIs
  • Mock the relevant Pocket Casts API
  • Verify that the resulting data in Pocket Casts is what's expected
  • Verify the stdout/stderr
  • Contain a minimal number of useful test cases

Error in sync of a specific podcast

There was one podcast that caused the script to stop in a error. The podcast was found in both services, but was maybe incorrectly matched because of the quite common word in the name or something. Unsubscribing the show in Spotify let the script run completely.

Here is the error dump:

Processing Singletracks Mountain Bike Podcast
There are 396 episodes!
Traceback (most recent call last):
  File "/Users/-/opt/spotify-to-pocketcasts-master/spotify_to_pocketcasts.py", line 109, in <module>
    main()
  File "/Users/-/opt/spotify-to-pocketcasts-master/spotify_to_pocketcasts.py", line 87, in main
    podcast.episodes = spotify.get_listened_episodes_for_show(spotify_client, podcast)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/-/opt/spotify-to-pocketcasts-master/spotify.py", line 69, in get_listened_episodes_for_show
    episode["name"],
    ~~~~~~~^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

Same happened with the "Rise and Play Podcast".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.