Kodi Community Forum

Full Version: Kodi Playback Resumer (Matrix+ , v2.0.1+)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
(2022-08-21, 12:25)devkid Wrote: [ -> ]For what it's worth I am having a addon here that I am using to resume audio books after a hard shutdown:
https://github.com/verybadsoldier/kodi-s...ableresume
Tried installing your script in Linux and Android Kodi installs. Fails in both due to invalid structure. This stuff is a bit new to me so I can't get any further.
At some point I might find the time to add this, but I'll be honest, I really only personally care about the anti-crash aspects of the addon.

...But would more than happily accept a PR.  As context - I didn't write this as such, just updated it to keep it going, and am absolutely not in love with how it works.  If someone wants to pull out the resumption code from that addon, and add it to this, that would be ok (although I don't think official Kodi addons are allowed to write to the DB like that, so would need to store the data in a file, most likely...so it's a bit more complicated) - I'd be willing to help guide a PR and help then get it into the main Kodi repo.
(2022-08-22, 09:10)bossanova808 Wrote: [ -> ]...But would more than happily accept a PR.  As context - I didn't write this as such, just updated it to keep it going, and am absolutely not in love with how it works.  If someone wants to pull out the resumption code from that addon, and add it to this, that would be ok (although I don't think official Kodi addons are allowed to write to the DB like that, so would need to store the data in a file, most likely...so it's a bit more complicated) - I'd be willing to help guide a PR and help then get it into the main Kodi repo.

Official Kodi addons can write to the Kodi databases but only via JSON RPC calls and not directly.  There are limits to what you can write to the databases via JSON RPC but it has gotten a lot better.  I have a large addon I maintain which writes directly to the Kodi DB for speed , control and simplicity but I am not sure that is required for this type of functionality.  It could be likely handled by writing to the addon settings and then recalling them on the addon startup. 

I am kind of watching this thread a bit to see if this is a capability I might want to add to my autostop addon.  I already have the resume point save feature in my Mezzmo addon, which saves the resume point every 30 seconds to Mezzmo and the Kodi DB, which is part of the functionality.


Jeff
(2022-08-22, 20:02)jbinkley60 Wrote: [ -> ]I am kind of watching this thread a bit to see if this is a capability I might want to add to my autostop addon.  I already have the resume point save feature in my Mezzmo addon, which saves the resume point every 30 seconds to Mezzmo and the Kodi DB, which is part of the functionality.

That does sound like it would be a good direction to go Thanks for the info.

My use case is pretty simple. I have maybe 550 songs in a folder(also a playlist) that I share between all my devices but when at home I use kodi exclusively. I would like it to remember which song I played last when I restart the playlist, which would need to remember the shuffled playlist from the previous use and start the correct media and time offset. 

Kodi is wonderful for videos, but somewhat limited for audio. I have a total of about 60,000 songs in my library and it's such a dog trying to do a lot of stuff. Looking for an alternative for my current use case, I tried a bunch of apps and finally settled on VLC. It remembers all it needs to, restarts at the same place every time, allows network/local media access, works on all devices, etc. I will be happy to revert the music playing to kodi if/when this is resolved.

Thanks all for the input, both current and future.
I'm using kodi-20230228-340e3edd-master-arm64-v8a.apk on Nvidia Shield 2019.

And this does not seem to update with new resume times in my file.
I have a movie I've been watching, it saved the first time but even after watching for 30 mins or so, it does not add any new time to the file so it starts over at the first saved time and I have to skip forwards manually.


Request: It should auto update the resume time everytime a movie is paused. I notice that I often pause a movie to do something and then after some time the screen saver kicks in and ultimately the TV shuts down after 20 min. And no resume time has been saved.
@Ejziponken 

Read the bottom of my signature please Smile  Full _debug_ log needed (play a library video for a couple of minuted and post it somewhere and get me the link).   Do note it has to be a video in the Kodi library - if you're just playing files you haven't scanned in, it ignores those.

RE: resuming on pause - I suppose I could add this but most people using this will have it saving resume points in short intervals already (default 20s) - so that is usually going to be good enough in terms of crash recovery, which is ultimately what this is about really.
Hello. I want to save a movie "resume point" in my hard disk in the router to resume from other device in the same network. ¿How?
Regards from Uruguay
@hlena that is a question more about Kodi and shared libraries.  If you're using a shared library, then the resume point (set by this addon or any normal Kodi mechanism) - will work across devices.

