summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bachelier <laurent@bachelier.name>2020-01-19 18:45:08 +0100
committerLaurent Bachelier <laurent@bachelier.name>2020-01-19 18:45:08 +0100
commitd6f6a3eef6e66d1b1abc6e325eda647b500b0404 (patch)
treedd41d050dd97596c8810437d1c9d732aaab6ad28
parentMove to Python 3 (diff)
downloadmpdat-master.tar.xz
Update db scriptHEADmaster
-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()