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 07-27-2010, 10:35 PM
iolaus iolaus is offline
Sage Advanced User
 
Join Date: Jan 2008
Posts: 83
STVi Feasibility Question

Hey Guys,

I haven't ventured into Studio land before so before I dive in I'm hoping someone can give me an idea of whether or not what I want to accomplish is possible.

The background:

I've had a NetRemote MediaBridge plug-in for SageTV in the works for over a year now but SageTV's inconsistent playlist behavior (it adds music files to the Now Playing list but not other media files) has prevented me from completing it.

I've had a couple long e-mail discussions with the SageTV devs and despite explaining as clearly as I could that the issue makes it nearly impossible to implement a multi-instance external playlist control they've been unwilling to change the behavior.

The idea:

So, I'd like to create a STVi that fixes the SageTV playlist system so it acts consistently with all standard media. I'd like audio, video, dvds, and completed recordings, when started, to clear the existing Now Playing list and then be added as the sole item in that list. It would also be nice (but not necessary) if I could add some sort of dummy entry to the Now Playing list to identify when live TV or an incomplete recording are playing.

I'm hoping this proposed plug-in would allow me to finally complete my NetRemote MediaBridge plug-in and release it to the community.
Reply With Quote
  #2  
Old 07-28-2010, 04:44 AM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Sure it's all possible and pretty easy really. Not really understanding what you are wanting to do or control, but all now playing list are stored by uicontext so it is doable. In fact I clear out the now playing list in mymovies when a video is played an add in only the video played, but I do it for trailer and intro playback reasons. Definately doable, but also wanted to say sage handles them the way they should by default in my opinion, but if you don't like that in your case it is pretty easy to change.
Reply With Quote
  #3  
Old 07-28-2010, 04:18 PM
iolaus iolaus is offline
Sage Advanced User
 
Join Date: Jan 2008
Posts: 83
Plucky,

Thanks for the info. The problem I have is that SageTV, by default, doesn't update the Now Playing list for anything other than music files. So, if I queue up a few files (music, video, etc) in the Now Playing list using my plug-in, and then play a video using the SageTV UI, the plug-in has no way of knowing that the queue has changed.

I'd like to prevent SageTV from ever going into "Single File Mode" (unless playing LiveTV) like you do with SMW so I can keep multiple instances of my plug-in synced with the current SageTV queue.

Is there a way for me to catch all Watch() commands and make sure that the Now Playing list gets cleared, the target gets added to the Now Playing list, and the Now Playing list gets played? Or would I have to update each and every UI item that can trigger a Watch() event to make sure it does those steps?
Reply With Quote
  #4  
Old 07-28-2010, 05:55 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Yes you could do it with a plugin implementation that gets fired on media playback started and stopped.( I think that gets fires on music as well) Or you could link to all the various areas in the stvi. The first option would be easiest in my opinion.
Reply With Quote
  #5  
Old 07-28-2010, 07:10 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by iolaus View Post
...so I can keep multiple instances of my plug-in synced with the current SageTV queue.
I'm not sure I follow this. There will presumably be at most one instance of your plugin per client, and each client has its own Now Playing list. So unless I'm misunderstanding something, there shouldn't be any cases where multiple instances of your plugin need to sync with the same playlist.

I'm also not clear on why you want to make an exception for Live TV. How do you define "live" in a way that makes sense for different users accessing the same content through different menus on different clients? (E.g. user A pushes the Live TV button, user B chooses the same program from the guide, while user C picks it from the Recordings list, and expects it to behave like any other recording. But they're all watching the same thing.)

I'm somewhat skeptical that you'll be able to do what you want by handling PlaybackStarted events. Note the past tense: playback has already started (in what you're calling "Single File Mode") by the time the event fires. So if your goal is to prevent that, then I don't see any alternative to replacing all calls to Watch with new code that adds the file to the Now Playing list and calls StartPlaylist instead.

That's not to say you need to duplicate that code in many places. You can code it just once and put references at all the relevant places.

If you want to get tricky, you can hand-code your STVI's import handler to dynamically search-and-replace calls to Watch at import time, instead of editing them all manually in Studio. But the built-in STVI generator won't generate that kind of code for you automatically; you'd have to code the transform yourself, the old-fashioned way, which requires a pretty thorough understanding of the WidgetAPI. (Once upon a time, all STVIs were built that way, as hand-coded editing scripts that ran at import time to make the necessary widget changes.)

But before getting too deeply into all of that, I'd strongly suggest reading the Studio manual and working through the tutorial exercises (if you haven't already) in order to get a good grasp of the Studio programming paradigm and widget code execution model, which is substantially different from any other programming system you've used before.
__________________
-- Greg
Reply With Quote
  #6  
