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 01-09-2007, 02:58 PM
IncredibleHat IncredibleHat is offline
Sage Aficionado
 
Join Date: May 2006
Posts: 352
Trying to get a "Watch this Channel" button added... help?

I've got this MOSTLY working... I'm just missing something.

Ok, the rundown:

Because of WAF, I have been confronted to 'add' a new button to the Program Guide TVShow options of "Watch Channel #" when "Watch Now" is not an option.

This happens when you select a TV Show that is about to start in like 5 minutes or so, but there is NO button to start watching THAT channel (so when the show starts, you are already on the channel).

Makes sense, right?

Well, I've got it mostly working... with one bad glitch.

The button when "Watch Now" isn't an option, says like instead "Watch Channel 28" when you are viewing a tv show guide entry on channel 28 that isn't on right now (or pre-recorded). That works fine!

However, when clicking it, it simply goes to video playback of the last channel sage was tuned too on whichever tuner card it happens to decide on (two cards both have the same guide).

The half working part though, is if sage is currently watching some OTHER channel at the time you select "Watch Channel #"... it WILL change to that channel and start watching it! Pretty weird huh?

I've looked and looked and cannot figure out why it wont work when nothing is currently being viewed at the time, yet works fine when something is on, even a prerecorded show I was watching.

This is a rundown of what I added in "THEME ORGANIZER/PanelThemes/EPGCell/Mouseclick...etc.../Options Panel/Basic Options Panel":

Code:
IF ((GetAiringStartTime(Airing) > Time()) || (GetAiringEndTime(Airing) < Time())) && (MediaFile == null)
   Watch Channel {item}
     ChannelChange {attr}
     ChannelChange = GetAiringChannelNumber(Airing) {action}
       ChannelSet(ChannelChange) {action}
         !DisplayInfo {alias}
         MediaPlayer OSD {alias}
     DefaultFocus {attr}
     Watch Channel Panel {graphic setup}
       "Watch Channel " + GetAiringChannelNumber(Airing) {action text}
       Play Icon Panel {alias}
Thats it... and it works almost perfectly, except when nothing else is being watched, it refuses to change to the right channel when it goes to watching.

I have tried using the live tv command, then issuing a channel change to the selected tv show's channel... but that resulted in the exact same behavior. I tried linking out to aliases used in Watch Now, but that resulted in errors of "This show isnt aired yet" (obviously)...

Stumped! Any ideas oh great gurus of ... gurudom?
Reply With Quote
  #2  
Old 01-09-2007, 03:09 PM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
I would instead 'Watch(airing)' where airing is the current program on the channel in question. There is an api 'GetAiringsOnChannel...' that can get you the airing and I believe there is one called GetAiringsOnChannelAtTime or something like that but look at the API. I seem to remember it in either the Database branch or the Global branch.

BobP.
Reply With Quote
  #3  
Old 01-09-2007, 03:14 PM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
Quote:
Originally Posted by IncredibleHat

Stumped! Any ideas oh great gurus of ... gurudom?
Try

Code:
- Airings = GetAiringsOnChannelAtTime(ChannelChange, Time(), Time() + (60*1000), false)
+- Watch(GetElement(Airings, 0))
Edit: Bob's tooooo fast ...

Dirk
Reply With Quote
  #4  
Old 01-09-2007, 03:18 PM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
Quote:
Originally Posted by flachbar
Try
Edit: Bob's tooooo fast ...

Dirk
Maybe but you were more accurate. I was going to make him work for it.
Reply With Quote
  #5  
Old 01-09-2007, 03:55 PM
IncredibleHat IncredibleHat is offline
Sage Aficionado
 
Join Date: May 2006
Posts: 352
Quote:
Originally Posted by BobPhoenix
Maybe but you were more accurate. I was going to make him work for it.
Heh... after your first reply, I sent my laptop into sleep mode while I dove into the htpc and dug around for what you were talking about... came pretty darn close, but got all screwed up with the elements.

Thanks to both... I will try messing with the code posted to see if I can get that working instead.

On a side note, I stumbled across being able to change aspect ratio during playback without having to bury myself into option menus So, some good came out of having me work for it! LOL.
Reply With Quote
  #6  
Old 01-09-2007, 04:59 PM
IncredibleHat IncredibleHat is offline
Sage Aficionado
 
Join Date: May 2006
Posts: 352
Agh.... I cant get it to work. Actually, cant get it to work at all lol!

Keeps giving me "error -12 there was a null object requested to playback". I've tried various ways of using the airing that should be on that channel 'now'... but each time it breaks. Once it actually 'cleared out' the program guide ! Woops. As I was overwriting the object of Airing with the one 'now'... which was null for some reasons.

I have to take a break, but will dive back into it later after some mythbusters
Reply With Quote
  #7  
Old 01-09-2007, 06:07 PM
IncredibleHat IncredibleHat is offline
Sage Aficionado
 
Join Date: May 2006
Posts: 352
SageTV 6 must be busted ?

