summaryrefslogtreecommitdiff
path: root/nephilim
diff options
context:
space:
mode:
authorAnton Khirnov <wyskas@gmail.com>2009-03-07 13:54:58 +0100
committerAnton Khirnov <wyskas@gmail.com>2009-03-07 13:54:58 +0100
commit011c8f43a9fa9a12c72535f5b719c713578f55e7 (patch)
tree8d13fd32c4a921d9c6eb13f95868de04e5135858 /nephilim
parentfbd81bd6a5b9495fd29a91b345fb0555f1e7e176 (diff)
clSong: get rid of camelcase.
Diffstat (limited to 'nephilim')
-rw-r--r--nephilim/clSong.py38
-rw-r--r--nephilim/plugins/AlbumCover.py12
-rw-r--r--nephilim/plugins/Library.py8
-rw-r--r--nephilim/plugins/Lyrics.py6
-rw-r--r--nephilim/plugins/Playlist.py2
-rw-r--r--nephilim/winMain.py4
6 files changed, 35 insertions, 35 deletions
diff --git a/nephilim/clSong.py b/nephilim/clSong.py
index 05b9f96..3bd319c 100644
--- a/nephilim/clSong.py
+++ b/nephilim/clSong.py
@@ -32,32 +32,32 @@ class Song:
self._data['timems'] = '%i:%i'%(self._data['time'] / 60, self._data['time'] % 60)
self._data['length'] = sec2min(self._data['time'])
- def getID(self):
- """Get the ID."""
- return self.getTag('id', -1)
+ def id(self):
+ """Get the song's playlist ID. (-1 if not in playlist)."""
+ return self.tag('id', -1)
- def getTitle(self):
- """Get the title."""
- return self.getTag('title', self._data['file'])
+ def title(self):
+ """Get the song's title (or filename if it has no title)."""
+ return self.tag('title', self._data['file'])
- def getArtist(self):
- """Get the artist."""
- return self.getTag('artist', self._data['file'])
+ def artist(self):
+ """Get the song's artist."""
+ return self.tag('artist')
- def getTrack(self):
- """Get the track."""
- return self.getTag('track')
+ def track(self):
+ """Get the song's track number."""
+ return self.tag('track')
- def getAlbum(self):
+ def album(self):
"""Get the album."""
- return self.getTag('album')
+ return self.tag('album')
- def getFilepath(self):
+ def filepath(self):
"""Get the filepath."""
return self._data['file']
- def getTag(self, tag, default=''):
- """Get a tag. If it doesn't exist, return $default."""
+ def tag(self, tag, default=''):
+ """Get a tag. If it doesn't exist, return default."""
if tag in self._data:
return self._data[tag]
if tag=='song':
@@ -68,9 +68,9 @@ class Song:
def expand_tags(self, str):
"""Expands tags in form $tag in str."""
ret = str
- ret = ret.replace('$title', self.getTitle()) #to ensure that it is set to at least filename
+ ret = ret.replace('$title', self.title()) #to ensure that it is set to at least filename
for tag in self._data:
ret = ret.replace('$' + tag, unicode(self._data[tag]))
- ret = ret.replace('$songdir', os.path.dirname(self.getFilepath()))
+ ret = ret.replace('$songdir', os.path.dirname(self.filepath()))
return ret
diff --git a/nephilim/plugins/AlbumCover.py b/nephilim/plugins/AlbumCover.py
index ae410ff..99dfc8c 100644
--- a/nephilim/plugins/AlbumCover.py
+++ b/nephilim/plugins/AlbumCover.py
@@ -77,10 +77,10 @@ class wgAlbumCover(QtGui.QLabel):
self.cover_loaded = False
return
- if QtCore.QDir.isAbsolutePath(song.getFilepath()):
- self.cover_dirname = os.path.dirname(song.getFilepath())
+ if QtCore.QDir.isAbsolutePath(song.filepath()):
+ self.cover_dirname = os.path.dirname(song.filepath())
self.cover_filepath = ''
- elif '://' in song.getFilepath(): # we are streaming
+ elif '://' in song.filepath(): # we are streaming
self.cover_dirname = ''
self.cover_filepath = ''
else:
@@ -117,7 +117,7 @@ class wgAlbumCover(QtGui.QLabel):
return
file = QtGui.QFileDialog.getOpenFileName(self,
- 'Select album cover for %s - %s'%(song.getArtist(), song.getAlbum()),
+ 'Select album cover for %s - %s'%(song.artist(), song.album()),
self.cover_dirname, '')
cover = QtGui.QPixmap(file)
if cover.isNull():
@@ -168,10 +168,10 @@ class wgAlbumCover(QtGui.QLabel):
self.set_cover(cover, True)
def fetch_amazon(self, song):
- if not song.getArtist() or not song.getAlbum():
+ if not song.artist() or not song.album():
return None
# get the url from amazon WS
- coverURL = AmazonAlbumImage(song.getArtist(), song.getAlbum()).fetch()
+ coverURL = AmazonAlbumImage(song.artist(), song.album()).fetch()
logging.info("fetching from Amazon")
if not coverURL:
logging.info("not found on Amazon")
diff --git a/nephilim/plugins/Library.py b/nephilim/plugins/Library.py
index 3f3f2d5..11e1816 100644
--- a/nephilim/plugins/Library.py
+++ b/nephilim/plugins/Library.py
@@ -104,7 +104,7 @@ class LibraryWidget(QtGui.QWidget):
for song in self.plugin.mpclient().library():
cur_item = tree
for part in str(self.modes.currentText()).split('/'):
- tag = song.getTag(part)
+ tag = song.tag(part)
if isinstance(tag, list):
tag = tag[0] #FIXME hack to make songs with multiple genres work.
if not tag:
@@ -116,8 +116,8 @@ class LibraryWidget(QtGui.QWidget):
cur_item[1].addChild(it)
cur_item[0][tag] = [{}, it]
cur_item = cur_item[0][tag]
- it = QtGui.QTreeWidgetItem(['%02d %s'%(song.getTrack() if song.getTrack() else 0,
- song.getTitle() if song.getTitle() else song.getFilepath())], 1000)
+ it = QtGui.QTreeWidgetItem(['%02d %s'%(song.track() if song.track() else 0,
+ song.title() if song.title() else song.filepath())], 1000)
it.setData(0, QtCore.Qt.UserRole, QVariant(song))
cur_item[1].addChild(it)
@@ -149,7 +149,7 @@ class LibraryWidget(QtGui.QWidget):
def item_to_playlist(self, item, add_queue):
if item.type() == 1000:
- add_queue.append(item.data(0, QtCore.Qt.UserRole).toPyObject().getFilepath())
+ add_queue.append(item.data(0, QtCore.Qt.UserRole).toPyObject().filepath())
else:
for i in range(item.childCount()):
self.item_to_playlist(item.child(i), add_queue)
diff --git a/nephilim/plugins/Lyrics.py b/nephilim/plugins/Lyrics.py
index ee8bb5b..3bffe49 100644
--- a/nephilim/plugins/Lyrics.py
+++ b/nephilim/plugins/Lyrics.py
@@ -29,7 +29,7 @@ class wgLyrics(QtGui.QWidget):
if song:
self.txtView.insertHtml('<b>%s</b>\n<br /><u>%s</u><br />'\
- '<br />\n\n'%(song.getTitle(), song.getArtist()))
+ '<br />\n\n'%(song.title(), song.artist()))
else:
return
@@ -72,8 +72,8 @@ class Lyrics(Plugin):
def fetch_lyricwiki(self, song):
soap = LyricWiki_client.LyricWikiBindingSOAP("http://lyricwiki.org/server.php")
req = LyricWiki_client.getSongRequest()
- req.Artist = song.getArtist()
- req.Song = song.getTitle()
+ req.Artist = song.artist()
+ req.Song = song.title()
result = soap.getSong(req).Return.Lyrics.decode('utf-8').encode('iso8859').decode('utf-8')
return result if result != 'Not found' else None
diff --git a/nephilim/plugins/Playlist.py b/nephilim/plugins/Playlist.py
index f784fab..2ac8bbb 100644
--- a/nephilim/plugins/Playlist.py
+++ b/nephilim/plugins/Playlist.py
@@ -71,7 +71,7 @@ class PlaylistWidget(QtGui.QWidget):
for song in self.plugin.mpclient().playlist():
item = QtGui.QTreeWidgetItem()
for i in range(len(columns)):
- item.setText(i, unicode(song.getTag(str(columns[i]))))
+ item.setText(i, unicode(song.tag(str(columns[i]))))
item.setData(0, QtCore.Qt.UserRole, QVariant(song))
self.addTopLevelItem(item)
diff --git a/nephilim/winMain.py b/nephilim/winMain.py
index 2ef8d79..af5d766 100644
--- a/nephilim/winMain.py
+++ b/nephilim/winMain.py
@@ -249,8 +249,8 @@ class winMain(QtGui.QMainWindow):
def update_state_messages(self):
song = self.mpclient.current_song()
if song and self.mpclient.is_playing():
- self.setWindowTitle('%s by %s - %s'%(song.getTitle(), song.getArtist(), APPNAME))
- self.statuslabel.setText('Now playing %s by %s on %s'%(song.getTitle(), song.getArtist(),song.getAlbum()))
+ self.setWindowTitle('%s by %s - %s'%(song.title(), song.artist(), APPNAME))
+ self.statuslabel.setText('Now playing %s by %s on %s'%(song.title(), song.artist(),song.album()))
else:
self.setWindowTitle(APPNAME)
self.statuslabel.setText('')