Example #1
0
 def add2(self, i):
     if not control.condVisibility('Window.IsVisible(infodialog)') and not control.condVisibility('Player.HasVideo'):
         try:
             control.infoDialog('Dodawanie Folderu do Biblioteki ...', time=3)
             self.infoDialog = True
         except:
             self.infoDialog = False
     files_added = 0
     progressDialogBG = control.progressDialogBG
     progressDialogBG.create('cda.pl','Dodawanie Folderu do Biblioteki')
     for index, found in enumerate(i):
         czas_progres = int((index+1)*100.0/(len(i)))
         fwebId = found.get('_filmweb',False)
         title = found.get('title','')
         title = re.sub('\\(\\d{4}\\)','',title).strip()
         year  = found.get('year','')
         url   = found.get('url','')
         if not ( fwebId and url): continue
         if self.check_setting == 'true':
             if lib_tools.get_urlStat(url) != 'OK':
                 progressDialogBG.update(czas_progres,message='martwy link [%s] '%(title))
                 printuj_linka('[CheckLink]: BAD Source: %s'%title)
                 continue
             else:
                 printuj_linka('[CheckLink]: OK Source: %s'%title)
         if self.strmFile(fwebId,title,year,url):
             files_added += 1
             progressDialogBG.update(czas_progres,message='Dodano [%s] '%(title))
     progressDialogBG.close()
     if self.infoDialog == True:
         control.infoDialog('Dodano %d film\xc3\xb3w'%files_added, time=2)
     if self.library_setting == 'true' and not control.condVisibility('Library.IsScanningVideo') and files_added > 0:
         control.execute('UpdateLibrary(video)')
Example #2
0
def startDownload():
    if downloadPath == '':
        return control.infoDialog(
            'You need to set your download folder in addon settings first',
            'File Not Downloadable')

    control.execute('RunPlugin(%s?action=startDownloadThread)' % sys.argv[0])
Example #3
0
def setView(content, viewDict=None):
    for i in range(0, 200):
        if control.condVisibility('Container.Content(%s)' % content):
            try:
                skin = control.skin
                record = (skin, content)
                dbcon = database.connect(control.viewsFile)
                dbcur = dbcon.cursor()
                dbcur.execute(
                    "SELECT * FROM views WHERE skin = ? AND view_type = ?", (
                        record[0],
                        record[1],
                    ))
                view = dbcur.fetchone()
                view = view[2]
                if view is None:
                    raise Exception()
                return control.execute('Container.SetViewMode(%s)' % str(view))
            except BaseException:
                try:
                    return control.execute('Container.SetViewMode(%s)' %
                                           str(viewDict[skin]))
                except BaseException:
                    return

        control.sleep(5)
Example #4
0
    def search_new(self):
        control.idle()

        t = control.lang(32010).encode('utf-8')
        k = control.keyboard('', t)
        k.doModal()
        q = k.getText() if k.isConfirmed() else None

        if (q == None or q == ''): return
        q = q.lower()
        try:
            from sqlite3 import dbapi2 as database
        except:
            from pysqlite2 import dbapi2 as database

        dbcon = database.connect(control.searchFile)
        dbcur = dbcon.cursor()
        dbcur.execute("DELETE FROM tvshow WHERE term = ?", (q, ))
        dbcur.execute("INSERT INTO tvshow VALUES (?,?)", (None, q))
        dbcon.commit()
        dbcur.close()
        url = self.search_link + urllib.quote_plus(q)
        if int(control.getKodiVersion()) >= 18:
            self.get(url)
        else:
            url = '%s?mode=6&url=%s' % (sys.argv[0], urllib.quote_plus(url))
            control.execute('Container.Update(%s)' % url)
Example #5
0
    def setWatchedStatus(self):
        if self.content == 'movie':
            try:
                xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": {"movieid" : %s, "playcount" : 1 }, "id": 1 }' % str(self.DBID))
                if not self.folderPath.startswith('plugin://'): control.execute('Container.Refresh')
            except:
                pass

            try:
                from metahandler import metahandlers
                metaget = metahandlers.MetaData(preparezip=False)
                metaget.get_meta('movie', self.title ,year=self.year)
                metaget.change_watched(self.content, '', self.imdb, season='', episode='', year='', watched=7)
            except:
                pass

            try:
                if trakt.getTraktAddonMovieInfo() == False: trakt.markMovieAsWatched(self.imdb)
                trakt.syncMovies()
            except:
                pass


        elif self.content == 'episode':
            try:
                xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.SetEpisodeDetails", "params": {"episodeid" : %s, "playcount" : 1 }, "id": 1 }' % str(self.DBID))
                if not self.folderPath.startswith('plugin://'): control.execute('Container.Refresh')
            except:
                pass

            try:
                from metahandler import metahandlers
                metaget = metahandlers.MetaData(preparezip=False)
                metaget.get_meta('tvshow', self.show, imdb_id=self.imdb)
                metaget.get_episode_meta(self.show, self.imdb, self.season, self.episode)
                metaget.change_watched(self.content, '', self.imdb, season=self.season, episode=self.episode, year='', watched=7)
            except:
                pass

            try:
                if trakt.getTraktAddonEpisodeInfo() == False: trakt.markEpisodeAsWatched(self.tvdb, self.season, self.episode)
                trakt.syncTVShows()
            except:
                pass
