Ejemplo n.º 1
0
    def __init__(self, library, library_id=None, update=False):

        self.library = library
        self.direct_path = settings('useDirectPaths') == "1"
        self.update_library = update
        self.server = Emby()
        self.sync = get_sync()

        if library_id:
            libraries = library_id.split(',')

            for selected in libraries:

                if selected not in [x.replace('Mixed:', "") for x in self.sync['Libraries']]:
                    library = self.get_libraries(selected)

                    if library:

                        self.sync['Libraries'].append("Mixed:%s" % selected if library[1] == 'mixed' else selected)

                        if library[1] in ('mixed', 'movies'):
                            self.sync['Libraries'].append('Boxsets:%s' % selected)
                    else:
                        self.sync['Libraries'].append(selected)
        else:
            self.mapping()

        xmls.sources()

        if not xmls.advanced_settings() and self.sync['Libraries']:
            self.start()
Ejemplo n.º 2
0
    def libraries(self, library_id=None, update=False):
        ''' Map the syncing process and start the sync. Ensure only one sync is running.
        '''
        self.direct_path = settings('useDirectPaths') == "1"
        self.update_library = update
        self.sync = get_sync()

        if library_id:
            libraries = library_id.split(',')

            for selected in libraries:

                if selected not in [
                        x.replace('Mixed:', "") for x in self.sync['Libraries']
                ]:
                    library = self.get_libraries(selected)

                    if library:

                        self.sync['Libraries'].append("Mixed:%s" %
                                                      selected if library[1] ==
                                                      'mixed' else selected)

                        if library[1] in ('mixed', 'movies'):
                            self.sync['Libraries'].append('Boxsets:%s' %
                                                          selected)
                    else:
                        self.sync['Libraries'].append(selected)
        else:
            self.mapping()

        xmls.sources()

        if not xmls.advanced_settings() and self.sync['Libraries']:
            self.start()
Ejemplo n.º 3
0
    def __init__(self, library, library_id=None, update=False):

        ''' Map the syncing process and start the sync. Ensure only one sync is running.
        '''
        self.__dict__ = self._shared_state
        window('emby_sync.bool', True)

        if not settings('dbSyncScreensaver.bool'):

            xbmc.executebuiltin('InhibitIdleShutdown(true)')
            self.screensaver = get_screensaver()
            set_screensaver(value="")

        if not self.running:

            self.running = True
            self.library = library
            self.direct_path = settings('useDirectPaths') == "1"
            self.update_library = update
            self.server = Emby()
            self.sync = get_sync()

            if library_id:
                libraries = library_id.split(',')

                for selected in libraries:

                    if selected not in [x.replace('Mixed:', "") for x in self.sync['Libraries']]:
                        library = self.get_libraries(selected)

                        if library:

                            self.sync['Libraries'].append("Mixed:%s" % selected if library[1] == 'mixed' else selected)

                            if library[1] in ('mixed', 'movies'):
                                self.sync['Libraries'].append('Boxsets:%s' % selected)
                        else:
                            self.sync['Libraries'].append(selected)
            else:
                self.mapping()

            xmls.sources()

            if not xmls.advanced_settings() and self.sync['Libraries']:
                self.start()
            else:
                self.running = False
        else:
            dialog("ok", heading="{emby}", line1=_(33197))

            raise Exception("Sync is already running.")