Пример #1
0
def main():
    kodiutil.setScope()
    kodiutil.setGlobalProperty('VERSION',
                               kodiutil.ADDON.getAddonInfo('version'))
    kodiutil.LOG('Sequence editor: OPENING')
    SequenceEditorWindow.open()
    kodiutil.LOG('Sequence editor: CLOSED')
Пример #2
0
def main():
    kodiutil.checkAPILevel()
    kodiutil.setScope()
    kodiutil.setGlobalProperty('VERSION', kodiutil.ADDON.getAddonInfo('version'))
    kodiutil.LOG('Sequence editor: OPENING')
    SequenceEditorWindow.open()
    kodiutil.LOG('Sequence editor: CLOSED')
Пример #3
0
def setTheme(theme_path=None):
    global THEME

    default = os.path.join(kodiutil.ADDON_PATH, 'resources', 'themes',
                           'default') + '/'

    if theme_path is not None:
        kodiutil.setSetting('theme.path', theme_path)
    else:
        theme_path = kodiutil.getSetting('theme.path', default)

    cfg = cinemavision.util.pathJoin(theme_path, 'theme.json')
    try:
        with cinemavision.util.vfs.File(cfg, 'r') as f:
            THEME = json.loads(f.read().decode('utf-8'))
            THEME['theme.path'] = theme_path
    except:
        kodiutil.ERROR('Could not read {0}'.format(cfg))
        THEME = {
            'theme.name': '[I]Default[/I]',
            'theme.color.icon': 'FF9C2A2D',
            'theme.color.setting': 'FF9C2A2D',
            'theme.color.move': 'FF9C2A2D',
            'theme.color.button.selected': 'FF9C2A2D',
            'theme.path': default
        }

    kodiutil.setGlobalProperty('theme.color.icon', THEME['theme.color.icon'])
    kodiutil.setGlobalProperty('theme.color.setting',
                               THEME['theme.color.setting'])
    kodiutil.setGlobalProperty('theme.color.move', THEME['theme.color.move'])
    kodiutil.setGlobalProperty('theme.color.button.selected',
                               THEME['theme.color.button.selected'])
    kodiutil.setGlobalProperty('theme.path', THEME['theme.path'])
Пример #4
0
 def checkForContentDB(self):
     if kodiutil.getSetting('content.path'):
         kodiutil.setGlobalProperty('DEMO_MODE', '')
         return kodiutil.getSetting('content.initialized', False)
     else:
         kodiutil.setGlobalProperty('DEMO_MODE', '1')
         return True
Пример #5
0
    def new(self):
        if self.abortOnModified():
            return

        self.sequenceData = cinemavision.sequence.SequenceData()
        self.setName('')
        kodiutil.setGlobalProperty('ACTIVE', self.sequenceData.active and '1'
                                   or '0')
        self.sequenceControl.reset()
        self.fillSequence()
        self.setFocusId(self.ADD_ITEM_LIST_ID)
Пример #6
0
    def toggleItemEnabled(self):
        item = self.sequenceControl.getSelectedItem()
        if not item:
            return

        sItem = item.dataSource
        sItem.enabled = not sItem.enabled
        item.setProperty('enabled', sItem.enabled and '1' or '')
        kodiutil.setGlobalProperty('sequence.item.enabled',
                                   item.getProperty('enabled'))
        self.updateItemSettings(item)

        self.modified = True
Пример #7
0
 def change(self, url):
     kodiutil.setGlobalProperty('image0', self.lastImage)
     kodiutil.setGlobalProperty('show1', '')
     xbmc.sleep(100)
     kodiutil.setGlobalProperty('image1', url)
     kodiutil.setGlobalProperty('show1', '1')
     self.lastImage = url
Пример #8
0
 def change(self, url):
     kodiutil.setGlobalProperty('image0', self.lastImage)
     kodiutil.setGlobalProperty('show1', '')
     xbmc.sleep(100)
     kodiutil.setGlobalProperty('image1', url)
     kodiutil.setGlobalProperty('show1', '1')
     self.lastImage = url
Пример #9
0
 def start(self, sequence_path):
     kodiutil.setGlobalProperty('running', '1')
     xbmcgui.Window(10025).setProperty('CinemaExperienceRunning', 'True')
     self.initSkinVars()
     self.playGUISounds.disable()
     self.screensaver.disable()
     self.visualization.disable()
     try:
         return self._start(sequence_path)
     finally:
         self.playGUISounds.restore()
         self.screensaver.restore()
         self.visualization.restore()
         kodiutil.setGlobalProperty('running', '')
         xbmcgui.Window(10025).setProperty('CinemaExperienceRunning', '')
         self.initSkinVars()