Example #6
0
    def setWatchedStatus(self):
        if self.content == 'movie':
            try:
                xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.SetMovieDetails", "params": {"movieid" : %s, "playcount" : 1 }, "id": 1 }' % str(self.DBID))
                if not self.folderPath.startswith('plugin://'): control.execute('Container.Refresh')
            except:
                pass

            try:
                from metahandler import metahandlers
                metaget = metahandlers.MetaData(preparezip=False)
                metaget.get_meta('movie', self.title ,year=self.year)
                metaget.change_watched(self.content, '', self.imdb, season='', episode='', year='', watched=7)
            except:
                pass

            try:
                if trakt.getTraktAddonMovieInfo() == False: trakt.markMovieAsWatched(self.imdb)
                trakt.syncMovies()
            except:
                pass


        elif self.content == 'episode':
            try:
                xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.SetEpisodeDetails", "params": {"episodeid" : %s, "playcount" : 1 }, "id": 1 }' % str(self.DBID))
                if not self.folderPath.startswith('plugin://'): control.execute('Container.Refresh')
            except:
                pass

            try:
                from metahandler import metahandlers
                metaget = metahandlers.MetaData(preparezip=False)
                metaget.get_meta('tvshow', self.show, imdb_id=self.imdb)
                metaget.get_episode_meta(self.show, self.imdb, self.season, self.episode)
                metaget.change_watched(self.content, '', self.imdb, season=self.season, episode=self.episode, year='', watched=7)
            except:
                pass

            try:
                if trakt.getTraktAddonEpisodeInfo() == False: trakt.markEpisodeAsWatched(self.tvdb, self.season, self.episode)
                trakt.syncTVShows()
            except:
                pass
Example #7
0
def setView(content, viewDict=None):
    for i in range(0, 200):
        if control.condVisibility('Container.Content(%s)' % content):
            try:
                skin = control.skin
                record = (skin, content)
                control.makeFile(control.dataPath)
                dbcon = database.connect(control.databaseFile)
                dbcur = dbcon.cursor()
                dbcur.execute("SELECT * FROM views WHERE skin = '%s' AND view_type = '%s'" % (record[0], record[1]))
                view = dbcur.fetchone()
                view = view[2]
                if view == None: raise Exception()
                return control.execute('Container.SetViewMode(%s)' % str(view))
            except:
                try: return control.execute('Container.SetViewMode(%s)' % str(viewDict[skin]))
                except: return

        control.sleep(100)
Example #8
0
 def add(self, found):
     fwebId = found.get('_filmweb',False)
     title = found.get('title','')
     title = re.sub('\\(\\d{4}\\)','',title).strip()
     year  = found.get('year','')
     url   = found.get('url','')
     if not ( fwebId and url):
         return False
     if self.check_setting == 'true':
         if lib_tools.get_urlStat(url) != 'OK':
             return False
     if not control.condVisibility('Window.IsVisible(infodialog)') and not control.condVisibility('Player.HasVideo'):
         control.infoDialog('Dodawanie do Biblioteki ...', time=3)
         self.infoDialog = True
     files_added = 0
     if self.strmFile(fwebId,title,year,url):
         files_added += 1
     if self.infoDialog == True:
         control.infoDialog('Zako\xc5\x84czono', time=2)
     if self.library_setting == 'true' and not control.condVisibility('Library.IsScanningVideo') and files_added > 0:
         control.execute('UpdateLibrary(video)')
Example #9
0
    def search_term(self, q):
        control.idle()
        q = q.lower()
        try:
            from sqlite3 import dbapi2 as database
        except:
            from pysqlite2 import dbapi2 as database

        dbcon = database.connect(control.searchFile)
        dbcur = dbcon.cursor()
        dbcur.execute("DELETE FROM tvshow WHERE term = ?", (q, ))
        dbcur.execute("INSERT INTO tvshow VALUES (?,?)", (None, q))
        dbcon.commit()
        dbcur.close()
        url = self.search_link + urllib.quote_plus(q)
        if int(control.getKodiVersion()) >= 18:
            self.get(url)
        else:
            url = '%s?mode=tvshowPage&url=%s' % (sys.argv[0],
                                                 urllib.quote_plus(url))
            control.execute('Container.Update(%s)' % url)
 def test_given_hello_world_when_execute_expect_hello_world(self):
     self.assertEqual(control.execute("echo 'hello world'"), "hello world")
Example #11
0
def startDownload():
    if downloadPath == '':
        return control.infoDialog('You need to set your download folder in addon settings first', 'File Not Downloadable')

    control.execute('RunPlugin(%s?action=startDownloadThread)' % sys.argv[0])