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-17-2007, 10:32 AM
abasu2003's Avatar
abasu2003 abasu2003 is offline
Sage Expert
 
Join Date: Jul 2004
Posts: 551
Setup conflicts between Different Encoders - Programming Question

Hi all. I have more of a programming architecture question rather than a SAGE API question.


I want to create a conflict screen alerting me when two or more encoders are set to record at the same time. Now, I know how to get the full recording schedule for any encoder and I guess I would just need to compare one list against another, but is there a better way of doing this than a loop. The only thing I can think of is that I take one recording from encoder 1 and compare it to every other recording on another encoder 2, then take the next recording on encoder 1 and compare it to every other recording on encoder 2, etc.

I haven't really taken advanced programming classes and I have to think there is a better architectural solution than the one I thought of. My way seems to have a ton of steps.
Reply With Quote
  #2  
Old 01-17-2007, 12:56 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
In general, when you have two lists you want to compare, you sort them both (by time in this case) and then pass them against each other. I.e. you compare the first entry of each list. If the entry from list A is less, step to the next entry in list A. If the entry from list B is less, step to the next entry in list B. If the entries match, you have a conflict. Keep doing this until one list or the other has been used up. For large lists this is much more efficient than doing an MxN comparison of every entry from list A with every entry from list B.

However for this particular problem you shouldn't need separate lists. Use GetScheduledRecordings to get the complete schedule, sort it by start time, and then make a single pass through it looking for consecutive entries that overlap in time.
__________________
-- Greg
Reply With Quote
  #3  
Old 01-17-2007, 02:27 PM
abasu2003's Avatar
abasu2003 abasu2003 is offline
Sage Expert
 
Join Date: Jul 2004
Posts: 551
Quote:
Originally Posted by GKusnick
In general, when you have two lists you want to compare, you sort them both (by time in this case) and then pass them against each other. I.e. you compare the first entry of each list. If the entry from list A is less, step to the next entry in list A. If the entry from list B is less, step to the next entry in list B. If the entries match, you have a conflict. Keep doing this until one list or the other has been used up. For large lists this is much more efficient than doing an MxN comparison of every entry from list A with every entry from list B.

However for this particular problem you shouldn't need separate lists. Use GetScheduledRecordings to get the complete schedule, sort it by start time, and then make a single pass through it looking for consecutive entries that overlap in time.
Thanks. This is why I asked.
Reply With Quote
  #4  
Old 03-03-2007, 08:13 AM
PhillJones PhillJones is offline
Sage Aficionado
 
Join Date: Feb 2006
Location: Boston, MA
Posts: 270
Quote:
Originally Posted by abasu2003
Hi all. I have more of a programming architecture question rather than a SAGE API question.


I want to create a conflict screen alerting me when two or more encoders are set to record at the same time. Now, I know how to get the full recording schedule for any encoder and I guess I would just need to compare one list against another, but is there a better way of doing this than a loop. The only thing I can think of is that I take one recording from encoder 1 and compare it to every other recording on another encoder 2, then take the next recording on encoder 1 and compare it to every other recording on encoder 2, etc.

I haven't really taken advanced programming classes and I have to think there is a better architectural solution than the one I thought of. My way seems to have a ton of steps.
I would just like to add my encouragement to this project. If you could create a list of conflicts that would be great, automatically resolving them would be the best thing since sliced bread. Everyone who use firewire recording and s-video from the same cable box would love you forever. The official position from sage is that it will never be supported so such a plugin will be very useful.
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 06:11 PM.


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