示例#1
0
 def CheckLinksInLibrary(self):
     import thread_pool
     import time
     self.t_link_delay =  int(control.setting('library.service.testlink.delay') or 0)
     if self.t_link_delay == 0:
         printuj_linka('[CheckLink]: START and STOP - Do not check library sources')
         return
     dirs,files = control.listDir(self.library_folder)
     self.progressDialogBG = control.progressDialogBG
     self.progressDialogBG.create('Sprawdzam \xc5\xbar\xc3\xb3d\xc5\x82a biblioteki cda.pl','Ilo\xc5\x9b\xc4\x87 pozycji: %d'%len(dirs))
     printuj_linka('[CheckLink]: START Library Folders = %d'%len(dirs))
     if not control.condVisibility('Window.IsVisible(infodialog)') and not control.condVisibility('Player.HasVideo'):
         try:
             control.infoDialog('Sprawdzam \xc5\xbar\xc3\xb3dla biblioteki cda.pl', time=3)
             self.infoDialog = True
         except:
             self.infoDialog = False
     pool = thread_pool.ThreadPool(self.fredy)
     self.res={'checked':0,'skipped':0,'removed':0,'updated':0}
     N = len(dirs)
     for idx,folder_ in enumerate(dirs):
         pool.add_task(self.check_remove, *(folder_,idx,N))
         time.sleep(0.1)
     pool.wait_completion()
     printuj_linka('[CheckLink]: END Status checked:%d, skipped:%d, removed:%d, updated:%d'%(self.res['checked'],self.res['skipped'],self.res['removed'],self.res['updated']))
     self.progressDialogBG.close()
     if self.infoDialog == True:
         control.infoDialog('Usuni\xc4\x99to :%d, Zaktualizowano :%d '%(self.res['removed'],self.res['updated']), time=30)
示例#2
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)')
示例#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)
示例#4
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)')
示例#5
0
 def GetNewMovies(self):
     from cdapl import searchCDA
     import thread_pool
     import time
     self.check_setting = 'false'
     url = 'https://www.cda.pl/video/show/cale_filmy_or_caly_film_or_lektor_or_pl_or_dubbing_or_napisy_or_fps_or_odc/p%d?duration=dlugie&section=&quality=720p&section=&s=date&section='
     if not control.condVisibility('Window.IsVisible(infodialog)') and not control.condVisibility('Player.HasVideo'):
         try:
             control.infoDialog('Szukam nowych film\xc3\xb3w ...', time=3)
             self.infoDialog = True
         except:
             self.infoDialog = False
     self.progressDialogBG = control.progressDialogBG
     self.progressDialogBG.create('cda.pl','Szukam nowych film\xc3\xb3w ...')
     items=[]
     control.setSetting('library.service.last.run', datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
     for stronkaX in range(int(control.setting('library.service.pages') or 1)):
         stronkaX +=1
         printuj_linka('[AddMovie]: Searching cda.pl, page [%d]'%stronkaX)
         nowy_link,next=searchCDA(url%(stronkaX),False,False)
         items.extend(nowy_link)
         self.progressDialogBG.update(0,message='Znalaz\xc5\x82em pozycji [%d] '%(len(items)))
     self.progressDialogBG.update(0,message='Indentyfikuje %d film\xc3\xb3w w %d w\xc4\x85tkach ...'%(len(items),self.fredy))
     items = [x for x in items if x.get('code','')!= '']
     printuj_linka('[AddMovie]: Found Total %d videos ... '%(len(items)))
     pool = thread_pool.ThreadPool(self.fredy)
     self.out=[]
     N=len(items)
     for idx,one in enumerate(items):
         pool.add_task(self.dod_Movies, *(one,idx,N))
         time.sleep(0.1)
     pool.wait_completion()
     printuj_linka('[AddMovie]: (After Threading) Found Total %d Movies ... '%(len(self.out)))
     self.out.reverse()
     self.progressDialogBG.close()
     self.add2( self.out )
     control.setSetting('library.service.last.run', datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
示例#6
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)
    def onPlayBackStarted(self):
        for i in range(0, 200):
            if control.condVisibility('Window.IsActive(busydialog)') == 1:
                control.idle()
            else:
                break
            control.sleep(100)

        if control.setting('playback_info') == 'true':
            elapsedTime = '%s %s %s' % (control.lang(30464).encode('utf-8'), int((time.time() - self.loadingTime)),
                                        control.lang(30465).encode('utf-8'))
            control.infoDialog(elapsedTime, heading=self.title)

        try:
            if self.offset == '0':
                raise Exception()
            self.seekTime(float(self.offset))
        except Exception, e:
            print str(e)
            pass
示例#8
0
文件: player.py 项目: camalot/kodur
    def onPlayBackStarted(self):
        for i in range(0, 200):
            if control.condVisibility('Window.IsActive(busydialog)') == 1:
                control.idle()
            else:
                break
            control.sleep(100)

        if control.setting('playback_info') == 'true':
            elapsedTime = '%s %s %s' % (control.lang(30464).encode('utf-8'), int((time.time() - self.loadingTime)),
                                        control.lang(30465).encode('utf-8'))
            control.infoDialog(elapsedTime, heading=self.title)

        try:
            if self.offset == '0':
                raise Exception()
            self.seekTime(float(self.offset))
        except Exception, e:
            print str(e)
            pass