PM4K / PlexMod for Kodi (18, 19, 20, 21, 22+)

I just tried out 0.7.4-beta11 and it almost / mostly works on the odroid n2+.

Now when switching from movies view to collections view there is a bit of a delay (with no loading animation) but it does end up switching. I can switch back and forth a few times before the crash happens. Now instead of there being a few errors in a row there’s just 1 error seemingly a few lines later but maybe that was because of other additions / changes in the file.

Error is now on line 1741 instead of line 1729. But there is only 1 error now instead of 3 in a row from beta10.

2024-01-07 13:02:20.191 T:1463    error <general>: _________________________________________________________________________________
2024-01-07 13:02:20.191 T:1463    error <general>: script.plex: ERROR: 
2024-01-07 13:02:20.191 T:1463    error <general>:     Traceback (most recent call last):
2024-01-07 13:02:20.191 T:1463    error <general>:       File "/storage/.kodi/addons/script.plexmod/lib/backgroundthread.py", line 95, in _runTask
2024-01-07 13:02:20.191 T:1463    error <general>:         task._run()
2024-01-07 13:02:20.191 T:1463    error <general>:       File "/storage/.kodi/addons/script.plexmod/lib/backgroundthread.py", line 49, in _run
2024-01-07 13:02:20.191 T:1463    error <general>:         self.run()
2024-01-07 13:02:20.191 T:1463    error <general>:       File "/storage/.kodi/addons/script.plexmod/lib/windows/library.py", line 207, in run
2024-01-07 13:02:20.191 T:1463    error <general>:         self.callback(items, self.start)
2024-01-07 13:02:20.191 T:1463    error <general>:       File "/storage/.kodi/addons/script.plexmod/lib/windows/library.py", line 1654, in chunkCallback
2024-01-07 13:02:20.191 T:1463    error <general>:         self._chunkCallback(items, start)
2024-01-07 13:02:20.191 T:1463    error <general>:       File "/storage/.kodi/addons/script.plexmod/lib/windows/library.py", line 1741, in _chunkCallback
2024-01-07 13:02:20.191 T:1463    error <general>:         mli = self.showPanelControl[pos]
2024-01-07 13:02:20.191 T:1463    error <general>:               ~~~~~~~~~~~~~~~~~~~~~^^^^^
2024-01-07 13:02:20.191 T:1463    error <general>:     TypeError: 'NoneType' object is not subscriptable
2024-01-07 13:02:20.191 T:1463    error <general>: _________________________________________________________________________________
2024-01-07 13:02:20.191 T:1463    error <general>: `

Edit: Found another error / bug in the movie library view, when collections are displayed with movies in the list, after entering a collection and returning back to the list view watched statuses are not set and the following errors show in the log:

2024-01-07 13:16:53.329 T:3131    error <general>: _________________________________________________________________________________
2024-01-07 13:16:53.329 T:3131    error <general>: script.plex: ERROR: 
2024-01-07 13:16:53.329 T:3131    error <general>:     Traceback (most recent call last):
2024-01-07 13:16:53.329 T:3131    error <general>:       File "/storage/.kodi/addons/script.plexmod/lib/backgroundthread.py", line 95, in _runTask
2024-01-07 13:16:53.329 T:3131    error <general>:         task._run()
2024-01-07 13:16:53.329 T:3131    error <general>:       File "/storage/.kodi/addons/script.plexmod/lib/backgroundthread.py", line 49, in _run
2024-01-07 13:16:53.329 T:3131    error <general>:         self.run()
2024-01-07 13:16:53.329 T:3131    error <general>:       File "/storage/.kodi/addons/script.plexmod/lib/windows/library.py", line 207, in run
2024-01-07 13:16:53.329 T:3131    error <general>:         self.callback(items, self.start)
2024-01-07 13:16:53.329 T:3131    error <general>:       File "/storage/.kodi/addons/script.plexmod/lib/windows/library.py", line 1654, in chunkCallback
2024-01-07 13:16:53.329 T:3131    error <general>:         self._chunkCallback(items, start)
2024-01-07 13:16:53.329 T:3131    error <general>:       File "/storage/.kodi/addons/script.plexmod/lib/windows/library.py", line 1673, in _chunkCallback
2024-01-07 13:16:53.329 T:3131    error <general>:         if (self.section.TYPE in ('movie', 'show') and items[0].TYPE != 'collection') or (self.section.TYPE == 'collection' and items[0].TYPE in ('movie', 'show', 'episode')): # NOTE: A collection with Seasons doesn't have the leafCount/viewedLeafCount until you actually go into the season so we can't update the unwatched count here
2024-01-07 13:16:53.329 T:3131    error <general>:                                                        ~~~~~^^^
2024-01-07 13:16:53.329 T:3131    error <general>:     IndexError: list index out of range
2024-01-07 13:16:53.329 T:3131    error <general>: _________________________________________________________________________________
2024-01-07 13:16:53.329 T:3131    error <general>: `
2024-01-07 13:16:53.329 T:3131     info <general>: script.plex: BGThreader (queue.0:worker.2): Idle
2024-01-07 13:16:53.332 T:3129    error <general>: _________________________________________________________________________________
2024-01-07 13:16:53.332 T:3129    error <general>: script.plex: ERROR: 
2024-01-07 13:16:53.332 T:3129    error <general>:     Traceback (most recent call last):
2024-01-07 13:16:53.332 T:3129    error <general>:       File "/storage/.kodi/addons/script.plexmod/lib/backgroundthread.py", line 95, in _runTask
2024-01-07 13:16:53.332 T:3129    error <general>:         task._run()
2024-01-07 13:16:53.332 T:3129    error <general>:       File "/storage/.kodi/addons/script.plexmod/lib/backgroundthread.py", line 49, in _run
2024-01-07 13:16:53.332 T:3129    error <general>:         self.run()
2024-01-07 13:16:53.332 T:3129    error <general>:       File "/storage/.kodi/addons/script.plexmod/lib/windows/library.py", line 207, in run
2024-01-07 13:16:53.332 T:3129    error <general>:         self.callback(items, self.start)
2024-01-07 13:16:53.332 T:3129    error <general>:       File "/storage/.kodi/addons/script.plexmod/lib/windows/library.py", line 1654, in chunkCallback
2024-01-07 13:16:53.332 T:3129    error <general>:         self._chunkCallback(items, start)
2024-01-07 13:16:53.332 T:3129    error <general>:       File "/storage/.kodi/addons/script.plexmod/lib/windows/library.py", line 1673, in _chunkCallback
2024-01-07 13:16:53.332 T:3129    error <general>:         if (self.section.TYPE in ('movie', 'show') and items[0].TYPE != 'collection') or (self.section.TYPE == 'collection' and items[0].TYPE in ('movie', 'show', 'episode')): # NOTE: A collection with Seasons doesn't have the leafCount/viewedLeafCount until you actually go into the season so we can't update the unwatched count here
2024-01-07 13:16:53.332 T:3129    error <general>:                                                        ~~~~~^^^
2024-01-07 13:16:53.332 T:3129    error <general>:     IndexError: list index out of range
2024-01-07 13:16:53.332 T:3129    error <general>: _________________________________________________________________________________

