PDA

View Full Version : Add songs via command line

MeSue
2006-02-13, 12:25
J River Media Center has a Send To > External Tool command that can be configured with a program path and parameters. I was hoping this could be used to send songs directly to the squeezebox playlist from MC, but I can't figure it out.

Program path: G:\Program Files\SlimServer\server\slim.exe

(MC replaces [FILENAME] with the full path of the song.)

All it does is flash a command window on the screen but it goes away too fast for me to read it. Is there something I'm doing wrong or is this just hopeless?

mherger
2006-02-13, 13:07
> Program path: G:\Program Files\SlimServer\server\slim.exe
> Parameters: 00%3A04%3A20%3A05%3Ad1%3A39 playlist play [FILENAME]

You can't imho run slim.exe to manipulate the playlist.

A while back I created a perl script which allows to feed files to the

http://forums.slimdevices.com/attachment.php?attachmentid=785&d=1138018586

You'll need perl to run this. But I'm sure a vbs wiz could come up with
that solution in a few minutes ;-)

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

MeSue
2006-02-13, 21:40
Well, I'm neither a perl or vbs wiz so I just have to rely on begging. A while back I posted an idea for some kind of EXE drop target widget that could pass songs off to SlimServer, but it didn't get any response. Guess all I can do is keep waiting and wishing.

mherger
2006-02-14, 01:02
> Well, I'm neither a perl or vbs wiz so I just have to rely on begging. A

You don't need to be a perl wiz to get this working. I just meant if you
preferred _not_ to install perl and you were a VB wiz, it would be easy to

Now, if you feel like giving this a try, download and install perl from
activestate.com.

- Edit the server, player and path settings in feedmyslim.pl to match your
environment.
- edit the path to the script file in the registry file (eg.
"m:\\feedmyslim.pl") - keep the double backslashes!
- double click the registry file to import it
- right click your music folder

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

MeSue
2006-02-14, 21:28
Well, I fooled with it for a while and didn't get anywhere. Can you be more specific about what I'm supposed to edit in the feedmyslim.pl file? I assume these lines...
my $localFolder = "d:"; # the folder where the file is stored from the client's view my$serverFolder = "d:"; # dito. from the server's point of view

...but I don't know what is meant by "the file." Anything else besides that?

And assuming I get the script figured out… will I be able to use it in the send to menu of MC?

Fred
2006-02-15, 00:22
And assuming I get the script figured out… will I be able to use it in the send to menu of MC?

Yes, using the same command that is in the .reg file, i.e.

wperl m:\\feedmyslim.pl --file=\"%L\"

(Of course you should replace m:\\ with the path to the changed version of feedmyslim.pm (c:/slim/stuff/feedbmzslim.pl), and \"%L\" with "[FILENAME]" I think from your post.

Can you be more specific about what I'm supposed to edit...

First question: is Slim Server running on the same machine that will execute the script (the media center) ? If yes, then case A, otherwise B.

my $szServerIP = "127.0.0.1"; A: no change B: change to the IP address of the computer running slimserver my$serverFolder = "d:";

A&B: change to the location of your music library as configured in Slim Server

my $localFolder = "d:"; A: same as$serverFolder

B: the idea here is that you will send the path to the song file as seen by your PC, but since SlimServer is running on ANOTHER machine, the path may be different between the two. That is, if slim server runs on server with music library on D: but that your local PC mounts this using U:, when you want to play U:/abba.mp3, the script will change it to D:/abba.mp3.
In the above example the value here would be "u:".

my \$szPlayerName = "mySqueezebox";

A&B: set this to the name of your player.

HTH

Fred

mherger
2006-02-15, 00:56
Fred,

Thanks for translating my code! I'll have to keep your descriptions for
further requests. As you got the idea from my code, I assume the latter
makes sense ;-).

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

MeSue
2006-02-15, 09:45
Michael,

