Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No playlist found in Plex #32

Open
arsaboo opened this issue Oct 18, 2021 · 5 comments
Open

No playlist found in Plex #32

arsaboo opened this issue Oct 18, 2021 · 5 comments

Comments

@arsaboo
Copy link

arsaboo commented Oct 18, 2021

I am trying to sync my Plex playlists to Spotify. I have connected both the services. But, when I run the applet, I see that no playlists are found. When I visit the URL (and manually add the token), I can see all the playlists.

2021-10-18 11:48:49,284 - plugins - INFO - Running applet: 056907c6-3028-11ec-a267-0242ac110004 (plugins.py:251)
2021-10-18 11:48:49,284 - plugins - DEBUG - Running plugin plex v0.1 (plugins.py:158)
2021-10-18 11:48:49,285 - 🎧 plex - INFO - Requesting playlists from endpoint: http://192.168.2.212:32400/playlists/?X-Plex-Token=*********** (up_plex.py:179)
2021-10-18 11:48:49,298 - 🎧 plex - INFO - Found 0 playlists. (up_plex.py:195)
2021-10-18 11:48:49,298 - plugins - DEBUG - Running plugin spotify v0.3 (plugins.py:158)
2021-10-18 11:48:49,299 - 🎧 spotify - INFO - Credentials will be cached in: /config/up_spotify/up_spotify.bz2 (up_spotify.py:104)
2021-10-18 11:48:49,300 - 🎧 spotify - DEBUG - Fetching your Spotify token (up_spotify.py:121)
2021-10-18 11:48:49,559 - 🎧 spotify - DEBUG - Token is valid. (up_spotify.py:152)
2021-10-18 11:48:49,559 - 🎧 spotify - DEBUG - Returning cached token (up_spotify.py:129)
2021-10-18 11:48:49,839 - 🎧 spotify - INFO - Found 36 playlist(s) on Spotify. (up_spotify.py:340)
2021-10-18 11:48:49,839 - plugins - INFO - Applet 056907c6-3028-11ec-a267-0242ac110004 completed successfully in 0:00:00.555649 (plugins.py:296)
2021-10-18 11:48:49,844 - database - INFO - Applet lastrun updated (database.py:377)

Any thoughts on what may be going on? Not sure if it matters, but I am using the docker container.

@XDGFX
Copy link
Owner

XDGFX commented Oct 23, 2021

Hmm, I'm not too sure, it might be that Plex changed the API slightly and my code is mis-reading it now. As mentioned in #30 could you please download the latest https://github.com/XDGFX/ultrasonics/tree/1.2.0 branch, try syncing with the new 'plex beta' plugin instead, and let me know how you get on?

This uses a proper plex-python api so it should be more reliable!

@arsaboo
Copy link
Author

arsaboo commented Oct 24, 2021

@XDGFX With 1.2.0, there is some progress, but when I try to sync Spotify to Plex, I get the following error (and nothing is synced)

