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

Leave them, basically. How to Remove a Server from Plex - Plexopedia

Not yet. Finishing 0.8.0 first, and the last remaining big step is Watchlist.

7 Likes

:partying_face:

4 Likes

Should the add-on updated itself? I thought that was part of the later beta. I thought you could just have it. Automatically update itself from the beta repository?

I have two installs of this add-on installed on two different OSMC boxes. It works great, but it doesn’t seem to update itself and I have to manually update the new zip file when a new version comes out. Is that normal?

Also, I’ve got a list of older repositories when I look at the add on updates within the install. None of them are listed as the new plug-in that I keep adding manually. Shouldn’t I remove these somehow?

EDIT: I noticed when I start the add-on it does prompt me to exit and update. It would be nice to remove the other repos though since none of the old DontPanic repos are in use anymore for me.

2 Likes

Oh wow, this is really noticeable on a SHIELD with “prefer local over secure connection” (e.g. HTTP) and a Plex server on the local network.

Edit: I’m surprised again, that there are these things to find in this codebase. I was under the impression, that I’ve found all obvious performance enhancing fixes. Turns out I was very wrong.

Seems like you’ve figured out how to switch to the beta branch.

You can leave the repository intact or delete the one you have installed (the multiple versions you see are the ones available, not what you’ve got installed). Doesn’t make much of a difference in the end.

5 Likes

Kodi’s log:

