Lestrad wrote:
> Wow. That works. I know this is beyond the call of duty, but can the
> script (which I assume is what's in the line beginning "*"script"*" up
> to the first "*"*") be altered to convert the path that's sent to the
> clipboard from //Linux /to \\Windows\ ? And/or possibly call another
> script (to launch Foobar, for example)?
>
> I'm now refreshing my almost non-existent knowledge of Javascript.
The script is javascript, so yes it could do path conversion, etc.
Pretty sure it cannot launch another app though - as the script runs in
the browser. If you want to launch a command the you can use "command"
and not "script" as the action. This would start a command on the LMS
machine. So, what you could do is have a simple python script that
converts an LMS track ID into a path and then runs Foobar. e.g.
Code:
--------------------
{
"track":[
{
"title":"Edit with foobar",
"command":"start /b c:\to\command\launch-foobar.py $TRACKID",
"icon":"file_copy"
}
]
}
--------------------
(My windows knowledge is pretty non-existant, but I'm assuming "start /
b <command>" launches a command in the "background" - as you dont want
LMS to be stalled whilst your command runs)
'launch-foobar.py' would be passed a track ID, it then needs to call
into LMS to convert this into a path - using code similar to the above.
e.g.
Code:
--------------------
import json
import os
import requests
SERVER_IP = '127.0.0.1'
try:
resp = json.loads(requests.post('http://%s:9000/jsonrpc.js' % SERVER_IP, data
=
'{"id":1,"method":"slim.request","params":["",["songinfo",0,10,"tags:u","track_id:%s"
% sys.argv[1]]]}').text)
url = resp['result']['songinfo_loop'][0]['url']
# convert URL, invoke foolbar
except:
print("FAILED")
--------------------
*Material debug:* 1. Launch via http: //SERVER:9000/material/?debug=json
(Use http: //SERVER:9000/material/?debug=json,cometd to also see update
messages, e.g. play queue) 2. Open browser's developer tools 3. Open
console tab in developer tools 4. REQ/RESP messages sent to/from LMS
will be logged here.
------------------------------------------------------------------------
cpd73's Profile: http://forums.slimdevices.com/member.php?userid=66686
View this thread: http://forums.slimdevices.com/showthread.php?t=113145
_______________________________________________
Squeezecenter mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/squeezecenter