Your code made sense to me too, but when it wasn't working I started second guessing myself. Anyway… I still can't get it to work, neither through the reg file or from MC.

I checked it in regedit and the registry file is merging properly, but when I right click on a folder and choose "Play on Sqeezebox" (BTW, you left out a U there), it asks me choose the program to open the file. I choose "Perl command line interpreter." Then the command window flashes on and off and nothing changes in the playlist when I refresh the SS Web page.

In MC, I put:
Program Path: F:\Other\feedmyslim.pl
Parameters: --file="[filename]"

The command window flashes by real fast, but nothing changes in the playlist.

I also tried putting wperl in front of the path in MC, but when I do that I just get an error that the file can't be found.

SlimServer does run on the same machine where I execute the script, and my music folder is K:\MP3. I noticed Fred reversed the slashes in most of his examples, so maybe it has to do with that? I think I tried every combination of slash and backslash, but never could get it to work.

mherger
2006-02-15, 12:23
MeSue

> Then the command window flashes
> on and off and nothing changes in the playlist when I refresh the SS Web
> page.

What happens if you run it from the command line:

pwerl feedmyslim.pl

> I also tried putting wperl in front of the path in MC, but when I do
> that I just get an error that the file can't be found.

Have a look at how it's done in the .reg file:

wperl m:\feedmyslim.pl --file="d:\path\to\your\music"

should work.

> SlimServer does run on the same machine where I execute the script, and
> my music folder is K:\MP3. I noticed Fred reversed the slashes in most
> of his examples, so maybe it has to do with that? I think I tried every
> combination of slash and backslash, but never could get it to work.

Use single forward slashes in the perl script.

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
StringEditor Plugin (http://www.herger.net/slim/)

MeSue
2006-02-15, 17:37
I don't know what 'wperl' in front of it, is supposed to do, but my system doesn't like it. BUT I managed to add a song from the command prompt, using this command:

F:\Other>feedmyslim.pl --file="K:\MP3\4 Non Blondes\1992 - Bigger, Better, Faster, More\01 Train.mp3"

So that's progress! I still can't get it working in MC, though. I have to break it up into "Program path" and "parameters." It doesn't work if I put it all in one line or the other.

HOLY CRAP… I just got it! This works:
Program Path: F:\Other\feedmyslim.pl
Parameters: --file=[FILENAME]

(No quotes around the filename.)

So… That works fine for one song at a time, but what I was hoping to do is highlight multiple files in MC and use Send To > SlimServer. When I tried multiple files, though, it only sends the last 3 or 4. :-(

Thanks for helping me out so patiently.

mherger
2006-02-16, 05:05
> I don't know what 'wperl' in front of it, is supposed to do, but my
> system doesn't like it. BUT I managed to add a song from the command
> prompt, using this command:

But you have ActivePerl installed on your system, don't you? wperl is the
Windows version of perl which will not open a DOS window.

> So that's progress!

Excellent :-)

> HOLY CRAPâ€¦ I just got it! This works:
> Program Path: F:\Other\feedmyslim.pl
> Parameters: --file=[FILENAME]

Interesting. I would have expected wperl.exe to be the program and all the
rest (including the feedmyslim.pl) to be the parameters.

> Soâ€¦ That works fine for one song at a time, but what I was hoping to do
> is highlight multiple files in MC and use Send To > SlimServer. When I
> tried multiple files, though, it only sends the last 3 or 4. :-(

You're right. The script currently is limited to one song or folder at a
time.

--

Michael

-----------------------------------------------------------
Help translate SlimServer by using the
SlimString Translation Helper (http://www.herger.net/slim/)

MeSue
2006-02-16, 08:54
Interesting. I would have expected wperl.exe to be the program and all the rest (including the feedmyslim.pl) to be the parameters.

Okay… now that you mention it, that works too. I guess it isn't needed because pl files are associated with wperl.exe.

If you ever decide to update it so it works with multiple files from different folders, please let me know. Thanks again for the help.