![]() |
|
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 |
#21
|
|||
|
|||
Quote:
If you’d like a JAR with that functionality added to try, I could build you one, though I’m heading on a 5 day vacation tomorrow. |
#22
|
||||
|
||||
Yes I am wanting to save the watched position to be able to resume in Sage. The watching will be not through the stv but on an iPhone or Apple TV. Ultimately I would like to be able to start watching at home on the hd-300 then later pick back up at the same spot on my iPhone and possible continue when I get back home on the hd-300. My understanding was the api function SetWatchedTimes would do set the watched position for this. It half works in that it works for recordings. The titlenum doesn't make sense when you are not watching on the stv or an extender. That is why the existing api code is using 0 for the title number.
Sure I could use a JAR with that functionality but ultimately the code should go in the api function for it. David Quote:
Last edited by davidb; 08-28-2018 at 08:59 AM. |
#23
|
|||
|
|||
Quote:
Does watching on IOS after leaving Sage work ok or are both directions currently broken? I assume you can resume where you want to on IOS since the problem you’re dealing with is setting the watched time afterwards. Best of luck to you. I cannot suggest anything further. |
#24
|
||||
|
||||
From IOS I can resume watching where I left off on the hd-300. I can also use the SetWatchedTimes call to set the position last watched for a recording. I can then continue watching on the hd-300 at the last spot on watched on my iPhone. This works great for a recording but not for a dvd rip.
I do have the mediaID if you have a way to use it to the titleNum from it. David Quote:
|
#25
|
|||
|
|||
Your IOS player needs to determine which title number it was last playing. Do you have a way to do that? Then the API needs fixed/amended/augmented with one that accepts titlenum and saves it into wiz.bin.
Here’s the DVD playback code in VideoFrame.java that uses that wiz.bin information to resume payback. Notice the filter for “bad watched info” that checks the titlenum? That’s what is getting you when you use the current API for DVDs. Code:
if (watchMe.isDVD() || watchMe.isBluRay()) { dvdResumeTarget = Wizard.getInstance().getWatch(watchMe.getContentAiring()); if (dvdResumeTarget != null && dvdResumeTarget.getTitleNum() == 0) { // bad watched info from 7.0.13/14 dvdResumeTarget = null; } |
#26
|
||||
|
||||
In the VideoFrame.java is the call to dvdResumeTarget.getTitleNum() really needed? In the sample code earlier in this thread there is a print statement that is showing the WatchedTime is actually being set as it prints correctly. So I would assume the
Code:
dvdResumeTarget = Wizard.getInstance().getWatch(watchMe.getContentAiring()); Or is there another way to get the titlenum into the wiz.bin? Thanks! David Quote:
|
#27
|
|||
|
|||
Quote:
Yes, Wizard.getWatch() returns a 'Watched' object. The Watched object contains the watched times, duration and the titlenum (for DVD's) where something was last watched. These watched objects are stored in wiz.bin. When your IOS player is done playing its section of the DVD, your IOS app needs to figure out what the title is currently at and then save it back to Sage along with the watched time. In other words, watched time alone isn't enough information for DVD's. The DVD playback code in VideoFrame.java sets the title using this information: Code:
dplayer.playControlEx(DVD_CONTROL_TITLE_SET, dvdResumeTarget.getTitleNum(), dvdResumeTarget.getTitleNum()); When I looked through the code, the only things I found that can set the titlenum are VideoFrame.logFileWatch(): Code:
if (Sage.DBG) System.out.println("Setting DVD watched info for " + currFile + " title=" + getDVDTitle() + " Time=" + theTime); BigBrother.setWatched(doneAir, 0, theTime, realWatchStart, Sage.time(), getDVDTitle(), false); Code:
BigBrother.setWatched(theAir, airStart, airEnd, realStart, realEnd, titleNum, false); The API is missing that ability and that is a bug/missing feature. Last edited by wnjj; 08-28-2018 at 10:44 AM. |
#28
|
|||
|
|||
Here's 9.1.9 jar file with an added API if you want to try it out:
https://www.dropbox.com/s/f2d3rnwszg...dTimesDVD?dl=0 I created "SetWatchedTimesDVD" that works like the original "SetWatchedTimes" but also takes an integer for the title number after "RealStartTime". Code:
rft.put(new PredefinedJEPFunction("Airing", "SetWatchedTimesDVD", 4, new String[] { "Airing", "WatchedEndTime", "RealStartTime", "TitleNum" }, true) { /** * Updates the Watched information for this airing, including the DVD titlenum. The AiringEndTime should be an airing-relative time which indicates the time the * user has watched the show up until. The new watched end time will be the maximum of this value and the current watched end time. The * RealStartTime is the time (in real time) the user started watching this program at. Internally SageTV will set the start time of the watched * data to be the minimum of the recording start time and the airing start time; and the 'real' end time to be the current time. * @param Airing the Airing object * @param WatchedEndTime an airing-relative time which indicates the time the user has watched the show up until * @param RealStartTime the time (in real time) the user started watching this program at * @param Titlenum the title number the user was last watching * @since 9.1 * * @declaration public void SetWatchedTimes(Airing Airing, long WatchedEndTime, long RealStartTime, int TitleNum); */ public Object runSafely(Catbert.FastStack stack) throws Exception{ int titlenum = getInt(stack); long realStart = getLong(stack); long airEnd = getLong(stack); Airing air = getAir(stack); if (air != null && Permissions.hasPermission(Permissions.PERMISSION_RECORDINGSCHEDULE, stack.getUIMgr())) { MediaFile mf = Wizard.getInstance().getFileForAiring(air); BigBrother.setWatched(air, (mf != null) ? mf.getRecordTime() : air.getStartTime(), airEnd, realStart, Sage.time(), titlenum, false); } return null; }}); Last edited by wnjj; 08-28-2018 at 04:55 PM. |
#29
|
|||
|
|||
So here's some further details about DVD playback in DirectShow (Windows clients):
When the DVD position is changed, VideoFrame.timeselected() calls player.seek() which for Windows playback of DVD's calls DShowDVDPlayer.seek() which calls seekDVD0 in the native DLL driver (DVDPlaybackExtensions.cpp) which calls PlayAtTime() in DirectShow. Here's the description of PlayAtTime() from MS: https://docs.microsoft.com/en-us/win...ol2-playattime Notice it can only seek within a title. So absolute DVD playback time is not valid. That's why you need both a title and playback time within that title. Based upon what I can tell, the 'watched' times for a DVD are all relative to a title. I'm assuming the extenders are similar. |
#30
|
||||
|
||||
How do I get a title number? I have the airring and mediaID.
David Quote:
|
#31
|
|||
|
|||
Quote:
Alternatively I could make the original API get and the re-set the title rather than setting 0 so you don’t need to. I don’t know if external players will want to keep the title or change it though. |
#32
|
||||
|
||||
No the app keeps track of the mediaID and can do everything with it.
David Quote:
|
#33
|
|||
|
|||
I updated my Dropbox link with 2 new things:
1. Modified the original SetWatchedTimes API to get the previous titlenum and pass it back into BigBrother. This should fix your problem as-is. 2. Since #1 is not backward compatible and I'm not sure who else uses SetWatchedTimes and assumes title will be set to 0, I also added a GetDVDTitleNum API: Code:
rft.put(new PredefinedJEPFunction("Airing", "GetDVDTitleNum", 1, new String[] { "Airing" }) { /** * Gets the DVD title. * @param Airing the Airing object * @return the DVD titlenum for this Airing * @since 6.4 * * @declaration public int GetDVDTitle(Airing Airing); */ public Object runSafely(Catbert.FastStack stack) throws Exception{ Airing a = getAir(stack); if (a == null) return new Integer(0); Watched w = Wizard.getInstance().getWatch(a); return (w == null) ? new Integer(0) : new Integer(w.getTitleNum()); }}); In summary: Use both of my 2 new API functions as a Get/Set pair or just use the original one that I've modded. Download the jar from https://www.dropbox.com/s/f2d3rnwszg...dTimesDVD?dl=0 and give it a try if you want. Please back up your old jar and wiz.bin or do this on a test system you don't care about. Last edited by wnjj; 08-28-2018 at 04:55 PM. |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
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 |