Permalink
Browse files

refactor mpd connect into client library

  • Loading branch information...
1 parent fa2458e commit 4df33893a68e5db98e712a4f1c97ff6a5dcdfaff Dusty Phillips committed Apr 10, 2012
Showing with 10 additions and 4 deletions.
  1. +1 −0 .gitignore
  2. +7 −0 www/.aspen/mpdclient.py
  3. +2 −4 www/play.html
View
@@ -1 +1,2 @@
venv
+*.pyc
@@ -0,0 +1,7 @@
+import mpd
+def get_client(request):
+ client = mpd.MPDClient()
+ client.connect("localhost", 6600)
+ client.password(request.cookie.get("auth_pwd").value)
+ # FIXME: deal with not authenticated
+ return client
View
@@ -1,8 +1,6 @@
-import mpd
+import mpdclient
^L
-client = mpd.MPDClient()
-client.connect("localhost", 6600)
-client.password(request.cookie.get("auth_pwd").value)
+client = mpdclient.get_client(request)
client.pause()
^L
Played!

0 comments on commit 4df3389

Please sign in to comment.