2021-10-24 12:17:05,560 - 🎧 plex beta - INFO - Processing playlist: LastFM Songs (up_plex beta.py:165)
Adding songs:   0%|                                                                                                                                                                    | 0/22 [00:01<?, ?it/s]
Processing playlists:   0%|                                                                                                                                                             | 0/6 [00:01<?, ?it/s]
2021-10-24 12:17:06,591 - plugins - ERROR - could not convert string to float: '' (plugins.py:291)
Traceback (most recent call last):
  File "/home/arsaboo/ultrasonics/ultrasonics/plugins.py", line 285, in applet_run
    plugin_run(*get_info(plugin), component="outputs",
  File "/home/arsaboo/ultrasonics/ultrasonics/plugins.py", line 162, in plugin_run
    response = found_plugins[name].run(
  File "/home/arsaboo/ultrasonics/ultrasonics/official_plugins/up_plex beta.py", line 207, in run
    if max(scores) >= float(settings_dict["fuzzy_ratio"]):
ValueError: could not convert string to float: ''

When I try to sycn Plex to Spotify, I get the following error (again, nothing is synced)

021-10-24 12:17:40,468 - 🎧 plex beta - DEBUG - Processing track: Wakhra Swag (feat. Badshah) (up_plex beta.py:128)██████████████████████████████████████████████████▎       | 94/99 [00:08<00:01,  4.90it/s]
                                                                                                                                                                                                            2021-10-24 12:17:40,669 - 🎧 plex beta - DEBUG - Processing track: Small Town Girl (up_plex beta.py:128)███████████████████████████████████████████████████████████████▊      | 95/99 [00:08<00:00,  4.92it/s]
2021-10-24 12:17:40,697 - 🎧 plex beta - DEBUG - Processing track: Sharabi (up_plex beta.py:128)
2021-10-24 12:17:40,722 - 🎧 plex beta - DEBUG - Processing track: Kukkad (up_plex beta.py:128)
2021-10-24 12:17:40,748 - 🎧 plex beta - DEBUG - Processing track: Kangna (up_plex beta.py:128)
Getting songs: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 99/99 [00:08<00:00, 11.57it/s]
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:08<00:00,  8.64s/it]
2021-10-24 12:17:40,770 - plugins - DEBUG - Running plugin spotify v0.5 (plugins.py:158)
2021-10-24 12:17:40,771 - 🎧 spotify - INFO - Credentials will be cached in: /home/arsaboo/ultrasonics/config/up_spotify/up_spotify.bz2 (up_spotify.py:93)
2021-10-24 12:17:40,771 - 🎧 spotify - DEBUG - Fetching your Spotify token (up_spotify.py:110)
2021-10-24 12:17:41,065 - 🎧 spotify - DEBUG - Token is valid. (up_spotify.py:136)
2021-10-24 12:17:41,065 - 🎧 spotify - DEBUG - Returning cached token (up_spotify.py:118)
2021-10-24 12:17:41,289 - 🎧 spotify - INFO - Found 6 playlist(s) on Spotify. (up_spotify.py:331)
2021-10-24 12:17:41,289 - plugins - ERROR - 'name' (plugins.py:291)
Traceback (most recent call last):
  File "/home/arsaboo/ultrasonics/ultrasonics/official_plugins/up_spotify.py", line 645, in run
    if playlist["id"]["spotify"] in [
KeyError: 'spotify'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/arsaboo/ultrasonics/ultrasonics/plugins.py", line 285, in applet_run
    plugin_run(*get_info(plugin), component="outputs",
  File "/home/arsaboo/ultrasonics/ultrasonics/plugins.py", line 162, in plugin_run
    response = found_plugins[name].run(
  File "/home/arsaboo/ultrasonics/ultrasonics/official_plugins/up_spotify.py", line 650, in run
    if playlist["name"] in [item["name"] for item in current_playlists]:
KeyError: 'name'

Hopefully these logs give you some idea about what is going on and we can fix them. Let me know if you need anything else.

@arsaboo
Copy link
Author

arsaboo commented Oct 24, 2021

Ok..so I added the fuzzy ratio and now I can sync from Spotify to Plex.

Plex to Spotify is still not working and shows the same error above. It may be because I have not set things properly. Here's how my applet looks:

image

@XDGFX
Copy link
Owner

XDGFX commented Nov 3, 2021

Ah, I had incorrectly named a dict entry in the new beta plugin, try with the latest commit on the 1.2.0 branch (or the latest 1.2.0 Docker tag)

@arsaboo
Copy link
Author

arsaboo commented Nov 10, 2021

So, looks like the process is working. However, the matching is terrible. I have a playlist of over 10K tracks and only 1200 were matched :(

This is not your fault, but how Spotify organizes tracks. Sometimes the tracks are organized in albums, sometimes they will organize it as tracktitle (from albumtitle) and so on. I like how beets handles this situation by giving an option to manually intervene. Wondering if it would be a better idea to give an option for manual matching like beets does.

Here's some code snippet that uses beets library for basic import and here's some discussion implementing the same in Beets forum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants