PDA

View Full Version : CLI rescan question

gharris999
2007-09-19, 21:03
Is there a way to do a "Look for new and changed music" rescan via the CLI? Didn't find anything the the CLI doc or in a forum search. Thanks.

kdf
2007-09-19, 21:22
'rescan' causes SlimServer to rescan the entire music library
'rescan causes SlimServer to rescan only the playlist folder
music file information. This differs from the "rescan" command in
that it first clears the tag database.

So, what you are looking for is the 'rescan' command.
-kdf

On 19-Sep-07, at 9:03 PM, gharris999 wrote:

>
> Is there a way to do a "Look for new and changed music" rescan via the
> CLI? Didn't find anything the the CLI doc or in a forum search.
> Thanks.
>
>
> --
> gharris999
> ----------------------------------------------------------------------
> --
> gharris999's Profile: http://forums.slimdevices.com/member.php?
> userid=115
>
>

gharris999
2007-09-19, 22:24
Actually, now that I think about it, I think my question is a little more involved.

Goal: create a windows short-cut (or batch file) that when double-clicked, causes slimserver to do a new music scan.

Why: I use scripts to mass prepare newly ripped music on my ripping machine (reflac, embed cuesheets, embed coverart, etc) which then copies the new music files up to my slimserver (on a linux box). I'd like the music prep script to trigger a slimserver new music scan as it's last act.

In the past, I've had reasonable luck getting wget to pull off tricks like this. But I'm not sure how to craft the url in this case. This doesn't quite work:

wget http://slim_minuet:9000/Classic/settings/server/basic.html --post-data="rescan=1rescan"

The above does trigger a rescan, but it's a wipe, not a "look for new music" and it stops the currently playing track.

I really don't quite know what I'm doing here, obviously.

kdf
2007-09-19, 22:34
On 19-Sep-07, at 10:24 PM, gharris999 wrote:

>
> Actually, now that I think about it, I think my question is a little
> more involved.
>
> Goal: create a windows short-cut (or batch file) that when
> double-clicked, causes slimserver to do a new music scan.

why not simply call the scanner directly in a shortcut:

"c:\program files\slimserver\server\scanner.exe" -- rescan c:\path\to
\music

-kdf

gharris999
2007-09-19, 22:36
Actually, I think it might be:

wget http://slim_minuet:9000/Classic/settings/server/basic.html --post-data="rescantype=1rescan&rescan=Rescan"

I'll have to wait awhile, before trying this, though, since the wipe rescan currently running takes more than an hour to complete on my server.

gharris999
2007-09-20, 07:23
why not simply call the scanner directly in a shortcut:

"c:\program files\slimserver\server\scanner.exe" -- rescan c:\path\to
\music

-kdf

Because the server is a remote, linux machine.

gharris999
2007-09-20, 11:04
OK, this seems to correctly trigger a new-music rescan on a remote slimserver:

wget -q -O - http://your_ss_ip:9000/Classic/settings/server/basic.html --post-data="language=EN&audiodir=/your_music_path&playlistdir=/your_playlists_path&rescantype=1rescan&rescan=Rescan"

If anyone is interested in using this trick to remotely trigger a Slimserver library rescan, you'll need to fix-up the IP address of that URL with the corrrect IP of your slimserver and also fix-up the paths so they correctly point to your music library and your playlist folder. Also, this assumes your language is English. Look at the source for the page to determine the codes for other languages.

Finally, be aware that this is a URL for Slimserver version 7.

kdf
2007-09-20, 11:16
Using scanner.exe/scanner.pl with command line args as your shortcut would avoid any problems due to changes in the url.
-kdf

jaysung
2007-09-20, 14:37
Hi,
Kdf, don't you realise? It is remote! You can't use any scanner.exe on the windows system since it is not there! One could actually run a shell script on the linux machine:
#!/bin/bash
mainloop {
MUSICDIR=$1 SIZEOFMUSICDIR=du -b while$SIZEOFMUSICDIR -eq du -b \$1; do
sleep 300;
done
# Now we can call the scanner.pl! Don't know the code though.
}
mainloop
------------
The idea is to check the size of the folder periodically. When new content gets uploaded the condition of the while statement is no longer true since the saved value of the size of the folder is no longer correct. A rescan is triggered. And the function is called again. Now I have to admit that I do not script in bash regularly. So DON'T EXPECT the code to work. But if you do some debugging the server would look after himself and you would save a double click on a windump machine. Linux can happily look after it's self. It doesn't need Billyboy to be save. ;) And it's as good as sex.

kdf
2007-09-20, 14:56
my apologies. I'd still suggest a remote trigger, rather than relying on html commands.

Of course, as I mentioned first, all you need to do is send 'rescan' through port 9090. You have a much better chance at have that last longer than a url. I'm sure you'll find many options (like netcat) that can send CLI commands as part of a script or batch file.

cheers,
kdf

jaysung
2007-09-20, 15:13
Hey netcat is great. Also for doing remote batching via the cli. I am just thinking about it. I like cli Interfaces much more than guis and if one polishes the cli a bit one can do all sorts of things with it. Thanks kdf.

gharris999
2007-09-21, 10:29
Yes! Thank you KDF. Netcat was exactly what I was looking for!

Is there a handy internet acronym for "thank you for figuring out what I was trying to ask, even though I was too dense to have really thought the question through..." ?

Anyway, this is now working perfectly for me for triggering a "scan for new music":

echo rescan | nc -w 1 slimsever_ip 9090

Mentioning Netcat in the CLI documentation would be handy for those of us who grew up in the dos/windows world and have only limited Linux experience. As it is, the CLI doc only mentions telnet.