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.

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 ?

#2 May 28, 2012, 18:45:53 Last Edit: May 29, 2012, 11:30:31 by peedanee
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.

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.)

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

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.

Still, the import only works when I select multiple folders then click OK.

When I select single folder then click OK, nothing happens.  :'(

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(...)

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 `('

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

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.