See: https://kodi.wiki/view/Syncing_and_sharing
Regarding the lack of resume updates posted by Ejziponken in #35, I have found the issue.

On line 182 of the resources\lib\player.py file, the "total" value is commented out and the bookmark update query generated by Kodi defaults to 0.0000. If that value is 0 in the database, Kodi does not offer a Resume from option on pressing OK or Play even if the resume seconds has a value.

Changing line 182 from

            "params": {
                id_name: Store.library_id,
                "resume": {
                    "position": seconds,
                    # "total": 0 # Not needed: https://forum.kodi.tv/showthread.php?tid...pid1596436
                }
            }

to
            "params": {
                id_name: Store.library_id,
                "resume": {
                    "position": seconds,
                    "total": Store.length_of_currently_playing_file
                }
            }

resolves the problem. It appears that Kodi has changed the Resume detection since the thread discussion in 2014.

Edit to add: This is on 20.1 on both Windows 10 and LibreElec with a shared MySQL database.
I really must be missing something - what 'lack of resume updates'?  The add-on is working fine across multiple CoreElec and Windows installations, for me at least.  (I'm also using a MySQL DB).

If there is an issue, then please actually post a debug log of it happening.   In a debug log, you will usually see the add-on both setting resume points and then also querying the DB for them to make sure they are being set (and if you don't, even better, because then I'd have some vague starting point to work from!).

More than happy to fix things, if someone can actually demonstrate an issue and provide logs.
Here goes. Ran a few tests with normal playback/stop/resume, simulated crash with the original code and simulated crash with the modified code.

First, a video demonstrating the issue.



Screenshots of the database records as generated by each of the tests.

http://southerngold.co.za/images/good_video.jpg
http://southerngold.co.za/images/video_w...ed_out.jpg
http://southerngold.co.za/images/video_w...length.jpg

Debug logs
1 - Debug log with original code in place with playback and simulated crash via Task Manager - numowecidi.kodi (paste)
2 - Debug log with original code in place with attempted resume - itigasoyod.kodi (paste)
3 - Debug log with modified code in place with playback and simulated crash via Task Manager - jexewayazo.kodi (paste)
4 - Debug log with modified code in place with successful resume - sebireloke.kodi (paste)

Hope this helps prove the issue exists if not consistently. The resume bookmark insert/update queries show where the totalTimeInSeconds values are 0.0000 and set to the video length.
Well that's certainly thorough - thanks!

It's odd I have never seen that - never seen any video with a resume point then start at the beginning like that.  Very weird.  I've tested it here and can't get it to repeat that behaviour, so feels like something else/more is going on.  I don't really like not understanding the issue or being able to replicate it...

On the flipside, I can't really see why having the total seconds in there would actually cause any issues (and would appear to be part of the original intent for the resume points) - so might as well try adding it, given it solves this mystery thing for you!
Thanks for your help - fix submitted: https://github.com/xbmc/repo-scripts/pull/2511

(Next time if you have a fix maybe do this in an issue/PR, but in any case, super thanks for all the effort in that report!)
(2023-03-01, 23:19)bossanova808 Wrote: [ -> ]Do note it has to be a video in the Kodi library - if you're just playing files you haven't scanned in, it ignores those.

Is it possible to not ignore them? I'm using Kodi on a TV with no internet access. Since apparently videos MUST either be scraped (requiring internet access) or include their own NFO file (which I'm not interested in creating for the many videos I will only watch once then delete) most of the videos I watch aren't in the Kodi library. There must be plenty of other users also either frequently or at least occasionally watching videos not in the library who could benefit from this addon. So, any possibility of it also working with non-library videos? If not, do you know of another simply addon that will? Thanks!
I don't believe Kodi can save a resume point for a non library item, sorry.

I suppose one could create a mechanism for it even so (save the restore point to a file rather than the Kodi library db) - and then seek to that spot on the start of playback.

Maybe open an issue on github so I don't forget about it, but no time at present to work on it, and no one else has asked before I think, so not sure it's a much needed feature (why use Kodi if not the library, basically...)
Pages: 1 2 3 4