SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Studio
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

SageTV Studio Discussion related to the SageTV Studio application produced by SageTV. Questions, issues, problems, suggestions, etc. relating to the Studio software application should be posted here.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-03-2011, 06:48 PM
jpaddock3000 jpaddock3000 is offline
Sage Aficionado
 
Join Date: Dec 2006
Location: San Diego, CA
Posts: 341
How to get DVD content length

I'm working on an issue where I can't seem to be able to pull the DVD length from the API. I was hoping someone here can provide some assistance.

Both sagex.api.MediaFileAPI.GetFileDuration(MediaFile) and sagex.api.AiringAPI.GetAiringDuration(MediaFile) return 1 for DVD's. I'm looking to get the milliseconds for the entire DVD that is being watched. Well I guess only for the main movie. Do I need to do other things with the Title and Chapter or is it just a different API that I need to hit?

Thanks in advance!
__________________
Server - Windows Home Server: Sage 7.1.9 HVR-2250 and HD Homerun Dual Tuner, Intel Core2Duo 2.4GHz, RAM 4 GB, HD OS/Movies/Music/Pictures:500GB (SATAII) TV:1TB (SATAII),
Clients - 2 x HD-300, 3 x MediaMVP
Reply With Quote
  #2  
Old 08-04-2011, 08:36 AM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Getting a reliable length (or end time) from all possible formats is a pain... If the ones you tried fail, have a fall back using the (EndTimeAiring - StartTimeAiring)/rescaling, that should do it.
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #3  
Old 08-04-2011, 10:08 AM
jpaddock3000 jpaddock3000 is offline
Sage Aficionado
 
Join Date: Dec 2006
Location: San Diego, CA
Posts: 341
Quote:
Originally Posted by Fonceur View Post
Getting a reliable length (or end time) from all possible formats is a pain... If the ones you tried fail, have a fall back using the (EndTimeAiring - StartTimeAiring)/rescaling, that should do it.
Thanks for your input. That makes sense and I will try that later tonight. I wasn't able to find anything on rescaling? What should this value be and which API can I call it in?

Thanks again!
__________________
Server - Windows Home Server: Sage 7.1.9 HVR-2250 and HD Homerun Dual Tuner, Intel Core2Duo 2.4GHz, RAM 4 GB, HD OS/Movies/Music/Pictures:500GB (SATAII) TV:1TB (SATAII),
Clients - 2 x HD-300, 3 x MediaMVP
Reply With Quote
  #4  
Old 08-04-2011, 10:22 AM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Quote:
Originally Posted by jpaddock3000 View Post
I wasn't able to find anything on rescaling?
For the airing time: "The time is in Java time units, which are milliseconds since Jan 1, 1970 GMT "

So you would have to divide the difference by a rescaling factor of 1000 to get it back in seconds. Actually, I think they're not really using milliseconds, but an even smaller unit, but you should be able to figure it out easily with a real DVD.
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #5  
Old 08-04-2011, 10:26 AM
jpaddock3000 jpaddock3000 is offline
Sage Aficionado
 
Join Date: Dec 2006
Location: San Diego, CA
Posts: 341
Ah, makes sense. Thanks!
__________________
Server - Windows Home Server: Sage 7.1.9 HVR-2250 and HD Homerun Dual Tuner, Intel Core2Duo 2.4GHz, RAM 4 GB, HD OS/Movies/Music/Pictures:500GB (SATAII) TV:1TB (SATAII),
Clients - 2 x HD-300, 3 x MediaMVP
Reply With Quote
  #6  
Old 08-04-2011, 11:00 PM
jpaddock3000 jpaddock3000 is offline
Sage Aficionado
 
Join Date: Dec 2006
Location: San Diego, CA
Posts: 341
Looks like the same issue:

DVD End Time = 1303702442541 and DVD Start Time = 1303702442540

The difference is 1 millisecond. This is the same response as the duration call. Any other ideas?

