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-06-2007, 04:03 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Start, Current and Stop times for different media types

I'm trying to get a grasp on how GetStartTime and GetStopTime and GetMediaTime all deal with the different forms of media. For instance, Live TV, recorded TV, imported video files, DVD's, music, etc.

My tests with imported media returned a start and stop time that appeared to be based off the file's creation date.

Obviously, for live TV, the start, stop and current time are all clock times....so if you're watching a show at 6:45p, the current time returned for the media is 6:45p. But once that show is recorded, and you go play it back...does it still show the clock time, or does it convert to elapsed time?

I ask this because I don't have the capability to test a lot of these different media types, but I want to try and come up with some standard way that I display start, stop and current times so that, no matter what the media, they are useful values. Is there a specific, standard way? Thanks!
Reply With Quote
  #2  
Old 08-06-2007, 10:15 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Do you mean GetFileStartTime(), GetFileEndTime(), and GetMediaTime()?

Have you checked the descriptions of them in the API docs? It talks about where the the start/stop times come from and what GetMediaTime() represents.

There is code using all these & other time calls in the "MediaPlayer OSD" menu, used for the playback time bar.

- 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
  #3  
Old 08-07-2007, 09:30 AM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Well, I think I was actually using the airing GetStart and GetStop times. So, I guess that if my media object HAS an airing, then I can use those times, and if it doesn't, then I can use the GetFileStart and Stop times.

As for GetMediaTime, though, this is where I was a little confused.

Quote:
Gets the current playback time of the MediaPlayer. For DVD content this time will return a value appropriate for a current time display (starting at zero). For all other content types, this value will be the time in java.lang.System.currentTimeMillis() units and is relative to the start time of the Airing metadata which represents the currently loaded file. So for a current time display you should subtract the airing start time of the current media file from the returned value.
So, it says that it will use the airing start and stop time, the only exception being for DVD's, which gives a current time from 0 (so, elapsed, essentially).

However, what about music files or imported media files? They do not have airings associated with them, but are not DVD's....so that's where some of my confusion comes in. How does the media player treat them?
Reply With Quote
  #4  
Old 08-07-2007, 09:49 AM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Those are files, so just use the file start/stop time APIs I mentioned above. These are used below the "New Progress Panel with Padding Shown" panel widget in the OSD menu of the default STV. The widget chain below that panel deals with any media type being played.

- 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
  #5  
Old 08-07-2007, 12:06 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
I don't completely understand what you said, because none of this is for an STV. I'm gathering the data with my java code and then sending it over TCP to another app. So I don't deal with any of the OSD or STV widgets.

But I think I've got it then.....basically, if it has an airing object, then use that. Otherwise, use the file versions of them and just trust GetMediaTime() to always return something useful.

Is that about right?
Reply With Quote
  #6  
Old 08-07-2007, 12:20 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
I pointed you to the code in the STV because that is easier to do than to try to describe it. You don't need to be using it in an STV, since the API calls will be similar either way -- the sample code shows how the data is being gathered for different situations. The STV also deals with padding time for TV recordings/files because the AiringStartTime() can be different from GetScheduleStartTime() or FileStartTime(). But, those times will be the same for imported media, so there will be no padding.

- 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
  #7  
Old 08-07-2007, 12:27 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Ooooo. Ok. I'll try to learn enough about the STV then to take a look at that.
Reply With Quote
  #8  
Old 08-07-2007, 12:35 PM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
Quote:
Originally Posted by beelzerob View Post
basically, if it has an airing object, then use that.
All media files have an airing object and a show object -- even pictures. This is how Sage works internally.

Quote:
Otherwise, use the file versions of them and just trust GetMediaTime() to always return something useful.
As you know that you are working with a media files, then always use the GetFileStartTime/StopTime to get the... uh... file start/stop (and by inference duration) times

Note The Airing start/stop times for TV files may not correspond to the File start/stop times. This can be due to record padding, or the user starting the recording late, or it being a liveTV partial file.

To get the relative playback position in milliseconds, for all media file types APART from DVDs, you are 'safe' with using:

GetMediaTime()-GetFileStartTime(GetCurrentMediaFile())

For DVDs, simply use GetMediaTime().
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #9  
Old 08-07-2007, 01:09 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by beelzerob View Post
Ooooo. Ok. I'll try to learn enough about the STV then to take a look at that.
I'll just second what Andy said. Even if you don't plan to write any STV code of your own, the default STV is a great source of practical info about how to use the API.

You can also learn a lot by trying out API calls interactively using Studio's Expression Evaluator. This can help you zero in on correct usage a lot quicker than repeated edit/compile/debug cycles.
__________________
-- Greg
Reply With Quote
  #10  
Old 08-07-2007, 04:23 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Quote:
Originally Posted by nielm View Post
All media files have an airing object and a show object -- even pictures. This is how Sage works internally.
I thought I had just experienced a null value exception in java when trying to use a show object from an imported media file....I just assumed that there was no show because it was imported. I'll have to go back then and see if that really was what the problem was.

Quote:
As you know that you are working with a media files, then always use the GetFileStartTime/StopTime to get the... uh... file start/stop (and by inference duration) times
But if I'm watching live TV, and thus it hasn't actually ended yet...is there really a file stop time yet? Obviously there's an airing stop time, as that's when it's predicted to stop. Is the file stop time the same as the airing stop time, or is it the current time (since the "end" of the file is where it currently is right now).

