[rhythmbox/wip/python3: 28/35] lyrics: more python3 updates



commit 9b210269db48d35c7de72e531c9cb863ba774136
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat Apr 20 12:14:24 2013 +1000

    lyrics: more python3 updates

 plugins/lyrics/lyrics.py | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/plugins/lyrics/lyrics.py b/plugins/lyrics/lyrics.py
index 31e68d5..fa600a4 100644
--- a/plugins/lyrics/lyrics.py
+++ b/plugins/lyrics/lyrics.py
@@ -149,8 +149,10 @@ class LyricGrabber(object):
                status = self.verify_lyric()
                
                if status:
-                       l = rb.Loader()
-                       l.get_url('file://' + urllib.request.pathname2url(self.cache_path), callback)
+                       f = open(self.cache_path, 'rt')
+                       text = f.read()
+                       f.close()
+                       self.callback(text)
                elif cache_only:
                        self.callback(_("No lyrics found"))
                elif self.artist == "" and self.title == "":
@@ -177,14 +179,14 @@ class LyricPane(object):
                self.build_path()
                
                def save_lyrics(cache_path, text):
-                       f = file (cache_path, 'w')
-                       f.write (text)
-                       f.close ()
+                       f = open(cache_path, 'wt')
+                       f.write(text)
+                       f.close()
                
                def erase_lyrics(cache_path):
-                       f = file (cache_path, 'w')
-                       f.write ("")
-                       f.close ()
+                       f = open(cache_path, 'w')
+                       f.write("")
+                       f.close()
                
                def save_callback():
                        buf = self.buffer
@@ -269,7 +271,7 @@ class LyricPane(object):
                self.get_lyrics()
 
        def __got_lyrics(self, text):
-               self.buffer.set_text(str(text), -1)
+               self.buffer.set_text(text, -1)
 
        def get_lyrics(self):
                if self.entry is None:


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