Thanks
__________________
Server - Windows Home Server: Sage 7.1.9 HVR-2250 and HD Homerun Dual Tuner, Intel Core2Duo 2.4GHz, RAM 4 GB, HD OS/Movies/Music/Pictures:500GB (SATAII) TV:1TB (SATAII),
Clients - 2 x HD-300, 3 x MediaMVP
Reply With Quote
  #7  
Old 08-04-2011, 11:02 PM
jpaddock3000 jpaddock3000 is offline
Sage Aficionado
 
Join Date: Dec 2006
Location: San Diego, CA
Posts: 341
So I tried pulling the DVD end time and the DVD start time. The difference is 1 millisecond.

DVD End Time = 1303702442541 and DVD Start Time = 1303702442540

I'm keep working on it, but it doesn't seem promising.

* merged *
__________________
Server - Windows Home Server: Sage 7.1.9 HVR-2250 and HD Homerun Dual Tuner, Intel Core2Duo 2.4GHz, RAM 4 GB, HD OS/Movies/Music/Pictures:500GB (SATAII) TV:1TB (SATAII),
Clients - 2 x HD-300, 3 x MediaMVP
Reply With Quote
  #8  
Old 08-04-2011, 11:53 PM
Fonceur's Avatar
Fonceur Fonceur is offline
Sage Icon
 
Join Date: Jan 2008
Location: DDO, QC
Posts: 1,915
Try the airing.GetShow(), and see if the getShowDuration and/or air time are as useless...
__________________
SageTCPServer (2.3.5): Open source TCP interface to the SageTV API
MLSageTV (3.1.8)/Sage Media Server (1.13): SageTV plugin for MainLobby/CQC
TaSageTV (2.58)/TaSTVRemote (1.14): Monitor/control SageTV with an Android device
TbSageTV (1.02)/STVRemote (1.11): Monitor/control SageTV with a PlayBook 2
TiSageTV (1.64)/TiSTVRemote (1.09): Monitor/control SageTV with an iPhone/iPod/iPad
Reply With Quote
  #9  
Old 08-05-2011, 12:10 AM
jpaddock3000 jpaddock3000 is offline
Sage Aficionado
 
Join Date: Dec 2006
Location: San Diego, CA
Posts: 341
Same info. I think the MediaPlayerAPI will give me the info so I'm trying that one now.
__________________
Server - Windows Home Server: Sage 7.1.9 HVR-2250 and HD Homerun Dual Tuner, Intel Core2Duo 2.4GHz, RAM 4 GB, HD OS/Movies/Music/Pictures:500GB (SATAII) TV:1TB (SATAII),
Clients - 2 x HD-300, 3 x MediaMVP
Reply With Quote
  #10  
Old 08-05-2011, 12:38 AM
jpaddock3000 jpaddock3000 is offline
Sage Aficionado
 
Join Date: Dec 2006
Location: San Diego, CA
Posts: 341
Nope, no luck How/Why is it so hard to pull DVD duration?
__________________
Server - Windows Home Server: Sage 7.1.9 HVR-2250 and HD Homerun Dual Tuner, Intel Core2Duo 2.4GHz, RAM 4 GB, HD OS/Movies/Music/Pictures:500GB (SATAII) TV:1TB (SATAII),
Clients - 2 x HD-300, 3 x MediaMVP
Reply With Quote
  #11  
Old 08-05-2011, 05:34 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by jpaddock3000 View Post
Something interesting I just noticed, looking at a DVD using Sage Webserver:

Episode: The Dilemma
Aired: Jul 16, 2011 3:53 PM - 3:53 PM
Duration: 0 m

Looks like they couldn't figure out how to tell duration with it either. One thing that is interesting:
Internal details: MediaFileID=9005048 , AiringID=9005069

I noticed that these 2 values are different. Have your tried playing with the AiringID instead of the MediaFileID or vice versa? I would think MediaFileID would be the correct one to use, but just wanted to figure out what you have already done before I tackle this project.

Thanks
Most of the Sage API's take either a MediaFile Object or an Airing Object, you can use either interchangably. So it doesn't matter if you use the MediaFileID to get a MediaFile Object or an AiringID to get an Airing Object.
__________________

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.
Reply With Quote
  #12  