Quote:
Note The Airing start/stop times for TV files may not correspond to the File start/stop times. This can be due to record padding, or the user starting the recording late, or it being a liveTV partial file.
Well, that's a good point....file stop and start times will be what it REALLY is, not what it should have been.

Quote:
To get the relative playback position in milliseconds, for all media file types APART from DVDs, you are 'safe' with using:

GetMediaTime()-GetFileStartTime(GetCurrentMediaFile())

For DVDs, simply use GetMediaTime().
Thanks, that's easy enough.
Reply With Quote
  #11  
Old 08-07-2007, 06:17 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Well, API docs partially answered that....the file end time is when it stopped recording, or the starttime + duration. So either way, if it's live tv, then I'm going to want to use the airing end time anyway.

Sooo.....

If LiveTV:
Use GetMediaTime, GetAiringStartTime, GetAiringEndTime

Else
Use GetMediaTime, GetFileStartTime, GetFileEndTime
Reply With Quote
  #12  
Old 08-07-2007, 08:09 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Quote:
Originally Posted by beelzerob View Post
Well, API docs partially answered that....the file end time is when it stopped recording, or the starttime + duration. So either way, if it's live tv, then I'm going to want to use the airing end time anyway.

Sooo.....

If LiveTV:
Use GetMediaTime, GetAiringStartTime, GetAiringEndTime
Not necessarily... The airing end time may not be the same as the scheduled end time of the recording. I suppose it depends on whether you want to deal only with the expected start/end times of the show itself, or whether you want to take the possibility of positive or negative padding into account.

I'll suggest one more time that you check out the code in the STV that I referred you to & then I won't mentioning it again.

- 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
  #13  
Old 08-08-2007, 01:37 AM
nielm's Avatar
nielm nielm is offline
SageTVaholic
 
Join Date: Oct 2003
Location: Belgium
Posts: 4,496
You are really making things much more difficult for yourself by not using studio...
I can understand that the STV itself may be daunting, but if you just use the Studio window's Expression Evaluator to see what some functions return, it helps a lot in prototyping, especially for Java apps.

For a LiveTV show where viewing started after the Airing has started, and is currently playing:

PrintTimeLong(GetAiringStartTime(GetCurrentMediaFile())) =09:30:00
PrintTimeLong(GetAiringStopTime(GetCurrentMediaFile())) =09:55:00

PrintTimeLong(GetFileStartTime(GetCurrentMediaFile())) =09:31:03
PrintTimeLong(GetFileStartTime(GetCurrentMediaFile())) =09:34:05
(note that this value will increase as more of the show is being recorded)

PrintTimeLong(GetMediaTime())=09:34:12
__________________
Check out my enhancements for Sage in the Sage Customisations and Sageplugins Wiki
Reply With Quote
  #14  
Old 08-08-2007, 08:09 AM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Well, I'd be a complete idiot to not listen to the advice of people who have already helped me so much. (Now, I'm not saying I'm NOT a complete idiot.... ).

Before I post another question, then, I will get the STV up and going and play around with it.
Reply With Quote
  #15  
Old 08-08-2007, 09:27 AM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Quote:
Originally Posted by nielm View Post
For a LiveTV show where viewing started after the Airing has started, and is currently playing:

PrintTimeLong(GetAiringStartTime(GetCurrentMediaFile())) =09:30:00
PrintTimeLong(GetAiringStopTime(GetCurrentMediaFile())) =09:55:00
And, due to padding, these results may be different from the above values:

PrintTimeLong(GetScheduleStartTime(GetCurrentMediaFile()))
PrintTimeLong(GetScheduleEndTime(GetCurrentMediaFile()))

- 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-08-2007, 09:39 AM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Well, my overriding goal in all of this is to represent the start, end, and current time of all types of media, in a Time (UTC) format. That gives the most flexibility for the client on the end to represent media dates and time however they want. For items that don't have a specific date (such as DVD's), then I'd just have to add the current time to 0 UTC (ya, it'd look like 1970 for date, but they'd just omit the date and only translate the time).
Reply With Quote
  #17  
Old 08-08-2007, 09:31 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Quote:
Originally Posted by Opus4 View Post
Those are files, so just use the file start/stop time APIs I mentioned above. These are used below the "New Progress Panel with Padding Shown" panel widget in the OSD menu of the default STV. The widget chain below that panel deals with any media type being played.

- Andy
Well, I found the STV. Geez, I had no idea it was already there! It was so easy to start, it was confusing.

The function evaluator worked, and I can see some usefulness there.

But I can't find this New Progress etc thing you talk about...the only thing with OSD I can find is the MediaPlayer OSD, and there's nothing under that about a progess panel.
Reply With Quote
  #18  
Old 08-08-2007, 09:38 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Quote:
Originally Posted by beelzerob View Post
But I can't find this New Progress etc thing you talk about...the only thing with OSD I can find is the MediaPlayer OSD, and there's nothing under that about a progess panel.
Just search for "New Progress Panel with Padding Shown" (w/o the quotes). That will find a single panel widget. Expand the children under it & you'll see the Start/End time calls in the first few sections of the child widget tree. (A search for GetFileStartTime will find the same section of code.)

You don't really need to keep following the code down into the "Entire Progress Panel", unless you want to see a real mess.

- 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
  #19  
Old 08-08-2007, 09:44 PM
beelzerob beelzerob is offline
Sage Advanced User
 
Join Date: May 2006
Posts: 163
Ok, found it.
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


All times are GMT -6. The time now is 01:50 PM.


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