+ if self.filelist.getServiceRef().type == 4098: # playlist
+ list = []
+ list.append((_("Add files to playlist"), (self.ADDPLAYLIST, self.filelist.getServiceRef())))
+ list.append((_("Replace current playlist"), (self.REPLACEPLAYLIST, self.filelist.getServiceRef())))
+ self.session.openWithCallback(self.playlistCallback, ChoiceBox, title=_("You selected a playlist"), list = list)
+ else:
+ self.playlist.addFile(self.filelist.getServiceRef())
+ self.playlist.updateList()
+ if len(self.playlist) == 1:
+ self.changeEntry(0)
+
+ def addPlaylistParser(self, parser, extension):
+ self.playlistparsers[extension] = parser
+
+ def playlistCallback(self, answer):
+ if answer is not None:
+ extension = answer[1][1].getPath()[answer[1][1].getPath().rfind('.') + 1:]
+ print "extension:", extension
+ if self.playlistparsers.has_key(extension):
+ playlist = self.playlistparsers[extension]()
+ if answer[1][0] == self.REPLACEPLAYLIST:
+ self.stopEntry()
+ self.playlist.clear()
+ self.switchToFileList()
+ if answer[1][0] == self.REPLACEPLAYLIST or answer[1][0] == self.ADDPLAYLIST:
+ list = playlist.open(answer[1][1].getPath())
+ for x in list:
+ self.playlist.addFile(x.ref)
+