From 121e8768e40bc6012ec34d77b22d2c408aee048c Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 10 Feb 2010 20:57:12 +0100 Subject: remove some useless conversions to unicode --- nephilim/plugins/Filebrowser.py | 4 ++-- nephilim/plugins/Playlist.py | 2 +- nephilim/plugins/Songinfo.py | 2 +- nephilim/song.py | 3 --- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/nephilim/plugins/Filebrowser.py b/nephilim/plugins/Filebrowser.py index 7740afe..352eb02 100644 --- a/nephilim/plugins/Filebrowser.py +++ b/nephilim/plugins/Filebrowser.py @@ -88,14 +88,14 @@ class wgFilebrowser(QtGui.QWidget): def selection_copy_to_collection(self): target_paths = [] for index in self.selectedIndexes(): - filepath = unicode(self.model().filePath(index)) + filepath = self.model().filePath(index) self.logger.info('Copying %s to collection.'%filepath) path_base = os.path.basename(filepath) try: if os.path.isdir(filepath): shutil.copytree(filepath, '%s/%s'%(self.plugin.settings.value('MPD/music_dir').toString(), path_base)) else: - shutil.copy(filepath, unicode(self.plugin.settings.value('MPD/music_dir').toString())) + shutil.copy(filepath, self.plugin.settings.value('MPD/music_dir').toString()) target_paths.append(path_base) except (OSError, IOError), e: self.logger.error('Error copying to collection: %s.'%e) diff --git a/nephilim/plugins/Playlist.py b/nephilim/plugins/Playlist.py index 248f658..ed86393 100644 --- a/nephilim/plugins/Playlist.py +++ b/nephilim/plugins/Playlist.py @@ -114,7 +114,7 @@ class PlaylistTree(QtGui.QTreeWidget): for song in self.plugin.mpclient.playlistinfo(): item = PlaylistSongItem(PlaylistEntryRef(self.plugin.mpclient, song['id'])) for i in range(len(columns)): - item.setText(i, unicode(song[str(columns[i])])) + item.setText(i, song[columns[i]]) self.addTopLevelItem(item) def keyPressEvent(self, event): diff --git a/nephilim/plugins/Songinfo.py b/nephilim/plugins/Songinfo.py index 856b39b..4c1e126 100644 --- a/nephilim/plugins/Songinfo.py +++ b/nephilim/plugins/Songinfo.py @@ -106,7 +106,7 @@ class SonginfoWidget(QtGui.QWidget): def set_metadata(self, metadata): """Set displayed metadata, which is provided in a dict of { tag : value }.""" for tag in metadata: - self.__labels[tag].setText(unicode(metadata[tag])) + self.__labels[tag].setText(metadata[tag]) class SettingsWidgetSonginfo(Plugin.SettingsWidget): # private diff --git a/nephilim/song.py b/nephilim/song.py index 607d4a6..6d8cc39 100644 --- a/nephilim/song.py +++ b/nephilim/song.py @@ -25,12 +25,9 @@ class Song(dict): Its instances _shouldn't_ be stored, use SongRef or PlaylistEntryRef for that.""" def __init__(self, data): - # decode all strings to unicode for tag in data: if isinstance(data[tag], list): data[tag] = ','.join(data[tag]) - if isinstance(data[tag], str): - data[tag] = data[tag].decode('utf-8') dict.__init__(self, data) -- cgit v1.2.3