Old 08-05-2011, 05:41 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by jpaddock3000 View Post
So I tried pulling the DVD end time and the DVD start time. The difference is 1 millisecond.

DVD End Time = 1303702442541 and DVD Start Time = 1303702442540

I'm keep working on it, but it doesn't seem promising.
Why do you need the duration to figure out where to resume playback?

One thing I was going to try: The way the API works now is to start playing the DVD and then immediately try to seek to the saved Title and Chapter. IIRC this was failing. I was thinking this may be failing because I'm trying to seek too soon and the MediaPlayer has not fully loaded the DVD. What I was going to try was putting a delay before the seeks to give the MediaPlayer time to do it's thing.

If you can get that to work you still will not be at the exact playback position, but at least you'll be at the nearest chapter within the title.
__________________

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.
Reply With Quote
  #13  
Old 08-05-2011, 05:52 AM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Because DVDs don't have a duration, they're made up of menus and a series of video clips that run on indefinite repeat, so there's no easy way to determine the duration of a DVD.
Reply With Quote
  #14  
Old 08-05-2011, 06:32 AM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
Quote:
Originally Posted by tmiranda View Post
Why do you need the duration to figure out where to resume playback?

One thing I was going to try: The way the API works now is to start playing the DVD and then immediately try to seek to the saved Title and Chapter. IIRC this was failing. I was thinking this may be failing because I'm trying to seek too soon and the MediaPlayer has not fully loaded the DVD. What I was going to try was putting a delay before the seeks to give the MediaPlayer time to do it's thing.

If you can get that to work you still will not be at the exact playback position, but at least you'll be at the nearest chapter within the title.
How about checking MediaPlayerAPI.IsMediaPlayerFullyLoaded then seeking?
Reply With Quote
  #15  
Old 08-05-2011, 07:28 AM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
SageTV does not report DVD duration unless it was included in its metadata (properties file). For an example of determining if the duration info is valid, look at the code around widget ID "OPUS4A-178354".

For the DVD duration shown on the OSD's timebar during playback, check the code below widget ID "BASE-52545".

- Andy
__________________
SageTV Open Source v9 is available.
- Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1.
- Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus
- HD Extenders: A) FAQs B) URC MX-700 remote setup
Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request.
Reply With Quote
  #16  
Old 08-05-2011, 09:31 AM
jpaddock3000 jpaddock3000 is offline
Sage Aficionado
 
Join Date: Dec 2006
Location: San Diego, CA
Posts: 341
Quote:
Originally Posted by tmiranda View Post
Why do you need the duration to figure out where to resume playback?
I want the duration so I know if we are within 5 minutes of the end of the DVD so I can mark the DVD watched and not force the user to fast forward through all the credits and go to the end of the file.

Quote:
Originally Posted by Opus4
SageTV does not report DVD duration unless it was included in its metadata (properties file). For an example of determining if the duration info is valid, look at the code around widget ID "OPUS4A-178354".

For the DVD duration shown on the OSD's timebar during playback, check the code below widget ID "BASE-52545".
Sorry, how do I find these widget ID's? I think I'm more interested in BASE-52545 as my goals are to be able to mark the DVD watched if you stop playback within the last 300 seconds (5 minutes) and be able to capture where the user left off during playback so we can properly resume playback.

Thanks
__________________
Server - Windows Home Server: Sage 7.1.9 HVR-2250 and HD Homerun Dual Tuner, Intel Core2Duo 2.4GHz, RAM 4 GB, HD OS/Movies/Music/Pictures:500GB (SATAII) TV:1TB (SATAII),
Clients - 2 x HD-300, 3 x MediaMVP
Reply With Quote
  #17  
Old 08-05-2011, 09:42 AM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Quote:
Originally Posted by jpaddock3000 View Post
Sorry, how do I find these widget ID's? I think I'm more interested in BASE-52545 as my goals are to be able to mark the DVD watched if you stop playback within the last 300 seconds (5 minutes) and be able to capture where the user left off during playback so we can properly resume playback.
Just enable the Tools option to "Display Widget UIDs" and then use Edit -> Find All to search for the IDs I listed.

