summaryrefslogtreecommitdiff
path: root/nephilim/common.py
diff options
context:
space:
mode:
authorAnton Khirnov <wyskas@gmail.com>2009-08-31 15:12:45 +0200
committerAnton Khirnov <wyskas@gmail.com>2009-08-31 15:12:45 +0200
commitb674c1a0fbc4612e65139fc0f4f6d0b0a41329cb (patch)
treeeecf9147c0023366cc519608d3ef358d09db1377 /nephilim/common.py
parenta77aecbee177152d61df3666015bfb6035606779 (diff)
switch to PyQt4 API v2 for QStrings
Diffstat (limited to 'nephilim/common.py')
-rw-r--r--nephilim/common.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/nephilim/common.py b/nephilim/common.py
index b0dac33..2663fa6 100644
--- a/nephilim/common.py
+++ b/nephilim/common.py
@@ -20,6 +20,7 @@ from PyQt4 import QtCore, QtGui, QtNetwork
import socket
import logging
import os
+import re
socket.setdefaulttimeout(8)
@@ -60,14 +61,12 @@ class Button(QtGui.QPushButton):
icon.addFile(iconPath, QtCore.QSize(self.iconSize, self.iconSize))
self.setIcon(icon)
-def expand_tags(str, expanders):
- #ensure that str is QString
- str = QtCore.QString(str)
+def expand_tags(string, expanders):
for expander in expanders:
- str = expander.expand_tags(str)
+ string = expander.expand_tags(string)
#remove unexpanded tags
- return str.replace(QtCore.QRegExp('\\$\\w+'), '')
+ return re.sub('\$\w+', '', string)
def generate_metadata_path(song, dir_tag, file_tag):
"""Generate dirname and (db files only) full file path for reading/writing metadata files
@@ -86,8 +85,8 @@ def generate_metadata_path(song, dir_tag, file_tag):
class MetadataFetcher(QtCore.QObject):
"""A basic class for metadata fetchers. Provides a fetch(song) function,
- emits a finished(song, metadata) signal when done; lyrics is either a QString,
- Python unicode string or None if not found."""
+ emits a finished(song, metadata) signal when done; lyrics is either a Python
+ unicode string or None if not found."""
#public, read-only
logger = None
name = ''