blastbeng / spotisub

Spotify to subsonic Playlist Generator and Importer
MIT License
105 stars 6 forks source link

Unable to access Lidarr (http / https mismatch?) #34

Open gardiol opened 2 months ago

gardiol commented 2 months ago

Yeah, i am using it, and it shows? Sorry to be such a PIA.

I am trying the "generate/artist_top_tracks/all/" API endpoint, and it seems it cannot connect to Lidarr because of an HTTP / HTTPS.

This is my docker-compose:

      - LIDARR_ENABLED=1
      - LIDARR_IP=xxx.mydomain.com
      - LIDARR_PORT=443
      - LIDARR_USE_SSL=1
      - LIDARR_BASE_API_PATH=/lidarr
      - LIDARR_TOKEN=xxx

(the LIDARR_USE_SSL=1 i found looking in the source code)

But it seems it's not working:

2024-09-18 10:20:35 ERROR    <class 'pyarr.exceptions.PyarrBadRequest'> subsonic_helper.py 153                                                                                               
Traceback (most recent call last):                                                                                                                                                           
  File "/home/user/spotisub/./spotisub/helpers/subsonic_helper.py", line 153, in write_playlist                                                                                              
    is_monitored = lidarr_helper.is_artist_monitored(artist_name_spotify)                                                                                                                    
  File "/home/user/spotisub/./spotisub/helpers/lidarr_helper.py", line 29, in is_artist_monitored                                                                                            
    artists_list = lidarr_client.get_artist()                                                                                                                                                
  File "/home/user/.local/lib/python3.10/site-packages/pyarr/lidarr.py", line 116, in get_artist                                                                                             
    return self._get(                                                                                                                                                                        
  File "/home/user/.local/lib/python3.10/site-packages/pyarr/request_handler.py", line 91, in _get                                                                                           
    response = _process_response(res)                                                                                                                                                        
  File "/home/user/.local/lib/python3.10/site-packages/pyarr/request_handler.py", line 233, in _process_response                                                                             
    raise PyarrBadRequest(f"Bad Request, possibly a bug. {str(res.content)}")                                                                                                                
pyarr.exceptions.PyarrBadRequest: Bad Request, possibly a bug. b'<html>\r\n<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>\r\n<body>\r\n<center><h1>400 Bad Req
uest</h1></center>\r\n<center>The plain HTTP request was sent to HTTPS port</center>\r\n<hr><center>nginx/1.26.2</center>\r\n</body>\r\n</html>\r\n'

It seems a mismatch in LidarrAPI? I can see you append "https" correctly, but it seems the library still open an HTTP connection

blastbeng commented 2 months ago

Yeah, i am using it, and it shows? Sorry to be such a PIA.

I am trying the "generate/artist_top_tracks/all/" API endpoint, and it seems it cannot connect to Lidarr because of an HTTP / HTTPS.

This is my docker-compose:

      - LIDARR_ENABLED=1
      - LIDARR_IP=xxx.mydomain.com
      - LIDARR_PORT=443
      - LIDARR_USE_SSL=1
      - LIDARR_BASE_API_PATH=/lidarr
      - LIDARR_TOKEN=xxx

(the LIDARR_USE_SSL=1 i found looking in the source code)

But it seems it's not working:

2024-09-18 10:20:35 ERROR    <class 'pyarr.exceptions.PyarrBadRequest'> subsonic_helper.py 153                                                                                               
Traceback (most recent call last):                                                                                                                                                           
  File "/home/user/spotisub/./spotisub/helpers/subsonic_helper.py", line 153, in write_playlist                                                                                              
    is_monitored = lidarr_helper.is_artist_monitored(artist_name_spotify)                                                                                                                    
  File "/home/user/spotisub/./spotisub/helpers/lidarr_helper.py", line 29, in is_artist_monitored                                                                                            
    artists_list = lidarr_client.get_artist()                                                                                                                                                
  File "/home/user/.local/lib/python3.10/site-packages/pyarr/lidarr.py", line 116, in get_artist                                                                                             
    return self._get(                                                                                                                                                                        
  File "/home/user/.local/lib/python3.10/site-packages/pyarr/request_handler.py", line 91, in _get                                                                                           
    response = _process_response(res)                                                                                                                                                        
  File "/home/user/.local/lib/python3.10/site-packages/pyarr/request_handler.py", line 233, in _process_response                                                                             
    raise PyarrBadRequest(f"Bad Request, possibly a bug. {str(res.content)}")                                                                                                                
pyarr.exceptions.PyarrBadRequest: Bad Request, possibly a bug. b'<html>\r\n<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>\r\n<body>\r\n<center><h1>400 Bad Req
uest</h1></center>\r\n<center>The plain HTTP request was sent to HTTPS port</center>\r\n<hr><center>nginx/1.26.2</center>\r\n</body>\r\n</html>\r\n'

It seems a mismatch in LidarrAPI? I can see you append "https" correctly, but it seems the library still open an HTTP connection

I haven't tested lidarr using https I am using https://github.com/totaldebug/pyarr to connect to Lidarr, not sure if it supports HTTPS tho

Reading their docs I haven't found anything about https or ssl, guess i am gonna try to open an issue on their github

blastbeng commented 2 months ago

I have opened an issue on their github:

https://github.com/totaldebug/pyarr/issues/178

gardiol commented 2 months ago

when i have time i will expose lidarr on http internally, i hope they will shed some light.

gardiol commented 2 months ago

Update: i exposed the lidarr API directly on port 8686 on HTTP locally and it works, it seems it's really HTTPS not being supported by PyArr... hope they add support! Meanwhile, let's keep this open for future reference maybe?

blastbeng commented 2 months ago

Update: i exposed the lidarr API directly on port 8686 on HTTP locally and it works, it seems it's really HTTPS not being supported by PyArr... hope they add support! Meanwhile, let's keep this open for future reference maybe?

Let's just keep this issue open and wait an answer from the PyArr team, if they say that https isn't supported I'll just close this as "WON'T DO"