+ def skip_listend(self):
+ if self.currList == "filelist":
+ idx = len(self.filelist.list)
+ self.filelist.moveToIndex(idx - 1)
+ else:
+ self.playlist.moveToIndex(len(self.playlist)-1)
+ self.updateCurrentInfo()
+
+ def save_playlist(self):
+ self.session.openWithCallback(self.save_playlist2,InputBox, title=_("Please enter filename (empty = use current date)"),windowTitle = _("Save Playlist"))
+
+ def save_playlist2(self, name):
+ if name is not None:
+ name = name.strip()
+ if name == "":
+ name = strftime("%y%m%d_%H%M%S")
+ name += ".e2pls"
+ self.playlistIOInternal.clear()
+ for x in self.playlist.list:
+ self.playlistIOInternal.addService(ServiceReference(x[0]))
+ self.playlistIOInternal.save(resolveFilename(SCOPE_PLAYLIST) + name)
+
+ def load_playlist(self):
+ listpath = []
+ playlistdir = resolveFilename(SCOPE_PLAYLIST)
+ try:
+ for i in os_listdir(playlistdir):
+ listpath.append((i,playlistdir + i))
+ except IOError,e:
+ print "Error while scanning subdirs ",e
+ self.session.openWithCallback(self.PlaylistSelected, ChoiceBox, title=_("Please select a playlist..."), list = listpath)
+
+ def PlaylistSelected(self,path):
+ if path is not None:
+ self.clear_playlist()
+ self.playlistIOInternal = PlaylistIOInternal()
+ list = self.playlistIOInternal.open(path[1])
+ if list:
+ for x in list:
+ self.playlist.addFile(x.ref)
+ self.playlist.updateList()
+
+ def delete_saved_playlist(self):
+ listpath = []
+ playlistdir = resolveFilename(SCOPE_PLAYLIST)
+ try:
+ for i in os_listdir(playlistdir):
+ listpath.append((i,playlistdir + i))
+ except IOError,e:
+ print "Error while scanning subdirs ",e
+ self.session.openWithCallback(self.DeletePlaylistSelected, ChoiceBox, title=_("Please select a playlist to delete..."), list = listpath)
+
+ def DeletePlaylistSelected(self,path):
+ if path is not None:
+ self.delname = path[1]
+ self.session.openWithCallback(self.deleteConfirmed, MessageBox, _("Do you really want to delete %s?") % (path[1]))
+
+ def deleteConfirmed(self, confirmed):
+ if confirmed:
+ os_remove(self.delname)
+
+ def clear_playlist(self):
+ self.stopEntry()
+ self.playlist.clear()
+ self.switchToFileList()
+
+ def copyDirectory(self, directory, recursive = True):
+ print "copyDirectory", directory