Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Solved: Moode 4.4 /cover art in remote app
#1
Hi,

I am using moOde for several years now and I am very satisfied with it.
As a remote app I am using mpdroid also. 
For pointing to the cover images I used to enter "ln -s /var/lib/mpd/music /var/www/covers" in moOde.
Just a few days ago I updated to 4.4, and now this setting does not remain after rebooting moOde.

Any suggestions for solving this problem?

Thanks

Best regards, Herman
Reply
#2
I can see a shortcut "covers" is created in /var/www which indeed has the same content as /var/lib/mpd/music.
Mpdroid can find the images at this point. But after reboot, the shortcut is gone.
There is also a numbered shortcut in /var/www with the same content.
Unfortunately the number is changed after a reboot.
So, not much progress yet.
Reply
#3
Hi Herman,
Why are you using mpdroid ?
Moode mobile UI works pretty well on android device. Just use chrome shortcut and it looks like an app.
Did u give it a try ?
Reply
#4
Hi Koda,

Yes, Moode works pretty well.
They both have their advantages.
E.G. in previous versions it wasn't very easy to create playlists in Moode.
So maybe in the near future there is no need to use mpdroid anymore.

But it is also a form of obstinacy, it has always worked, so now it should work again  Smile
Reply
#5
@Herman,

here is a short list composed of things you have to do for "your" symlink: This is not my own work, I just collected different things and put them together:
1. Create Symlink
sudo ln -s /var/lib/mpd/music /var/www/cover
2. Create a file named "symcoverlink" (or whatever you like) in /etc/init.d
sudo nano /etc/init.d/symcoverlink
3. Add the follwing content
#! /bin/sh
### BEGIN INIT INFO
# Provides: symcoverlink
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Erzeuge Cover SymlinkSymlink wird erstellt
# Description:
### END INIT INFO

case "$1" in
    start)
        echo "Symlink wird erstellt"
        # erzeuge Symlink
        ln -s /var/lib/mpd/music /var/www/cover
        ;;
    stop)
        echo "Symlink wird geloescht"
        # loesche Symlink
        rm /var/www/cover
        ;;
    *)
        echo "Benutzt: /etc/init.d/symcoverlink {start|stop}"
        exit 1
        ;;
esac

exit 0

4. Save the File
5. Make it executable
sudo chmod 755 /etc/init.d/symcoverlink
6. for test purpose
sudo /etc/init.d/symcoverlink start - creates the Symlink
sudo /etc/init.d/symcoverlink stop - deletes the Symlink
7. edit rc.local and insert a line at the end
sudo nano /etc/rc.local
7a. Insert
su root -c '/etc/init.d/symcoverlink start' - this creates the symlink during boot as user root
8. In MpDroid enter http://moode/cover as your cover-root.

I Hope that helps a bit.

Have fun and keep the music playing

Duke.G

2x RPi 3B, 1x RPi 4, Moode 8; 4k flac Songs; 180k MP3 Songs; Asset-UpnP 184k Songs
The blues has got a hold of me, I believe I'm gettin' dizzy - ZZ Top
Reply
#6
Thank you Duke!
I will try this.

Herman
Reply
#7
@duke.g,

This does the job. Thanks!

Keeps open the question why this symlink was permanent in previous versions and now have to be created during booting.
But for the time being I can live with that :-)

Herman
Reply
#8
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
Reply
#9
Hi Kent,

you're absolutely right concerning the creation of a loop. I just tested it. I was not aware of this.
I think the solution within the worker.php is the better one, at least it is easier to implement.

@Tim
Would it be possible that you add this one line to the worker.php? This way we would get the Symlink?
if (!file_exists('/var/www/cover')) {SysCmd('ln -s /var/lib/mpd/music /var/www/cover');}

As Kent pointed out, it should be in the section around line 242:
// ensure certain files exist

if (!file_exists('/var/www/cover')) {SysCmd('ln -s /var/lib/mpd/music /var/www/cover');}
if (!file_exists('/var/local/www/currentsong.txt')) {sysCmd('touch /var/local/www/currentsong.txt');}

Kind regards
   Duke.G

2x RPi 3B, 1x RPi 4, Moode 8; 4k flac Songs; 180k MP3 Songs; Asset-UpnP 184k Songs
The blues has got a hold of me, I believe I'm gettin' dizzy - ZZ Top
Reply
#10
Hi Kent and Duke,

This also works fine.

In this directory /var/www there is another symlink "nnnnnnn" with the same content. Unfortunately the number changes after a boot.
If it would not, this symlink could be used instead and there would be no need to create an additional link.

Would this offer an opportunity?

Regards, Herman
Reply


Forum Jump: