Don't prompt users to add duplicate files to playlist
This commit is contained in:
parent
7898916e90
commit
8ec9eea45d
@ -646,7 +646,7 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
if roomToJoin <> self._syncplayClient.getRoom():
|
if roomToJoin <> self._syncplayClient.getRoom():
|
||||||
menu.addAction(u"Join room {}".format(roomToJoin), lambda: self.joinRoom(roomToJoin))
|
menu.addAction(u"Join room {}".format(roomToJoin), lambda: self.joinRoom(roomToJoin))
|
||||||
elif username and filename and filename <> getMessage("nofile-note"):
|
elif username and filename and filename <> getMessage("nofile-note"):
|
||||||
if self.config['sharedPlaylistEnabled']:
|
if self.config['sharedPlaylistEnabled'] and not self.isItemInPlaylist(filename):
|
||||||
if isURL(filename):
|
if isURL(filename):
|
||||||
menu.addAction(QtGui.QPixmap(resourcespath + "world_add.png"), u"Add {} stream to playlist".format(shortUsername), lambda: self.addStreamToPlaylist(filename))
|
menu.addAction(QtGui.QPixmap(resourcespath + "world_add.png"), u"Add {} stream to playlist".format(shortUsername), lambda: self.addStreamToPlaylist(filename))
|
||||||
else:
|
else:
|
||||||
@ -1447,11 +1447,17 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
self._syncplayClient._player.openFile(filePath, resetPosition)
|
self._syncplayClient._player.openFile(filePath, resetPosition)
|
||||||
|
|
||||||
def noPlaylistDuplicates(self, filename):
|
def noPlaylistDuplicates(self, filename):
|
||||||
|
if self.isItemInPlaylist(filename):
|
||||||
|
self.showErrorMessage(u"Could not add second entry for '{}' to the playlist as no duplicates are allowed.".format(filename))
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
|
def isItemInPlaylist(self, filename):
|
||||||
for playlistindex in xrange(self.playlist.count()):
|
for playlistindex in xrange(self.playlist.count()):
|
||||||
if self.playlist.item(playlistindex).text() == filename:
|
if self.playlist.item(playlistindex).text() == filename:
|
||||||
self.showErrorMessage(u"Could not add second entry for '{}' to the playlist as no duplicates are allowed.".format(filename))
|
return True
|
||||||
return False
|
return False
|
||||||
return True
|
|
||||||
|
|
||||||
def addStreamToPlaylist(self, streamURI):
|
def addStreamToPlaylist(self, streamURI):
|
||||||
self.removePlaylistNote()
|
self.removePlaylistNote()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user