2025-01-15 03:00:38.536 T:25150   debug <general>: HandleKey: backspace (0xf008) pressed, window 13001, action is Back
2025-01-15 03:00:38.570 T:25535   debug <CSettingsManager>: requested setting (exit_default_is_quit) was not found.
2025-01-15 03:00:38.586 T:25150   debug <general>: ------ Window Init (/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plexmod/resources/skins/Main/1080i/script-plex-options_dialog.xml) ------
2025-01-15 03:00:38.586 T:25150    info <general>: Loading skin file: /storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plexmod/resources/skins/Main/1080i/script-plex-options_dialog.xml, load type: LOAD_ON_GUI_INIT
2025-01-15 03:00:38.663 T:25149   debug <general>: CAndroidKey: key up (dev: 9; src: 769; code: 4 (AKEYCODE_BACK); repeat: 0; flags: 0x8; alt: no; shift: no; sym: no)
2025-01-15 03:00:38.686 T:25150   debug <general>: Keyboard: scancode: 0x4, sym: 0x08 (backspace), unicode: 0x00, modifier: 0x0
2025-01-15 03:00:39.740 T:25149   debug <general>: CAndroidKey: key down (dev: 9; src: 769; code: 23 (AKEYCODE_DPAD_CENTER); repeat: 0; flags: 0x8; alt: no; shift: no; sym: no)
2025-01-15 03:00:39.756 T:25150   debug <general>: Keyboard: scancode: 0x17, sym: 0x0d (enter), unicode: 0x00, modifier: 0x0
2025-01-15 03:00:39.840 T:25149   debug <general>: CAndroidKey: key up (dev: 9; src: 769; code: 23 (AKEYCODE_DPAD_CENTER); repeat: 0; flags: 0x8; alt: no; shift: no; sym: no)
2025-01-15 03:00:39.847 T:25204   debug <CSettingsManager>: requested setting (auto_update_check) was not found.
2025-01-15 03:00:39.856 T:25150   debug <general>: Keyboard: scancode: 0x17, sym: 0x0d (enter), unicode: 0x00, modifier: 0x0
2025-01-15 03:00:39.856 T:25150   debug <general>: HandleKey: return (0xf00d) pressed, window 13020, action is Select
2025-01-15 03:00:39.871 T:25150   debug <general>: ------ Window Deinit (/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plexmod/resources/skins/Main/1080i/script-plex-options_dialog.xml) ------
2025-01-15 03:00:40.087 T:25150   debug <general>: CGUIWindowManager::PreviousWindow: Deactivate
2025-01-15 03:00:40.088 T:25150   debug <general>: ------ Window Deinit (/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plexmod/resources/skins/Main/1080i/script-plex-home.xml) ------
2025-01-15 03:00:40.089 T:25150   debug <general>: CGUIWindowManager::PreviousWindow: Activate new
2025-01-15 03:00:40.090 T:25150   debug <general>: ------ Window Init (/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.plexmod/resources/skins/Main/1080i/script-plex-background.xml) ------
2025-01-15 03:00:40.094 T:25150   debug <general>: Error [-541478725] while reading frame: Unknown error 541478725
2025-01-15 03:00:41.848 T:25204   debug <CSettingsManager>: requested setting (auto_update_check) was not found.
2025-01-15 03:00:45.284 T:25198   debug <CAddonSettings[0@plugin.video.jellycon]>: trying to load setting definitions from old format...
2025-01-15 03:00:51.850 T:25204    info <CSettingsManager>: Skipped 1 duplicate messages..
2025-01-15 03:00:51.850 T:25204   debug <CSettingsManager>: requested setting (auto_update_check) was not found.
2025-01-15 03:00:56.089 T:25150   debug <general>: CheckIdle - Closing session to https://plex.xxxxx (easy=0x256f2a1800, multi=0x2573e07a80)
2025-01-15 03:00:56.096 T:25150   debug <general>: CheckIdle - Closing session to https://plex.xxxxx (easy=0x254d95e000, multi=0x2566fc2b00)
2025-01-15 03:00:56.102 T:25150   debug <general>: CheckIdle - Closing session to https://plex.xxxxx (easy=0x25660c4800, multi=0x256701b180)
2025-01-15 03:00:56.114 T:25150   debug <general>: CheckIdle - Closing session to https://plex.xxxxx (easy=0x2555f20800, multi=0x255dd0a180)
2025-01-15 03:00:56.656 T:25309   debug <general>: PLEX.plexgdm: Checking whether we are still listed as GDM Plex Companionclient on our PMS
2025-01-15 03:00:57.590 T:25309   error <general>: PLEX.plexgdm: Could not download GDM Plex Companion clients
2025-01-15 03:01:01.855 T:25204   debug <CSettingsManager>: requested setting (auto_update_check) was not found.
2025-01-15 03:01:04.723 T:30951   debug <general>: Thread JobWorker 159710360816 terminating (autodelete)
2025-01-15 03:01:04.723 T:30971   debug <general>: Thread JobWorker 159716979952 terminating (autodelete)
2025-01-15 03:01:04.723 T:30941   debug <general>: Thread JobWorker 159706199280 terminating (autodelete)
2025-01-15 03:01:04.736 T:30969   debug <general>: Thread JobWorker 159705158896 terminating (autodelete)
2025-01-15 03:01:05.533 T:25198   debug <CAddonSettings[0@plugin.video.jellycon]>: trying to load setting definitions from old format...
2025-01-15 03:01:11.857 T:25204    info <CSettingsManager>: Skipped 1 duplicate messages..
2025-01-15 03:01:11.856 T:25204   debug <CSettingsManager>: requested setting (auto_update_check) was not found.
2025-01-15 03:01:21.860 T:25204   debug <CSettingsManager>: requested setting (auto_update_check) was not found.
2025-01-15 03:01:25.708 T:25198   debug <CAddonSettings[0@plugin.video.jellycon]>: trying to load setting definitions from old format...
2025-01-15 03:01:31.862 T:25204    info <CSettingsManager>: Skipped 1 duplicate messages..
2025-01-15 03:01:31.862 T:25204   debug <CSettingsManager>: requested setting (auto_update_check) was not found.
2025-01-15 03:01:41.863 T:25204   debug <CSettingsManager>: requested setting (auto_update_check) was not found.
2025-01-15 03:01:45.995 T:25198   debug <CAddonSettings[0@plugin.video.jellycon]>: trying to load setting definitions from old format...
2025-01-15 03:01:51.867 T:25204    info <CSettingsManager>: Skipped 1 duplicate messages..
2025-01-15 03:01:51.866 T:25204   debug <CSettingsManager>: requested setting (auto_update_check) was not found.
2025-01-15 03:01:56.633 T:25149   debug <general>: virtual void CXBMCApp::onPause(): 
2025-01-15 03:01:56.633 T:25149   debug <general>: void CXBMCApp::KeepScreenOn(bool): false
2025-01-15 03:01:56.702 T:25149   debug <general>: virtual void CXBMCApp::onLostFocus(): 
2025-01-15 03:01:57.217 T:25127   debug <general>: virtual void CXBMCApp::surfaceDestroyed(CJNISurfaceHolder): 
2025-01-15 03:01:57.217 T:25127   debug <general>: XBMC_DestroyDisplay()
2025-01-15 03:01:57.222 T:25150    info <general>: CWinSystemAndroid::DestroyWindow
2025-01-15 03:01:58.444 T:25149   debug <general>: virtual void CXBMCApp::onStop(): 
2025-01-15 03:01:58.444 T:25149   debug <general>: virtual void CXBMCApp::onSaveState(void **, size_t *): 
2025-01-15 03:02:01.868 T:25204   debug <CSettingsManager>: requested setting (auto_update_check) was not found.
2025-01-15 03:02:06.380 T:25198   debug <CAddonSettings[0@plugin.video.jellycon]>: trying to load setting definitions from old format...

