|
SageTV Github Development Discussion related to SageTV Open Source Development. Use this forum for development topics about the Open Source versions of SageTV, hosted on Github. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
How to set Watched time for DVD's
I am trying to add support in my IOS client to optionally set the Watched time on SageTV for where someone just watched a movie to on IOS. I can do this for a tv show but not for a dvd. SageTV obviously can do it but I haven't found out how. I asked this on 4/30/2015 here:
http://forums.sagetv.com/forums/show...837#post571837 This link has sample code for what I have tried. But now that the code is open source has someone seen how this is done and how I could do it? Thanks David |
#2
|
||||
|
||||
Quote:
If I recall it was not obvious.
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#3
|
||||
|
||||
I took a look at the code. I never actually set the watched duration of a DVD. What I do is save the current playback position and then when the user resumes playback perform a seek to the saved location.
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#4
|
||||
|
||||
Thanks for checking!
David |
#5
|
||||
|
||||
I still would like to add this to my IOS client. When I watch using the hd300 I can stop watching a show or dvd and when I watch it again it prompts me to resume at the same spot? Does anyone who is knowledgeable with the source code know what api I can use to do this?
I would like to be able to start watching something on the hd300 then stop and later watch some or finish on IOS and if not finished report the position back to sage and resume on the hd300 at the spot I left off on IOS. David Quote:
|
#6
|
|||
|
|||
Quote:
Code:
dvdResumeTarget = Wizard.getInstance().getWatch(watchMe.getContentAiring()); . . . dvdResumeTarget.getWatchEnd() http://download.sage.tv/api/sage/api...e(sage.Airing) or maybe this one: http://download.sage.tv/api/sage/api...e(sage.Airing) Will one of those work? I also found this one for setting the watched times: http://download.sage.tv/api/sage/api...0long,%20long) Last edited by wnjj; 08-06-2018 at 02:34 PM. |
#7
|
||||
|
||||
I am able to resume an airing and can set the watched time for a show but not for a dvd. This post shows what I have tried:
https://forums.sagetv.com/forums/sho...837#post571837 If there is not an api to do it then how is the GUI saving the position of a DVD? David Quote:
Last edited by davidb; 08-06-2018 at 02:33 PM. |
#8
|
|||
|
|||
Quote:
Code:
if (watchMe.isDVD() || watchMe.isBluRay()) { dvdResumeTarget = Wizard.getInstance().getWatch(watchMe.getContentAiring()); |
#9
|
|||
|
|||
The "SetWatchedTimes" call simply updates the watched time data in wiz.bin for the specific airing. Try getting those times using an API after partially watching a DVD in the HD300. Then see if simply setting them back to where they were causes the HD300 to still "restart" from there. If that doesn't even work there must be some kind of time bounds checking that's forcing it to the end.
Looking in the STV, it appears that "Start from the Beginning" just calls "ClearWatched(Airing)" before playing and nothing else special for the "Resume Playback" option. Last edited by wnjj; 08-06-2018 at 02:55 PM. |
#10
|
||||
|
||||
I looked into this a long time ago for my "Multi User" plugin. I'm traveling now and don't have access to the code but will look at it when I get home. It was not obvious, if I remember I had to mess with something to set the right "track".
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#11
|
||||
|
||||
I spent some more time on this and still can't set the watched time for a dvd. I am testing this on Sage 9 on windows. I am watching on the stv but using a hd-300 gives the same result. The code below is trying to set the watched time to 5 minutes for both a show and a dvd rip. In both cases the stv reports the media has been partially watched and prompts me to resume playback which I am doing. The tv airing starts at 5 minutes as expected but the dvd starts at the beginning. This test code is using sagex and running on the same machine as sage is on. I am calling the test function from main like this:
Code:
public static void main(String args[]) throws Exception { int mediaID = 7130249; // I feel pretty testSetAiringTime(mediaID, 300); mediaID = 7354220; // Chesapeake Shores testSetAiringTime(mediaID, 300); } Code:
public static void testSetAiringTime(int mediaID, int secondsWatched) { Object mediafile = MediaFileAPI.GetMediaFileForID(mediaID); Object airing = MediaFileAPI.GetMediaFileAiring(mediafile); AiringAPI.ClearWatched(airing); AiringAPI.SetWatchedTimes(airing, AiringAPI.GetAiringStartTime(airing) + secondsWatched * 1000, 1534948850L * 1000L); System.out.println("media Title = "+ MediaFileAPI.GetMediaTitle(airing) + " IsDVD: " + MediaFileAPI.IsDVD(airing)); long watchedDuration = AiringAPI.GetWatchedDuration(airing); long watchedEndTime = AiringAPI.GetWatchedEndTime(airing); long realWatchedStartTime = AiringAPI.GetRealWatchedStartTime(airing); long startTime = AiringAPI.GetAiringStartTime(airing); long sageSecondsWatched = watchedDuration / 1000L; System.out.println("watchedDuration: " + watchedDuration); System.out.println("watchedEndTime: " + watchedEndTime); System.out.println("realWatchedStartTime: " + realWatchedStartTime); System.out.println("startTime: " + startTime); System.out.println("sageSecondsWatched: " + sageSecondsWatched); if (Math.abs(sageSecondsWatched - secondsWatched) <= 3) { System.out.println("Sage shows watched time set to the desired time."); } else { System.out.println("Sage does not show watched time was set to the desired time!"); } } |
#12
|
||||
|
||||
I looked into my MultiUserSupport plugin and the trick seems to be that you need to set the title number as well as the watched duration. The code below is what does it in my plugin.
Code:
if (sagex.api.MediaFileAPI.IsDVD(MediaFile)) { for (String UserID : UserIDs) { MultiMediaFile MMF = new MultiMediaFile(UserID, MediaFile); Long seekDuration = MMF.getDVDWatchedDuration(); if (seekDuration != 0) { Long watchedTitleNum = (long)(MMF.getTitleNum()); int Code = 202; Log.getInstance().write(Log.LOGLEVEL_TRACE, "watch: DVD Setting Title to " + watchedTitleNum); sagex.api.MediaPlayerAPI.DirectPlaybackControl(new UIContext(UIContext), Code, watchedTitleNum, watchedTitleNum); Log.getInstance().write(Log.LOGLEVEL_TRACE, "watch: DVD Seeking to " + seekDuration); sagex.api.MediaPlayerAPI.Seek(new UIContext(UIContext), seekDuration); } } }
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#13
|
||||
|
||||
What tmiranda is doing is keeping track of the watched position for multiple users then when playback starts restoring the watched position. He doesn't appear to be using the Sage api call that I am having a problem with(SetWatchedTimes). I can't do what he is doing because my playback is not done on sage itself but from IOS. I think the relativity recent(version not time) addition of the api function SetWatchedTimes has a problem. I don't have a build environment to be able to put in log messages in the function to see what is going on though. Can someone look at this?
Quote:
|
#14
|
|||
|
|||
It sounds like you need an API that SETS the titlenum. Then the airing DB is updated properly for whatever system plays it back next time. Since you’re not actually playing the file on Sage but want it to act like it had, I suspect this is the missing piece. Unfortunately I don’t see an API for for that or an optional argument for the existing ones.
Last edited by wnjj; 08-25-2018 at 09:49 AM. |
#15
|
|||
|
|||
It’s looks like BigBrother.java has 2 setWatched() types and the second one includes titlenum. That looks like it needs an API equivalent.
Code:
public static boolean setWatched(Airing a, long airWatchStart, long airWatchEnd, long realWatchStart, long realWatchEnd, boolean checkOnly) { return setWatched(a, airWatchStart, airWatchEnd, realWatchStart, realWatchEnd, 0, checkOnly); } static boolean setWatched(Airing a, long airWatchStart, long airWatchEnd, long realWatchStart, long realWatchEnd, int titleNum, boolean checkOnly) { Last edited by wnjj; 08-25-2018 at 09:57 AM. |
#16
|
||||
|
||||
The SetWatchedTimes is supposed to provide this functionality. A SetWatchedTimesEx is not needed. I have entered an issue (#384)on the sagetv github. I looked at the source code but can't do much as I can't build it on my system.
David Quote:
|
#17
|
|||
|
|||
I don’t see how you can add the titlenum without breaking existing users of the API. A new API is the easiest solution.
|
#18
|
||||
|
||||
in the source code AiringAPI.java SetWatchedTimes calls
BigBrother.setWatched function with 6 parms. Then that func calls the BigBrother.setwatched func with 7 parms passing in a titleNum of 0. It appears the BigBrother.setwatched should handle it and new a new api function is not needed. the BigBrother.setWatched |
#19
|
|||
|
|||
Quote:
|
#20
|
||||
|
||||
The api doesn't need to be extended for this to work. The titlenum is only for when you are watching on Sage.
The SetWatchedTimes was added in SageTV V7.0.13 Beta 8/4/2010 with the comment: "Added Airing API call SetWatchedTimes(Airing, WatchedEndTime, RealStartTime) which can be used to set explicitly what the last watched time is for an Airing. Useful if viewing is done outside of the regular SageTV media players (i.e. web clients)." If anyone is lurking and didn't read the whole thread. I have added issue: 384 on github. David Quote:
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Marking one episode Watched marks all future as Watched | svemuri | SageTV Beta Test Software | 3 | 03-16-2011 01:24 PM |
Last time you watched Live TV? | IVB | General Discussion | 34 | 01-01-2010 03:28 AM |
Daylight Savings Time and NTFS time stamps - 1 hour off? | Opus4 | The SageTV Community | 2 | 11-01-2006 11:34 PM |
Reset watched shows after a certain time? | Speedy64i | SageTV Software | 3 | 04-20-2006 02:08 PM |
Feature Request: Time limited "watched" list | Deadbolt | SageTV Beta Test Software | 2 | 02-10-2004 05:34 PM |