Exemplo n.º 1
0
def upgradeDB():

    # Load DB

    # DB upgrades per version
    if control.setting('lastVersion') == '1.0.0-beta' and control.addonInfo(
            'version') == '1.0.0':
        episodeDB = episodes.Episode(control.episodesFile)
        showDB = shows.Show(control.showsFile)
        libraryDB = library.Library(control.libraryFile)

        control.showNotification('Upgrading databases...', control.lang(50002))
        logger.logDebug(
            episodeDB.upgrade([
                'ALTER TABLE `EPISODE` ADD COLUMN `TYPE` TEXT',
                'UPDATE `EPISODE` SET TYPE = \'episode\' WHERE TYPE IS NULL'
            ]))
        logger.logDebug(
            showDB.upgrade([
                'ALTER TABLE `SHOW` ADD COLUMN `TYPE` TEXT',
                'UPDATE `SHOW` SET TYPE = \'show\' WHERE TYPE IS NULL'
            ]))

    elif control.setting('lastVersion') in (
            '1.0.0', '1.0.1',
            '1.1.0') and control.addonInfo('version') == '1.2.0':
        # Check if installation is complete
        logger.logNotice('Checking installation')
        tools.checkInstallDB(True)
Exemplo n.º 2
0
def importDBFiles():
    status = True
    try:
        dBImportURL = control.setting('databaseImportURL')
        
        # Shows DB file
        fileSource = dBImportURL + 'shows.db' 
        logger.logInfo('Copying %s to %s' % (fileSource, control.showsFile))
        status = True if status is True and logger.logInfo(xbmcvfs.copy(fileSource, control.showsFile)) != 0 else False

        # Episodes DB file
        fileSource = dBImportURL + 'episodes.db' 
        logger.logInfo('Copying %s to %s' % (fileSource, control.episodesFile))
        status = True if status is True and logger.logInfo(xbmcvfs.copy(fileSource, control.episodesFile)) != 0 else False

        # Celebrities DB file
        fileSource = dBImportURL + 'celebrities.db' 
        logger.logInfo('Copying %s to %s' % (fileSource, control.celebritiesFile))
        status = True if status is True and logger.logInfo(xbmcvfs.copy(fileSource, control.celebritiesFile)) != 0 else False
    except:
        status = False
        pass
    if status is True:
        control.setSetting('showUpdateCatalog', 'false')
        control.showNotification(control.lang(57003), control.lang(50010))
    else:
        control.showNotification(control.lang(57027), control.lang(50004))
    return status
Exemplo n.º 3
0
def checkInstallDB(refresh=False):
    control.showNotification(control.lang(50005))
    isInstalled = isDBInstalled()
    
    if refresh == True and isInstalled == True:
        deleteDBFiles()
    
    if refresh == True or isInstalled == False:
        # control.run(config.IMPORTALLDB, 'install')
        importDBFiles()
Exemplo n.º 4
0
    def showMainMenu(self):
        self.addDirectoryItem(control.lang(50204),
                              '/',
                              config.SEARCHMENU,
                              control.addonFolderIcon(control.lang(50204)),
                              isFolder=True,
                              **self.formatMenu())

        # if control.setting('displayMyList') == 'true':
        #     self.addDirectoryItem(control.lang(50200), '/', config.MYLIST, control.addonFolderIcon(control.lang(50200)), isFolder=True, **self.formatMenu())

        # if control.setting('displayWebsiteSections') == 'true':
        #     self.addDirectoryItem(control.lang(50201), '/', config.CATEGORIES, control.addonFolderIcon(control.lang(50201)), isFolder=True, **self.formatMenu())
        # else:
        #     self.showCategories()
        if control.setting('displayWebsiteSections') == 'true':
            control.showNotification(control.lang(57020), control.lang(50008))
            sections = gmatv.getWebsiteHomeSections()
            for s in sections:
                self.addDirectoryItem(s['name'].title(),
                                      str(s['id']),
                                      config.SECTIONCONTENT,
                                      control.addonFolderIcon(
                                          s['name'].title()),
                                      isFolder=True,
                                      **self.formatMenu())

        if control.setting('exportToLibrary') == 'true':
            self.addDirectoryItem(control.lang(56023),
                                  '/',
                                  config.EXPORTEDSHOWS,
                                  control.addonFolderIcon(control.lang(56023)),
                                  isFolder=True,
                                  **self.formatMenu())

        if control.setting('displayTools') == 'true':
            self.addDirectoryItem(control.lang(50203), '/', config.TOOLS,
                                  control.addonFolderIcon(control.lang(50203)))

        self.endDirectory()
