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-23-2007, 06:48 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Must be doing something stupid, can't pass a variable to a new menu.

OK, trying to pass "TheVideoList" to a new menu from the Video - Browser menu. I had this working before, I added an attribute for it in a Panel parent to it's current one and the one I'm trying to pass from. For some reason I can't get it to work today though using the latest STV.

I've added a button to the bottom of the controls, so it's in Extra_Panel_1 (I think that's the right one).

Can anybody point out the really simple thing that I can't seem to see?

Thanks

Attached Files
File Type: zip SageTV3wImportMenu.zip (552.0 KB, 226 views)
Reply With Quote
  #2  
Old 01-23-2007, 07:12 PM
MeInMaui's Avatar
MeInMaui MeInMaui is offline
SageTVaholic
 
Join Date: Feb 2005
Location: Maui. HI
Posts: 4,203
Hi Stanger,

Have you tried using AddStaticContext("Name",Object) instead of placing an attribute higher in the tree? This has worked for me. HTH

Quote:
AddStaticContext

public java.lang.Object AddStaticContext(java.lang.String Name, java.lang.Object Value)

Sets the variable with the specified name to the specified value. This variable will exist for the lifetime of the current Menu. When the next Menu transition occurs, all values in the static context will be copied to the highest level context for the new Menu. The static context is then cleared. This is the way you can pass an Object from one menu to another, an example is showing the detailed info for an Airing by adding the Airing to the static context and then transitioning to a Menu that will display the details for that Airing.

Parameters:
Name - the name to use for this 'static context' variable
Value - the value to set this 'static context' variable to
Aloha,
Mike
__________________
"Everything doesn't exist. I'm thirsty." ...later... "No, it's real!!! I'm full."
- Nikolaus (4yrs old)

Last edited by MeInMaui; 01-23-2007 at 07:16 PM.
Reply With Quote
  #3  
Old 01-23-2007, 07:18 PM
dflachbart dflachbart is offline
SageTVaholic
 
Join Date: Jan 2006
Location: Brookfield, CT
Posts: 2,743
Quote:
Originally Posted by stanger89
OK, trying to pass "TheVideoList" to a new menu from the Video - Browser menu. I had this working before, I added an attribute for it in a Panel parent to it's current one and the one I'm trying to pass from. For some reason I can't get it to work today though using the latest STV.

I've added a button to the bottom of the controls, so it's in Extra_Panel_1 (I think that's the right one).

Can anybody point out the really simple thing that I can't seem to see?

Thanks

Just sitting here with Studio open, so I had a quick peek
Well, there's already another Attribute 'TheVideoList' defined in the 'DVDs Panel', so without debugging into it I would think that the value might get reset before you are trying to pass it to the other menu.

Rename your new Attribute (e.g. 'ImportVideoList'), and add 'ImportVideoList = TheVideoList' to the two places where 'TheVideoList' gets initialized. Alternatively you could also just use the already existing 'SortedVideoList' (which also gets initialized with 'TheVideoList'), though it seems that this one can get set to other values too

Dirk
Reply With Quote
  #4  
Old 01-23-2007, 09:28 PM
Opus4's Avatar
Opus4 Opus4 is offline
Administrator
 
Join Date: Sep 2003
Location: NJ
Posts: 19,624
Quote:
Originally Posted by flachbar
there's already another Attribute 'TheVideoList' defined in the 'DVDs Panel'
Like he said above, the new attribute conflicts with the existing one. Don't remove the existing attribute, because it is used for 2 different views to cache their data so the list doesn't have to be recreated unless the situation calls for it. You can probably create a new attibute at the higher level & rename it like flachbar suggested, but set that new variable to TheVideoList just before TheVideoList is fed to the BrowserVideosTable table.

BTW: You'll also want to limit when your new Import button is available, because TheVideoList isn't valid for some browser views. It is really only used for the title & dvd list views.

And, if you want to send the complete list of imported videos to your custom menu while using any browser view, just send AllVideoFiles instead... or filter it to contain what you want.

- 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.
Reply With Quote
  #5  
Old 01-25-2007, 04:47 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Quote:
Originally Posted by MeInMaui
Hi Stanger,

Have you tried using AddStaticContext("Name",Object) instead of placing an attribute higher in the tree? This has worked for me. HTH

Aloha,
Mike
Thanks, have that in there, but where it is, it can't access the list. I was having trouble finding a way for it to access the Object I wanted it to.

Quote:
Originally Posted by flachbar
Alternatively you could also just use the already existing 'SortedVideoList' (which also gets initialized with 'TheVideoList'),
Briliant! That's great, works perfect.

Quote:
though it seems that this one can get set to other values too
Yup, and I've added logic to remove the button when it's set to something other than a list of airings

Quote:
Originally Posted by Opus4
Like he said above, the new attribute conflicts with the existing one.
Yeah, I knew/figured that was a problem, but I somehow I managed to get myself stuck to where I couldn't make this thing work regardless of what I did.

Fortunately flachbar to the rescue.

Thanks again guys
Reply With Quote
  #6  
Old 02-23-2007, 04:27 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Under the theory that "it's always better to post to an existing thread than to create a new one"...

I'm having some trouble with a regex and I'm puzzled. What I'm trying to do is replace characters in a title that are illegal in filenames. The following regex should do that:

[^a-zA-Z0-9$()#_'`~@{}%! &-.]

However when I do a:
string.replaceAll("[^a-zA-Z0-9$()#_'`~@{}%! &-.]","")

it removes "."s to. Now I know . in a regex matches any character, normally you'd \. it to get the period litteral, however "[^a-zA-Z0-9$()#_'`~@{}%! &-\.]" comes up as an invalid escape sequence.

Am I missing something? Is it a bug (java)? Is there a better way to replace illegal filename characters? Do I just break down and not put "."s in my filenames?

Reply With Quote
  #7  
Old 02-23-2007, 04:46 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Your problem is with the "&-." part. It's taking that to mean all character codes between "&" and "." inclusive. So if you want to keep hyphens, you going to have to find some way of expressing that outside of the square brackets.
__________________
-- Greg
Reply With Quote
  #8  
Old 02-23-2007, 04:50 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
OK, but wouldn't that still match . then? (or technically not . since it starts with the ^)

Ah well, moving the space and - to the end fixed it, ie:

[^a-zA-Z0-9$()#_'`~@{}%!&. -]
Reply With Quote
  #9  
Old 02-23-2007, 04:54 PM
salsbst's Avatar
salsbst salsbst is offline
SageTVaholic
 
Join Date: Jun 2003
Posts: 2,592
Quote:
Originally Posted by stanger89
Under the theory that "it's always better to post to an existing thread than to create a new one"...

I'm having some trouble with a regex and I'm puzzled. What I'm trying to do is replace characters in a title that are illegal in filenames. The following regex should do that:

[^a-zA-Z0-9$()#_'`~@{}%! &-.]

However when I do a:
string.replaceAll("[^a-zA-Z0-9$()#_'`~@{}%! &-.]","")

it removes "."s to. Now I know . in a regex matches any character, normally you'd \. it to get the period litteral, however "[^a-zA-Z0-9$()#_'`~@{}%! &-\.]" comes up as an invalid escape sequence.

Am I missing something? Is it a bug (java)? Is there a better way to replace illegal filename characters? Do I just break down and not put "."s in my filenames?

I'm a regular expression novice or something just slightly more advanced than that; they still make my head hurt, in any case, and probably always will. I will never, ever use Perl.

I use this when I have to get serious with regular expressions: http://tools.osherove.com/CoolTools/...5/Default.aspx

Thought it might come in handy. There are other tools out there, too. This looks like a decent list: http://www.larkware.com/RegexTools.html .

Lastly -- is it possible that your backslash is being interpreted as the Java string escape? Or are you double-backslashing (which I think you should be)? http://www.quepublishing.com/article...p?p=28697&rl=1 (see table 3.1)
Reply With Quote
  #10  
Old 02-23-2007, 04:59 PM
GKusnick's Avatar
GKusnick GKusnick is offline
SageTVaholic
 
Join Date: Dec 2005
Posts: 5,083
Yes, good point. You must double-backslash all RE escapes in string literals to get them past the string-escape logic.

Edit: There are any number of Web-based RE testers as well. Just Google for "regular expression tester" and you'll find several.
__________________
-- Greg
Reply With Quote
  #11  
Old 02-23-2007, 05:06 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Quote:
Originally Posted by GKusnick
Yes, good point. You must double-backslash all RE escapes in string literals to get them past the string-escape logic.

Edit: There are any number of Web-based RE testers as well. Just Google for "regular expression tester" and you'll find several.
Ah, forgot about that.

Anyway, problem and mystery solved now

Quote:
Originally Posted by salsbst
I'm a regular expression novice or something just slightly more advanced than that; they still make my head hurt, in any case, and probably always will. I will never, ever use Perl.
Are you kidding, regular expressions are the greatest thing ever....

...programming wise
Reply With Quote
  #12  
Old 02-23-2007, 05:11 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Ga!!!!

I can't win. The source of this issue was I had a few imports that I couldn't figure out why Sage couldn't find them in DVD Profiler, turned out they had a . in the filename.

OK, fix that, now it finds them, but....

Now it can't find a billion others that have .'s in the name, but apparently I "fixed" the filenames to work with my broken code...



That brings up another point. You know how you google something and you don't quite spell it right and it gives you a suggestion?

Anybody have an idea how to do that in java?
Reply With Quote
  #13  
Old 02-23-2007, 05:12 PM
salsbst's Avatar
salsbst salsbst is offline
SageTVaholic
 
Join Date: Jun 2003
Posts: 2,592
Hey, I'm not knocking regular expressions. They are tremendously valuable for parsing text. I just don't like to parse text!

Don't get me started on Perl, though. Well, actually, I guess I started that. What a shame of a language.
Reply With Quote
  #14  
Old 02-23-2007, 05:14 PM
salsbst's Avatar
salsbst salsbst is offline
SageTVaholic
 
Join Date: Jun 2003
Posts: 2,592
Quote:
Originally Posted by stanger89
...You know how you google something and you don't quite spell it right and it gives you a suggestion?

Anybody have an idea how to do that in java?
Google for "fuzzy search java libarary"?
Reply With Quote
  #15  
Old 02-23-2007, 05:24 PM
stanger89's Avatar
stanger89 stanger89 is offline
SageTVaholic
 
Join Date: May 2003
Location: Marion, IA
Posts: 15,188
Perhaps I could have put more in my post

Thanks for the suggestion, I've been down that road, (fuzzy searching) and I don't recall finding anything helpful.
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.