Old 07-28-2010, 07:21 PM
PLUCKYHD PLUCKYHD is offline
SageTVaholic
 
Join Date: Dec 2007
Posts: 6,257
Quote:
Originally Posted by GKusnick View Post
I'm not sure I follow this. There will presumably be at most one instance of your plugin per client, and each client has its own Now Playing list. So unless I'm misunderstanding something, there shouldn't be any cases where multiple instances of your plugin need to sync with the same playlist.
I think he meant all clients and extenders synched with his program at least that was my understanding so he can see what is playing on every instance of sage.

Greg is also right about the widget API it is very powerful and universal but has a good learning curve. I didn't bother to learn it until recently and now I am starting to use it more and more.

I wasn't around sage in the "olden days "

He also has a good point on the playback started it could take a bit to for that depending on how many plugins are in line and where you stand so ignore that suggestion that was my bad.
Reply With Quote
  #7  
Old 07-28-2010, 10:06 PM
iolaus iolaus is offline
Sage Advanced User
 
Join Date: Jan 2008
Posts: 83
That's great info guys.

GKusnick,

The idea with multiple instances is if I have touchscreens around the house (and perhaps have portable touchscreen devices) that I'd like to be able to control any SageTV client from any of those devices. I'd also like each of those devices to be able to show an accurate playlist for the selected client. You probably wouldn't be queuing video on a client from varying locations very often, but perhaps audio (or maybe even music videos). It might also be useful for some people to do a quick check on what the kids are watching. The reason I'm making an exception for LiveTV is that the idea of queuing something to play after LiveTV doesn't really make sense. I'm drawing a distinction between LiveTV (TV that is currently recording and will continue on to the next program if you begin watching it) and Recorded TV (recordings that have completed and will simply stop when they reach the end of the file). Also, as far as I know, LiveTV doesn't work with the Now Playing list.

Of the two solutions you proposed the hand-coded search and replace definitely sounds like the more appealing option. It seems like it could be daunting to hunt down all the instances of Watch() calls. I've begun reading the Studio Guide and playing around a little bit, do you happen to know of any examples of a search-and-replace type scheme that I could look at for guidance?
Reply With Quote
  #8  
Old 07-29-2010, 01:41 AM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Quote:
Originally Posted by iolaus View Post
Of the two solutions you proposed the hand-coded search and replace definitely sounds like the more appealing option. It seems like it could be daunting to hunt down all the instances of Watch() calls. I've begun reading the Studio Guide and playing around a little bit, do you happen to know of any examples of a search-and-replace type scheme that I could look at for guidance?
Finding all calls to Watch during interactive Studio editing is actually pretty easy if you use my Studio Tools plugin, which includes an advanced Search feature that (if I say so myself) is considerably more flexible and user-friendly than the built-in Find function.

I'm hard-pressed to think of any current examples of hand-coded import scripts, since almost nobody does it that way anymore. You might be able to find something among the older STVIs in the Downloads section. But basically the idea is that you write a handler for the STVImported hook and iterate through the ExistingWidgets array looking for Action or Conditional widgets whose expression (which you access with GetWidgetName) contains a call to Watch. Having found one, you'd then use various WidgetAPI methods to insert, delete, and dispose of child widgets to establish the new widget structure you require.

But again, this is pretty advanced stuff for a Studio newbie, since you're programming at one remove from the actual code (i.e. writing a program to edit the code for you, instead of editing it yourself manually). You might want to start with manually editing a few calls to Watch and making STVIs the normal way (using the built-in STVI generator) until you're comfortable with your Studio skills and have a better feel for the overall feasibility of your project.
__________________
-- Greg
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
STVi Generation Question jorton SageTV Studio 7 07-22-2010 03:30 PM
STV/STVI/Theme Question jorton SageTV Studio 5 06-28-2010 02:53 PM
Help importing STVI Belgrath SageTV Customizations 2 08-08-2009 07:59 PM
importing stvi/xml question Chroner SageTV Customizations 7 12-03-2006 10:46 AM


All times are GMT -6. The time now is 06:08 PM.


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