summaryrefslogtreecommitdiff
path: root/nephilim/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'nephilim/plugins')
-rw-r--r--nephilim/plugins/AlbumCover.py10
-rw-r--r--nephilim/plugins/Filebrowser.py8
-rw-r--r--nephilim/plugins/Library.py4
-rw-r--r--nephilim/plugins/Lyrics.py12
-rw-r--r--nephilim/plugins/Playlist.py3
-rw-r--r--nephilim/plugins/__init__.py2
6 files changed, 20 insertions, 19 deletions
diff --git a/nephilim/plugins/AlbumCover.py b/nephilim/plugins/AlbumCover.py
index ea34b4b..a2493e5 100644
--- a/nephilim/plugins/AlbumCover.py
+++ b/nephilim/plugins/AlbumCover.py
@@ -244,7 +244,7 @@ class AlbumCover(Plugin):
cover = QtGui.QPixmap(self.__cover_path)
if not cover.isNull():
return self.o.set_cover(song, cover)
- except IOError, e:
+ except IOError as e:
self.logger.info('Error reading cover file: %s.'%e)
for fetcher in self.__fetchers:
@@ -269,7 +269,7 @@ class AlbumCover(Plugin):
path = self.__cover_path
cover.save(path, 'png')
self.logger.info('Cover successfully saved.')
- except IOError, e:
+ except IOError as e:
self.logger.error('Error writing cover: %s', e)
def delete_cover_file(self, song = None):
@@ -290,13 +290,13 @@ class AlbumCover(Plugin):
return
self.__abort_fetch()
- file = QtWidgets.QFileDialog.getOpenFileName(None,
+ f, _ = QtWidgets.QFileDialog.getOpenFileName(None,
'Select album cover for %s - %s'%(song['?artist'], song['?album']),
self.__cover_dir, '')
- if not file:
+ if not f:
return
- cover = QtGui.QPixmap(file)
+ cover = QtGui.QPixmap(f)
if cover.isNull():
self.logger.error('Error opening cover file.')
return
diff --git a/nephilim/plugins/Filebrowser.py b/nephilim/plugins/Filebrowser.py
index f9b07f6..d28b754 100644
--- a/nephilim/plugins/Filebrowser.py
+++ b/nephilim/plugins/Filebrowser.py
@@ -74,14 +74,14 @@ class wgFilebrowser(QtWidgets.QWidget):
for index in self.selectedIndexes():
filepath = self.model().filePath(index)
if os.path.isdir(filepath):
- perm = 0755
+ perm = 0o755
else:
- perm = 0644
+ perm = 0o644
self.logger.info('Changind permissions of %s to %d.'%(filepath, perm))
try:
os.chmod(filepath, perm)
- except OSError, e:
+ except OSError as e:
self.logger.error('Can\'t change permissions: %s.'%e)
def selection_copy_to_collection(self):
@@ -96,7 +96,7 @@ class wgFilebrowser(QtWidgets.QWidget):
else:
shutil.copy(filepath, self.plugin.settings.value('MPD/music_dir'))
target_paths.append(path_base)
- except (OSError, IOError), e:
+ except (OSError, IOError) as e:
self.logger.error('Error copying to collection: %s.'%e)
self.plugin.mpclient.update_db(target_paths)
diff --git a/nephilim/plugins/Library.py b/nephilim/plugins/Library.py
index 6f2aad9..ed6fd98 100644
--- a/nephilim/plugins/Library.py
+++ b/nephilim/plugins/Library.py
@@ -102,7 +102,7 @@ class LibraryWidget(QtWidgets.QWidget):
self.logger.info('Refreshing library.')
self.library_model.fill(self.plugin.mpclient.db.values(), self.foldings.currentText().split('/'))
- @Slot(unicode)
+ @Slot(str)
def filter_library(self, text):
"""Hide all items that don't contain text."""
to_hide = []
@@ -262,7 +262,7 @@ class LibraryFolding(QtWidgets.QComboBox):
@Slot()
def _update_foldings(self):
foldings = []
- for i in xrange(self.count()):
+ for i in range(self.count()):
foldings.append(self.itemText(i))
self._settings.setValue('foldings', foldings)
self._settings.setValue('cur_folding', self.currentIndex())
diff --git a/nephilim/plugins/Lyrics.py b/nephilim/plugins/Lyrics.py
index b569094..a07916d 100644
--- a/nephilim/plugins/Lyrics.py
+++ b/nephilim/plugins/Lyrics.py
@@ -262,7 +262,7 @@ class Lyrics(Plugin):
if lyrics:
self.save_lyrics(lyrics)
return self.o.set_lyrics(song, lyrics)
- except IOError, e:
+ except IOError as e:
self.logger.info('Error reading lyrics file: %s.'%e)
for fetcher in self.__fetchers:
@@ -286,7 +286,7 @@ class Lyrics(Plugin):
try:
os.remove(path)
- except (IOError, OSError), e:
+ except (IOError, OSError) as e:
self.logger.error('Error removing lyrics file %s: %s'%(path, e))
def get_settings_widget(self):
@@ -385,8 +385,8 @@ class FetchAnimelyrics(metadata_fetcher.MetadataFetcher):
def __handle_search_res(self):
# TODO use Qt xml functions
try:
- tree = etree.HTML(unicode(self.rep.readAll(), encoding = 'utf-8', errors='ignore'))
- except etree.XMLSyntaxError, e:
+ tree = etree.HTML(str(self.rep.readAll(), encoding = 'utf-8', errors='ignore'))
+ except etree.XMLSyntaxError as e:
self.logger.error('Error parsing lyrics: %s' %e)
return self.finish()
@@ -407,8 +407,8 @@ class FetchAnimelyrics(metadata_fetcher.MetadataFetcher):
def __handle_lyrics(self):
lyrics = ''
try:
- tree = etree.HTML(unicode(self.rep.readAll(), encoding = 'utf-8'))
- except etree.XMLSyntaxError, e:
+ tree = etree.HTML(str(self.rep.readAll(), encoding = 'utf-8'))
+ except etree.XMLSyntaxError as e:
self.logger.error('Error parsing lyrics: %s' %e)
return self.finish()
for elem in tree.iterfind('.//pre'):
diff --git a/nephilim/plugins/Playlist.py b/nephilim/plugins/Playlist.py
index a3373a1..8af877b 100644
--- a/nephilim/plugins/Playlist.py
+++ b/nephilim/plugins/Playlist.py
@@ -148,6 +148,7 @@ class PlaylistTree(QtWidgets.QTreeWidget):
for i in range(len(columns)):
item.setText(i, song['?' + columns[i]])
self.addTopLevelItem(item)
+
self._update_cur_song(self.plugin.mpclient.cur_song)
def keyPressEvent(self, event):
@@ -216,5 +217,5 @@ class PlaylistSongItem(QtWidgets.QTreeWidgetItem):
font.setBold(True)
font.setItalic(True)
- for i in xrange(self.columnCount()):
+ for i in range(self.columnCount()):
self.setFont(i, font)
diff --git a/nephilim/plugins/__init__.py b/nephilim/plugins/__init__.py
index 71ee2c4..32d9261 100644
--- a/nephilim/plugins/__init__.py
+++ b/nephilim/plugins/__init__.py
@@ -43,7 +43,7 @@ class Plugins:
module = sys.modules[name]
else:
module = __import__(name, globals(), locals(), [], 1)
- except (SyntaxError, ImportError), e:
+ except (SyntaxError, ImportError) as e:
logging.error('Failed to initialize plugin %s: %s.'%(name, e))
return False