Пример #10
0
 def start(self, sequence_path):
     kodiutil.setGlobalProperty('running', '1')
     xbmcgui.Window(10025).setProperty('CinemaExperienceRunning', 'True')
     self.initSkinVars()
     self.playGUISounds.disable()
     self.screensaver.disable()
     self.visualization.disable()
     try:
         return self._start(sequence_path)
     finally:
         self.playGUISounds.restore()
         self.screensaver.restore()
         self.visualization.restore()
         kodiutil.setGlobalProperty('running', '')
         xbmcgui.Window(10025).setProperty('CinemaExperienceRunning', '')
         self.initSkinVars()
Пример #11
0
 def __init__(self, *args, **kwargs):
     kodigui.BaseWindow.__init__(self, *args, **kwargs)
     kodiutil.setGlobalProperty('paused', '')
     kodiutil.setGlobalProperty('number', '')
     kodiutil.setScope()
     self.player = None
     self.action = None
     self.volume = None
     self.abortFlag = None
     self.effect = None
     self.duration = 400
     self.lastImage = ''
     self.initialized = False
     self._paused = False
     self._pauseStart = 0
     self._pauseDuration = 0
     self.clear()
Пример #12
0
 def __init__(self, *args, **kwargs):
     kodigui.BaseWindow.__init__(self, *args, **kwargs)
     kodiutil.setGlobalProperty('paused', '')
     kodiutil.setGlobalProperty('number', '')
     kodiutil.setScope()
     self.player = None
     self.action = None
     self.volume = None
     self.abortFlag = None
     self.effect = None
     self.duration = 400
     self.lastImage = ''
     self.initialized = False
     self._paused = False
     self._pauseStart = 0
     self._pauseDuration = 0
     self.clear()
Пример #13
0
    def setSkinFeatureVars(self):
        feature = self.processor.nextFeature()

        if feature:
            kodiutil.setGlobalProperty('feature.next.title', feature.title)
            kodiutil.setGlobalProperty('feature.next.dbid', str(feature.ID))
            kodiutil.setGlobalProperty('feature.next.dbtype', feature.dbType)
            kodiutil.setGlobalProperty('feature.next.path', feature.path)
        else:
            self.initSkinFeatureVars()
Пример #14
0
    def setSkinFeatureVars(self):
        feature = self.processor.nextFeature()

        if feature:
            kodiutil.setGlobalProperty('feature.next.title', feature.title)
            kodiutil.setGlobalProperty('feature.next.dbid', str(feature.ID))
            kodiutil.setGlobalProperty('feature.next.dbtype', feature.dbType)
            kodiutil.setGlobalProperty('feature.next.path', feature.path)
        else:
            self.initSkinFeatureVars()
Пример #15
0
    def attributeClicked(self):
        item = self.attributeList.getSelectedItem()
        if not item:
            return
        option = item.dataSource[0]
        label = item.dataSource[1]

        val = None

        if option == 'directors':
            val = self.getDBEntry(self.getDirectorList, 'director', 'Director', self.sequenceData.get('directors'))
        elif option == 'actors':
            val = self.getDBEntry(self.getActorList, 'actor', 'Actor', self.sequenceData.get('actors'))
        elif option == 'studios':
            val = self.getDBEntry(self.getStudioList, 'studio', 'Studio', self.sequenceData.get('studios'))
        elif option == 'genres':
            val = self.getDBEntry(self.getGenreList, 'genre', 'Genre', self.sequenceData.get('genres'))
        elif option == 'tags':
            val = self.getDBEntry(self.getTagList, 'tag', 'Tag', self.sequenceData.get('tags'))
        elif option == 'year':
            val = self.getRangedEntry(self.getYear, 'year', self.sequenceData.get('year'))
        elif option == 'ratings':
            val = self.getRangedEntry(self.getRating, 'ratings', self.sequenceData.get('ratings'))
        elif option == 'dates':
            val = self.getRangedEntry(self.getDate, 'dates', self.sequenceData.get('dates'))
        elif option == 'times':
            val = self.getRangedEntry(self.getTime, 'times', self.sequenceData.get('times'))
        elif option == 'active':
            val = not self.sequenceData.active
            self.sequenceData.active = val
            kodiutil.setGlobalProperty('ACTIVE', self.sequenceData.active and '1' or '0')
        elif option == 'type':
            if not self.sequenceData.get('type'):
                val = '2D'
            else:
                val = self.sequenceData.get('type') == '2D' and '3D' or ''
        else:
            val = xbmcgui.Dialog().input(u'Enter {0}'.format(label), self.sequenceData.get(option))

        if val is None:
            return

        self.sequenceData.set(option, val)
        self.modified = True
        self.updateItem(item)