- Andy
__________________
SageTV Open Source v9 is available.
- Read the SageTV FAQ. Older PDF User's Guides mostly still apply: SageTV V7.0 & SageTV Studio v7.1.
- Hauppauge remote help: 1) Basics/Extending it 2) Replace it 3) Use it w/o needing focus
- HD Extenders: A) FAQs B) URC MX-700 remote setup
Note: This is a users' forum; see the Rules. For official tech support fill out a Support Request.
Reply With Quote
  #18  
Old 08-05-2011, 10:48 AM
tmiranda's Avatar
tmiranda tmiranda is offline
SageTVaholic
 
Join Date: Jul 2005
Location: Central Florida, USA
Posts: 5,851
Quote:
Originally Posted by BobPhoenix View Post
How about checking MediaPlayerAPI.IsMediaPlayerFullyLoaded then seeking?
That's probably a better idea.
__________________

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.
Reply With Quote
  #19  
Old 08-05-2011, 11:19 AM
jpaddock3000 jpaddock3000 is offline
Sage Aficionado
 
Join Date: Dec 2006
Location: San Diego, CA
Posts: 341
Kind of a novice here. Would this be a good way to go about waiting for the media player to be fully loaded?

Code:
if (eventName.startsWith("PlaybackStarted")) {
   if (sagex.api.MediaFileAPI.IsDVD(MediaFile)) {
      Log.getInstance().write(Log.LOGLEVEL_TRACE, "sageEvent: DVDPlaybackStarted");
      while (!sagex.api.MediaPlayerAPI.IsMediaPlayerFullyLoaded()) {
         Log.getInstance().write(Log.LOGLEVEL_TRACE, "sageEvent: DVDPlaybackStarted: Waiting for DVD to load");
      }
   }
}
Family is watching TV at the moment, so I'm not going to be able to test until tonight.

Thanks in advanced!
__________________
Server - Windows Home Server: Sage 7.1.9 HVR-2250 and HD Homerun Dual Tuner, Intel Core2Duo 2.4GHz, RAM 4 GB, HD OS/Movies/Music/Pictures:500GB (SATAII) TV:1TB (SATAII),
Clients - 2 x HD-300, 3 x MediaMVP
Reply With Quote
  #20  
Old 08-05-2011, 12:14 PM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
Quote:
Originally Posted by jpaddock3000 View Post
Kind of a novice here. Would this be a good way to go about waiting for the media player to be fully loaded?

Code:
if (eventName.startsWith("PlaybackStarted")) {
   if (sagex.api.MediaFileAPI.IsDVD(MediaFile)) {
      Log.getInstance().write(Log.LOGLEVEL_TRACE, "sageEvent: DVDPlaybackStarted");
      while (!sagex.api.MediaPlayerAPI.IsMediaPlayerFullyLoaded()) {
         Log.getInstance().write(Log.LOGLEVEL_TRACE, "sageEvent: DVDPlaybackStarted: Waiting for DVD to load");
      }
   }
}
Family is watching TV at the moment, so I'm not going to be able to test until tonight.

Thanks in advanced!
I think that would work but I would also put the thread to sleep in that loop as well. Couple hundred milliseconds - maybe less depending on time media player usually takes to load - or a configurable value even better. Then you won't flood the log with trace statements that state the obvious.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Video Length ddaggett1 SageTV Beta Test Software 6 03-01-2011 12:54 PM
Buffer Max Length and Duration? ktuimala SageTV Software 2 07-23-2009 10:48 PM
Favorites by length of show? wayner SageTV Software 1 01-12-2009 02:47 AM
Ethernet Cable length viperdiablo SageTV Media Extender 10 06-13-2008 12:21 AM
HAVA content - 16:9 content is letter and pillar boxed by sage dwalton22 SageTV Software 14 10-16-2007 08:57 AM


All times are GMT -6. The time now is 12:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.