def Dialog_Example(): koding_test = message_xml_url if 'file' in koding_test: temp = xbmc.translatePath(('special://home/addons/%s' % (addon_id))) koding_test = os.path.join(temp, koding_test.replace('file://', '')).decode('utf-8') main_text = koding.Text_File(path=koding_test, mode='r') main_text = main_text.replace('$version$', str(ownAddon.getAddonInfo('version'))) if '$changelog$' in main_text: temp = xbmc.translatePath(('special://home/addons/%s' % (addon_id))) koding_test = os.path.join(temp, 'changelog.txt').decode('utf-8') changelog = koding.Text_File(path=koding_test, mode='r') main_text = main_text.replace('$changelog$', changelog) my_buttons = ['Close'] my_choice = koding.Custom_Dialog(main_content=main_text, pos='center', size='900x600', buttons=my_buttons, transparency=90, highlight_color='yellow', header='Latest News') if my_choice == 0: return
def Dialog_News(): koding_test = message_xml_url mytest = '' if 'http' in koding_test: import urllib2 req = urllib2.Request(koding_test) req.add_header('User-Agent', 'klopp') response = urllib2.urlopen(req) mytext = response.read() response.close() else: mytext = koding.Text_File(path=koding_test, mode='r') main_text = mytext my_buttons = ['Close'] my_choice = koding.Custom_Dialog(main_content=main_text, pos='center', size='900x600', buttons=my_buttons, transparency=90, highlight_color='yellow', header='Latest News and Updates') if my_choice == 0: root()
def Dialog_Example(): koding_test = message_xml_url mytext = koding.Text_File(path=koding_test, mode='r') main_text = mytext my_buttons = ['Close'] my_choice = koding.Custom_Dialog(main_content=main_text,pos='center',size='900x600',buttons=my_buttons,transparency=90,highlight_color='yellow',header='Latest News') if my_choice ==0: root()
def Dialog_Example(): koding_test = message_xml_url mytext = koding.Text_File(path=koding_test, mode='r') main_text = mytext my_buttons = ['Close'] my_choice = koding.Custom_Dialog( main_content=main_text, pos='center', size='900x600', buttons=my_buttons, transparency=90, highlight_color='white', header= '[B][COLOR white]Planet[/COLOR] [COLOR red]MMA[/COLOR] [COLOR white]News[/COLOR] [COLOR red]&[/COLOR] [COLOR white]Updates[/COLOR][/B]' ) if my_choice == 0: return
def xml_item_count(source, block, tag_to_count): ''' source == route to file can either be a url or special path block == master tag tag_to_count == tag you wish to count returns a int value of count ''' count = 0 if source.startswith('http'): source = koding.Open_URL(url=source,cookiejar=source) elif source.startswith('special'): source = koding.Physical_Path(source) source = koding.Text_File(source,'r') else: message = 'xml %s source not correct unable to count'%source koding.dolog(message,line_info=True) xbmc_executebuiltin.Notify(message=message) source_details = koding.Parse_XML(source, block, tag_to_count) for items in source_details: count += 1 return count
dixie.log("Copying chan.xml to addon_data") shutil.copyfile(xmlmaster, chanxml) else: dixie.log("Chan.xml file exists in addon_data") sf_channels = xbmc.translatePath(default_path) xbmc.log('SF CHANS PATH: %s' % sf_channels) # If this is first run extract the skin zip if os.path.exists(skin_zip): if not os.path.exists(update_skin): xbmc.log('### First run extraction of skins') Extract_Skins() else: skinsize = os.path.getsize(skin_zip) current_size = koding.Text_File(update_skin, 'r') if current_size != str(skinsize): xbmc.log('### New skin file, extracting') Extract_Skins() else: dialog.ok( 'MISSING FILES', 'There are files missing on your system, click OK to check for updates then try opening Live TV again.' ) Check_Updates() cont = 0 if cont: if not os.path.exists(addremove): shutil.copyfile(addremove_file, addremove)