Edit 2: This new error seems kinda strange. It’s not just when entering a collection and returning to the list view.

On entering a library which displays Movies and Collections in the same list everything is displayed fine until reaching items starting with C.

Then from items starting with C to items starting with K no posters are displayed for movies but posters are displayed for collections and no watched statuses are displayed. Then from K to the end of the library everything is displayed fine.

Edit 3: Possibly related errors when scrolling through a library.

2024-01-07 13:48:43.360 T:7724    error <general>: CCurlFile::Stat - <https://192-168-99-205.7267e5b37cd04f37ba9ee5cdcbab1a65.plex.direct:32400/photo/:/transcode?url=http%3A%2F%2F127.0.0.1%3A32400%2Flibrary%2Fmetadata%2F160493%2Fart%2F1704337821&width=630&height=355&minSize=1&X-Plex-Token=****> Failed: HTTP response code said error(22)
2024-01-07 13:48:43.444 T:7724    error <general>: CCurlFile::Stat - <https://192-168-99-205.7267e5b37cd04f37ba9ee5cdcbab1a65.plex.direct:32400/photo/:/transcode?url=http%3A%2F%2F127.0.0.1%3A32400%2Flibrary%2Fmetadata%2F160493%2Fart%2F1704337821&width=1920&height=1080&minSize=1&blur=0&opacity=20&background=111111&X-Plex-Token=****> Failed: HTTP response code said error(22)
2024-01-07 13:48:44.317 T:7735     info <general>: Skipped 1 duplicate messages..
2024-01-07 13:48:44.317 T:7735    error <general>: CCurlFile::Stat - <https://192-168-99-205.7267e5b37cd04f37ba9ee5cdcbab1a65.plex.direct:32400/photo/:/transcode?url=http%3A%2F%2F127.0.0.1%3A32400%2Flibrary%2Fmetadata%2F160493%2Fart%2F1704337821&width=630&height=355&minSize=1&X-Plex-Token=****> Failed: HTTP response code said error(22)
2024-01-07 13:48:44.321 T:7745    error <general>: CCurlFile::Stat - <https://192-168-99-205.7267e5b37cd04f37ba9ee5cdcbab1a65.plex.direct:32400/photo/:/transcode?url=http%3A%2F%2F127.0.0.1%3A32400%2Flibrary%2Fmetadata%2F160493%2Fart%2F1704337821&width=1920&height=1080&minSize=1&blur=0&opacity=20&background=111111&X-Plex-Token=****> Failed: HTTP response code said error(22)
2024-01-07 13:48:49.240 T:7735     info <general>: Skipped 1 duplicate messages..
2024-01-07 13:48:49.240 T:7735    error <general>: CCurlFile::Stat - <https://192-168-99-205.7267e5b37cd04f37ba9ee5cdcbab1a65.plex.direct:32400/photo/:/transcode?url=http%3A%2F%2F127.0.0.1%3A32400%2Flibrary%2Fmetadata%2F160493%2Fart%2F1704337821&width=630&height=355&minSize=1&X-Plex-Token=****> Failed: HTTP response code said error(22)
2024-01-07 13:48:49.274 T:7735    error <general>: CCurlFile::Stat - <https://192-168-99-205.7267e5b37cd04f37ba9ee5cdcbab1a65.plex.direct:32400/photo/:/transcode?url=http%3A%2F%2F127.0.0.1%3A32400%2Flibrary%2Fmetadata%2F160493%2Fart%2F1704337821&width=1920&height=1080&minSize=1&blur=0&opacity=20&background=111111&X-Plex-Token=****> Failed: HTTP response code said error(22)
1 Like

