]> kaliko git repositories - mpd-goodies.git/blobdiff - lib/mpdutils.py
* start working on MPDClass and new crop command.
[mpd-goodies.git] / lib / mpdutils.py
index a64d23908d0e5be0776200ee7a766597b7641c37..ce1b38dc06deaee1f575519808658ae239dd2638 100644 (file)
@@ -73,10 +73,14 @@ def mpdAuth(client, secret):#{{{
     return True#}}}
 
 
-def mconnect():
+def mconnect(host=None, port=None):#{{{
     """"""
-    ## get connection id
+    ## get connection id from ENV VAR
     con_id, passwd = get_mpd_environ()
+    if host:
+        con_id.update({'host': host})
+    if port:
+        con_id.update({'port': port})
     ## MPD object instance
     client = MPDClient()
     if mpdConnect(client, con_id):
@@ -95,7 +99,14 @@ def mconnect():
             print 'ERROR: fail trying to pass auth. Check password?'
             client.disconnect()
             sys.exit(1)
-    return client
+    return client#}}}
+
+def collapse_tags(value):
+    if isinstance(value, list):
+        #self.__dict__[tag] = ", ".join(set(value))
+        self.collapse_tags_bool = True
+        return ', '.join(set(value))
+    return value#}}}
 
 # Script starts here
 if __name__ == '__main__':