Пример #16
0
    def next(self, prev=False):
        if not self.processor or self.processor.atEnd():
            return

        if not self.window.isOpen:
            self.abort()
            return

        if prev:
            playable = self.processor.prev()
        else:
            playable = self.processor.next()

        if playable is None:
            self.window.doClose()
            return

        DEBUG_LOG('Playing next item: {0}'.format(playable))

        if playable.type not in ('ACTION', 'COMMAND'):
            kodiutil.setGlobalProperty('module.current', playable.module._type)
            kodiutil.setGlobalProperty('module.current.name', playable.module.displayRaw())
            kodiutil.setGlobalProperty('module.next', self.processor.upNext() and self.processor.upNext().module._type or '')
            kodiutil.setGlobalProperty('module.next.name', self.processor.upNext() and self.processor.upNext().module.displayRaw() or '')

        if playable.type == 'IMAGE':
            try:
                action = self.showImage(playable)
            finally:
                self.window.clear()

            if action == 'BACK':
                self.next(prev=True)
            else:
                self.next()

        elif playable.type == 'IMAGE.QUEUE':
            if not self.showImageQueue(playable):
                self.next(prev=True)
            else:
                self.next()

        elif playable.type == 'VIDEO.QUEUE':
            self.showVideoQueue(playable)

        elif playable.type in ('VIDEO', 'FEATURE'):
            self.showVideo(playable)

        elif playable.type == 'ACTION':
            self.doAction(playable)
            self.next()

        else:
            DEBUG_LOG('NOT PLAYING: {0}'.format(playable))
            self.next()
Пример #17
0
    def _load(self, path):
        try:
            sData = cinemavision.sequence.SequenceData.load(path)
        except cinemavision.exceptions.EmptySequenceFileException:
            xbmcgui.Dialog().ok(
                T(32573, 'Failed'), 'Failed to read sequence file!',
                'Kodi may be unable to read from this location.')
            return
        except cinemavision.exceptions.BadSequenceFileException:
            xbmcgui.Dialog().ok(T(32573,
                                  'Failed'), 'Failed to read sequence file!',
                                'The sequence file may have been corrupted.')
            return
        except:
            kodiutil.ERROR()
            xbmcgui.Dialog().ok(
                T(32573, 'Failed'), 'Failed to read sequence file!',
                'There was an unknown error. See kodi.log for details.')
            return

        if not sData:
            xbmcgui.Dialog().ok(T(32601, 'ERROR'),
                                T(32602, 'Error parsing sequence'))
            return

        self.sequenceControl.reset()
        self.fillSequence()

        self.sequenceData = sData
        kodiutil.setGlobalProperty('ACTIVE', self.sequenceData.active and '1'
                                   or '0')
        self.addItems(sData)

        if self.sequenceControl.positionIsValid(1):
            self.selectSequenceItem(1)
            self.setFocusId(self.ITEM_OPTIONS_LIST_ID)
        else:
            self.selectSequenceItem(0)
            self.setFocusId(self.ADD_ITEM_LIST_ID)

        self.modified = False
Пример #18
0
 def none(self, url):
     self.lastImage = url
     kodiutil.setGlobalProperty('image0', url)
Пример #19
0
    def next(self, prev=False):
        if not self.processor or self.processor.atEnd():
            return

        if not self.window.isOpen:
            self.abort()
            return

        if prev:
            playable = self.processor.prev()
        else:
            playable = self.processor.next()

        if playable is None:
            self.window.doClose()
            return

        DEBUG_LOG('Playing next item: {0}'.format(playable))

        if playable.type not in ('ACTION', 'COMMAND'):
            kodiutil.setGlobalProperty('module.current', playable.module._type)
            kodiutil.setGlobalProperty('module.current.name',
                                       playable.module.displayRaw())
            kodiutil.setGlobalProperty(
                'module.next',
                self.processor.upNext()
                and self.processor.upNext().module._type or '')
            kodiutil.setGlobalProperty(
                'module.next.name',
                self.processor.upNext()
                and self.processor.upNext().module.displayRaw() or '')

        if playable.type == 'IMAGE':
            try:
                action = self.showImage(playable)
            finally:
                self.window.clear()

            if action == 'BACK':
                self.next(prev=True)
            else:
                self.next()

        elif playable.type == 'IMAGE.QUEUE':
            if not self.showImageQueue(playable):
                self.next(prev=True)
            else:
                self.next()

        elif playable.type == 'VIDEO.QUEUE':
            self.showVideoQueue(playable)

        elif playable.type in ('VIDEO', 'FEATURE'):
            self.showVideo(playable)

        elif playable.type == 'ACTION':
            self.doAction(playable)
            self.next()

        else:
            DEBUG_LOG('NOT PLAYING: {0}'.format(playable))
            self.next()