Exemplo n.º 5
0
 def showSearchMenu(self, category):
     if category == 'movieshow':
         self.addDirectoryItem(control.lang(50208),
                               '/',
                               config.EXECUTESEARCH,
                               control.addonFolderIcon(control.lang(50208)),
                               isFolder=True,
                               query='category=%s&type=%s' %
                               (category, 'title'),
                               **self.formatMenu())
         self.addDirectoryItem(control.lang(50209),
                               '/',
                               config.EXECUTESEARCH,
                               control.addonFolderIcon(control.lang(50209)),
                               isFolder=True,
                               query='category=%s&type=%s' %
                               (category, 'category'),
                               **self.formatMenu())
         self.addDirectoryItem(control.lang(50210),
                               '/',
                               config.EXECUTESEARCH,
                               control.addonFolderIcon(control.lang(50210)),
                               isFolder=True,
                               query='category=%s&type=%s' %
                               (category, 'cast'),
                               **self.formatMenu())
         self.addDirectoryItem(control.lang(50212),
                               '/',
                               config.EXECUTESEARCH,
                               control.addonFolderIcon(control.lang(50212)),
                               isFolder=True,
                               query='category=%s&type=%s' %
                               (category, 'year'),
                               **self.formatMenu())
     elif category == 'episode':
         self.addDirectoryItem(control.lang(50208),
                               '/',
                               config.EXECUTESEARCH,
                               control.addonFolderIcon(control.lang(50208)),
                               isFolder=True,
                               query='category=%s&type=%s' %
                               (category, 'title'),
                               **self.formatMenu())
         self.addDirectoryItem(control.lang(50211),
                               '/',
                               config.EXECUTESEARCH,
                               control.addonFolderIcon(control.lang(50211)),
                               isFolder=True,
                               query='category=%s&type=%s' %
                               (category, 'date'),
                               **self.formatMenu())
     elif category == 'celebrity':
         control.showNotification(control.lang(57026), control.lang(50001))
     else:
         self.addDirectoryItem(control.lang(50205),
                               '/',
                               config.SEARCHMENU,
                               control.addonFolderIcon(control.lang(50205)),
                               isFolder=True,
                               query='category=%s' % 'movieshow',
                               **self.formatMenu())
         self.addDirectoryItem(control.lang(50206),
                               '/',
                               config.SEARCHMENU,
                               control.addonFolderIcon(control.lang(50206)),
                               isFolder=True,
                               query='category=%s' % 'episode',
                               **self.formatMenu())
         self.addDirectoryItem(control.lang(50207),
                               '/',
                               config.SEARCHMENU,
                               control.addonFolderIcon(control.lang(50207)),
                               isFolder=True,
                               query='category=%s' % 'celebrity',
                               **self.formatMenu())
     self.endDirectory()
Exemplo n.º 6
0
    def showMainMenu(self):
        self.addDirectoryItem(control.lang(50204),
                              '/',
                              config.SEARCHMENU,
                              control.addonFolderIcon(control.lang(50204)),
                              isFolder=True,
                              **self.formatMenu())

        # if not logged in, ask to log in
        if control.setting('emailAddress') != '':
            tfctv.checkAccountChange()
            if tfctv.isLoggedIn() == False:
                if (control.confirm(control.lang(57007),
                                    line1=control.lang(57008) %
                                    control.setting('emailAddress'))):
                    (account, logged) = tfctv.checkAccountChange(True)
            elif control.setting('displayMyList') == 'true':
                self.addDirectoryItem(control.lang(50200),
                                      '/',
                                      config.MYLIST,
                                      control.addonFolderIcon(
                                          control.lang(50200)),
                                      isFolder=True,
                                      **self.formatMenu())

        if control.setting('displayWebsiteSections') == 'true':
            self.addDirectoryItem(control.lang(50201),
                                  '/',
                                  config.CATEGORIES,
                                  control.addonFolderIcon(control.lang(50201)),
                                  isFolder=True,
                                  **self.formatMenu())
        else:
            self.showCategories()

        if control.setting('displayWebsiteSections') == 'true':
            control.showNotification(control.lang(57020), control.lang(50008))
            sections = tfctv.getWebsiteHomeSections()
            for s in sections:
                self.addDirectoryItem(s['name'].title(),
                                      str(s['id']),
                                      config.SECTIONCONTENT,
                                      control.addonFolderIcon(
                                          s['name'].title()),
                                      isFolder=True,
                                      **self.formatMenu())

        if control.setting(
                'displayMyAccountMenu'
        ) == 'true' and control.setting('emailAddress') != '':
            self.addDirectoryItem(control.lang(50202),
                                  '/',
                                  config.MYACCOUNT,
                                  control.addonFolderIcon(control.lang(50202)),
                                  isFolder=True,
                                  **self.formatMenu())

        if control.setting('exportToLibrary') == 'true':
            self.addDirectoryItem(control.lang(56023),
                                  '/',
                                  config.EXPORTEDSHOWS,
                                  control.addonFolderIcon(control.lang(56023)),
                                  isFolder=True,
                                  **self.formatMenu())

        if control.setting('displayTools') == 'true':
            self.addDirectoryItem(control.lang(50203), '/', config.TOOLS,
                                  control.addonFolderIcon(control.lang(50203)))

        self.endDirectory()

        if tfctv.isLoggedIn() == False:
            control.infoDialog(control.lang(57017),
                               control.lang(50002),
                               time=8000)
Exemplo n.º 7
0
def importEpisodeDB():
    fileSource = logger.logInfo(control.browse(1, 'Select your episodes DB file', 'files', '.db'))
    if (fileSource != ''):
        logger.logInfo(xbmcvfs.copy(fileSource, control.episodesFile))
        control.showNotification(control.lang(57040), control.lang(50010))