XDGFX / ultrasonics

Sync music playlists between all your music services. Do more with your music.
GNU General Public License v3.0
225 stars 19 forks source link

Spotify to Plex via docker #33

Closed Drazzilb08 closed 3 years ago

Drazzilb08 commented 3 years ago

So I've installed ultrasonics via docker on my unraid server. I've set everything up, ultrasonics connects to my Spotify account, and connects to my Plex server. When I run the applet I receive this error:

plugins - DEBUG - Running plugin plex v0.1 (plugins.py:158)
today at 6:50:18 PM 2021-10-21 01:50:18,379 - 🎧 plex - INFO - Requesting playlists from endpoint: http://192.168.1.200:32400/playlists/?X-Plex-Token=*********** (up_plex.py:179)
today at 6:50:18 PM 2021-10-21 01:50:18,383 - 🎧 plex - INFO - Found 1 playlists. (up_plex.py:195)
today at 6:50:18 PM 2021-10-21 01:50:18,383 - 🎧 plex - INFO - Creating temporary playlists to send to Plex. (up_plex.py:239)
today at 6:50:18 PM 2021-10-21 01:50:18,399 - 🎧 plex - INFO - Updating playlist: EDM Bangers (up_plex.py:243)
today at 6:50:18 PM 2021-10-21 01:50:18,412 - 🎧 plex - DEBUG - <html><head><title>Internal Server Error</title></head><body><h1>500 Internal Server Error</h1></body></html> (up_plex.py:298)

which duplicates across all my Spotify playlists.

I've tested my plex URL + the token and I get a normal response

The run shows as successful but it is not, obviously

Today at 6:50:19 PM 2021-10-21 01:50:19,474 - plugins - INFO - Applet 7bbc3df8-3203-11ec-a41c-0242ac11000b completed successfully in 0:00:14.873865 (plugins.py:296)

My docker setup:

services:
  ultrasonics:
    command:
      - app.py
    container_name: ultrasonics
    entrypoint:
      - python
    environment:
      - PUID=99
      - PGID=100
      - TZ=America/Los_Angeles
      - HOST_OS=Unraid
      - PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
      - LANG=C.UTF-8
      - GPG_KEY=E3FF2839C048B25C084DEBE9B26995E310250568
      - PYTHON_VERSION=3.8.5
      - PYTHON_PIP_VERSION=20.2.3
      - PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/fa7dc83944936bf09a0e4cb5d5ec852c0d256599/get-pip.py
      - PYTHON_GET_PIP_SHA256=6e0bb0a2c2533361d7f297ed547237caf1b7507f197835974c0dd7eba998c53c
    hostname: 9dd093140e87
    image: xdgfx/ultrasonics:latest
    ipc: private
    logging:
      driver: json-file
      options:
        max-file: 1
        max-size: 50m
    networks:
      - external
    ports:
      - 5000:5000/tcp
    volumes:
      - /mnt/user/appdata/ultrasonics:/config:rw
      - /mnt/user/appdata/ultrasonics/plugins:/plugins:rw
      - /mnt/user/data/:/data:rw
    working_dir: /
networks:
  external:
    external: true

I really want to use this app as it's exactly what I've been looking for. Just got this one issue.

XDGFX commented 3 years ago

Not too sure what the issue is (with that not very informative error message from Plex...). As I've 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!

Drazzilb08 commented 3 years ago

Has that been pushed to docker (I didn't see it to be)? As that's the way I have this currently installed.

Edit: I've installed it on the host. Everything is running smoothly so far.

Any idea when you'd be able to push this update to your container on docker?

Seems that when it comes across a playlist in which you have ZERO songs for it spits this out (could be wrong about this)

2021-10-23 22:16:13,876 - 🎧 plex beta - INFO - Found 0 songs in Plex out of 50 songs supplied (up_plex beta.py:212)
2021-10-23 22:16:13,876 - 🎧 plex beta - INFO - Creating playlist: Feelin' Myself (up_plex beta.py:218)
Processing playlists: 16%|█▌ | 13/82 [06:23<33:54, 29.49s/it]
2021-10-23 22:16:13,876 - plugins - ERROR - Must include items to add when creating new playlist. (plugins.py:291)
Traceback (most recent call last):
File "/mnt/user/data/scripts/ultrasonics/ultrasonics/plugins.py", line 285, in applet_run
plugin_run(*get_info(plugin), component="outputs",
File "/mnt/user/data/scripts/ultrasonics/ultrasonics/plugins.py", line 162, in plugin_run
response = found_plugins[name].run(
File "/mnt/user/data/scripts/ultrasonics/ultrasonics/official_plugins/up_plex beta.py", line 219, in run
plex_playlist = plexapi.playlist.Playlist.create(
File "/mnt/user/data/scripts/env/lib64/python3.9/site-packages/plexapi/playlist.py", line 403, in create
return cls._create(server, title, items)
File "/mnt/user/data/scripts/env/lib64/python3.9/site-packages/plexapi/playlist.py", line 324, in _create
raise BadRequest('Must include items to add when creating new playlist.')
plexapi.exceptions.BadRequest: Must include items to add when creating new playlist.
2021-10-23 22:16:13,920 - plugins - WARNING - Applet c846eae0-347b-11ec-bfed-ac1f6bec95ff failed in 0:06:43.215565 (plugins.py:299)

If I remove the offending playlist on Spotify it will press past this point.

XDGFX commented 3 years ago

I've updated the Docker containers now - my bad, I had thought I had automated it ;)

It could be a good idea to catch the case where no songs are matched. It would be annoying if it took out a job with multiple playlists because of one bad one.

Opening a new issue in #36 to keep it clean :) Thanks for the heads up!