Open AverageDave93 opened 5 days ago
Plex is hosted on the same machine as your docker? Might try http/https or 127.0.0.1 instead of localhost. Doesn't seem like a bug with the app, seems more like a docker networking thing but if you get any more info I can look this evening
Oh not sure if it's related but you're not on the latest version I think:
2024/06/23 18:58:33,stdout,Configuration set from environment variables
That line shouldn't be in the code anymore
hmm has the docker image been updated? Im pulling like so
docker run -d --name=spotiplex \ -e SPOTIFY_API_KEY=REDACTED \ -e SPOTIFY_API_ID=REDACTED \ -e PLEX_API_KEY=REDACTED \ -e PLEX_SERVER_URL=http://192.168.50.153:32400 \ -e PLEX_REPLACE= \ -e LIDARR_API_KEY=REDACTED \ -e LIDARR_API_URL=http://192.168.50.153:8686 \ -e PLEX_USERS=REDACTED \ -e WORKER_COUNT=4 \ -e MANUAL_PLAYLISTS= \ -e LIDARR_SYNC=True \ -e CRON_SCHEDULE="0 1 *" \ --restart unless-stopped \ 0xchloe/spotiplex:latest
I feel like its something about the script not reading the enviroment variables, i just pulled the latest from here and and used my own image and im getting the same issue. Old scripts is still working, connects to plex, connects to soptify connects to lidarr.
Can you run "docker image ls"?
Latest image should be 41a1ba566dde, if it's not marked as that in docker images locally you'll have to do docker pull. I believe by default doesn't pull down the latest image.
yeah that was it, never had that before had to manually delete the image after deleting in the container. Thank you so much once again. Will this not run on startup? will it wait for its cron time? as im not seeing much in the logs
If you do "docker exec -it spotiplex bash" you can find the log file, but yes, assuming your cron format is correct it should just work on schedule (from your envvars, every day at 1 AM), and should have run an initial sync on container start as well. Docker is kind of unpredictable with pulling imo, I use portainer and it just gives me a toggle for pulling the latest version. I think the log file is /usr/bin/spotiplex/spotiplex.log?
and it only states when there is an error? it doesnt print when succesfull?
root@7ce0479a59d6:/usr/bin/spotiplex# more spotiplex.log 2024-06-23 19:50:02.455 | DEBUG | spotiplex.modules.spotiplex.main:get_user_list:40 - Users to proc ess: ['REDACTED'] 2024-06-23 19:50:02.985 | DEBUG | spotiplex.modules.spotiplex.main:process_for_user:51 - Processing for user REDACTED 2024-06-23 19:50:02.989 | DEBUG | spotiplex.modules.spotify.main:get_playlist_name:51 - Error retrieving playlist name from Spotify for playlist
2024-06-23 19:50:02.989 | DEBUG | spotiplex.modules.spotify.main:get_playlist_name:56 - Error was h ttp status: 400, code:-1 - Unsupported URL / URI., reason: None 2024-06-23 19:50:02.990 | DEBUG | spotiplex.modules.spotiplex.main:process_playlist:98 - Playlist n ame could not be retrieved for playlist ID ''. 2024-06-23 19:50:05.734 | DEBUG | spotiplex.modules.spotiplex.main:get_user_list:40 - Users to proc ess: ['REDACTED'] 2024-06-23 19:50:05.916 | DEBUG | spotiplex.modules.spotiplex.main:process_for_user:51 - Processing for user REDACTED 2024-06-23 19:50:05.918 | DEBUG | spotiplex.modules.spotify.main:get_playlist_name:51 - Error retrieving playlist name from Spotify for playlist
2024-06-23 19:50:05.920 | DEBUG | spotiplex.modules.spotify.main:get_playlist_name:56 - Error was h ttp status: 400, code:-1 - Unsupported URL / URI., reason: None 2024-06-23 19:50:05.920 | DEBUG | spotiplex.modules.spotiplex.main:process_playlist:98 - Playlist n ame could not be retrieved for playlist ID ''. 2024-06-23 19:52:51.113 | DEBUG | spotiplex.modules.spotiplex.main:get_user_list:40 - Users to proc ess: ['REDACTED'] 2024-06-23 19:52:51.489 | DEBUG | spotiplex.modules.spotiplex.main:process_for_user:51 - Processing for user REDACTED 2024-06-23 19:52:51.492 | DEBUG | spotiplex.modules.spotify.main:get_playlist_name:51 - Error retrieving playlist name from Spotify for playlist
2024-06-23 19:52:51.492 | DEBUG | spotiplex.modules.spotify.main:get_playlist_name:56 - Error was h ttp status: 400, code:-1 - Unsupported URL / URI., reason: None 2024-06-23 19:52:51.492 | DEBUG | spotiplex.modules.spotiplex.main:process_playlist:98 - Playlist n ame could not be retrieved for playlist ID ''. 2024-06-23 19:52:54.082 | DEBUG | spotiplex.modules.spotiplex.main:get_user_list:40 - Users to proc ess: ['REDACTED'] 2024-06-23 19:52:54.370 | DEBUG | spotiplex.modules.spotiplex.main:process_for_user:51 - Processing for user REDACTED 2024-06-23 19:52:54.372 | DEBUG | spotiplex.modules.spotify.main:get_playlist_name:51 - Error retrieving playlist name from Spotify for playlist
2024-06-23 19:52:54.373 | DEBUG | spotiplex.modules.spotify.main:get_playlist_name:56 - Error was h ttp status: 400, code:-1 - Unsupported URL / URI., reason: None 2024-06-23 19:52:54.373 | DEBUG | spotiplex.modules.spotiplex.main:process_playlist:98 - Playlist n ame could not be retrieved for playlist ID ''.
Hmm. And you're pulling from lidarr? That's odd. Looks like it's not pulling the playlist ids correctly. Trying to think what the easiest way to debug that is. Do you know how to make an API call to Lidarr using Postman or Thunder Client? Would be interested to see what the endpoint gives you back.
https://github.com/cmathews393/spotify-to-plex/blob/main/spotiplex%2Fmodules%2Flidarr%2Fmain.py#L34
^ this would be the endpoint to test
I did LOG_LEVEL=DEBUG and am now geting this error
2024-06-23 19:52:54.373 | DEBUG | spotiplex.modules.spotify.main:get_playlist_name:56 - Error was h ttp status: 400, code:-1 - Unsupported URL / URI., reason: None 2024-06-23 19:52:54.373 | DEBUG | spotiplex.modules.spotiplex.main:process_playlist:98 - Playlist n ame could not be retrieved for playlist ID ''. 2024-06-23 21:23:09.098 | DEBUG | spotiplex.modules.spotiplex.main:get_user_list:40 - Users to proc ess: ['REDACTED'] 2024-06-23 21:23:09.687 | DEBUG | spotiplex.modules.spotiplex.main:process_for_user:51 - Processing for user REDACTED 2024-06-23 21:23:09.979 | DEBUG | spotiplex.modules.spotify.main:get_playlist_name:51 - Error retrieving playlist name from Spotify for playlist False
2024-06-23 21:23:09.980 | DEBUG | spotiplex.modules.spotify.main:get_playlist_name:56 - Error was h ttp status: 400, code:-1 - https://api.spotify.com/v1/playlists/False?fields=name&additional_types=tra ck: Invalid base62 id, reason: None 2024-06-23 21:23:09.980 | DEBUG | spotiplex.modules.spotiplex.main:process_playlist:98 - Playlist n ame could not be retrieved for playlist ID 'False'. 2024-06-23 21:23:17.520 | DEBUG | spotiplex.modules.spotiplex.main:get_user_list:40 - Users to proc ess: ['REDACTED'] 2024-06-23 21:23:17.746 | DEBUG | spotiplex.modules.spotiplex.main:process_for_user:51 - Processing for user REDACTED 2024-06-23 21:23:17.820 | DEBUG | spotiplex.modules.spotify.main:get_playlist_name:51 - Error retrieving playlist name from Spotify for playlist False
2024-06-23 21:23:17.820 | DEBUG | spotiplex.modules.spotify.main:get_playlist_name:56 - Error was h ttp status: 400, code:-1 - https://api.spotify.com/v1/playlists/False?fields=name&additional_types=tra ck: Invalid base62 id, reason: None 2024-06-23 21:23:17.820 | DEBUG | spotiplex.modules.spotiplex.main:process_playlist:98 - Playlist n ame could not be retrieved for playlist ID 'False'.
https://github.com/cmathews393/spotify-to-plex/blob/main/spotiplex%2Fmodules%2Flidarr%2Fmain.py#L34
^ this would be the endpoint to test
not sure about this tbh
I think I know what the issue is. Can you confirm whether or not its making the script actually not work or not? Maybe test with adding a new playlist if you don't want to delete one and test recreation. I can't dig deep into it until Wednesday or Thursday this week. I'm hoping the error handling is catching it in a way that allows it to keep going if it fails, but maybe not.
I've literally just jumped off but it definitely didn't run, I've gone back to my edited version of your old script for temp. Let me know what you need and I'll wait till Thursday haha
@cmathews393 Any luck looking into this?
I seem to be getting an error message Connection refused indicating that the Docker container running spotiplex is unable to establish a connection to the Plex server. All other plex containers work fine, and i have reconfimed the Plex token, Spotify api info and lidar api.
spotiplex date,stream,content 2024/06/23 18:58:33,stderr,"requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4f6d82fb60>: Failed to establish a new connection: [Errno 111] Connection refused')) " 2024/06/23 18:58:33,stderr," raise ConnectionError(e, request=request) " 2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/requests/adapters.py\", line 519, in send " 2024/06/23 18:58:33,stderr, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024/06/23 18:58:33,stderr," r = adapter.send(request, **kwargs) " 2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/requests/sessions.py\", line 703, in send " 2024/06/23 18:58:33,stderr, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024/06/23 18:58:33,stderr," resp = self.send(prep, **send_kwargs) " 2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/requests/sessions.py\", line 589, in request " 2024/06/23 18:58:33,stderr, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024/06/23 18:58:33,stderr," return self.request(\"GET\", url, **kwargs) " 2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/requests/sessions.py\", line 602, in get " 2024/06/23 18:58:33,stderr, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024/06/23 18:58:33,stderr," response = method(url, headers=headers, timeout=timeout, **kwargs) " 2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/plexapi/server.py\", line 759, in query " 2024/06/23 18:58:33,stderr, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024/06/23 18:58:33,stderr," data = self.query(self.key, timeout=self._timeout) " 2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/plexapi/server.py\", line 116, in init " 2024/06/23 18:58:33,stderr, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024/06/23 18:58:33,stderr," return PlexServer(self.server_url, self.server_token, session=session) " 2024/06/23 18:58:33,stderr," File \"/usr/bin/spotiplex/plex.py\", line 21, in connect_plex " 2024/06/23 18:58:33,stderr, ^^^^^^^^^^^^^^^^^^^
2024/06/23 18:58:33,stderr, self.plex = self.connect_plex()
2024/06/23 18:58:33,stderr," File \"/usr/bin/spotiplex/plex.py\", line 14, in init " 2024/06/23 18:58:33,stderr, ^^^^^^^^^^^^^
2024/06/23 18:58:33,stderr, self.plex_service = PlexService()
2024/06/23 18:58:33,stderr," File \"/usr/bin/spotiplex/main.py\", line 54, in init " 2024/06/23 18:58:33,stderr, ^^^^^^^^^^^
2024/06/23 18:58:33,stderr, spotiplex = Spotiplex()
2024/06/23 18:58:33,stderr," File \"/usr/bin/spotiplex/main.py\", line 193, in main " 2024/06/23 18:58:33,stderr, main()
2024/06/23 18:58:33,stderr," File \"/usr/bin/spotiplex/main.py\", line 199, in
"
2024/06/23 18:58:33,stderr,Traceback (most recent call last):
2024/06/23 18:58:33,stderr,
2024/06/23 18:58:33,stderr,"During handling of the above exception, another exception occurred: " 2024/06/23 18:58:33,stderr,
2024/06/23 18:58:33,stderr,"urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=32400): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f4f6d82fb60>: Failed to establish a new connection: [Errno 111] Connection refused')) " 2024/06/23 18:58:33,stderr, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024/06/23 18:58:33,stderr," raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] " 2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/urllib3/util/retry.py\", line 515, in increment " 2024/06/23 18:58:33,stderr, ^^^^^^^^^^^^^^^^^^
2024/06/23 18:58:33,stderr, retries = retries.increment(
2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py\", line 844, in urlopen " 2024/06/23 18:58:33,stderr, ^^^^^^^^^^^^^
2024/06/23 18:58:33,stderr, resp = conn.urlopen(
2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/requests/adapters.py\", line 486, in send " 2024/06/23 18:58:33,stderr,Traceback (most recent call last):
2024/06/23 18:58:33,stderr,
2024/06/23 18:58:33,stderr,The above exception was the direct cause of the following exception:
2024/06/23 18:58:33,stderr,
2024/06/23 18:58:33,stderr,urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f4f6d82fb60>: Failed to establish a new connection: [Errno 111] Connection refused
2024/06/23 18:58:33,stderr, raise NewConnectionError(
2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/urllib3/connection.py\", line 218, in _new_conn " 2024/06/23 18:58:33,stderr, ^^^^^^^^^^^^^^^^
2024/06/23 18:58:33,stderr, self.sock = self._new_conn()
2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/urllib3/connection.py\", line 243, in connect " 2024/06/23 18:58:33,stderr, self.connect()
2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/http/client.py\", line 1035, in send " 2024/06/23 18:58:33,stderr, self.send(msg)
2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/http/client.py\", line 1091, in _send_output " 2024/06/23 18:58:33,stderr," self._send_output(message_body, encode_chunked=encode_chunked) " 2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/http/client.py\", line 1331, in endheaders " 2024/06/23 18:58:33,stderr, self.endheaders()
2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/urllib3/connection.py\", line 395, in request " 2024/06/23 18:58:33,stderr, conn.request(
2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py\", line 496, in _make_request " 2024/06/23 18:58:33,stderr, ^^^^^^^^^^^^^^^^^^^
2024/06/23 18:58:33,stderr, response = self._make_request(
2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/urllib3/connectionpool.py\", line 790, in urlopen " 2024/06/23 18:58:33,stderr,Traceback (most recent call last):
2024/06/23 18:58:33,stderr,
2024/06/23 18:58:33,stderr,The above exception was the direct cause of the following exception:
2024/06/23 18:58:33,stderr,
2024/06/23 18:58:33,stderr,ConnectionRefusedError: [Errno 111] Connection refused
2024/06/23 18:58:33,stderr, sock.connect(sa)
2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/urllib3/util/connection.py\", line 73, in create_connection " 2024/06/23 18:58:33,stderr, raise err
2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/urllib3/util/connection.py\", line 85, in create_connection " 2024/06/23 18:58:33,stderr, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024/06/23 18:58:33,stderr, sock = connection.create_connection(
2024/06/23 18:58:33,stderr," File \"/usr/local/lib/python3.12/site-packages/urllib3/connection.py\", line 203, in _new_conn " 2024/06/23 18:58:33,stderr,Traceback (most recent call last):
2024/06/23 18:58:33,stdout,reading config
2024/06/23 18:58:33,stdout,reading config
2024/06/23 18:58:33,stdout,reading config
2024/06/23 18:58:33,stdout,Configuration set from environment variables.
2024/06/23 18:58:33,stdout,writing config
2024/06/23 18:58:33,stdout,writing config
2024/06/23 18:58:33,stdout,writing config
2024/06/23 18:58:33,stdout,writing config
2024/06/23 18:58:33,stdout,reading config