Pārlūkot izejas kodu

read MPD_* envvar

boyska 9 gadi atpakaļ
vecāks
revīzija
16383cf777
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. 4 1
      larigira/audiogen_mpdrandom.py

+ 4 - 1
larigira/audiogen_mpdrandom.py

@@ -4,13 +4,16 @@ import random
 
 from mpd import MPDClient
 
+from config import get_conf
+
 
 def generate_by_artist(spec):
     '''choose HOWMANY random artists, and for each one choose a random song'''
     spec.setdefault('howmany', 1)
     log.info('generating')
+    conf = get_conf()
     c = MPDClient()
-    c.connect('localhost', 6600)  # TODO: read global options somehow
+    c.connect(conf['MPD_HOST'], conf['MPD_PORT'])  # TODO: read global options somehow
 
     artists = c.list('artist')
     log.debug("got %d artists" % len(artists))