Пример #20
0
 def none(self, url):
     self.lastImage = url
     kodiutil.setGlobalProperty('image0', url)
Пример #21
0
 def clear(self):
     self.currentImage = 0
     self.lastImage = ''
     kodiutil.setGlobalProperty('image0', '')
     kodiutil.setGlobalProperty('image1', '')
     kodiutil.setGlobalProperty('show1', '')
Пример #22
0
    def showImageQueue(self, image_queue):
        image_queue.reset()
        image = image_queue.next()

        start = time.time()
        end = time.time() + image_queue.duration
        musicEnd = [end - image_queue.musicFadeOut]

        info = self.ImageQueueInfo(image_queue, musicEnd)

        self.window.initialize()
        self.window.setTransition('none')

        xbmc.enableNavSounds(False)

        self.playMusic(image_queue)

        if xbmc.getCondVisibility('Window.IsVisible(visualisation)'):
            DEBUG_LOG('Closing visualisation window')
            xbmc.executebuiltin('Action(back)')

        self.window.setTransition(image_queue.transition,
                                  image_queue.transitionDuration)

        action = None

        try:
            while image:
                DEBUG_LOG(' -IMAGE.QUEUE: {0}'.format(image))

                action = self.showImageFromQueue(image, info, first=True)

                if action:
                    if action == 'NEXT':
                        image = image_queue.next(extend=True) or image
                        continue
                    elif action == 'PREV':
                        image = image_queue.prev() or image
                        continue
                    elif action == 'BIG_NEXT':
                        self.window.setSkipNotice('+3')
                        image = image_queue.next(count=3, extend=True) or image
                        continue
                    elif action == 'BIG_PREV':
                        self.window.setSkipNotice('-3')
                        image = image_queue.prev(count=3) or image
                        continue
                    elif action == 'BACK':
                        DEBUG_LOG(
                            ' -IMAGE.QUEUE: Skipped after {0}secs'.format(
                                int(time.time() - start)))
                        return False
                    elif action == 'SKIP':
                        DEBUG_LOG(
                            ' -IMAGE.QUEUE: Skipped after {0}secs'.format(
                                int(time.time() - start)))
                        return True
                    else:
                        if action is True:
                            image_queue.mark(image)

                        image = image_queue.next(start)
                else:
                    return
        finally:
            kodiutil.setGlobalProperty('paused', '')
            xbmc.enableNavSounds(True)
            self.stopMusic(action != 'BACK' and image_queue or None)
            if self.window.hasAction():
                if self.window.getAction() == 'BACK':
                    return False
            self.window.clear()

        DEBUG_LOG(' -IMAGE.QUEUE: Finished after {0}secs'.format(
            int(time.time() - start)))
        return True
Пример #23
0
 def fadeOut(self):
     kodiutil.setGlobalProperty('show1', '')
Пример #24
0
 def onResume(self):
     self.player.onPlayBackResumed()
     kodiutil.setGlobalProperty('paused', '')
Пример #25
0
 def onPause(self):
     self.player.onPlayBackPaused()
     kodiutil.setGlobalProperty('paused', '1')
Пример #26
0
 def fadeOut(self):
     kodiutil.setGlobalProperty('show1', '')
Пример #27
0
 def onResume(self):
     self.player.onPlayBackResumed()
     kodiutil.setGlobalProperty('paused', '')
Пример #28
0
 def setName(self, name):
     self.name = name
     kodiutil.setGlobalProperty('EDITING', name)
Пример #29
0
 def setSkipNotice(self, msg):
     kodiutil.setGlobalProperty('number', msg)
     self.skipNotice.setAnimations([('Conditional', 'effect=fade start=100 end=0 time=500 delay=1000 condition=true')])
Пример #30
0
 def initSkinVars(self):
     kodiutil.setGlobalProperty('module.current', '')
     kodiutil.setGlobalProperty('module.current.name', '')
     kodiutil.setGlobalProperty('module.next', '')
     kodiutil.setGlobalProperty('module.next.name', '')
     self.initSkinFeatureVars()