Please send the full log via DM.

It took a while.

I’ve thought about caching in PM4K for a long time. It was never really an option, as Plex discourages caching in clients (and we’re making PM4K pretty much “incompatible” with the Plex environment), because you lose certain creature-comforts and data guarantees. There is a case to build, though, especially for remote or slow connections, or slow Plex servers, and for slower Plex clients.

0.8.0-beta8 introduces request/response caching. This means: Plex Server data caching on our end (e.g.: the client-side).

It’s disabled by default for a good reason: To not confuse new users.

For experienced users, and those, who understand the implications, this is potentially great, it’s even noticable for local/LAN Plex servers. There are two new settings available:


“Cache Plex data for” and “Persist cached Plex data”. Both are off by default for now.

Enabling “Media Items” in “Cache Plex data for” caches the Plex server response data for a particular item data request; enabling “Libraries” does the same for Library views. This means that whenever data would be requested from the PMS, and we have data cached, we won’t make that server request, but would use the stored data.

This obviously has certain implications:

  • Item/Library data isn’t guaranteed to be current. There are multiple remedies to this, though:
    • PM4K automatically deletes the cached data after a video event (watching something, no matter for how long or which state it ends up in) clears the cached data for an item, including its Library view (as you might’ve watched something and would expect the checkmark in that particular library for that item). It also clears caches for episode’s seasons and shows when an episode has a watching event
    • This is never true for Home/Hubs - we don’t cache those.
    • Added options to context menus in Home, Episodes/Movies/Seasons/Shows, to manually clear the cache
    • Cached data has a lifetime of 7 days by default (configurable via addonSettings)
  • Vastly improved rendering time for the UI, if enabled (as we don’t do HTTP requests anymore for cached items), especially for non-local/slow Plex servers, slow connections, slower clients
  • More disk usage, because we write to an SQLite DB (auto managed, though, and probably negligible; DB is stored in special://temp/pm4k_requests_cache.sqlite (see the Kodi documentation of your client to find this path)
  • All cached data is cleared once you exit PM4K (unless you enable “Persist cached Plex data”), or it’s out of date

This is the first implementation. There are a lot of opportunities to optimize this, though:

  • Watching something shouldn’t clear the full cache of a related library view; it should supersede what the library view shows
  • Watching an episode shouldn’t clear the full cache of its Season and Show, but should inform it about its state
  • Simply keeping tabs on the data returned from Home/Hubs could be used to invalidate specific cache keys (e.g. Never-“seen” item exists in a home hub → invalidate cache for the corresponding areas)

Those need more time, though.

The “Persist cached Plex data” option is somewhat special. It persists the cache even if you quit PM4K. It has even more data implications, as you can imagine. It’s the most impactful, though.

Any cached request/response data expires in 7 days by default btw. You can change this, or even set this to 0, to disable expiry, via addonSettings.

0.8.0-beta8: script.plexmod.zip (3.1 MB)

  • Episodes/Movies: Fix actor dropdown positioning again
  • Movies: Correctly show reviews after watching a movie, if requested
  • Core: Enable explicit requests response caching for the runtime of the addon, for /library/metadata and /library/sections/X data
  • Core/PlexObjects: Don’t store original element data to reduce memory usage (wasn’t used anyways)
  • Home: Add reset cache entry to context menu of HOME library button (if enabled)
  • Home/Sections: Add reset library cache entry to context menu of section buttons (if enabled)
  • Home: Better hub refresh busy handling (show busy animation when a hub refresh takes more than one second)
  • Home: Better section switch busy handling (show busy animation when a section switch takes more than 0.5 seconds)
  • Home: Don’t error on non-existant hub focus
  • Episodes/Movies/Shows: Add reset item cache to all cachable items (if enabled)
  • Player: Clear specific media item cache when playback stopped; clear associated data as well (season, show, library)
  • SeekDialog/Player: Allow pressing down on any control to visit chapters (was: only play/pause)
  • Core: Stabilize minimize/maximize
  • Core: Add shipped dependency “requests-cache”
  • Core: Move addonSettings to separate file
  • Core: Separate properties into properties and properties_core
  • Update LICENSE

Edit: Thanks to @faxity for the final tests on CE

11 Likes

Stupid question - how do we switch from production to beta source? I can’t find that settings section in your screenshot


You install one of the latest beta zips manually, then switch to the Beta branch via PM4K settings.

The auto updater has been added in 0.8.0-beta, so you need 0.8.0 for updates. You won’t see those unless you do.

Edit: corrections

1 Like

Ah ha! Thank you!

You can keep everything else as-is (repositories etc). I’d recommend a Kodi restart after manually installing/upgrading PM4K.

Works like a treat, thanks again for all the awesome work!

1 Like

Just to make sure I’m not missing a setting somewhere - is it still true we can’t have a true 4k GUI? Looking at everything compared to the native Plex on the aTV is just
depressing. The posters, the background art
day and night. Content of course is flawless.

1 Like

Wow, beta8 was something to wake up to.

After a bit of head scratching I get it about caching, I like it and I’m impressed by the implementation. This speeds up loading times for PM4K on my Lan but it’ll be great when I go away armed with my fire stick.

I’ve had a play and all seems good.

I’ve continued with beta 8 and think I’ve found something. With cache set as Persist I got the 3 dots on exit. I rebooted and repeated 3 times. Turned off Persist and exit works.

Oh, got a log via DM for me?

You can, if your box can handle it, memory-wise. Advanced ‐ Artwork Quality · pannal/plex-for-kodi Wiki · GitHub

1 Like

I already had it in the beta repository. What I hadn’t done was actually start the add-on. It doesn’t check until you do that. I was expecting it would just happen in the background.

Is there an easy way to remove old repositories? Not being a Kodi guru I couldn’t find one that was straightforward. There are about a dozen old ones there and I was hoping I could simply SSH in and delete files or edit a sources list or something like that.

AFAIK Kodi doesn’t keep old repositories, as I said. I think you’re just seeing the older ones that are available to install.

0.8.0-beta8c: script.plexmod.zip (3.1 MB)

  • Core/Cache: Separate responses and URL map

Thanks @sonofdibnah for posting the crash log. If you had beta8 installed before, a cache cleanup is advised (long press on Home section):

Edit: Reuploaded as beta8c

2 Likes

Does it makes sense to adjust artwork quality also if I run PM4K on a 4K TV, but with screen resolution 1920x1080 @ 120.00 Hz? In other words, is it advise to adapt only, if I run Kodi/CoreElec in 4K?