mmmmmtasty / SportScanner

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

working on linux? #32

Closed snickers2k closed 2 years ago

snickers2k commented 2 years ago

for me it's still not working after all the last fixes. can somebody confirm this is working for linux ? otherwise i could stop testing^^

omnath0 commented 2 years ago

After making the following tweaks in the file "SportScanner-0.2\SportScanner-0.2\SportScanner.bundle\Contents\Code__init__.py" , I was able to make this work, tested with F1. Please feel free to test with other sports.

1) Replace continue with break in line no 121/134 (right now it's going in continuous loop ever after a match is found) 2) Remove line no 306/307, the attribute strCircuit is no longer available.

snickers2k commented 2 years ago

thanks, i tried that. but still not working for me with nba and nfl

omnath0 commented 2 years ago

Are you following this nomenclature?

NFL.2021-12-26.Houston.Texans.vs.Los.Angeles.Chargers.ext

Also, post the logs (com.plexapp.agents.sportscanner.log) from the Plex server, you will find it here..

/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs/PMS Plugin Logs#

snickers2k commented 2 years ago

Sportsscanner-logs.zip

sorry had not no time lately.. here are the logs

thanks

zag2me commented 2 years ago

Your naming is wrong, logs show you are searching for "49ers vs Saints GERMAN" which means nothing to the scraper. It must be this format:

NFL.2016-11-06.San.Francisco.49ers.vs.New.Orleans.Saints.mkv

snickers2k commented 2 years ago

okay.. renamed to 100% thesportsdb title but still not working.. not even pulling the front-covers for the sport itself. thanks anyway

snickers2k commented 2 years ago

again, is this for anyone working on linux? what are those ps files ? are they needed? postscript can't work on linux ?

jbalcorn commented 2 years ago

I've got it working - it wasn't pulling images but I submitted a pull request that was accepted some months ago to fix the download of binary files.

I took a very quick look - the error on resourceHashes I've noticed. I think it's something that should be fixed but the agent can still work.

But this is an issue:

SS: Attempting to match Boxing
2022-01-21 11:15:25,591 (7ff324579b38) :  WARNING (data:179) - Error decoding with simplejson, using demjson instead (this will cause a performance hit) - Expecting value: line 1 column 1 (char 0)
2022-01-21 11:15:25,592 (7ff324579b38) :  INFO (__init__:113) - SS: Could not retrieve shows from thesportsdb.com
2022-01-21 11:15:25,592 (7ff324579b38) :  CRITICAL (agentkit:1018) - Exception in the search function of agent named 'SportScanner', called with keyword arguments {'openSubtitlesHash': '5e8853ddad99e3a1', 'episode': '1912164664', 'name': 'Viktor Kotochigov vs Javier Jose Clavero', 'episodic': '1', 'show': 'Boxing', 'released_at': '2019-12-16', 'season': '2019', 'plexHash': 'c72c535af34f5fbc24ba11602ee13141d45dfb9e', 'filename': '%2Fmnt%2Fmedia%2FSports%2FBoxing%2FSeason%202019%2FBoxing%2E2019%2E12%2E16%2EViktor%2EKotochigov%2Evs%2EJavier%2EJose%2EClavero%2E720p%2EWEB%2Emkv', 'year': '2019', 'duration': '-1', 'id': '786900'} (most recent call last):
  File "/usr/lib/plexmediaserver/Resources/Plug-ins-f11334058/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/api/agentkit.py", line 1011, in _search
    agent.search(*f_args, **f_kwargs)
  File "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins/SportScanner.bundle/Contents/Code/__init__.py", line 119, in search
    if potential_leagues is not None:
UnboundLocalError: local variable 'potential_leagues' referenced before assignment

I submitted an issue to fix the UnboundLocalError. You're getting it because you have a 'Boxing' directory, you can avoid the error by adding the potential_leagues = None line:

try:
            potential_leagues = (JSON.ObjectFromString(GetResultFromNetwork(url, True)))['leagues']
        except:
            potential_leagues = None
            Log("SS: Could not retrieve shows from thesportsdb.com")

None of your logs show it trying to update an NFL game. You'll need to do a 'Refresh Metadata' on one of them then show the agent log.

snickers2k commented 2 years ago

but "boxing" is a league, right? https://www.thesportsdb.com/league/4445-Boxing 1-2 years ago it even once pulled the image for "boxing".

i removed boxing and made a fresh library, but still the same

com.plexapp.agents.sportscanner.log

jbalcorn commented 2 years ago

Oh. You've been bitten by the fact that the API key has been deprecated.

I would suggest becoming a patreon supporter, getting your own API key, and using the latest code with the SportScanner.ini so you can use your own key.

See Issue #34 and #35

zag2me commented 2 years ago

No need to sign up personally, one key will work for the whole scraper. Hopefully you can get it PR'd.

snickers2k commented 2 years ago

okay... maybe that one should be in readme :D thanks anyway.

snickers2k commented 2 years ago

so i updated to the latest version (with "api key fix"). and it is finally pulling some data. at least one "episode" got data - and the poster for nfl. but nba is completely untouched, and the other episodes are not matched. even removed the "german" in title, but still no luck. date + teams should be enough right ?

2022-01-29 15:39:45,099 (7fd7fc146b38) :  INFO (__init__:341) - SS: Using 0.35 from match with NFL Panthers vs Packers 
2022-01-29 15:39:45,099 (7fd7fc146b38) :  INFO (__init__:341) - SS: Match ratio of 0.35 between Panthers vs Packers  and Tennessee Titans vs Kansas City Chiefs

strange ... it's unsure between "Panthers vs Packers" and "Tennessee Titans vs Kansas City Chiefs" for a file named "NFL.2019.11.10.Panthers.vs.Packers.-.1080p.HDTV.x264-REQiT" ? O_o com.plexapp.agents.sportscanner.log

and for the one matched correctly, episode name identifier is "1909063785" instead of "Episode 3" for example. Probably should be rewritten to the Date. Makes more sense?

jbalcorn commented 2 years ago

Match ratio of .35 isn't close to enough.

Take a look at https://www.thesportsdb.com/event/599929 - this is where the match is made. The potential filename (look at the very bottom of the page) is:

NFL.2019-11-10.Green.Bay.Packers.vs.Carolina.Panthers.ext

The NFL requires the city names to match. Any naming in Plex, you've got to get it closer than what you have.

Here's my current NBA Folder:

0 jalcorn@gossamer:/mnt/disk/share/sports/NBA$ ls
NBA.2016-06-19.Golden.State.Warriors.vs.Cleveland.Cavaliers_1.mp4
NBA.2016-06-19.Golden.State.Warriors.vs.Cleveland.Cavaliers_1.SportScanner
NBA.2016-06-19.Golden.State.Warriors.vs.Cleveland.Cavaliers.mpg
NBA.2022-01-05.Cleveland.Cavaliers.vs.Memphis.Grizzlies.mp4
NBA.2022-01-08.Portland.Trail.Blazers.vs.Cleveland.Cavaliers.mp4
NBA.2022-01-10.Golden.State.Warriors.vs.Cleveland.Cavaliers.mp4
NBA.2022-01-11.Sacramento.Kings.vs.Cleveland.Cavaliers.mp4
NBA.2022-01-13.Utah.Jazz.vs.Cleveland.Cavaliers.mp4
NBA.2022-01-15.San.Antonio.Spurs.vs.Cleveland.Cavaliers.mp4
NBA.2022-01-16.Oklahoma.City.Thunder.vs.Cleveland.Cavaliers.mp4
NBA.2022-01-17.Cleveland.Cavaliers.vs.Brooklyn.Nets.mp4
NBA.2022-01-20.Chicago.Bulls.vs.Cleveland.Cavaliers.mp4
NBA.2022-01-23.Cleveland.Cavaliers.vs.Oklahoma.City.Thunder.mp4
NBA.2022-01-25.Cleveland.Cavaliers.vs.New.York.Knicks.mp4
NBA.2022-01-27.Cleveland.Cavaliers.vs.Milwaukee.Bucks.mp4

These all are matched correctly by SportScanner, and the greatest moment in NBA history looks like this in my Plex: image

. The two SportScanner files are:

0 jalcorn@gossamer:/mnt/disk/share/sports/NBA$ cat SportScanner.txt
xxyy 7,1
0 jalcorn@gossamer:/mnt/disk/share/sports/NBA$ cat NBA.2016-06-19.Golden.State.Warriors.vs.Cleveland.Cavaliers_1.SportScanner
1
(End of the Game)

You may need to do the Plex Dance to get the files to scan and match properly after renaming them.

jbalcorn commented 2 years ago

Another example, this time using a Season folder, is my FIFA World Cup qualifying videos - most of them are highlights, so I use .SportScanner files to get them to have (Highlights) in the name.

0 jalcorn@gossamer:/mnt/disk/share/sports/FIFA World Cup/Season 2122$ ls
FIFA_World_Cup.2021-09-03.El_Salvador_vs_USA.mkv          FIFA_World_Cup.2021-10-11.Panama_vs_USA_1.mp4               FIFA_World_Cup.2021-11-13.USA_vs_Mexico_h.SportScanner
FIFA_World_Cup.2021-09-06.USA_vs_Canada.mp4               FIFA_World_Cup.2021-10-11.Panama_vs_USA_1.SportScanner      FIFA_World_Cup.2021-11-16.Jamaica_vs_USA.mp4
FIFA_World_Cup.2021-09-06.USA_vs_Canada.SportScanner      FIFA_World_Cup.2021-10-11.Panama_vs_USA_3.SportScanner      FIFA_World_Cup.2021-11-16.Jamaica_vs_USA.SportScanner
FIFA_World_Cup.2021-09-09.Honduras_vs_USA_1.mp4           FIFA_World_Cup.2021-10-13.USA_vs_Costa_Rica_1.SportScanner  FIFA_World_Cup.2022-01-28.USA_vs_El_Salvador_h.mp4
FIFA_World_Cup.2021-09-09.Honduras_vs_USA_1.SportScanner  FIFA_World_Cup.2021-10-13.USA_vs_Costa_Rica_2.mkv           FIFA_World_Cup.2022-01-28.USA_vs_El_Salvador_h.SportScanner
FIFA_World_Cup.2021-10-07.USA_vs_Jamaica_1.mkv            FIFA_World_Cup.2021-10-13.USA_vs_Costa_Rica_2.SportScanner  FIFA_World_Cup.2022-01-28.USA_vs_El_Salvador.mkv
FIFA_World_Cup.2021-10-07.USA_vs_Jamaica_1.SportScanner   FIFA_World_Cup.2021-11-13.USA_vs_Mexico_h.mp4               FIFA_World_Cup.2022-01-28.USA_vs_El_Salvador.mkv-original

image

snickers2k commented 2 years ago

yeah thanks. it's somehow working sometimes, sometimes not. even with the filesnames like i have. there is no way i would name every single game by hand. so i'll wait until maybe there is more intelligent matching.

to be honest, i still don't get why it's not working. First is the League, Second is the Date, with Year upfront (should be optional), and after this comes the actual name. which is absolutely fine - even showed correct in Plex.

shouldn't be too hard for an agent. it's not like the date is at the end, and the episode-name is in front and somewhere in the middle is the league :D

So makes no sense why there is no match anyway...

but thanks for everything

jbalcorn commented 2 years ago

You can use something like filebot that would automatically change "vs.Packers" to "vs.Green.Bay.Packers" and "([0-9]).Panthers" to "\1.Carolina.Panthers" (and so on...) and that would fix it.

I record with Mythtv and automatically move everything to plex. The script that does it uses a table in the database to do this. You'd need to roll your own but this example might help:

https://github.com/jbalcorn/mythtv-plex

-- Justin B. Alcorn The views expressed are not necessarily my own, much less anyone else's PGP Fingerprint CCEB F776 C3FD 1050 C8DB 532E B8B9 BED7 7764 406C

On Sat, Jan 29, 2022 at 12:17 PM snickers2k @.***> wrote:

yeah thanks. it's somehow working sometimes, sometimes not. even with the filesnames like i have. there is no way i would name every single game by hand. so i'll wait until maybe there is more intelligent matching.

thanks for everything

— Reply to this email directly, view it on GitHub https://github.com/mmmmmtasty/SportScanner/issues/32#issuecomment-1024950782, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXEEZCUPBPBXVEENVBIS4TUYQOLDANCNFSM5IOW4PAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

snickers2k commented 2 years ago

ahh... now i get it... sportsdb can not make a difference between "green bay packers" and "packers" ? okay.... that more seems like an issue on sportsdb site ... like they need an alias for teams, just like tmdb has for movies.

thanks for the script. i'll take a look at mythtv again, since i'm using tvheadend.

jbalcorn commented 2 years ago

It's just that both Plex and TheSportsDB have naming rules. You just need to follow the naming rules and magic happens. -- Justin B. Alcorn The views expressed are not necessarily my own, much less anyone else's PGP Fingerprint CCEB F776 C3FD 1050 C8DB 532E B8B9 BED7 7764 406C

On Sat, Jan 29, 2022 at 12:24 PM snickers2k @.***> wrote:

ahh... now i get it... sportsdb can not make a difference between "green bay packers" and "packers" ? okay.... that more seems like an issue on sportsdb site ... like they need an alias for teams.

— Reply to this email directly, view it on GitHub https://github.com/mmmmmtasty/SportScanner/issues/32#issuecomment-1024952072, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABXEEZD3KHNFZSZPGUCFNULUYQPETANCNFSM5IOW4PAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>

snickers2k commented 2 years ago

seems like fuzzy search is temporarily disabled and is maybe activated again https://www.thesportsdb.com/forum_topic.php?t=5446