summaryrefslogtreecommitdiff
path: root/nephilim
diff options
context:
space:
mode:
authorAnton Khirnov <wyskas@gmail.com>2009-06-19 15:08:05 +0200
committerAnton Khirnov <wyskas@gmail.com>2009-06-19 15:08:05 +0200
commit4264cea8e446cd5cb5f01c9749b201d5c57ecff6 (patch)
tree6d0ebac70ca61b4b116cc5e4d35c448d1bbe8ea8 /nephilim
parent7ea46b5470d3212d2b1bad639497597fb1e771f1 (diff)
Move expand_tags for musicdir from winMain to nephilim_app.
Diffstat (limited to 'nephilim')
-rw-r--r--nephilim/misc.py6
-rw-r--r--nephilim/plugins/AlbumCover.py2
-rw-r--r--nephilim/plugins/Lyrics.py2
-rw-r--r--nephilim/winMain.py7
4 files changed, 5 insertions, 12 deletions
diff --git a/nephilim/misc.py b/nephilim/misc.py
index 7ebecb1..f7dd2a0 100644
--- a/nephilim/misc.py
+++ b/nephilim/misc.py
@@ -69,7 +69,7 @@ def expand_tags(str, expanders):
#remove unexpanded tags
return str.replace(QtCore.QRegExp('\\$\\w+'), '')
-def generate_metadata_path(main_win, song, dir_tag, file_tag):
+def generate_metadata_path(song, dir_tag, file_tag):
"""Generate dirname and (db files only) full file path for reading/writing metadata files
(cover, lyrics) from $tags in dir/filename.
HACK main_win argument should be removed ASAP"""
@@ -80,7 +80,7 @@ def generate_metadata_path(main_win, song, dir_tag, file_tag):
dirname = ''
filepath = ''
else:
- dirname = expand_tags(dir_tag, (main_win, song))
- filepath = '%s/%s'%(dirname, expand_tags(file_tag, (main_win, song)).replace('/', '_'))
+ dirname = expand_tags(dir_tag, (QtGui.QApplication.instance(), song))
+ filepath = '%s/%s'%(dirname, expand_tags(file_tag, (QtGui.QApplication.instance(), song)).replace('/', '_'))
return dirname, filepath
diff --git a/nephilim/plugins/AlbumCover.py b/nephilim/plugins/AlbumCover.py
index 9c9746d..a62a701 100644
--- a/nephilim/plugins/AlbumCover.py
+++ b/nephilim/plugins/AlbumCover.py
@@ -134,7 +134,7 @@ class wgAlbumCover(QtGui.QLabel):
self.logger.info("autorefreshing cover")
# generate filenames
- (self._cover_dirname, self._cover_filepath) = generate_metadata_path(self.plugin.parent(), song, self.plugin.settings().value(self.plugin.name() + '/coverdir').toString(),
+ (self._cover_dirname, self._cover_filepath) = generate_metadata_path(song, self.plugin.settings().value(self.plugin.name() + '/coverdir').toString(),
self.plugin.settings().value(self.plugin.name() + '/covername').toString())
write = False
diff --git a/nephilim/plugins/Lyrics.py b/nephilim/plugins/Lyrics.py
index e982ee3..02d6a3c 100644
--- a/nephilim/plugins/Lyrics.py
+++ b/nephilim/plugins/Lyrics.py
@@ -110,7 +110,7 @@ class Lyrics(Plugin):
if not song:
return self.o.set_lyrics(None, None)
- (self.lyrics_dir, self.lyrics_path) = misc.generate_metadata_path(self.parent(), song,
+ (self.lyrics_dir, self.lyrics_path) = misc.generate_metadata_path(song,
self.settings().value(self.name() + '/lyricdir').toString(),
self.settings().value(self.name() + '/lyricname').toString())
try:
diff --git a/nephilim/winMain.py b/nephilim/winMain.py
index dfd8678..67a684d 100644
--- a/nephilim/winMain.py
+++ b/nephilim/winMain.py
@@ -21,7 +21,6 @@ from PyQt4.QtCore import QVariant
import logging
from misc import APPNAME, sec2min, appIcon
-from mpclient import MPClient
from connect_wg import ConnectWidget
DEFAULT_LAYOUT_FILE = 'default_layout'
@@ -231,9 +230,3 @@ class winMain(QtGui.QMainWindow):
if not self.time_slider.isSliderDown():
self.time_slider.setValue(new_time)
self.time_label.setText(sec2min(new_time) + '/' + self.time_label.duration)
-
- def expand_tags(self, str):
- # maybe there's a better place for this function
- ret = str
- ret = ret.replace('$musicdir', self.settings.value('MPD/music_dir').toString())
- return ret