Author: duncan
Date: Thu Nov 15 05:40:56 2007
New Revision: 10129

Log:
Made print statements debug statements


Modified:
   branches/rel-1-7/freevo/src/audio/plugins/freevo_scrobbler.py
   branches/rel-1/freevo/src/audio/plugins/freevo_scrobbler.py

Modified: branches/rel-1-7/freevo/src/audio/plugins/freevo_scrobbler.py
==============================================================================
--- branches/rel-1-7/freevo/src/audio/plugins/freevo_scrobbler.py       
(original)
+++ branches/rel-1-7/freevo/src/audio/plugins/freevo_scrobbler.py       Thu Nov 
15 05:40:56 2007
@@ -53,7 +53,7 @@
         try:
             resp = urllib2.urlopen(url);
         except Exception,e:
-            print 'Server not responding, handshake failed: %s' % (e)
+            _debug_('Server not responding, handshake failed: %s' % (e))
             return False
 
         # check response
@@ -61,7 +61,7 @@
         status = lines.pop(0)
 
         if status.startswith('UPDATE'):
-            print 'Please update: %s' % status
+            _debug_('Please update: %s' % (status))
 
         if status == 'UPTODATE' or status.startswith('UPDATE'):
             challenge = lines.pop(0)
@@ -72,7 +72,7 @@
             self.password_hash = hasher.hexdigest()
 
             self.submit_url = lines.pop(0)
-            print 'Handshake SUCCESS'
+            _debug_('Handshake SUCCESS')
 
         try: self.interval_time = int(lines.pop(0).split()[1])
         except: pass
@@ -80,10 +80,10 @@
         if status == 'UPTODATE' or status.startswith('UPDATE'):
             return True
         elif status == 'BADUSER':
-            print 'Handshake failed: bad user'
+            _debug_('Handshake failed: bad user %r' % (self.username))
             return False
         else:
-            print 'Handshake failed: %s' % status;
+            _debug_('Handshake failed: %s' % (status))
             return False
 
     def submit_song(self, info):
@@ -110,7 +110,7 @@
                 resp = urllib2.urlopen(url, data_str)
                 resp_save = resp.read()
             except Exception, e:
-                print 'Audioscrobbler server not responding, will try later: 
%s' % (e)
+                _debug_('Audioscrobbler server not responding, will try later: 
%s' % (e))
 
             lines = resp_save.rstrip().split('\n')
 
@@ -123,23 +123,20 @@
             else: self.interval_time = int(interval.split()[1])
 
             if status == 'BADAUTH':
-                print 'Authentication failed: invalid username or bad 
password.'
-                print url
-                print data
+                _debug_('Authentication failed: invalid username or bad 
password.')
+                _debug_('url=%r, data=%r' % (url, data))
 
             elif status == 'OK':
-                print 'Submit successful'
+                _debug_('Submit successful')
                 return True
 
             elif status.startswith('FAILED'):
-                print 'FAILED response from server: %s' % status
-                print 'Dumping full response:'
-                print resp_save
+                _debug_('FAILED response from server: %s' % status)
+                _debug_('full response:%s' % (resp_save))
             else:
-                print 'Unknown response from server: %s' % status
-                print 'Dumping full response:'
-                print resp_save
+                _debug_('Unknown response from server: %s' % status)
+                _debug_('Dumping full response:%s' % (resp_save))
         else:
-            print 'Song not accepted!'
+            _debug_('Song not accepted!')
 
         return False

Modified: branches/rel-1/freevo/src/audio/plugins/freevo_scrobbler.py
==============================================================================
--- branches/rel-1/freevo/src/audio/plugins/freevo_scrobbler.py (original)
+++ branches/rel-1/freevo/src/audio/plugins/freevo_scrobbler.py Thu Nov 15 
05:40:56 2007
@@ -53,7 +53,7 @@
         try:
             resp = urllib2.urlopen(url);
         except Exception,e:
-            print 'Server not responding, handshake failed: %s' % (e)
+            _debug_('Server not responding, handshake failed: %s' % (e))
             return False
 
         # check response
@@ -61,7 +61,7 @@
         status = lines.pop(0)
 
         if status.startswith('UPDATE'):
-            print 'Please update: %s' % status
+            _debug_('Please update: %s' % (status))
 
         if status == 'UPTODATE' or status.startswith('UPDATE'):
             challenge = lines.pop(0)
@@ -72,7 +72,7 @@
             self.password_hash = hasher.hexdigest()
 
             self.submit_url = lines.pop(0)
-            print 'Handshake SUCCESS'
+            _debug_('Handshake SUCCESS')
 
         try: self.interval_time = int(lines.pop(0).split()[1])
         except: pass
@@ -80,10 +80,10 @@
         if status == 'UPTODATE' or status.startswith('UPDATE'):
             return True
         elif status == 'BADUSER':
-            print 'Handshake failed: bad user'
+            _debug_('Handshake failed: bad user %r' % (self.username))
             return False
         else:
-            print 'Handshake failed: %s' % status;
+            _debug_('Handshake failed: %s' % (status))
             return False
 
     def submit_song(self, info):
@@ -110,7 +110,7 @@
                 resp = urllib2.urlopen(url, data_str)
                 resp_save = resp.read()
             except Exception, e:
-                print 'Audioscrobbler server not responding, will try later: 
%s' % (e)
+                _debug_('Audioscrobbler server not responding, will try later: 
%s' % (e))
 
             lines = resp_save.rstrip().split('\n')
 
@@ -123,23 +123,20 @@
             else: self.interval_time = int(interval.split()[1])
 
             if status == 'BADAUTH':
-                print 'Authentication failed: invalid username or bad 
password.'
-                print url
-                print data
+                _debug_('Authentication failed: invalid username or bad 
password.')
+                _debug_('url=%r, data=%r' % (url, data))
 
             elif status == 'OK':
-                print 'Submit successful'
+                _debug_('Submit successful')
                 return True
 
             elif status.startswith('FAILED'):
-                print 'FAILED response from server: %s' % status
-                print 'Dumping full response:'
-                print resp_save
+                _debug_('FAILED response from server: %s' % status)
+                _debug_('full response:%s' % (resp_save))
             else:
-                print 'Unknown response from server: %s' % status
-                print 'Dumping full response:'
-                print resp_save
+                _debug_('Unknown response from server: %s' % status)
+                _debug_('Dumping full response:%s' % (resp_save))
         else:
-            print 'Song not accepted!'
+            _debug_('Song not accepted!')
 
         return False

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to