Moode Forum
[SOLVED] Moode 4.4 /cover art in remote app - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7)
+--- Thread: [SOLVED] Moode 4.4 /cover art in remote app (/showthread.php?tid=787)

Pages: 1 2


Moode 4.4 /cover art in remote app - Herman - 12-17-2018

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


RE: Moode 4.4 /cover art in remote app - Herman - 12-18-2018

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.


RE: Moode 4.4 /cover art in remote app - Koda59 - 12-18-2018

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 ?


RE: Moode 4.4 /cover art in remote app - Herman - 12-18-2018

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


RE: Moode 4.4 /cover art in remote app - duke.g - 12-19-2018

@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


RE: Moode 4.4 /cover art in remote app - Herman - 12-20-2018

Thank you Duke!
I will try this.

Herman


RE: Moode 4.4 /cover art in remote app - Herman - 12-20-2018

@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


RE: Moode 4.4 /cover art in remote app - TheOldPresbyope - 12-20-2018

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


RE: Moode 4.4 /cover art in remote app - duke.g - 12-20-2018

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


RE: Moode 4.4 /cover art in remote app - Herman - 12-20-2018

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