No matter how I go about it, "GetAiringsOnChannelAtTime" always returns null. I've tried dynamic channel numbers, hard set numbers, I've tried higher time frames, lower, I've tried true and false on must start within timeframe... it always, reptitively returns null.

I even stuck that in the title of the button to see what it comes with, and its null! AGH! The channel number shows up fine, lol.

I'm going to go back to idea #1: watch live tv and change the channel. At least that worked halfway... just have to figure out why it doesnt work when nothing is currently playing.
Reply With Quote
  #8  
Old 01-09-2007, 06:24 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Most likely you're not calling it correctly. Note that the first argument to GetAiringsOnChannelAtTime is not an integer (channel number) or String (channel name), it's a Sage.Channel, which you must obtain from the ChannelAPI, e.g. by calling GetChannelForStationID.

That said, it seems from your description that what you really want is not "watch this channel" but "watch this program as soon as it starts". That might actually be easier to code, since it can be done by simply forking off a thread that sleeps for a bit and then jumps to "Watch Now".
__________________
-- Greg
Reply With Quote
  #9  
Old 01-09-2007, 06:28 PM
Tiki's Avatar
Tiki Tiki is offline
Sage Icon
 
Join Date: Feb 2005
Location: Southwest Florida, USA
Posts: 2,009
Quote:
Originally Posted by IncredibleHat
SageTV 6 must be busted ?

No matter how I go about it, "GetAiringsOnChannelAtTime" always returns null. I've tried dynamic channel numbers, hard set numbers, I've tried higher time frames, lower, I've tried true and false on must start within timeframe... it always, reptitively returns null.

I even stuck that in the title of the button to see what it comes with, and its null! AGH! The channel number shows up fine, lol.

I'm going to go back to idea #1: watch live tv and change the channel. At least that worked halfway... just have to figure out why it doesnt work when nothing is currently playing.
I haven't tested this, but according to the API documentation, the GetAiringsOnChannelAtTime() function requires a Channel object (not a string or an integer of the channel name or number. You should be able to use the GetChannel() function to get the channel object for the airing you are interested in.

public sage.Channel GetChannel(sage.Airing Airing)


public sage.Airing[] GetAiringsOnChannelAtTime(sage.Channel Channel,
long StartTime,
long EndTime,
boolean MustStartDuringTime)
Reply With Quote
  #10  
Old 01-09-2007, 06:32 PM
BobPhoenix BobPhoenix is offline
SageTVaholic
 
Join Date: Oct 2004
Posts: 3,152
Try this:
Code:
- Airings = GetAiringsOnViewableChannelsAtTime(Time(), Time() + 1, false)
+-Airings = FilterByMethod(Airings, "GetAiringChannelNumber", "<your channel number string here>", true)
   +- Watch(GetElement(Airings, 0))
BobP.
Reply With Quote
  #11  
Old 01-09-2007, 06:58 PM
IncredibleHat IncredibleHat is offline
Sage Aficionado
 
Join Date: May 2006
Posts: 352
Found it! Thanks for the hints about Channel Key instead of channel number. TOTALLY makes sense... didn't think it was that way, but now that I see if, it makes perfect sense!

When I do this it works:

Code:
Watch(GetElement(GetAiringsOnChannelAtTime(GetChannel(Airing), Time(), Time()+60000, false), 0))
Thats the combined method. Hard to read, but it works. Broken out its this:

Code:
ChanOBJ = GetChannel(Airing)
  AirLIST = GetAiringsOnChannelAtTime(ChanOBJ, Time(), Time()+60000, false)
    AirELM = GetElement(AirLIST, 0))
      Watch(AirELM)
This works exactly how I want it. This then gives instant gratification to the 'guest user' when they click to watch. Before they would go into 'record now' and get all lost and then yell at me from across the house on "why isnt this damned thing working right?!"... of which I had to constantly re-explain "You cant watch something that isnt yet ON... you have to go back to a show that is currently playing to tune to that channel."

Now, this allows them to easily tune to that channel and sit like a couch potatoe for the show to come on. Lol.

Me, I just have everything recorded and I never watch live tv ha!

Thanks for all the help guys! I was totally missing that one teeny little thing.

PS: 60000 is a bit much really... 1000 hours worth ? I'm sure doing like 10 hours would be sufficient enough, I would hope... I've never seen a show on for longer than 10 hours LOL.

Last edited by IncredibleHat; 01-09-2007 at 07:04 PM.
Reply With Quote
  #12  
Old 01-09-2007, 07:10 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by IncredibleHat
PS: 60000 is a bit much really... 1000 hours worth ?
Times are measured in milliseconds, not minutes. 60,000 == 1 minute.
__________________
-- Greg
Reply With Quote
  #13  
Old 01-09-2007, 07:19 PM
IncredibleHat IncredibleHat is offline
Sage Aficionado
 
Join Date: May 2006
Posts: 352
Oy. Gotcha.
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 02:33 AM.


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