[rhythmbox/wip/python3: 20/35] magnatune: more python3 fixes
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox/wip/python3: 20/35] magnatune: more python3 fixes
- Date: Sun, 21 Apr 2013 00:04:29 +0000 (UTC)
commit fe65ef68145cf29c168a167fcab1d577663b2cc6
Author: Jonathan Matthew <jonathan d14n org>
Date: Tue Apr 16 09:14:25 2013 +1000
magnatune: more python3 fixes
plugins/magnatune/MagnatuneSource.py | 8 ++++----
plugins/magnatune/TrackListHandler.py | 10 +++++-----
2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/plugins/magnatune/MagnatuneSource.py b/plugins/magnatune/MagnatuneSource.py
index 774eaa0..5a8f79a 100644
--- a/plugins/magnatune/MagnatuneSource.py
+++ b/plugins/magnatune/MagnatuneSource.py
@@ -235,16 +235,16 @@ class MagnatuneSource(RB.BrowserSource):
def update_cb(remote_changes):
self.__catalogue_check = None
try:
- f = open(magnatune_changes, 'r')
+ f = open(magnatune_changes, 'rt')
local_changes = f.read().strip()
except:
local_changes = ""
- remote_changes = remote_changes.strip()
+ remote_changes = remote_changes.strip().decode("iso-8859-1")
print("local checksum %s, remote checksum %s" % (local_changes, remote_changes))
if local_changes != remote_changes:
try:
- f = open(magnatune_changes, 'w')
+ f = open(magnatune_changes, 'wt')
f.write(remote_changes + "\n")
f.close()
except Exception as e:
@@ -274,7 +274,7 @@ class MagnatuneSource(RB.BrowserSource):
print("catalog download successful")
# done downloading, unzip to real location
catalog_zip = zipfile.ZipFile(magnatune_song_info_temp)
- catalog = open(magnatune_song_info, 'w')
+ catalog = open(magnatune_song_info, 'wb')
filename = find_song_info(catalog_zip)
if filename is None:
RB.error_dialog(title=_("Unable to load catalog"),
diff --git a/plugins/magnatune/TrackListHandler.py b/plugins/magnatune/TrackListHandler.py
index 357285d..f0578f6 100644
--- a/plugins/magnatune/TrackListHandler.py
+++ b/plugins/magnatune/TrackListHandler.py
@@ -25,6 +25,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+import sys
import xml.sax, xml.sax.handler
import datetime, re, urllib
@@ -82,19 +83,18 @@ class TrackListHandler(xml.sax.handler.ContentHandler):
self.__db.entry_set(entry, RB.RhythmDBPropType.ALBUM,
str(self.__track['albumname']))
self.__db.entry_set(entry, RB.RhythmDBPropType.TITLE,
str(self.__track['trackname']))
self.__db.entry_set(entry, RB.RhythmDBPropType.GENRE,
str(self.__track['magnatunegenres']))
- self.__db.entry_set(entry, RB.RhythmDBPropType.TRACK_NUMBER, long(tracknum))
- self.__db.entry_set(entry, RB.RhythmDBPropType.DATE, long(date))
- self.__db.entry_set(entry, RB.RhythmDBPropType.DURATION, long(duration))
+ self.__db.entry_set(entry, RB.RhythmDBPropType.TRACK_NUMBER, int(tracknum))
+ self.__db.entry_set(entry, RB.RhythmDBPropType.DATE, int(date))
+ self.__db.entry_set(entry, RB.RhythmDBPropType.DURATION, int(duration))
key = str(trackurl)
- sku = intern(str(self.__track['albumsku']))
+ sku = sys.intern(str(self.__track['albumsku']))
self.__sku_dict[key] = sku
self.__home_dict[sku] = str(self.__track['home'])
self.__art_dict[sku] = str(self.__track['cover_small'])
self.__db.commit()
except Exception as e: # This happens on duplicate uris being added
- import sys
sys.excepthook(*sys.exc_info())
print("Couldn't add %s - %s" % (self.__track['artist'],
self.__track['trackname']), e)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]