- 0 Talk
-
Executable Songs
Contents |
Overview
Edit
I think it would be a good idea to add the possibility for execute "tracks". This would be good for creating webservice-scripts which authoricate to the webservice, fetch its url and play it in mpd. This would have to advantages: the services can be accessed through normal clients (so no client sided scripts required) and when playing a webservice-stream, then stopping mpd and start it a day after (may while pc is down) it would continue playing this station.
Working wise
Edit
If the execute flag of a file in the database-folder is set, and this function is enabled in the mpd configuration, mpd execute the file while indexing with the indexing parameter and use this as default title (see Title-Response). If the track is playing, the mpd should parse executables output on the parameter information like described (see Information-Response) and after stopped, reset all fields. The interval in which mpd should refetch the information from the script may be set in the mpds configuration or as an extra response-field on the indexing parameter.
File specifications
Edit
As first parameter, one of the following statements is given to the executable file:
- start when the client load the "song" (see Start-Response)
- stop when the client stop the "song" (no response)
- indexing when indexing in the database
- information when mpd wants to get the current informations from the executable (see Information-Response)
Start-Response
Edit
The reponse should contain one or more http urls like described following (newline between urls): url: <url which mpd have to play>
Indexing-Response
Edit
The response contains the default title of the "track": <default title>
Information-Response
Edit
title: <title of current track>
artist: <artist of the current track>
album: <album of the current track>
genre: <genre of the current track>
url: <change url to this url> [optional, may for a podcastreader script]
...
Edit
Indexing:
- MPD starts indexing
- MPD find a executable in music_directory
- MPD executes file ans parse its output
- (file is with its default title imported to the database)
Playing:
- User want to play this song
- MPD executes file with parameter start
- script may log in or did something and return the start
- MPD executes with parameter information every few seconds while track is playing to get informations of the current played track
- MPD send the song informations to the clients
- User stops the song (or switch to another playlist item) then MPD executes script with stop
Disscusion
Edit
This sounds like a great idea, but I store my files on a shared vfat/ntfs partition, which doesn't have executable flags. Maybe some other way - like a name-based method, such as: add a '.mpd' suffix to denote an executable, and have mpd try to exec() that file and append its output as entries in the playlist. -- Skaman Sam <skamansam AT gmail>
One thought that came into my mind while reading this is that there could be a scheme (exec:// or exe://), which, when used as a prefix, would fetch the specified file, execute it and interpret the output as some kind of music file. --jn
To my mind the number of scripts will be low and the parameters very rich.
I would like the scripts where in a peudo directory,
/autoplaylist/ /autoplaylist/MyMostPlayed /autoplaylist/MyHighestRated /autoplaylist/Music /autoplaylist/streams /autoplaylist/podcasts /autoplaylist/ipod
For just scripts with a config file enabling them selectively with appropriate patters such as
[ScriptSettings] path=/autoplaylist/steams/radio4 exe=streamBBCRadio --control stdctrl --sound stdout --channel radio4 [ScriptSettings] hotplug=ipod \# %o -- Ipod Owner path=/autoplaylist/ipod/%o/Top_Ten_Played exe=streamIpod --dbLoad -dbBackup -stream [ScriptSettings] hotplug=ipod # %o -- Ipod Owner # %g -- Genre path=/autoplaylist/ipod/%o/Genre/%g exe=streamIpod --dbLoad --dbBackup --stream --dynamicPlaylist Genre %g [ScriptSettings] # %o -- Ipod Owner hotplug=ipod path=/autoplaylist/ipod/%o/PlayCount/Decending exe=streamIpod --dbLoad --dbBackup --stream --dynamicPlaylist PlayCount Decending
The script would then listen for control messages such as indexing, pausing, streaming, and effectively work, and jump to next track, replying always on a signal to the control channel, (Unix id4) and behaving not to different to udev. Messages on the Control Channel should be of a similar format to MPD. -- oms101