示例#1
0
文件: service.py 项目: noba3/KoTos
def start_rytec_service():
    from resources.lib import rytec
    print '[Rytec EPG Downloader]: rytec service started'
    descriptions = common.get_descriptions()
    sources_list = None
    merge = False
    for description in descriptions:
        ret = False
        epg_url = common.get_description_url(description)
        if epg_url:
            ret = common.load_local_xml(epg_url)
            if ret:
                print '[Rytec EPG Downloader]: no epg update needed', description
            else:
                ret = rytec.download_epg(epg_url)
                if ret: merge = True
        if not ret:
            if not sources_list: sources_list = rytec.get_sources_list()
            if sources_list:
                ret = rytec.get_epg(sources_list, description)
                if ret:
                    merge = True
                else:
                    xbmc.executebuiltin('Notification(could not download epg data,)')
                    print '[Rytec EPG Downloader]: could not download epg data', description
            else:
                xbmc.executebuiltin('Notification(could not download sources list,)')
                print '[Rytec EPG Downloader]: could not download sources list'
    if merge and len(descriptions) > 1: 
        try:
            common.merge_epg()
        except Exception, e:
            xbmc.executebuiltin('Notification(could not merge epg,)')
            print '[Rytec EPG Downloader]: could not merge epg', e
示例#2
0
文件: service.py 项目: kodinerds/repo
 def run(self):
 
     for description in self.descriptions:
 
         common.log('[Rytec EPG Downloader]: '+description)
         self.i += self.upd
         self.progress('update', self.i, 'Rytec EPG Downloader', description, 'Downloading XML Data')
         ret = False
         epg_url = self.get_epg_url(description)
         
         if epg_url:
             ret = self.download_epg(description, epg_url)
             
         if not ret and not description.startswith('http'):
             self.run_rytec(description)
             
     self.progress('update', 70, 'Merging XML Data', ' ', 'Please Wait...This May Take Awhile')
             
     if self.len_desc > 1:
         common.merge_epg()
         self.progress('update', 90, 'Merging XML Data', ' ', 'Please Wait...This May Take Awhile')
         common.copy_temp_merged()
         common.delete_temp_merged()
     
     self.progress('close', '', '', '', '')