|
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. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
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. |
#2
|
||||
|
||||
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 |
#3
|
||||
|
||||
Quote:
|
#4
|
|||
|
|||
Quote:
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|