Example #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')
Example #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')
Example #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'])
Example #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
Example #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)
Example #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
 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
Example #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
 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()
Example #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()
Example #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()
 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()
Example #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()
    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()
    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)
    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()
Example #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
Example #18
0
 def none(self, url):
     self.lastImage = url
     kodiutil.setGlobalProperty('image0', url)
Example #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()
 def none(self, url):
     self.lastImage = url
     kodiutil.setGlobalProperty('image0', url)
 def clear(self):
     self.currentImage = 0
     self.lastImage = ''
     kodiutil.setGlobalProperty('image0', '')
     kodiutil.setGlobalProperty('image1', '')
     kodiutil.setGlobalProperty('show1', '')
Example #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
Example #23
0
 def fadeOut(self):
     kodiutil.setGlobalProperty('show1', '')
Example #24
0
 def onResume(self):
     self.player.onPlayBackResumed()
     kodiutil.setGlobalProperty('paused', '')
 def onPause(self):
     self.player.onPlayBackPaused()
     kodiutil.setGlobalProperty('paused', '1')
 def fadeOut(self):
     kodiutil.setGlobalProperty('show1', '')
 def onResume(self):
     self.player.onPlayBackResumed()
     kodiutil.setGlobalProperty('paused', '')
Example #28
0
 def setName(self, name):
     self.name = name
     kodiutil.setGlobalProperty('EDITING', name)
 def setSkipNotice(self, msg):
     kodiutil.setGlobalProperty('number', msg)
     self.skipNotice.setAnimations([('Conditional', 'effect=fade start=100 end=0 time=500 delay=1000 condition=true')])
 def initSkinVars(self):
     kodiutil.setGlobalProperty('module.current', '')
     kodiutil.setGlobalProperty('module.current.name', '')
     kodiutil.setGlobalProperty('module.next', '')
     kodiutil.setGlobalProperty('module.next.name', '')
     self.initSkinFeatureVars()
Example #31
0
 def setName(self, name):
     self.name = name
     kodiutil.setGlobalProperty('EDITING', name)
    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
Example #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()
Example #34
0
 def clear(self):
     self.currentImage = 0
     self.lastImage = ''
     kodiutil.setGlobalProperty('image0', '')
     kodiutil.setGlobalProperty('image1', '')
     kodiutil.setGlobalProperty('show1', '')
Example #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', '')
Example #36
0
 def onPause(self):
     self.player.onPlayBackPaused()
     kodiutil.setGlobalProperty('paused', '1')
 def initSkinFeatureVars(self):
     kodiutil.setGlobalProperty('feature.next.title', '')
     kodiutil.setGlobalProperty('feature.next.dbid', '')
     kodiutil.setGlobalProperty('feature.next.dbtype', '')
     kodiutil.setGlobalProperty('feature.next.path', '')
Example #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')
     ])
Example #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 '')