Пример #31
0
 def setName(self, name):
     self.name = name
     kodiutil.setGlobalProperty('EDITING', name)
Пример #32
0
    def showImageQueue(self, image_queue):
        image_queue.reset()
        image = image_queue.next()

        start = time.time()
        end = time.time() + image_queue.duration
        musicEnd = [end - image_queue.musicFadeOut]

        info = self.ImageQueueInfo(image_queue, musicEnd)

        self.window.initialize()
        self.window.setTransition('none')

        xbmc.enableNavSounds(False)

        self.playMusic(image_queue)

        if xbmc.getCondVisibility('Window.IsVisible(visualisation)'):
            DEBUG_LOG('Closing visualisation window')
            xbmc.executebuiltin('Action(back)')

        self.window.setTransition(image_queue.transition, image_queue.transitionDuration)

        action = None

        try:
            while image:
                DEBUG_LOG(' -IMAGE.QUEUE: {0}'.format(image))

                action = self.showImageFromQueue(image, info, first=True)

                if action:
                    if action == 'NEXT':
                        image = image_queue.next(extend=True) or image
                        continue
                    elif action == 'PREV':
                        image = image_queue.prev() or image
                        continue
                    elif action == 'BIG_NEXT':
                        self.window.setSkipNotice('+3')
                        image = image_queue.next(count=3, extend=True) or image
                        continue
                    elif action == 'BIG_PREV':
                        self.window.setSkipNotice('-3')
                        image = image_queue.prev(count=3) or image
                        continue
                    elif action == 'BACK':
                        DEBUG_LOG(' -IMAGE.QUEUE: Skipped after {0}secs'.format(int(time.time() - start)))
                        return False
                    elif action == 'SKIP':
                        DEBUG_LOG(' -IMAGE.QUEUE: Skipped after {0}secs'.format(int(time.time() - start)))
                        return True
                    else:
                        if action is True:
                            image_queue.mark(image)

                        image = image_queue.next(start)
                else:
                    return
        finally:
            kodiutil.setGlobalProperty('paused', '')
            xbmc.enableNavSounds(True)
            self.stopMusic(action != 'BACK' and image_queue or None)
            if self. window.hasAction():
                if self.window.getAction() == 'BACK':
                    return False
            self.window.clear()

        DEBUG_LOG(' -IMAGE.QUEUE: Finished after {0}secs'.format(int(time.time() - start)))
        return True
Пример #33
0
 def initSkinVars(self):
     kodiutil.setGlobalProperty('module.current', '')
     kodiutil.setGlobalProperty('module.current.name', '')
     kodiutil.setGlobalProperty('module.next', '')
     kodiutil.setGlobalProperty('module.next.name', '')
     self.initSkinFeatureVars()
Пример #34
0
 def clear(self):
     self.currentImage = 0
     self.lastImage = ''
     kodiutil.setGlobalProperty('image0', '')
     kodiutil.setGlobalProperty('image1', '')
     kodiutil.setGlobalProperty('show1', '')
Пример #35
0
 def initSkinFeatureVars(self):
     kodiutil.setGlobalProperty('feature.next.title', '')
     kodiutil.setGlobalProperty('feature.next.dbid', '')
     kodiutil.setGlobalProperty('feature.next.dbtype', '')
     kodiutil.setGlobalProperty('feature.next.path', '')
Пример #36
0
 def onPause(self):
     self.player.onPlayBackPaused()
     kodiutil.setGlobalProperty('paused', '1')
Пример #37
0
 def initSkinFeatureVars(self):
     kodiutil.setGlobalProperty('feature.next.title', '')
     kodiutil.setGlobalProperty('feature.next.dbid', '')
     kodiutil.setGlobalProperty('feature.next.dbtype', '')
     kodiutil.setGlobalProperty('feature.next.path', '')
Пример #38
0
 def setSkipNotice(self, msg):
     kodiutil.setGlobalProperty('number', msg)
     self.skipNotice.setAnimations([
         ('Conditional',
          'effect=fade start=100 end=0 time=500 delay=1000 condition=true')
     ])
Пример #39
0
 def selectSequenceItem(self, pos):
     self.sequenceControl.selectItem(pos)
     dataSource = self.sequenceControl[pos].dataSource
     kodiutil.setGlobalProperty(
         'sequence.item.enabled', dataSource and dataSource.enabled and '1'
         or '')