gmusicbrowser Forum

Main board => Customization => Topic started by: peedanee on May 28, 2012, 08:07:18

Title: RunPerlCode Documentation
Post by: peedanee on May 28, 2012, 08:07:18
Hi, I'm new here.

Are there any RunPerlCode documentation of gmusicbrowser available?

I have problem when I try to make custom MenuItem which able to import files and folders and its subfolders to library.
Because RunPerlCode(::ChooseAddPath(0,1)) just won't do the trick.
Title: Re: RunPerlCode Documentation
Post by: Quentin Sculo on May 28, 2012, 17:45:00
There is no documentation for RunPerlCode and there will never be, because it's just there in case the existing commands don't do what you need, and you really want to do it :)
I have allowed some, at least ::ChooseAddPath(0,1), in the included layouts, but I'll replace them once I finish the new command system that should allow many more things and in a much more organized way.
What do you want to do exactly ?
Title: Re: RunPerlCode Documentation
Post by: peedanee on May 28, 2012, 18:45:53
Hi, Quentin.  :D

I was making customize layouts. The other parts was done except this particular one.
Please take a look at this part:
BMMenu  = (icon=gtk-preferences,size=large-toolbar) LayoutItem \
  MenuItem1(command="RunPerlCode(::ChooseAddPath(0,1))",label=_"Import to library") \
  MenuItem2(command="RunPerlCode(::IdleCheck)",label=_"Check Library") \
  MenuItem3(command="RunPerlCode(::IdleScan)",label=_"Rescan Library") \
  MenuItem4(command=OpenCustom(Equalizer),label=_"Show Equalizer") SeparatorMenuItem1 \
  MenuItem5(command=OpenPref,label=_"Preferences") SeparatorMenuItem2 \
  MenuItem6(command="RunPerlCode(::AboutDialog)",label=_"About")

I want MenuItem1 to be able to "import files/folders/subfolders" to library. ::ChooseAddPath(0,1) can't do that.  :'(
When I tried to find a way to do that I read gmusicbrowser command list, I thought "AddToLibrary" command can do that.
But I was clueless. (FYI I'm not programmer)
I'm glad if you could help me.
Title: Re: RunPerlCode Documentation
Post by: Quentin Sculo on May 28, 2012, 20:02:09
You probably want ::ChooseAddPath(1,1) it will add the files/folder you select to the library. (if the first argument is true it will add them to the library, second argument will allow selection of files if true.)
Title: ReĀ : RunPerlCode Documentation
Post by: peedanee on May 29, 2012, 13:10:46
Thank you.  :)

But it's strange that ::ChooseAddPath(1,1) works on multiple folders only, I can't import single folder.

Please, care to take a look at my custom layout: NoisyBox . What do you think? :)

http://forum.gmusicbrowser.org/index.php?topic=605.0
Title: Re: RunPerlCode Documentation
Post by: Quentin Sculo on May 29, 2012, 19:37:35
QuoteBut it's strange that ::ChooseAddPath(1,1) works on multiple folders only, I can't import single folder.

I think the problem is that if "selecting files" are allowed (second "1" in arguments), double clicking on a folder opens it instead of selecting it. To import a folder you have to select it and then click ok.
Title: Re: RunPerlCode Documentation
Post by: peedanee on May 30, 2012, 06:07:42
Still, the import only works when I select multiple folders then click OK.

When I select single folder then click OK, nothing happens.  :'(
Title: Re: RunPerlCode Documentation
Post by: Quentin Sculo on May 30, 2012, 19:42:01
It works perfectly for me.
Can you run it from a terminal and look at its output after doing this ?
It should print a line by folder scanned : ScanFolder(...)
Title: Re: RunPerlCode Documentation
Post by: peedanee on May 31, 2012, 08:38:57
I'm sorry, but I don't know how to run it from terminal.  :-[

I tried to run this:
gmusicbrowser -cmd RunPerlCode(::ChooseAddPath(1,1))

But I got this instead:
bash: syntax error near unexpected token `('
Title: Re: RunPerlCode Documentation
Post by: Quentin Sculo on June 06, 2012, 19:44:08
Sorry I somehow missed your reply, I meant run gmb (not the command itself) from the terminal, and see the output.
If you want to run the command from the terminal, you have to use quotes : gmusicbrowser -cmd 'RunPerlCode(::ChooseAddPath(1,1))'

Anyway, I found the bug after upgrading my system, it is a problem with recent gtk versions.
It is now fixed on git : http://git.gmusicbrowser.org/commit/901647d67c
Title: Re: RunPerlCode Documentation
Post by: peedanee on June 08, 2012, 03:28:29
Oh, I'm sorry I didn't understand what you meant back then.  :-[

But I'm glad you found the bug.

I'm looking forward for the next release. :)
Thank you Quentin.