Update of /cvsroot/freevo/freevo/src/audio/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv9788/audio/plugins

Modified Files:
        coversearch.py 
Log Message:
add deactivation when something is wrong

Index: coversearch.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/audio/plugins/coversearch.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** coversearch.py      9 Sep 2003 18:54:59 -0000       1.18
--- coversearch.py      10 Sep 2003 19:30:08 -0000      1.19
***************
*** 14,17 ****
--- 14,20 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.19  2003/09/10 19:30:08  dischi
+ # add deactivation when something is wrong
+ #
  # Revision 1.18  2003/09/09 18:54:59  dischi
  # Add some doc
***************
*** 97,101 ****
  from gui.AlertBox import AlertBox
  
! SHOW_WARNING=1
  
  class PluginInterface(plugin.ItemPlugin):
--- 100,105 ----
  from gui.AlertBox import AlertBox
  
! import amazon
! 
  
  class PluginInterface(plugin.ItemPlugin):
***************
*** 121,132 ****
      """
      def __init__(self, license=None):
          plugin.ItemPlugin.__init__(self)
  
-       # You must get your own key!
-       if license:
-           self.license = license
-         else:
-           self.license = None
- 
  
      def actions(self, item):
--- 125,146 ----
      """
      def __init__(self, license=None):
+         if not config.USE_NETWORK:
+             self.reason = 'no network'
+             return
+         
+         if license:
+             amazon.setLicense(license)
+         try:
+             amazon.getLicense()
+         except amazon.NoLicenseKey:
+             print 'To search for covers you need an Amazon.com Web Services'
+             print 'license key. You can get yours from:'
+             print 'https://associates.amazon.com/exec/panama/associates/join/'\
+                   'developer/application.html'
+             self.reason = 'no amazon key'
+             return
+             
          plugin.ItemPlugin.__init__(self)
  
  
      def actions(self, item):
***************
*** 149,153 ****
                                 'imdb_search_or_cover_search') ]
                  else:
!                     if SHOW_WARNING:
                          print "WARNING: coversearch disabled for this item! " + \
                                "coversearch needs an item with " + \
--- 163,167 ----
                                 'imdb_search_or_cover_search') ]
                  else:
!                     if config.DEBUG:
                          print "WARNING: coversearch disabled for this item! " + \
                                "coversearch needs an item with " + \
***************
*** 157,161 ****
                                "Maybe you must fix this file (%s) tag?" % 
item.filename 
              except KeyError:
!                 if SHOW_WARNING:
                      print "WARNING: coversearch disabled for this item! " + \
                            "coversearch needs an item with " + \
--- 171,175 ----
                                "Maybe you must fix this file (%s) tag?" % 
item.filename 
              except KeyError:
!                 if config.DEBUG:
                      print "WARNING: coversearch disabled for this item! " + \
                            "coversearch needs an item with " + \
***************
*** 165,169 ****
                            "Maybe you must fix this file (%s) tag?" % item.filename
              except AttributeError:
!                 if SHOW_WARNING:
                      print "WARNING: Unknown CD, cover searching is disabled"
          return []
--- 179,183 ----
                            "Maybe you must fix this file (%s) tag?" % item.filename
              except AttributeError:
!                 if config.DEBUG:
                      print "WARNING: Unknown CD, cover searching is disabled"
          return []
***************
*** 174,179 ****
          search imdb for this item
          """
-         import amazon
- 
          box = PopupBox(text='searching Amazon...')
          box.show()
--- 188,191 ----
***************
*** 186,191 ****
          artist = self.item.info['artist']
  
-         if self.license:
-             amazon.setLicense(self.license)
          search_string = '%s %s' % (artist,album)
          search_string = re.sub('[\(\[].*[\)\]]', '', search_string)
--- 198,201 ----
***************
*** 208,220 ****
              return
  
-         except amazon.NoLicenseKey:
-             box.destroy()
-             text='To search for covers you need an ' + \
-                   'Amazon.com Web Services license key. You can get yours from: 
https://associates.amazon.com/exec/panama/associates/join/developer/application.html'
-             box = AlertBox(text=text)
-             print "ERROR: coversearch: %s" % text
-             box.show()
-             return
-         
          items = []
          
--- 218,221 ----




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to