Good first solution, thank you for looking into this.

When looking at the potential/existing issues, I’m starting to think we should get rid of the programmatic resizing of those buttons and just duplicate them in the XML, and rely on media.multiple on whether to display the small ones or the big ones.

What do you think?

Yeah, I mentioned that in my post about the resizing and I didn’t like that. Maybe @panni suggestion to just hardcode the button sizes in the xml might be the better option. I’ll look into that more today. I do not have the issue where the first load still has the problem with the button sizes though.

Yeah, I’ll play around with that today. I think that sounds like a better idea.

I think it can be replicated, you can place one dummy file for any tv show season for first episode i.e. s01e01 and let plex server scan it. Then it will show in PM4K just like this.

Yes, hardcoding it in episodes.xml would be good, as movies section is working good, without any issue.

1 Like

Hello,

I just installed this mod on a Raspberry Pi 3b+ with a fresh LibreELEC and i’m having issues with the home screen. Everything is flickering all the time, and elements gets repeated. I don’t know whats going on … tried formating the system and still the same issues. Happens on OSMC too.

If i try to reproduce something it gets played just fine, so its something only with the home screen.

If i restart Plex, sometimes it loads and works fine.

EDIT: nvm, apparently i found the solution, under the addon settings in Kodi there is an option inside “User Interface” called “Use legacy background fallback image”. Enabling it fixed the issue…

1 Like

I uploaded a change to the pull request with the hardcoded xml file changes. If you get a chance can you test it out and see if you like it better.

I checked your commit, the buttons are resizing normally, in multiple file versions.
Thanks

Just, one thing I want to know is this normal, as my screen was not shifting while opening the episodes previously, it is auto selecting episode 6.
ezgif-5-79dae666f5
I pressed only enter button (Not Down Button).

1 Like

I can confirm this.
I tested it on a Windows PC and the add-on and it looks exactly like yours.

No, it doesn’t do that for me.

Just installed on nexus 20.2 on android (firetv) and the addon seems to not launch if there is any cache entry in the advancedsettings.xml

Error Log
error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'AttributeError'>
                                                   Error Contents: 'NoneType' object has no attribute 'group'
                                                   Traceback (most recent call last):
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plexmod/default.py", line 2, in <module>
                                                       from lib import main
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plexmod/lib/main.py", line 13, in <module>
                                                       from . import plex
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plexmod/lib/plex.py", line 16, in <module>
                                                       from .playback_utils import PlaybackManager
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plexmod/lib/playback_utils.py", line 9, in <module>
                                                       from lib import util
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plexmod/lib/util.py", line 453, in <module>
                                                       kcm = KodiCacheManager()
                                                             ^^^^^^^^^^^^^^^^^^
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plexmod/lib/util.py", line 340, in __init__
                                                       self.load()
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plexmod/lib/util.py", line 381, in load
                                                       self.readFactor = int(ADV_RFACT_RE.search(cachexml).group(1))
                                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                   AttributeError: 'NoneType' object has no attribute 'group'
                                                   -->End of Python script error report<--

@panni Adding some extra info about my issue where posters and watched status are not displayed for movies they only seem to be missing in the list view of a movie library, the 2 poster wall views seem to display these things properly when collections and movies are displayed at the same time.

It is not happening with other TV Shows, just with this season where all the episodes are mark played and it automatically selects the last episode and screen shifts down.

Edit: I tried marking and un-marking the complete season, it still doesn’t change for this particular season.

Anyways, thank you, you have done a wonderful job.
One more request, can’t we have the initial default size of buttons loaded in the first screen ( but it need to be pre calculated programmatically), i got it.

This will work. Thank you

Wonder if it’s something new in the beta since I’m on the previous version with just the changes for the fix I’ve been working on.

Tried with the latest beta code and still not seeing the issue. Maybe @panni will have better luck reproducing.

No issues with 0.7.4-beta10 besides the TV show cast lists still getting cropped. Although it isn’t happening with every show now, only with a few of them :thinking:

Maybe you mentioned this before but is this only when you’re viewing the cast on the “Seasons” page? Or does it happen on the “Episodes” page as well?

I found one issue in the “Seasons” screen. I’m not sure if it will help with your issue or not.

1 Like

It happens on the “Seasons” pages. “Episodes” pages are fine.

ok, then I think my changes will hopefully solve your issue. If you want you can try my changes out, otherwise just wait until @panni pulls it into a build.

1 Like