Moode Forum
[PROBLEM] moOde 6.5.0 update cron script - 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: [PROBLEM] moOde 6.5.0 update cron script (/showthread.php?tid=2428)



moOde 6.5.0 update cron script - radu- - 04-27-2020

Up until 6.5.0 I had a script to automatically update the library using `mpd update` command, but in the new version I see the update is tied to refreshing the thumbnail cache for the albums and I like the idea.

How can I do the same in the shell with a cron line? Is there a php script action for this?


RE: moOde 6.5.0 update cron script - Tim Curtis - 04-27-2020

There is a Web API for submitting a Library Update.

Code:
http://moode/command/?cmd=libupd-submit.php



RE: moOde 6.5.0 update cron script - radu- - 04-27-2020

Great! Thanks a lot.


RE: moOde 6.5.0 update cron script - radu- - 04-27-2020

Only I just realized that it won't work, because it's running remotely and I don't get a status for it - only if I check with `mpc status`, which is a bit too much for a simple task.

@Tim Curtis would I break anything if I just run `mpc --wait update`? I usually did this to be able to get an exit code from the command and check if the status is OK.


RE: moOde 6.5.0 update cron script - Tim Curtis - 04-27-2020

From SSH you can use the command below.

Code:
sudo /var/www/libupd-submit.php



RE: moOde 6.5.0 update cron script - radu- - 04-28-2020

(04-27-2020, 12:43 PM)Tim Curtis Wrote: From SSH you can use the command below.

Code:
sudo /var/www/libupd-submit.php

Yes, but it's the same as for the API request: I can't get an exit code to know the status of the update.


RE: moOde 6.5.0 update cron script - Tim Curtis - 04-28-2020

What do you mean by "status of the update" ?

When a library update is submitted, MPD update and the thumbnail generator are started in parallel. They may each finish at different times. The visibility of the progress spinner is tied to only the MPD update process. When that process completes, the spinner is hidden.


RE: moOde 6.5.0 update cron script - vinnn - 04-28-2020

(04-28-2020, 09:29 AM)radu- Wrote:
(04-27-2020, 12:43 PM)Tim Curtis Wrote: From SSH you can use the command below.

Code:
sudo /var/www/libupd-submit.php

Yes, but it's the same as for the API request: I can't get an exit code to know the status of the update.

You could write a shell script that uses command-line tools instead of the php script, but I don't see the point myself when a cronjob could run the php script.
I have one I wrote but it doesn't do the cover update, it does the mpd db update and clears the tag cache. Would you like me to share as a starting point?


RE: moOde 6.5.0 update cron script - radu- - 04-28-2020

Haha.. No, this is not a problem. As I mentioned before, I already have a script that uses 'mpc update --wait' and it's fine with me, but thumbnails for new albums are not created in this case, so I wanted to try the new 'method'. Only that I can't have a status after running the php script and this is the problem.

Why do I want the status? Because I had issues sometimes where the update wouldn't finish because of permission or other kinds of problems. It's just a petty thing for me - I can live without it, but it would be nice to have.