|
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 |
#41
|
||||
|
||||
Ben,
I think you are struggling because you are not understanding the difference between a single variable and an array. It would help if you look through your code line by line so you understand what is happening. 1. You call the function GetMediaFiles(), which gets a list of all the Media Files that Sage knows about and stores it in a temporary variable (called "This"). This list actually contains more than just the names of the media files, it contains the actual mediafile objects. Each object is a complex structure containing all of the information about the mediafile. 2. You call the function FilterByBoolMethod(). You pass it 3 parameters. The first one is "This" which is the list of media files from the first step. The second parameter is "IsCompleteRecording|IsManualRecord". These are the names of two other functions from the sage api. Both of these functions can take a medifile object as an argument and both return a boolean result (boolean basically means true or false). So the filterByBoolMethod() function is going to call these two functions for every mediafile stored in the "This" array. Then it is going to take the results and OR them together (the "|" is a bit-wise OR operator). So , if one or the other or both is true, it returns true. The 3rd argument you pass ("true") is matched against the result of the OR operation. So the result is for every media file in your collection, it will check to see if it is a complete recording, then it will check to see if it is a manual recording. If either of these is true, the intermediate value is true, otherwise it is false. Then it compares the intermediate value to the 3rd argument (true) and if they match, that media file will get added to the result (which will be stored in the object variable you called "RecordedFiles". 3. Same as step 2, but this time it will keep anything from the "RecordedFiles" list that is a TVFile, and throw out everything else. 4. You read a property and store its value into a variable called movieCat. 5. Similar to Step 2 and 3, but this time the function is FilterByMethod(), which expects one additional argument. So, this time it will check every mediafile that is stored in the "RecordedFiles" variable to see what its category is. It will compare this to the new argument you are passing (movieCat), and if they match it will get stored back into "RecordedFiles", otherwise it gets thrown out. 6. Now you call the GroupByMethod() function and pass it the "RecordedFiles" object and the function name "GetShowTitle". It returns a map and stores it in your RecordedFiles variable. The map is a special object that is kind of hard to explain, but basically, it grous the objects by assigining each one a key. The key is whatever the function you told it to use (GetShowTitle) returns. So the map is basically a grouped list of all the media files you have left, grouped by title. 7. You assign the contents of "RecordedFiles" to a new variable called "Grouped". (Don't know why - would have made more sense to do this directly in step 6). 8. You check to see if the size of "Grouped" is greater than or equal to 2. For a map object, the function "Size()" returns the size of it (I believe this would be the number of objects stored in the map). If you have more than 2 media files stored in Grouped this will be true. You really want to iterate through each title in the map and see if there are 2 or more media files associated with it. I am not sure if there is a function that does what you want, or if you will need to create a loop that iterates through each title in the map, but this is where you went wrong...
__________________
Server: Ryzen 2400G with integrated graphics, ASRock X470 Taichi Motherboard, HDMI output to Vizio 1080p LCD, Win10-64Bit (Professional), 16GB RAM Capture Devices (7 tuners): Colossus (x1), HDHR Prime (x2),USBUIRT (multi-zone) Source: Comcast/Xfinity X1 Cable Primary Client: Server Other Clients: (1) HD200, (1) HD300 Retired Equipment: MediaMVP, PVR150 (x2), PVR150MCE, HDHR, HVR-2250, HD-PVR |
#42
|
||||
|
||||
Quote:
jaminben: I really think you are going to need to do your filtering in a loop, unless someone comes up with some other way to group/filter your list of videos than the obvious-looking one of checking the size of each subgroup. I know you said you didn't want to mess with a loop, but looking inside a lit house for the glasses you lost outside in the dark just because the light is on inside won't find the glasses. Tutorial 10 of the Studio manual goes over the basics of loops. For the loop, you would need to deal with the list of the group's keys (java_util_Map_keySet), then either remove the subgroups that have single items or copy the multi-item subgroups to a new grouping. You can use java_util_Map_remove() to remove a subgroup item. - 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. |
#43
|
||||
|
||||
Quote:
I grant that this may be beyond Ben's current level of expertise (no offense, Ben).
__________________
-- Greg |
#44
|
|||
|
|||
Quote:
Quote:
Quote:
I'm just gratefull for all the help I'm getting in understanding how things work.
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders |
#45
|
||||
|
||||
Quote:
- 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. |
#46
|
||||
|
||||
Yes, I thought of that after I posted. FilterByMethodRegex() allows extra arguments to be passed, which it then passes through to the supplied method. So that would be a way to get the map passed in to your custom method. The description for FilterByMethod() doesn't say anything about this option, but I seem to recall testing it and finding that it works there too. (At least I added code to handle this case to my API wrappers.)
__________________
-- Greg |
#47
|
||||
|
||||
Quote:
So my advice would be first, to understand the types of objects you're dealing with (e.g. files, arrays, maps, etc.) and second, to limit the use of a given variable to a single type of object, so that when you see a variable name in the code you always know what type it is and what operations are valid on it, without having to read back through the code to see how it got that way (which can be tricky if there are multiple code paths to a given usage).
__________________
-- Greg |
#48
|
||||
|
||||
Quote:
- 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. |
#49
|
||||
|
||||
Guess I'm misremembering then. (Wouldn't be the first time.)
__________________
-- Greg |
#50
|
|||
|
|||
I have to admit that I did think about this but I left it as it was because it worked.
Quote:
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders Last edited by jaminben; 04-28-2009 at 03:40 AM. |
#51
|
|||
|
|||
Ok, so I've been through the Loops tutorial several times now but it just doesn't make any sense. When looking at the result of the basic loop tutorial why does it give a result of 55.
This is how I look at it: First line is Sum = 0 not sure what this means, is it just a reference? Second line is LoopIndex = 1 which means that each time it loops it increments by 1. Third line is the conditional LoopIndex <= 10 which means has the loop gone round 10 times or less if it hasn't continue (true) if it has then its completed its looping (else). First line of true conditional Sum = Sum + LoopIndex which means add sum (0) to loopindex (1 - 10). Second line of true conditional LoopIndex = LoopIndex + 1 which means each time it comes round it adds 1 to loopindex (until its greater than or equal to 10). Third line of true conditional LoopIndex <= 10 reference back to the begining of the "if" conditional if its less than 10 or equal to 10. else which means its the way out of the loop. So where does the on-screen 55 come from. no matter how I look at it, it doesn't add up to 55. I've attached a screenie to quickly show what the sample loop looks like.
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders |
#52
|
||||
|
||||
I don't know studio but a basic loop would set the values as shown below
At the start you set sum to 0 sum = 0 when loop = 1 then sum = 0 + 1 = 1 when loop = 2 then sum = 1 + 2 = 3 when loop = 3 then sum = 3 + 3 = 6 when loop = 4 then sum = 6 + 4 = 10 when loop = 5 then sum = 10 + 5 = 15 when loop = 6 then sum = 15 + 6 = 21 when loop = 7 then sum = 21 + 7 = 28 when loop = 8 then sum = 28 + 8 = 36 when loop = 9 then sum = 36 + 9 = 45 when loop = 10 then sum = 45 + 10 =55 so thats where the 55 comes from I'd guess. |
#53
|
|||
|
|||
Ah, that makes perfect sense now, thanks for that. So the next question would be, how is this going to sort my single recordings?
I'm coming to the conclusion that this is just way to hard for me to understand at my current level so I think the best thing for me to do is give up the dream and go down the pub before I throw the *****NG PC through the window. Quote:
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders |
#54
|
||||
|
||||
I've used bubble sorts in the past where you compare 2 values in an array and then swap them over and keep repeating the process until no values need swapping, but thats a lot of work.
When I was programming in cobol we used sort routines from external modules which makes life a lot easier - you call the module and pass into it a file or array and tell it what characters to sort on. As for Studio? I haven't got a clue but hopefully one of the experts will come back to you soon. |
#55
|
||||
|
||||
Quote:
Quote:
Quote:
Code:
Sum = 0 -- Initialize Sum to 0 LoopIndex = 1 -- Initialize LoopIndex to 0 If LoopIndex <= 10 -- Conditional to see if that value is less than or equal to 10 > true -- Branch to execute if conditional is true Sum = Sum + LoopIndex -- Add LoopIndex to Sum & assign value to Sum LoopIndex = LoopIndex + 1 -- Add 1 to LoopIndex Reference to 'If LoopIndex <= 10' -- Jump back to the conditional > else -- Branch to execute if conditional is not true "Values summed in a basic loop: " + Sum -- Create a string with the Sum in it. Text widget -- Feed the above string to the text widget & display it. Quote:
Studio is easy enough for a non-programmer to move UI elements around & change some of the data displayed, but if you really want to do more programmatically, then you'll need to have an understanding of programming concepts. Then, Studio's programming 'language' is different enough from most programming languages that it takes a bit of understanding to know how to do something different in Studio compared to other languages... such as loops. - 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. |
#56
|
||||
|
||||
Quote:
__________________
-- Greg |
#57
|
|||
|
|||
I also agree and that's why I'm trying to build a new menu from scratch whilst learning and not do my usual trick of "Hack 'n' Slash". Maybe its a bad thing that I've released several imports already and probably should remove them due to the potential dangers of my coding. However in saying that they are free and I always make sure to tell people to backup before they use them.
What you guys are doing is actually more helpful than reading the tutorials as they don't explain what a loop is only how to use it, if that makes sense. Reading java books are also helpful but things aren't really sinking in, hopefully after time I'll start remembering what the difference between strings and objects are
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders |
#58
|
||||
|
||||
Quote:
- 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. |
#59
|
|||
|
|||
Sorry, I wasn't having a pop at the content. Do you fancy writing a programming primer with Studio in mind
__________________
Server - Win7 64bit, 2.4Ghz Intel Core 2 Duo, TBS 6284 PCI-E Quad DVB-T2 Tuner, 3 x HD200 & 1 x HD300 extenders |
#60
|
||||
|
||||
I didn't think you were; I was just confirming your conclusion that the Studio tutorials aren't the very beginning.
I referred you to the Studio manual & tutorials until you mentioned not knowing what '!=' means, at which point I suggested you read something else first. Quote:
- 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. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Studio and SageMC Questions | bama | SageMC Custom Interface | 4 | 07-26-2008 01:11 PM |
Silly Newbie Question: Starting Studio | willetin | SageTV Studio | 2 | 01-05-2008 08:21 AM |
Studio Newbie Question | mightyt | SageTV Studio | 4 | 01-30-2006 01:52 AM |
Some questions about the upcoming Studio. | ToxMox | SageTV Customizations | 26 | 06-08-2004 09:00 AM |