# HG changeset patch # User darius@inchoate.localdomain # Date 1194842840 -37800 # Node ID f11c5ed0178e15fe3b0de343dcfc3232f6e7a7d6 # Parent 65a9f99302cd9de5ff96cbc542721e14cff2bdbc Make using tagpy optional. diff -r 65a9f99302cd -r f11c5ed0178e amakode.py --- a/amakode.py Mon Nov 12 15:01:23 2007 +1030 +++ b/amakode.py Mon Nov 12 15:17:20 2007 +1030 @@ -60,8 +60,13 @@ import urllib import urlparse import re -import tagpy +try: + import tagpy + have_tagpy = True +except ImportError, e: + have_tagpy = False + class tagpywrap(dict): textfields = ['album', 'artist', 'title', 'comment', 'genre'] numfields = ['year', 'track'] @@ -191,7 +196,7 @@ encoder += self.encode[self.tofmt] try: - if (self.tofmt in self.tagopt): + if (have_tagpy and self.tofmt in self.tagopt): taginfo = tagpywrap(self.inurl) for f in taginfo.allfields: if (f in taginfo and f in self.tagopt[self.tofmt]): @@ -256,7 +261,11 @@ def __init__(self, args): """ Main loop waits for something to do then does it """ log.debug("Started.") - + if (have_tagpy): + log.debug("Using tagpy") + else: + log.debug("Warning: tagpy is unavailable") + self.readSettings() self.queue = QueueMgr(callback = self.notify, maxjobs = 1)