Hi, @
Herman
The approach @
duke.g takes is a proper use of Linux mechanisms but be careful. You can easily end up with an unwanted symlink /var/lib/mpd/music/music which points to /var/lib/mpd/music, creating a closed loop.
This would happen if the symlink in /var/www already exists when the script is used to create it. As it happens, step 1 and step 6 together establish exactly these conditions. [You can demonstrate this to yourself by running your "sudo ln -s ..." from the command line twice in a row. If you do this, don't forget to remove the unwanted symlink when you're done.]
There should be a test in the script to create the symlink only if it does not already exist.
---
Also, I found that the symlink created in this approach doesn't survive the execution of the utility script /home/pi/srestart.sh even though this script doesn't force a reboot. [Try it; you'll see what I mean.] Granted, this script gets executed only in special circumstances but ....
If you're into modifying Tim's code, you can accomplish what you want in one line.
In /var/www/command/worker.php, at or around line 242, you should find this section:
Code:
// ensure certain files exist
if (!file_exists('/var/local/www/currentsong.txt')) {sysCmd('touch /var/local/www/currentsong.txt');}
...
Insert a new line so that this section begins:
Code:
// ensure certain files exist
if (!file_exists('/var/www/covers')) {SysCmd('ln -s /var/lib/mpd/music /var/www/covers');}
if (!file_exists('/var/local/www/currentsong.txt')) {sysCmd('touch /var/local/www/currentsong.txt');}
...
[All the if-tests above are single lines of code. In my browser, at least, each is displayed folded into two lines.]
A disadvantage of this solution is that worker.php may get overwritten in a moOde update and you have to edit the new version. An advantage is that it overcomes the deletion of the symlink which occurs when the utility script /home/pi/srestart.sh is executed (the last line of which starts worker.php).
Regards,
Kent