Auto updating music library

Raspberry Pi related support

Auto updating music library

Postby Nick.Moshulu » 12 Feb 2018, 11:44

Hi,
I'm using a Pi 3 model B, using a NAS to store the music, but for some reason I can't get the library to update it's self without manually doing it. I know what command to use via SSH but I can't create a cron job to implement the command.

Could someone help please?

Thanks
Nick
Nick.Moshulu
 
Posts: 6
Joined: 12 Feb 2018, 11:29

Re: Auto updating music library

Postby ianhaynes » 12 Feb 2018, 18:58

Have you tried the Auto Update setting on the MPD page, from the menu?

Ian
ianhaynes
 
Posts: 176
Joined: 04 Mar 2015, 12:51

Re: Auto updating music library

Postby Nick.Moshulu » 13 Feb 2018, 09:27

Yes I have tried that but it isn't working
Nick.Moshulu
 
Posts: 6
Joined: 12 Feb 2018, 11:29

Re: Auto updating music library

Postby hondagx35 » 13 Feb 2018, 13:08

Hi Nick.Moshulu,

i checked the autoupdate on my latest RP2/3 image and it works like it should.
There are several reasons for your issues:
- permissions
- mpd only checks changes in file date, so retagged files are mostly not detected.

I know what command to use via SSH but I can't create a cron job to implement the command.

Could someone help please?


I would do it the systemd way:
create these two files in /usr/lib/systemd/system

mpd-update-db.timer
Code: Select all
[Unit]
Description=Run mpd database update every 15 minutes

[Timer]
OnUnitActiveSec=15m

[Install]
WantedBy=timers.target


mpd-update-db.service
Code: Select all
[Unit]
Description=Run mpd database update every 15 minutes

[Service]
ExecStart=/usr/bin/mpc update

[Install]
WantedBy=multi-user.target


then run this command
Code: Select all
systemctl enable --now mpd-update-db.timer


with this command you can check the state
Code: Select all
systemctl list-timers


Frank
User avatar
hondagx35
 
Posts: 2910
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: Auto updating music library

Postby Nick.Moshulu » 13 Feb 2018, 15:39

Hi Frank

When getting the list of timers, under next, left, last and past it just has n/a.

is that normal?

Thanks
Nick
Nick.Moshulu
 
Posts: 6
Joined: 12 Feb 2018, 11:29

Re: Auto updating music library

Postby hondagx35 » 13 Feb 2018, 15:47

Hi Nick,

please check:
Code: Select all
systemctl status mpd-update-db.timer


It is also possible that it needs a reboot.

Frank
User avatar
hondagx35
 
Posts: 2910
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: Auto updating music library

Postby Nick.Moshulu » 13 Feb 2018, 16:04

Hi Frank

I have rebooted the Pi and it looks like the mpd isn't booting up.

any ideas?

Should I reinstall it completely and try again?

Thanks
Nick
Nick.Moshulu
 
Posts: 6
Joined: 12 Feb 2018, 11:29

Re: Auto updating music library

Postby Nick.Moshulu » 13 Feb 2018, 16:19

Hi Frank

I went to dev and restarted mpd and that got that working again but it still says n/a.

I ran the code which says active (elapsed)
Code: Select all
systemctl status mpd-update-db.timer


Thanks
Nick
Nick.Moshulu
 
Posts: 6
Joined: 12 Feb 2018, 11:29

Re: Auto updating music library

Postby Nick.Moshulu » 14 Feb 2018, 11:29

I sorted the problem.
Use this for mpd-update-db.timer
Code: Select all
Unit]
Description=Run mpd database update every 15 minutes

[Timer]
OnBootSec=10min
OnUnitActiveSec=1d

[Install]
WantedBy=timers.target


and use this for mpd-update-db.service
Code: Select all
[Unit]
Description=Run mpd database update everyday

[Service]
ExecStart=/usr/bin/mpc update

[Install]
WantedBy=multi-user.target
Nick.Moshulu
 
Posts: 6
Joined: 12 Feb 2018, 11:29

support RuneAudio Donate with PayPal


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 1 guest