summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bachelier <laurent@bachelier.name>2010-07-26 21:55:58 +0200
committerLaurent Bachelier <laurent@bachelier.name>2010-07-26 21:55:58 +0200
commit2e2367a62138c0b40012d80ec6a5ce6a75a6d4c6 (patch)
tree0f44805423b218d37b0ee4720974ec2127d0e28b
parentNo need for a class (diff)
downloadmpdat-2e2367a62138c0b40012d80ec6a5ce6a75a6d4c6.tar.xz
Better imports
-rwxr-xr-xfeeding_example.py4
-rw-r--r--mpdrast/__init__.py2
-rwxr-xr-xmpdrast/client.py2
-rw-r--r--mpdrast/process.py4
-rwxr-xr-xpruning_example.py4
5 files changed, 8 insertions, 8 deletions
diff --git a/feeding_example.py b/feeding_example.py
index 1e5d6de..9cde3ac 100755
--- a/feeding_example.py
+++ b/feeding_example.py
@@ -1,11 +1,11 @@
#!/usr/bin/env python
-import mpdrast
+from mpdrast import MPDrastClient
from os import environ
mpd_host = environ.get("MPD_HOST", "localhost")
mpd_port = environ.get("MPD_PORT", 6600)
-m = mpdrast.MPDrastClient()
+m = MPDrastClient()
m.connect(mpd_host, mpd_port)
# the user can run mpc update before; wait for completion
diff --git a/mpdrast/__init__.py b/mpdrast/__init__.py
index e80fdb6..852604a 100644
--- a/mpdrast/__init__.py
+++ b/mpdrast/__init__.py
@@ -1 +1 @@
-from client import MPDrastClient
+from .client import MPDrastClient
diff --git a/mpdrast/client.py b/mpdrast/client.py
index 1e352c6..26d6410 100755
--- a/mpdrast/client.py
+++ b/mpdrast/client.py
@@ -3,7 +3,7 @@ import mpd
import time
import random
-import process
+import mpdrast.process as process
class MPDrastClient(mpd.MPDClient):
def __init__(self):
diff --git a/mpdrast/process.py b/mpdrast/process.py
index c546270..a7c7c3f 100644
--- a/mpdrast/process.py
+++ b/mpdrast/process.py
@@ -1,4 +1,4 @@
-import posixpath
+from os.path import dirname
"""
Process MPDrastClient responses
@@ -23,7 +23,7 @@ def process_song(item):
Adds a "dir" attribute to songs, change "pos" to int
"""
if item.has_key("file"):
- item["dir"] = posixpath.dirname(item["file"])
+ item["dir"] = dirname(item["file"])
if item.has_key("pos"):
item["pos"] = int(item["pos"])
diff --git a/pruning_example.py b/pruning_example.py
index ef01649..1ced4d5 100755
--- a/pruning_example.py
+++ b/pruning_example.py
@@ -1,12 +1,12 @@
#!/usr/bin/env python
-import mpdrast
+from mpdrast import MPDrastClient
from os import environ
mpd_host = environ.get("MPD_HOST", "localhost")
mpd_port = environ.get("MPD_PORT", 6600)
-m = mpdrast.MPDrastClient()
+m = MPDrastClient()
m.connect(mpd_host, mpd_port)
# Keep only one album in the playlist