summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xupdate_db.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/update_db.py b/update_db.py
new file mode 100755
index 0000000..11dd4e6
--- /dev/null
+++ b/update_db.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python3
+from os import environ
+
+from mpdat import MPDatClient
+
+mpd_host = environ.get("MPD_HOST", "localhost")
+mpd_port = environ.get("MPD_PORT", 6600)
+
+m = MPDatClient()
+m.connect_from_env(mpd_host, mpd_port)
+
+# the user can run mpc update before; wait for completion
+m.wait_for_update()
+
+# updates db if necessary
+nb_dirs = m.get_final_dirs()