NMJ Remote Administration
From NMTWiki
| Applicable to the following NMT |
|---|
| Popcorn Hour NMT Models: | C-200, A-200/210 |
|---|
Users zombiehunter and halfelite have contributed with a method to update the NMJ database remotely over the network. Original post on the NMT Forum
Warning! Backup your database first! Use the following information at your own risk
Contents |
Workflow and considerations
You will run the update command from a normal desktop web browser, first selecting your Popcorn Hour model. No extra software needs to be installed, not even the NMT Apps.
On the commands noted below, replace "pchmodel"
http://pchmodel:8008
with the following:
- for C200 use pch-c200
- for A200 use pch-A200
- for A210 use pch-A210
E.g. for C200 the address will be:
http://pch-c200:8008
NOTE: In some cases the above will work, in which case it is better to use the NMT IP address, example:
http://192.168.1.6:8008
(Replace 192.168.1.6 with your NMT's IP)
Now we need to find out the name of the source:
- Is your NMJ Jukebox is on a internal hard drive, external USB drive or on a Network Share?
Run the following command in your web browser
http://pchmodel:8008/system?arg0=list_devices
You will get a list of drives like this:
<theDavidBox> − <request> <arg0>list_devices</arg0> <module>system</module> </request> <response> <device> <accessPath>USB_DRIVE</accessPath> <name>USB_DRIVE</name> <type>usb</type> </device> </response> <returnValue>0</returnValue> </theDavidBox>
In the case above, the source is going to be "USB_DRIVE"
In case the NMJ Jukebox is on a Network Shares:
- The path for a network source will be NETWORK_SHARE/sharename
- You can find sharename by looking at the Network icon on the NMT menu wheel, or under network share in the Setup menu.
- In the example case the sharename is Movies - so mine my source is going to be:
NETWORK_SHARE/Movies
Considerations for Network Shares
If your NMJ database is on a network share it needs to be mounted do this by selecting it in the menu ring (the same as you do before pressing the red button). The NMT defaults to mounting one share at the time.
There is a way to mount defined Network Shares remotely too. Telnet into the NMT and issue the command:
cat /tmp/netshare
This will give you a list if shares added. Look for the name of the share you want then copy the http:// command line above it
Example, share name for "Movies"
http://127.0.0.1:8883/smbclient.cgi?smb.cmd=mount%26smb.opt=smb://192.168.1.3/movies%26smb.name=Movies%26smb.user =pchc200%26smb.passwd=players
Now replace 127.0.0.1 with your NMT's IP address, example with "Movies":
http://192.168.1.6:8883/smbclient.cgi?smb.cmd=mount%26smb.opt=smb://192.168.1.3/movies%26smb.name=Movies%26smb.user =pchc200%26smb.passwd=players
When you call this URL from a web browser or a script the share will be mounted on the NMT.
Now the magic!
Updating the NMJ database
To update NMJ database use the following:
- In a web browser enter the following address:
http://pchmodel:8008/metadata_database?arg0=scanner_start&arg1=source/nmj_database/media.db&arg2=background&arg3=
- Remember to replace pchmodel and source with those we found above that apply for your case
Rescan database
To rescan NMJ database use the following:
Warning! A rescan wipes database!
- In a web browser enter the following address:
http://pchmodel:8008/metadata_database?arg0=scanner_start&arg1=source/nmj_database/media.db&arg2=force&arg3=
- Replace pchmodel and source with those we found above.
If everything worked well you will get a result in your browser like the following example
An example of a used address on a network share:
http://pch-c200:8008/metadata_database?arg0=scanner_start&arg1=NETWORK_SHARE/Movies/nmj_database/media.db&arg2=background&arg3=
With the response:
<theDavidBox> − <request> <arg0>scanner_start</arg0> <arg1>NETWORK_SHARE/Movies/nmj_database/media.db</arg1> <arg2>background</arg2> <arg3/> <module>metadata_database</module> </request> <response/> <returnValue>0</returnValue> </theDavidBox>
This means everything is working! A non-zero return value indicates that an error has occurred.
If you get errors double check pchmodel (or IP address) and source.
You can test if it's working by pressing the coloured button, and you should see the NMJ activity progress bar as usual.
Run scan via script on NMT
You can initiate the NMJ scan from the NMT directly by using a script - which can be put in a cronjob for a scheduled cycle.
Oneliner:
wget "http://localhost:8008/metadata_database?arg0=scanner_start&arg1=source/nmj_database/media.db&arg2=background&arg3=" >/dev /null 2>&1
Replace source with SATA_DISK or USB_DISK or the path applicable for your setup. NOTE: This won't work for anything in NETWORK_SHARE unless it is mounted on the NMT.
