Jukebox Connector
From NMTWiki
| Applicable only for the following: |
|---|
| PCH NMT models: | A100/110/B110 |
|---|---|
| Others NMT's: | HDX/eGreat |
Jukebox connector is a protocol which allows Jukeboxes to make their own virtual directory hierarchy known to other applications. It was created to allow MediaTankController to browse a Jukebox running on the NMT.
There are currently no publicly available Jukeboxes that support this feature.
Contents |
Retrieving the information
The application that requests the virtual directory hierarchy will run a command on the NMT to retrieve the contents of a virtual directory. There are roughly two possibilities: it calls a shell script that returns the data in the format specified below, or it will read the contents of a file that has been prepared in advance.
In both cases there is only one things that need to be configured: the location of the connector.
Calling a shell script or PHP cgi script
You need to create a shell script or a PHP cgi script that takes the virtual path as a parameter and return the contents of virtual directory.
- The path is separated by slashes
- The path starts with a slash and ends with a slash
- A single slash is equivalent to the root of the virtual hierarchy
The location of the connector is the location of the script: /opt/sybhttpd/localhost.drives/HARD_DISK/Jukebox/connector.sh
/opt/sybhttpd/localhost.drives/HARD_DISK/Jukebox/connector.sh / /opt/sybhttpd/localhost.drives/HARD_DISK/Jukebox/connector.sh /Documentaries/ /opt/sybhttpd/localhost.drives/HARD_DISK/Jukebox/connector.sh /Documentaries/Planet\ Earth/
or the location: /opt/sybhttpd/localhost.drives/HARD_DISK/Jukebox/connector.php
/opt/sybhttpd/localhost.drives/HARD_DISK/Jukebox/connector.php / /opt/sybhttpd/localhost.drives/HARD_DISK/Jukebox/connector.php /Series/ /opt/sybhttpd/localhost.drives/HARD_DISK/Jukebox/connector.php /Series/Lost/ /opt/sybhttpd/localhost.drives/HARD_DISK/Jukebox/connector.php /Series/Lost/Season\ 1/
Reading regular files
You need to create a directory with a file in it for each of the virtual directories. Each file contains the contents of that particular directory.
- The filename starts with 'contents'
- The path - separated by dashes - is appended to the filename, excluding any final dash
- The filename ends with '.txt'
The location of the connector is the location of the directory that contains the files: /opt/sybhttpd/localhost.drives/HARD_DISK/Jukebox/connector/ (make sure the include the final slash!)
cat /opt/sybhttpd/localhost.drives/HARD_DISK/Jukebox/connector/contents.txt cat /opt/sybhttpd/localhost.drives/HARD_DISK/Jukebox/connector/contents-Documentaries.txt cat /opt/sybhttpd/localhost.drives/HARD_DISK/Jukebox/connector/contents-Documentaries-Planet\ Earth.txt
Format of the data
The data that is returned contains a line for each file or directory. Each line starts with either an f or d followed by a space. If the line starts with any other combination of characters, the line should be ignored.
Files
If the line starts with an f it means the line contains the data of a file. A file has two parameters, a pretty name and the actual path to the file on the hard drive. Because we are dealing with a virtual directory hierarchy the files do not have to be actually in the same directory.
f name=My Home Movie path=/opt/sybhttpd/localhost.drives/HARD_DISK/Video/homemovie.mkv f name=Our Vacation path=/opt/sybhttpd/localhost.drives/HARD_DISK/Video/other/vacation.iso
Directories
If the line starts with an d it means the line contains the data of a virtual directory. A directory has two parameters, a pretty name and the actual name of the virtual directory, which will be used in constructing a path that is passed on the connector.
d name=House id=House d name=Heroes id=Heroes d name=Lost id=Lost
or
d name=Season 1 id=1 d name=Season 2 id=2 d name=Season 3 id=3 d name=Specials id=specials
Examples
An example of a PHP script and an example of a directory with regular files will be released shortly.
