[kupfer] plugin.rhythmbox_support: Raise error when dbfile doesn't exist



commit b015a89dc3a758153dfba3556eef943624f469bc
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Thu Sep 10 21:01:10 2009 +0200

    plugin.rhythmbox_support: Raise error when dbfile doesn't exist

 kupfer/plugin/rhythmbox_support.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/plugin/rhythmbox_support.py b/kupfer/plugin/rhythmbox_support.py
index 7b78b2b..020c74b 100644
--- a/kupfer/plugin/rhythmbox_support.py
+++ b/kupfer/plugin/rhythmbox_support.py
@@ -8,6 +8,8 @@ NEEDED_KEYS= ("title", "artist", "album", "track-number", "location", )
 
 def get_rhythmbox_songs(typ="song", keys=NEEDED_KEYS,
         dbfile='~/.local/share/rhythmbox/rhythmdb.xml'):
+    if not dbfile or not os.path.exists(dbfile):
+        raise IOError("Rhythmbox database not found")
     rhythmbox_dbfile = os.path.expanduser(dbfile)
     rbParser = xml.sax.make_parser()
     lSongs = []



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]