[rhythmbox] Fix remaining Python 3 issues.



commit a988e235b76d08497390947953f28d00956fe47f
Author: Bohuslav Kabrda <bkabrda redhat com>
Date:   Mon Sep 23 13:14:53 2013 +0200

    Fix remaining Python 3 issues.

 plugins/artsearch/lastfm.py           |   10 +++++-----
 plugins/artsearch/oldcache.py         |    4 ++--
 plugins/context/AlbumTab.py           |    2 +-
 plugins/context/ArtistTab.py          |    2 +-
 plugins/context/LyricsTab.py          |    2 +-
 plugins/magnatune/TrackListHandler.py |    2 +-
 plugins/magnatune/magnatune.py        |    1 -
 remote/dbus/rb-print-playing.py       |    2 +-
 8 files changed, 12 insertions(+), 13 deletions(-)
---
diff --git a/plugins/artsearch/lastfm.py b/plugins/artsearch/lastfm.py
index 8244e55..ff1966e 100644
--- a/plugins/artsearch/lastfm.py
+++ b/plugins/artsearch/lastfm.py
@@ -24,7 +24,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 urllib
+import urllib.parse
 import xml.dom.minidom as dom
 import re
 import configparser
@@ -88,11 +88,11 @@ class LastFMSearch (object):
                print("searching for (%s, %s, %s)" % (artist, album, album_mbid))
                url = API_URL + "?method=album.getinfo&"
                if artist != None:
-                       url = url + "artist=%s&" % (urllib.quote_plus(artist))
+                       url = url + "artist=%s&" % (urllib.parse.quote_plus(artist))
                if album != None:
-                       url = url + "album=%s&" % (urllib.quote_plus(album))
+                       url = url + "album=%s&" % (urllib.parse.quote_plus(album))
                if album_mbid != None:
-                       url = url + "mbid=%s&" % (urllib.quote_plus(album_mbid))
+                       url = url + "mbid=%s&" % (urllib.parse.quote_plus(album_mbid))
 
                url = url + "api_key=%s" % API_KEY
                print("last.fm query url = %s" % url)
@@ -160,7 +160,7 @@ class LastFMSearch (object):
                artists = key.get_field_values("artist")
                album_mbid = key.get_info("musicbrainz-albumid")
 
-               artists = filter(lambda x: x not in (None, "", _("Unknown")), artists)
+               artists = list(filter(lambda x: x not in (None, "", _("Unknown")), artists))
                if album in ("", _("Unknown")):
                        album = None
 
diff --git a/plugins/artsearch/oldcache.py b/plugins/artsearch/oldcache.py
index 9d7d8e3..711f4b3 100644
--- a/plugins/artsearch/oldcache.py
+++ b/plugins/artsearch/oldcache.py
@@ -25,7 +25,7 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
 
 import os.path
-import urllib
+import urllib.request
 
 import rb
 from gi.repository import RB
@@ -55,7 +55,7 @@ class OldCacheSearch(object):
                                path = self.filename(album, artist, ext)
                                if os.path.exists(path):
                                        print("found %s" % path)
-                                       uri = "file://" + urllib.pathname2url(path)
+                                       uri = "file://" + urllib.request.pathname2url(path)
                                        storekey = RB.ExtDBKey.create_storage('album', album)
                                        storekey.add_field("artist", artist)
                                        store.store_uri(storekey, RB.ExtDBSourceType.SEARCH, uri)
diff --git a/plugins/context/AlbumTab.py b/plugins/context/AlbumTab.py
index 653b931..77424a2 100644
--- a/plugins/context/AlbumTab.py
+++ b/plugins/context/AlbumTab.py
@@ -26,7 +26,7 @@
 
 import os
 import cgi
-import urllib
+import urllib.request, urllib.parse
 from mako.template import Template
 import json
 
diff --git a/plugins/context/ArtistTab.py b/plugins/context/ArtistTab.py
index 9f9ef83..24677d4 100644
--- a/plugins/context/ArtistTab.py
+++ b/plugins/context/ArtistTab.py
@@ -26,7 +26,7 @@
 
 import re, os
 import cgi
-import urllib
+import urllib.request, urllib.parse
 import xml.dom.minidom as dom
 import json
 
diff --git a/plugins/context/LyricsTab.py b/plugins/context/LyricsTab.py
index 7aa0bae..e4a0d85 100644
--- a/plugins/context/LyricsTab.py
+++ b/plugins/context/LyricsTab.py
@@ -24,7 +24,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 urllib
+import urllib.request
 import re, os
 import cgi
 from mako.template import Template
diff --git a/plugins/magnatune/TrackListHandler.py b/plugins/magnatune/TrackListHandler.py
index f0578f6..26fec29 100644
--- a/plugins/magnatune/TrackListHandler.py
+++ b/plugins/magnatune/TrackListHandler.py
@@ -27,7 +27,7 @@
 
 import sys
 import xml.sax, xml.sax.handler
-import datetime, re, urllib
+import datetime, re
 
 import rb
 from gi.repository import RB
diff --git a/plugins/magnatune/magnatune.py b/plugins/magnatune/magnatune.py
index 4dd4ff1..d9456c8 100644
--- a/plugins/magnatune/magnatune.py
+++ b/plugins/magnatune/magnatune.py
@@ -25,7 +25,6 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
 
-import urllib
 import zipfile
 import sys, os.path
 import xml
diff --git a/remote/dbus/rb-print-playing.py b/remote/dbus/rb-print-playing.py
index 3bfff5d..8d27920 100755
--- a/remote/dbus/rb-print-playing.py
+++ b/remote/dbus/rb-print-playing.py
@@ -12,7 +12,7 @@ rbplayerobj = bus.get_object('org.gnome.Rhythmbox', '/org/gnome/Rhythmbox/Player
 rbplayer = dbus.Interface(rbplayerobj, 'org.gnome.Rhythmbox.Player')
 
 def playing_uri_changed(uri):
-    print "Now playing: %s" % (uri,)
+    print("Now playing: %s" % (uri,))
     props = rbshell.getSongProperties(uri)
     interesting = ['title', 'artist', 'album', 'location']
     for prop in props:


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