예제 #1
0
    def __init__(self):
        logger.log( 9, 'games.PluginInterface.__init__()')
        plugin.MimetypePlugin.__init__(self)
        self.display_type = [ 'games' ]

        # activate the mediamenu for image
        plugin.activate('mediamenu', level=plugin.is_active('games')[2], args='games')
예제 #2
0
    def play(self, item, menuw):
        _debug_('play(item=%r, menuw=%r)' % (item, menuw), 2)

        self.item = item
        self.filename = item.filename
        self.command = item.command
        self.mode = item.mode
        self.menuw = menuw

        if not os.path.isfile(self.filename):
            osd.clearscreen()
            osd.drawstring(_('File "%s" not found!') % self.filename, 30, 280)
            osd.update()
            time.sleep(2.0)
            self.menuw.refresh()
            return 0

        if plugin.getbyname('MIXER'):
            plugin.getbyname('MIXER').reset()

        if plugin.is_active('joy'):
            try:
                plugin.getbyname('JOY').enable(FALSE)
            except Exception, e:
                _debug_('getbyname(\'JOY\')', e, DWARNING)
예제 #3
0
def _create_fxd(prog, filename, start_time):
    """
    Create a .fxd file with the specified program information in.
    """
    from util.fxdimdb import FxdImdb, makeVideo
    fxd = FxdImdb()

    (filebase, fileext) = os.path.splitext(filename)
    fxd.setFxdFile(filebase, overwrite=True)

    video = makeVideo('file', 'f1', os.path.basename(filename))
    fxd.setVideo(video)
    if prog:
        fxd.title = prog.title
        fxd.info['tagline'] = fxd.str2XML(prog.sub_title)
        desc = prog.desc.replace('\n\n', '\n').replace('\n', '
')
        fxd.info['plot'] = fxd.str2XML(desc)
    else:
        fxd.title = _('Manual Recording')
    fxd.info['recording_timestamp'] = str(start_time)
    fxd.info['runtime'] = None
    # bad use of the movie year field :)
    try:
        fxd.info['year'] = time.strftime(config.TV_RECORD_YEAR_FORMAT,
                                         time.localtime(start_time))
    except:
        fxd.info['year'] = '2007'

    if plugin.is_active('tv.recordings_manager'):
        fxd.info['watched'] = 'False'
        fxd.info['keep'] = 'False'
    fxd.writeFxd()
예제 #4
0
def _create_fxd(prog, filename, start_time):
    """
    Create a .fxd file with the specified program information in.
    """
    from util.fxdimdb import FxdImdb, makeVideo
    fxd = FxdImdb()

    (filebase, fileext) = os.path.splitext(filename)
    fxd.setFxdFile(filebase, overwrite=True)

    video = makeVideo('file', 'f1', os.path.basename(filename))
    fxd.setVideo(video)
    if prog:
        fxd.title = prog.title
        fxd.info['tagline'] = fxd.str2XML(prog.sub_title)
        desc = prog.desc.replace('\n\n','\n').replace('\n','
')
        fxd.info['plot'] = fxd.str2XML(desc)
    else:
        fxd.title = _('Manual Recording')
    fxd.info['recording_timestamp'] = str(start_time)
    fxd.info['runtime'] = None
    # bad use of the movie year field :)
    try:
        fxd.info['year'] = time.strftime(config.TV_RECORD_YEAR_FORMAT, time.localtime(start_time))
    except:
        fxd.info['year'] = '2007'

    if plugin.is_active('tv.recordings_manager'):
        fxd.info['watched'] = 'False'
        fxd.info['keep'] = 'False'
    fxd.writeFxd()
예제 #5
0
    def play(self, item, menuw):
        logger.log( 9, 'play(item=%r, menuw=%r)', item, menuw)

        self.item = item
        self.filename = item.filename
        self.command = item.command
        self.mode = item.mode
        self.menuw = menuw

        if not os.path.isfile(self.filename):
            osd.clearscreen()
            osd.drawstring(_('File "%s" not found!') % self.filename, 30, 280)
            osd.update()
            time.sleep(2.0)
            self.menuw.refresh()
            return 0

        if plugin.getbyname('MIXER'):
            plugin.getbyname('MIXER').reset()

        if plugin.is_active('joy'):
            try:
                plugin.getbyname('JOY').disable()
            except Exception, why:
                logger.warning('getbyname("JOY"): %s', why)
예제 #6
0
 def stop(self):
     self.app.stop()
     rc.app(None)
     if plugin.is_active('joy'):
         try:
             plugin.getbyname('JOY').enable(TRUE)
         except Exception, e:
             print 'getbyname(\'JOY\')', e
예제 #7
0
    def __init__(self):
        plugin.MimetypePlugin.__init__(self)
        self.display_type = [ 'audio' ]

        # register the callbacks
        plugin.register_callback('fxditem', ['audio'], 'audio', self.fxdhandler)

        # activate the mediamenu for audio
        plugin.activate('mediamenu', level=plugin.is_active('audio')[2], args='audio')
예제 #8
0
    def __init__(self):
        _debug_('games.PluginInterface.__init__()', 2)
        plugin.MimetypePlugin.__init__(self)
        self.display_type = ['games']

        # activate the mediamenu for image
        plugin.activate('mediamenu',
                        level=plugin.is_active('games')[2],
                        args='games')
예제 #9
0
    def __init__(self):
        plugin.MimetypePlugin.__init__(self)
        self.display_type = [ 'image' ]

        # register the callbacks
        plugin.register_callback('fxditem', ['image'], 'slideshow', self.fxdhandler)

        # activate the mediamenu for image
        plugin.activate('mediamenu', level=plugin.is_active('image')[2], args='image')
예제 #10
0
 def stop(self):
     logger.log( 9, 'stop()')
     self.app.stop()
     rc.remove_app(self)
     rc.resume()
     if plugin.is_active('joy'):
         try:
             plugin.getbyname('JOY').enable()
         except Exception, why:
             logger.warning('getbyname("JOY"): %s', why)
예제 #11
0
    def __init__(self):
        logger.debug('audio.PluginInterface.__init__()')
        plugin.MimetypePlugin.__init__(self)
        self.display_type = [ 'audio' ]

        # register the callbacks
        plugin.register_callback('fxditem', ['audio'], 'audio', self.fxdhandler)

        # activate the mediamenu for audio
        plugin.activate('mediamenu', level=plugin.is_active('audio')[2], args='audio')
예제 #12
0
 def stop(self):
     _debug_('stop()', 2)
     self.app.stop()
     rc.app(None)
     rc.resume()
     if plugin.is_active('joy'):
         try:
             plugin.getbyname('JOY').enable(TRUE)
         except Exception, e:
             _debug_('getbyname(\'JOY\')', e, DWARNING)
예제 #13
0
    def __init__(self):
        plugin.MimetypePlugin.__init__(self)
        self.display_type = ['image']

        # register the callbacks
        plugin.register_callback('fxditem', ['image'], 'slideshow',
                                 self.fxdhandler)

        # activate the mediamenu for image
        plugin.activate('mediamenu',
                        level=plugin.is_active('image')[2],
                        args='image')
예제 #14
0
    def __init__(self):
        plugin.MimetypePlugin.__init__(self)
        self.display_type = [ 'video' ]
        if config.AUDIO_SHOW_VIDEOFILES:
            self.display_type = [ 'video', 'audio' ]

        # load the fxd part of video
        import fxdhandler

        plugin.register_callback('fxditem', ['video'], 'movie',    fxdhandler.parse_movie)
        plugin.register_callback('fxditem', ['video'], 'disc-set', fxdhandler.parse_disc_set)

        # activate the mediamenu for video
        plugin.activate('mediamenu', level=plugin.is_active('video')[2], args='video')
예제 #15
0
    def __init__(self):
        plugin.MimetypePlugin.__init__(self)
        self.display_type = [ 'video' ]
        if config.AUDIO_SHOW_VIDEOFILES:
            self.display_type = [ 'video', 'audio' ]

        # load the fxd part of video
        import fxdhandler

        plugin.register_callback('fxditem', ['video'], 'movie', fxdhandler.parse_movie)
        plugin.register_callback('fxditem', ['video'], 'disc-set', fxdhandler.parse_disc_set)

        # activate the mediamenu for video
        plugin.activate('mediamenu', level=plugin.is_active('video')[2], args='video')
예제 #16
0
    def __init__(self):
        if not config.SYS_USE_NETWORK:
            self.reason = 'SYS_USE_NETWORK not enabled'
            return

        if not plugin.is_active('video.subtitles'):
            self.reason = 'Plugin \'video.subtitles\' not active, activate it first in your local_config.py!'
            return

        # opensubtitles XMLRPC server and token
        self.server = None
        self.token = None

        SubtitlesPlugin.__init__(self, 'os', 'opensubtitles.org', [])
        plugin.register(self, 'video.subtitles.opensubtitles')
예제 #17
0
    def __init__(self):
        if not config.SYS_USE_NETWORK:
            self.reason = 'SYS_USE_NETWORK not enabled'
            return
        
        if not plugin.is_active('video.subtitles'):
            self.reason = 'Plugin \'video.subtitles\' not active, activate it first in your local_config.py!'
            return

        # opensubtitles XMLRPC server and token
        self.server = None
        self.token  = None
        
        SubtitlesPlugin.__init__(self, 'os', 'opensubtitles.org', [])
        plugin.register(self, 'video.subtitles.opensubtitles')
예제 #18
0
    def __init__(self):
        """
        Constructor
        """
        if not config.SYS_USE_NETWORK:
            self.reason = 'SYS_USE_NETWORK not enabled'
            return
        
        if not plugin.is_active('video.subtitles'):
            self.reason = 'Plugin \'video.subtitles\' not active, activate it first in your local_config.py!'
            return

        langs = []

        try:
            langs = config.NAPI_LANGS
        except:
            langs = NAPI_LANGS

        SubtitlesPlugin.__init__(self, 'np', 'napiprojekt.pl', langs)
        plugin.register(self, 'video.subtitles.napiprojekt')
예제 #19
0
    def __init__(self):
        """
        Constructor
        """
        if not config.SYS_USE_NETWORK:
            self.reason = 'SYS_USE_NETWORK not enabled'
            return

        if not plugin.is_active('video.subtitles'):
            self.reason = 'Plugin \'video.subtitles\' not active, activate it first in your local_config.py!'
            return

        langs = []

        try:
            langs = config.NAPI_LANGS
        except:
            langs = NAPI_LANGS

        SubtitlesPlugin.__init__(self, 'np', 'napiprojekt.pl', langs)
        plugin.register(self, 'video.subtitles.napiprojekt')
예제 #20
0
    def __init__(self):
        plugin.MimetypePlugin.__init__(self)
        self.display_type = [ 'games' ]

        # activate the mediamenu for image
        plugin.activate('mediamenu', level=plugin.is_active('games')[2], args='games')
예제 #21
0
파일: config.py 프로젝트: freevo/freevo1
#
# set data dirs
# if not set, set it to root and home dir
# if set, make all path names absolute
#
for type in ("video", "audio", "image", "games"):
    n = "%s_ITEMS" % type.upper()
    x = eval(n)
    if x == None:
        x = []
        if os.environ.has_key("HOME") and os.environ["HOME"]:
            x.append(("Home", os.environ["HOME"]))
        x.append(("Root", "/"))
        exec ("%s = x" % n)
        if not HELPER and plugin.is_active("mediamenu", type):
            print
            print "Error: %s not set, set it to Home directory" % n
            print
        if type == "video":
            VIDEO_ONLY_SCAN_DATADIR = True

    elif type == "games":
        abs = []
        for d in x:
            pos = d[1].find(":")
            if pos == -1:
                abs.append((d[0], os.path.abspath(d[1]), d[2]))
            else:
                if pos > d[1].find("/"):
                    abs.append((d[0], os.path.abspath(d[1]), d[2]))
예제 #22
0
    except ImportError:
        print
        print 'Error: unable to read kaa.metadata version information'
        print 'Please update kaa.metadata to the latest release or if you use'
        print 'Freevo SVN versions, please also use kaa.metadata SVN.'
        print
        print 'Some functions in Freevo may not work or even crash!'
        print
        print

    start = time.clock()

    activate_plugins = []
    for type in ('video', 'audio', 'image', 'games'):
        if plugin.is_active(type):
            # activate all mime-type plugins
            plugin.init_special_plugin(type)
            activate_plugins.append(type)

    for type in 'VIDEO', 'AUDIO', 'IMAGE':
        for d in copy.copy(getattr(config, '%s_ITEMS' % type)):
            if not isstring(d):
                d = d[1]
            if d == os.path.sep:
                print 'ERROR: %s_ITEMS contains root directory, skipped.' % type
                setattr(config, '%s_ITEMS' % type, [])

    if os.path.isdir(os.path.join(config.FREEVO_CACHEDIR, 'playlists')):
        config.AUDIO_ITEMS.append(('Playlists', os.path.join(config.FREEVO_CACHEDIR, 'playlists')))
    delete_old_files_1()
예제 #23
0
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# -----------------------------------------------------------------------
import config
import plugin
#import logging
#logger = logging.getLogger("freevo.skin.xbmc.config")

# failsafe
if config.SKIN_XML_FILE == 'xbmc':

    if plugin.is_active('audio.detachbar'):
        plugin.remove('audio.detachbar')
        
    if not plugin.is_active('audio.detachdialog'):
        plugin.activate('audio.detachdialog')

    # ======================================================================
    # Freevo SKIN settings:
    # ======================================================================
    #
    # Skin file that contains the actual skin code. This is imported
    # from skin.py
    #
    SKIN_MODULE = 'xbmc'

    #
예제 #24
0
#
# set data dirs
# if not set, set it to root and home dir
# if set, make all path names absolute
#
for type in ('video', 'audio', 'image', 'games'):
    n = '%s_ITEMS' % type.upper()
    x = eval(n)
    if x == None:
        x = []
        if os.environ.has_key('HOME') and os.environ['HOME']:
            x.append(('Home', os.environ['HOME']))
        x.append(('Root', '/'))
        exec('%s = x' % n)
        if not HELPER and plugin.is_active('mediamenu', type):
            print
            print 'Error: %s not set, set it to Home directory' % n
            print
        if type == 'video':
            VIDEO_ONLY_SCAN_DATADIR = True

    elif type == 'games':
        abs = []
        for d in x:
            pos = d[1].find(':')
            if pos == -1:
                abs.append((d[0], os.path.abspath(d[1]), d[2]))
            else:
                if pos > d[1].find('/'):
                    abs.append((d[0], os.path.abspath(d[1]), d[2]))
예제 #25
0
파일: config.py 프로젝트: freevo/freevo1
#
# set data dirs
# if not set, set it to root and home dir
# if set, make all path names absolute
#
for type in ('video', 'audio', 'image', 'games'):
    n = '%s_ITEMS' % type.upper()
    x = eval(n)
    if x == None:
        x = []
        if os.environ.has_key('HOME') and os.environ['HOME']:
            x.append(('Home', os.environ['HOME']))
        x.append(('Root', '/'))
        exec('%s = x' % n)
        if not HELPER and plugin.is_active('mediamenu', type):
            print
            print 'Error: %s not set, set it to Home directory' % n
            print
        if type == 'video':
            VIDEO_ONLY_SCAN_DATADIR = True

    elif type == 'games':
        abs = []
        for d in x:
            pos = d[1].find(':')
            if pos == -1:
                abs.append((d[0], os.path.abspath(d[1]), d[2]))
            else:
                if pos > d[1].find('/'):
                    abs.append((d[0], os.path.abspath(d[1]), d[2]))
예제 #26
0
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# -----------------------------------------------------------------------
import config
import plugin
#import logging
#logger = logging.getLogger("freevo.skin.xbmc.config")

# failsafe
if config.SKIN_XML_FILE == 'xbmc':

    if plugin.is_active('audio.detachbar'):
        plugin.remove('audio.detachbar')

    if not plugin.is_active('audio.detachdialog'):
        plugin.activate('audio.detachdialog')

    # ======================================================================
    # Freevo SKIN settings:
    # ======================================================================
    #
    # Skin file that contains the actual skin code. This is imported
    # from skin.py
    #
    SKIN_MODULE = 'xbmc'

    #
예제 #27
0
    # Fire up splashscreen and load the plugins
    splash = Splashscreen(_('Starting Freevo-%s, please wait ...') % _version)
    skin.register('splashscreen', ('screen', splash))
    plugin.init(splash.progress)
    skin.delete('splashscreen')

    # Fire up splashscreen and load the cache
    if config.MEDIAINFO_USE_MEMORY == 2:
        import util.mediainfo

        splash = Splashscreen(_('Reading cache, please wait ...'))
        skin.register('splashscreen', ('screen', splash))

        cachefiles = []
        for type in ('video', 'audio', 'image', 'games'):
            if plugin.is_active(type):
                n = 'config.%s_ITEMS' % type.upper()
                x = eval(n)
                for item in x:
                    if os.path.isdir(item[1]):
                        cachefiles += [item[1]] + util.get_subdirs_recursively(
                            item[1])

        cachefiles = util.unique(cachefiles)

        for f in cachefiles:
            splash.progress(
                int((float(
                    (cachefiles.index(f) + 1)) / len(cachefiles)) * 100))
            util.mediainfo.load_cache(f)
        skin.delete('splashscreen')
예제 #28
0
파일: viewer.py 프로젝트: charrea6/freevo1
    def eventhandler(self, event, menuw=None):
        logger.log( 9, 'eventhandler(event=%s, menuw=%s)', event, menuw)
        # SELECT also should act as PLAY/PAUSE (-> could be done with event rerouting!?)
        if event == PAUSE or event == PLAY or (event == BUTTON and event.arg == 'SELECT'):
            if self.slideshow:
                rc.post_event(Event(OSD_MESSAGE, arg=_('pause')))
                rc.post_event(Event('IMAGE_PAUSE_INFO', arg=''))
                self.slideshow = False
                if self.timer:
                    self.timer.stop()
                    self.timer = None
            else:
                rc.post_event(Event(OSD_MESSAGE, arg=_('play')+(' %ss'%self.duration)))
                rc.post_event(Event('IMAGE_PLAY_INFO', arg='%s' % self.duration))
                self.slideshow = True
                self.timer = kaa.OneShotTimer(self.signalhandler)
                self.timer.start(self.duration)
            return True

        elif event == STOP:
            self.last_image  = None, None           
            self.slideshow = config.IMAGEVIEWER_AUTOPLAY
            if self.timer:
                self.timer.stop()
                self.timer = None
            if self.blend:
                self.blend.stop()
                self.blend.remove()
                self.blend = None
            rc.remove_app(self)
            self.__added_app = False
            self.fileitem.eventhandler(event)
            return True

        # up and down will stop the slideshow and pass the
        # event to the playlist
        elif event == PLAYLIST_NEXT or event == PLAYLIST_PREV:
            if self.timer:
                self.timer.stop()
                self.timer = None
            self.fileitem.eventhandler(event)
            return True

        # rotate image
        elif event == IMAGE_ROTATE:
            if event.arg == 'left':
                self.rotation = (self.rotation - 90) % 360
            else:
                self.rotation = (self.rotation + 90) % 360
            self.fileitem['rotation'] = self.rotation
            self.view(self.fileitem, zoom=self.zoom, rotation=self.rotation)
            if self.timer:
                self.timer.start(self.duration)
            return True

        # print image information
        elif event == TOGGLE_OSD:
            self.osd_mode = (self.osd_mode + 1) % (len(config.IMAGEVIEWER_OSD) + 1)
            # Redraw
            self.view(self.fileitem, zoom=self.zoom, rotation = self.rotation)
            return True

        # zoom to one third of the image
        # 1 is upper left, 9 is lower right, 0 zoom off
        elif str(event) in self.zoom_btns:
            self.zoom = self.zoom_btns[str(event)]
            if self.timer:
                self.timer.stop()
                self.slideshow = False

            if self.zoom:
                # Zoom one third of the image, don't load the next
                # image in the list
                self.view(self.fileitem, zoom=self.zoom, rotation = self.rotation)
            else:
                # Display entire picture, don't load next image in case
                # the user wants to zoom around some more.
                self.view(self.fileitem, zoom=0, rotation=self.rotation)
            return True

        elif event == IMAGE_MOVE:
            coord = event.arg
            if isinstance(self.zoom, int):
                self.zoom = self.zoom, coord[0], coord[1]
            else:
                self.zoom = self.zoom[0], self.zoom[1] + coord[0], self.zoom[2] + coord[1]
            self.view(self.fileitem, zoom=self.zoom, rotation=self.rotation)
            return True

        # save the image with the current rotation
        elif event == IMAGE_SAVE:
            if self.rotation and os.path.splitext(self.filename)[1] == ".jpg":
                cmd = 'jpegtran -copy all -rotate %s -outfile /tmp/freevo-iview %s' \
                      % ((self.rotation + 180) % 360, self.filename)
                os.system(cmd)
                os.system('mv /tmp/freevo-iview %s' % self.filename)
                self.rotation = 0
                self.osd.bitmapcache.__delitem__(self.filename)
                return True

        # append the image filename to shoppingcart list
        elif event == IMAGE_TAG:
            if plugin.is_active('shoppingcart'):
                try:
                    plugin.get('item')[0].shuntItemInCart(self.fileitem)
                    return True
                except Exception, e:
                    print 'getbyname(\'shoppingcart\')', e