How to display the Now Playing information online (part 2)

Home > Search > How-to
  by

nohup ./automation.sh >/dev/null 2>&1
& echo $! > nohup_pid.txt
#!/bin/bash nohup ./automation.sh > nohup.log 2>&1
& echo $! > nohup_pid.txt

The second nohup script will create a nohup.log file in the directory. This file serves as a log. If our shell script is set to sleep 5, then once every 5 seconds, the nohup.log file will get a new entry. This is good for debugging. After we are done debugging, we can stop the logging by getting the process id from the nohup_pid.txt file, and using the below command.

We need to ensure the permissions of the nowplaying.sh, intervals.sh and nohup.sh shell scripts are set properly. Use these commands to set the permissions.

chmod 0755 nowplaying.sh
chmod 0755 nowplaying_intervals.sh
chmod 0755 sed.sh
chmod 0755 sed_intervals.sh
chmod 0755 nohup.sh

 

Now Playing Script (XML & PHP or XML & XSL)
If you used the SED XML for PHP script, use the below PHP markup. If you used the SED XML for XSL script, use the below XSL markup.

PHP markup (XML for PHP)

Just copy the below PHP, and save the file as example.php.

<?php 
include 'xml.php'; 
$music = new SimpleXMLElement($xmlstr); 

foreach ($music->info as $info)
 {
  switch((string) $info['type'])
  { case 'artwork_url': echo 'Album Art: ', $info; echo '
'; break; case 'filename': echo 'Songname: ', $info; break; }
 }
 ?>


Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments