summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorjerous <jerous@gmail.com>2008-09-28 00:51:09 +0200
committerjerous <jerous@gmail.com>2008-09-28 00:51:09 +0200
commit95bcfd646d9cebc4e85120e836fe6537b8b648be (patch)
treeca68c56abb0c1cf241ab6ccdcb2a7d916156392e /plugins
parenta20eadadeb4cb8ec95204e76b7249100265645cc (diff)
fix moving to next song in random album mode: next song was only chosen when at the end of an album, thus when songs were not in track-order, a non-album song was chosen
Diffstat (limited to 'plugins')
-rw-r--r--plugins/PlayControl.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/plugins/PlayControl.py b/plugins/PlayControl.py
index 53352a9..2e6c780 100644
--- a/plugins/PlayControl.py
+++ b/plugins/PlayControl.py
@@ -3,6 +3,7 @@ from PyQt4 import QtGui, QtSvg, QtCore
from misc import *
from clMonty import monty
from clPlugin import *
+import clSong
from thread import start_new_thread
from random import randint
@@ -200,6 +201,13 @@ class wgPlayControl(QtGui.QWidget):
# all first songs of an album
albums=filter(lambda s: s.getAlbum() and s.getTrack()==1, monty.listPlaylist())
nextID=albums[randint(0,len(albums)-1)].getID()
+ else:
+ # we're not at end of album, so we fetch the next id
+ # We must do this, because albums are not necesseraly in the same order
+ for i in xrange(len(self.curAlbumSongs)):
+ if self.curAlbumSongs[i].getTrack()==song.getTrack():
+ nextID=self.curAlbumSongs[i+1].getID()
+ break
if nextID!=None:
monty.play(nextID)
@@ -207,15 +215,12 @@ class wgPlayControl(QtGui.QWidget):
def findAlbumSongs(self):
"""This method looks for the songs in the album of current playing song."""
song=monty.getCurrentSong()
- if self.curAlbumSongs \
- and song.getAlbum()==self.curAlbumSongs[0].getAlbum() \
- and song.getArtist()==self.curAlbumSongs[0].getArtist():
+ if self.curAlbumSongs and clSong.isSameAlbum(song, self.curAlbumSongs[0]):
return
self.curAlbumSongs=None
if not song or not song.getAlbum():
return
- self.curAlbumSongs=filter(lambda s: s.getArtist()==song.getArtist()
- and s.getAlbum()==song.getAlbum(), monty.listPlaylist())
+ self.curAlbumSongs=filter(lambda s: clSong.isSameAlbum(s, song), monty.listPlaylist())
self.curAlbumSongs=sorted(self.curAlbumSongs, lambda l,r: numeric_compare(l.getTrack(), r.getTrack()))
def onBtnPlayPauseClick(self):