# -*- coding: iso-8859-1 -*- ## ## Copyright (C) 2008 michael michael[at]vierpi(dot)de ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published ## by the Free Software Foundation; version 2 only. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## # http://www.vierpi.de/JbroutMovieplayer.html from __main__ import JPlugin import os class Plugin(JPlugin): """Play movie of the selected pictures.""" __author__ = "michael" __version__ = "1.0" player = 'mplayer' def menuEntries(self, l): ipath = '/usr/share/icons/gnome/24x24/mimetypes/gnome-mime-video.png' if os.path.exists(ipath): icon = ipath else: icon = None return [ (511, _("Movieplayer"), False, self.movieplayerFromMenu, icon), ] def albumEntries(self,n): return [ (91, _("Movieplayer"), False, self.movieplayerFromAlbum), ] def movieplayer(self, filelist): for f in filelist: os.system(self.player + ' ' + f) def movieplayerFromAlbum(self, node): jpgfiles = [os.path.join(node.file, f) for f in os.listdir(node.file) if os.path.splitext(f)[1] == '.jpg'] movfiles = [] for f in jpgfiles: for ext in ('.avi', '.mpg'): mf = os.path.splitext(f)[0] + ext if os.path.exists(mf): movfiles.append(mf) self.movieplayer(movfiles) return False def movieplayerFromMenu(self, l): jpgfiles = [f.file for f in l] movfiles = [] for f in jpgfiles: for ext in ('.avi', '.mpg'): mf = os.path.splitext(f)[0] + ext if os.path.exists(mf): movfiles.append(mf) self.movieplayer(movfiles) return False