Set resume point via JSON API
#1
Hi, I'm trying to write a script that grabs the current resume point for each movie in the library, and then propagate the highest value to all the front ends that have that file in their libraries.

Basically, if I watch a movie on one frontend, stop watching, and resume on a different frontend, I would like that the resume point had sync'd between them.

Getting the value via the JSON API is easy:
{"jsonrpc":"2.0","method":"VideoLibrary.GetEpisodes","id":1,"params":{"properties":["file","showtitle","resume"]}}

Setting it is hard or impossible, as it doesn't appear to be implemented. Is this a missing feature?
Reply
#2
Should I be asking this question somewhere else?
Reply
#3
Sorry must have missed the topic. It was actually added to XBMC 9 days ago, see https://github.com/xbmc/xbmc/commit/408c...4169118fea . So the current nightly builds will have support for it. But it's not part of Frodo (12.0, 12.1, 12.2, ...).
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#4
I moved his post here :)
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#5
Thanks, Martijn and Montellese!
Reply
#6
If I'm reading the diff right, the request should look something like this?


Code:
{"jsonrpc": "2.0", "id": 1,
"method": "VideoLibrary.SetEpisodeDetails",
"params": {"episodeid":  680, "resume": {"position":434,"total":1383} }
}
Reply
#7
Yup that looks correct.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#8
For anyone that finds this thread wondering about this feature, I have created .debs of 12.1 for Ubuntu 12.04 LTS with this single patch incorporated. Send me a PM if this is something you'd like.
Reply
#9
The link to the diff is giving a 404: https://github.com/xbmc/xbmc/commit/408c...169118fea

Is there a way to set the resume point of a video if it's not in the library (not a TV Show/Movie)?
XBMC.MyLibrary (add anything to the library)
ForTheLibrary (Argus TV & XBMC Library PVR Integration)
SageTV & XBMC PVR Integration
Reply
#10
(2014-01-10, 16:08)bradvido88 Wrote: The link to the diff is giving a 404: https://github.com/xbmc/xbmc/commit/408c...169118fea

Is there a way to set the resume point of a video if it's not in the library (not a TV Show/Movie)?

Yeah, the auto-linking of myBB messed up the link.

Nope you can't set the resume point for non-library items.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#11
(2014-01-10, 16:31)Montellese Wrote:
(2014-01-10, 16:08)bradvido88 Wrote: The link to the diff is giving a 404: https://github.com/xbmc/xbmc/commit/408c...169118fea

Is there a way to set the resume point of a video if it's not in the library (not a TV Show/Movie)?

Yeah, the auto-linking of myBB messed up the link.

Nope you can't set the resume point for non-library items.
Thanks, I found the proper link: https://github.com/xbmc/xbmc/commit/408c...4169118fea
Is the "total" param required? I'm not sure what that does -- adjust what xbmc thinks the total length of the video is?
XBMC.MyLibrary (add anything to the library)
ForTheLibrary (Argus TV & XBMC Library PVR Integration)
SageTV & XBMC PVR Integration
Reply
#12
"total" means the total length of the video but it's optional (and doesn't really make much sense). If you don't provide any value or 0 it will be ignored.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#13
I'm using Gotham alpha 11 and trying to set the resume point of a episode,but it doesn't seem to do anything.

Here's the JSON-RPC call and response
Code:
Executing JSON-RPC: {"params": {"episodeid": 2, "resume": {"position": 65}}, "jsonrpc": "2.0", "id": "setResumePoint", "method": "VideoLibrary.SetEpisodeDetails"}
VideoLibrary.SetEpisodeDetails response: {"jsonrpc": "2.0", "id": "setResumePoint", "result": "OK"}

Even though the result is "OK", I see no effect. When opening that episode in XBMC, it doesn't prompt me to resume. Also, when looking at the bookmark table in MyVideos77.db there are no rows in there. Any idea what I'm missing?

UPDATE:
I've found that if a bookmark record already exists in the bookmark table, then the JSON-RPC interface will update the record with the new resume point and it works as expected.
However, if no bookmark already exists for the video, then a new one is not created and nothing happens.

My initial thought is that maybe there a problem with this line (in VideoLibrary.UpdateResumePoint). Since it doesn't find an existing bookmark:
Code:
videodatabase.GetResumeBookMark(details.m_strFileNameAndPath, bookmark);
On a side note, is there a way for Gotham to spit out SQL statements in the debug log? I have full debug enabled, but don't see any info on the sql statements like I used to with Frodo.
XBMC.MyLibrary (add anything to the library)
ForTheLibrary (Argus TV & XBMC Library PVR Integration)
SageTV & XBMC PVR Integration
Reply
#14
(2014-01-10, 19:52)bradvido88 Wrote: I'm using Gotham alpha 11 and trying to set the resume point of a episode,but it doesn't seem to do anything.

Here's the JSON-RPC call and response
Code:
Executing JSON-RPC: {"params": {"episodeid": 2, "resume": {"position": 65}}, "jsonrpc": "2.0", "id": "setResumePoint", "method": "VideoLibrary.SetEpisodeDetails"}
VideoLibrary.SetEpisodeDetails response: {"jsonrpc": "2.0", "id": "setResumePoint", "result": "OK"}

Even though the result is "OK", I see no effect. When opening that episode in XBMC, it doesn't prompt me to resume. Also, when looking at the bookmark table in MyVideos77.db there are no rows in there. Any idea what I'm missing?

UPDATE:
I've found that if a bookmark record already exists in the bookmark table, then the JSON-RPC interface will update the record with the new resume point and it works as expected.
However, if no bookmark already exists for the video, then a new one is not created and nothing happens.

My initial thought is that maybe there a problem with this line (in VideoLibrary.UpdateResumePoint). Since it doesn't find an existing bookmark:
Code:
videodatabase.GetResumeBookMark(details.m_strFileNameAndPath, bookmark);
On a side note, is there a way for Gotham to spit out SQL statements in the debug log? I have full debug enabled, but don't see any info on the sql statements like I used to with Frodo.

Yeah you're right, I figured out the same. It only worked when there was already an existing bookmark. It should be fixed with 57e7305a2d90f799d730ae515a1ba44346297f32 . Thanks for the report.

Concerning logging SQL statements I don't think that's possible for SQLite. IIRC it is possible for MySQL though (probably because MySQL makes more trouble than SQLite).
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#15
Thanks Montellese. I'll test once it's in a nightly.
XBMC.MyLibrary (add anything to the library)
ForTheLibrary (Argus TV & XBMC Library PVR Integration)
SageTV & XBMC PVR Integration
Reply

Logout Mark Read Team Forum Stats Members Help
Set resume point via JSON API0