mmmmmtasty / SportScanner

Scanner and Metadata Agent for Plex that uses sportdb
101 stars 31 forks source link

No matches for NHL #23

Closed Kallb123 closed 2 years ago

Kallb123 commented 6 years ago

I created a library and NHL folder, but Plex can't match it to thesportsdb league. I have the following in logs:

2018-03-26 17:11:19,958 (7f564a7fc700) :  INFO (__init__:94) - SS: Attempting to match NHL
2018-03-26 17:11:19,960 (7f564a7fc700) :  DEBUG (networking:166) - Requesting 'http://www.thesportsdb.com/api/v1/json/8123456712556/all_leagues.php'
2018-03-26 17:11:20,018 (7f564a7fc700) :  INFO (__init__:99) - SS: Could not retrieve shows from thesportsdb.com
2018-03-26 17:11:20,019 (7f564a7fc700) :  CRITICAL (agentkit:1014) - Exception in the search function of agent named 'SportScanner', called with keyword arguments {'show': 'NHL', 'id': '34792', 'year': '2017'} (most recent call last):
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-6de959918/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1007, in _search
    agent.search(*f_args, **f_kwargs)
  File "/home/kallum/Library/Application Support/Plex Media Server/Plug-ins/SportScanner.bundle/Contents/Code/__init__.py", line 104, in search
    if potential_leagues is not None:
UnboundLocalError: local variable 'potential_leagues' referenced before assignment

2018-03-26 17:11:20,022 (7f564a7fc700) :  DEBUG (runtime:88) - Sending packed state data (112 bytes)
2018-03-26 17:11:20,023 (7f564a7fc700) :  DEBUG (runtime:924) - Response: [200] str, 16 bytes

I tried to curl the url and that failed, so I noticed they now use https, which will curl properly. I changed the url in the code, but it didn't help unfortunately. Not sure why it can't retrieve shows from the site, it works via curl or browser.

Kallb123 commented 6 years ago

It's probably something to do with my setup with ubuntu 14.04 and python 2.7.6. It doesn't properly support ssl.

timhobbs commented 6 years ago

I am not the dev of this code, but I am a developer and I have just started trying to use this plugin, so I'll try to help you out.

The plugin is setup to call http. The URL works (http://www.thesportsdb.com/api/v1/json/8123456712556/all_leagues.php), so there must be some connection issue on your end. No need for https.

The log shows that it attempts to call that URL but fails ('Requesting...', 'SS: Could not retrieve shows...') and since there are no shows and the code doesn't throw an exception it tries to look at the 'potential_leagues' variable which doesn't exist since the initial lookup failed.

Just focus on the connection between your box and thesportsdb. Once you get that sorted it should work fine. Good luck 👍

Kallb123 commented 6 years ago

It's definitely a connection issue between me and thesportsdb. I'm on Ubuntu 14.04 and the version of python installed doesn't support modern SSL. I haven't managed to figure out a virtual environment or updated the packages, it's going to be a while before I can update ubuntu to 16.04 or something.

I wonder if it'd work if I could use python 3?

Kallb123 commented 6 years ago

I managed to install anaconda, so I have an up to date python install in a new directory. I can now connect and communicate with thesportsdb, so I just need to figure out how to get plex to use this new version of python.

Kallb123 commented 6 years ago

I solved this problem after being directed to another plex plugin. Copying what's done here: https://github.com/piplongrun/muvio.bundle/tree/master/Contents/Libraries/Shared

I put those libraries into the SportScanner folder (in the same structure) and them imported them into the init.py. I then switched the code to use the requests library and now I don't have issues with SSL certificates!

martin-juul commented 6 years ago

@Kallb123 could you share a repo with your diff?

Kallb123 commented 6 years ago

@martin-juul I forked and made a pull request including the libraries and changes to the init file:

https://github.com/mmmmmtasty/SportScanner/pull/24

Like I said, it wasn't my idea, just copied what has already been done elsewhere into this repo.

jbalcorn commented 2 years ago

This has been fixed, can @mmmmmtasty or @Kallb123 close it?