def SectionMenu():
	cNumber ='8'; cNumber2='2'; cNumber3='4'; 
	_addon.add_directory({'mode':'About','site':site},{'title':cFL_('About',colors['9'])},is_folder=False,fanart=fanartSite,img='http://i.imgur.com/0h78x5V.png') # iconSite
	if isFile(checkedFileWP)==False: _SaveFile(checkedFileWP,'')
	checkedFileList=_OpenFile(checkedFileWP)
	if isFile(workingFileWP)==False: MiscTag='  '+cFL('<<','red')+'  ['+cFL('Use Updater','blue')+']'
	else: MiscTag=''
	_addon.add_directory({'mode':'CustomUpdate','path':'/addon/','filename':workingFile,'url':workingFile,'site':site},{'title':cFL(cFL_('Click to update the data file for updates.'+MiscTag,colors['9']),colors['0'])+'[CR][May Take a few moments.]'},is_folder=False,fanart=fanartSite,img=iconSite)
	if isFile(workingFileWP)==True: _addon.add_directory({'mode':'TextBoxFile','url':workingFileWP,'title':cFL('Updates',colors['9'])},{'title':cFL_('Read Update\' documentation',colors[cNumber2])},is_folder=False,fanart=fanartSite,img=iconSite)
	#DownloadThis(workingUrl+workingFile,workingFile,_addonPath,useResolver=False)
	#if isFile(workingFileWP)==False: DownloadThis(workingUrl+workingFile,workingFile,_addonPath,useResolver=False)
	if isFile(workingFileWP)==True:
		dd=_OpenFile(workingFileWP)
		debob(dd)
		s="'(.*?)'\s*:\s*'([A-Za-z0-9\.\-_\[\]\(\)]*)'"; 
		try: matches=re.compile(s).findall(dd) #,re.DOTALL
		except: matches=''
		ItemCount=len(matches)
		if ItemCount > 0:
			debob(matches)
			for _path,_name in matches:
				if not _name in checkedFileList:
					img=iconSite; fimg=fanartSite; 
					_title=cFL(_name,colors[cNumber])+CR+' ['+_path+']'
					pars={'mode':'CustomUpdate','path':_path,'filename':_name,'site':site,'section':section,'url':_name}
					_addon.add_directory(pars,{'title':_title},is_folder=False,fanart=fimg,img=img,total_items=ItemCount)
		#
	#
	#
	eod()
def Updater(url,filename,destpath,iszip=True):
	#
	_FE=getFileExtension(filename)
	if (_FE.lower()=='txt') or (_FE.lower()=='log') or (_FE.lower()=='py') or (_FE.lower()=='png') or (_FE.lower()=='jpg') or (_FE.lower()=='gif'): iszip=False
	elif (_FE.lower()=='zip') or (_FE.lower()=='z7') or (_FE.lower()=='ace'): iszip=True
	#try: _addon.resolve_url(addpr('url',''))
	try: _addon.resolve_url(filename)
	except: pass
	try:
		import shutil
		debob(['url:',url,'filename:',filename,'destpath:',destpath])
		zippath=xbmc.translatePath(os.path.join(_addonPath,'zips'))
		zipfile=xbmc.translatePath(os.path.join(zippath,filename))
		if isPath(zippath)==False: os.mkdir(zippath); deb('Path Made',zippath)
		common.DownloadThis(url,filename,zippath,useResolver=False)
		if isPath(destpath)==False: os.mkdir(destpath); deb('Path Made',destpath)
		if isFile(zipfile)==True:
			if iszip==False: shutil.copy(zipfile,xbmc.translatePath(os.path.join(destpath,filename)))
			else: ee=ExtractThis(zipfile,destpath)
		else: deb('File not found',zipfile); myNote('Updater','may have failed.'); return
		try: 
			os.remove(zipfile)
			shutil.rmtree(zippath)
			#os.rmdir (zippath)
			#os.remove(zippath)
		except: pass
		checkedFileList=_OpenFile(checkedFileWP)
		checkedFileList+="\n'"+filename+"'"
		_SaveFile(checkedFileWP,checkedFileList)
		myNote('Updater','Completed')
		RefreshList()
	except:
		debob('error during updater process.')
		myNote('Updater','may have failed.')
示例#3
0
	def LoadGridFile(self):
		self.PuzzlePath=xbmc.translatePath(os.path.join(Config.path,'puzzles')); 
		self.PuzzleFiles=os.listdir(self.PuzzlePath); debob(self.PuzzleFiles); 
		zz=self.PuzzleFiles; 
		for z in zz:
			if '.bak' in z: self.PuzzleFiles.remove(z)
		PuF=self.PuzzleFiles[random.randint(0,len(self.PuzzleFiles)-1)]; 
		self.PuzzleFile=xbmc.translatePath(os.path.join(self.PuzzlePath,PuF)); 
		if tfalse(SettingG("select-puzzle"))==True:
			dialog=xbmcgui.Dialog()
			fn=str(dialog.browse(1,'Select Puzzle','files','.txt|.puzzle|.puz',False,False,self.PuzzleFile,False))
			try:
				if (fn==False) or (len(fn)==0): self.close; return
				if len(fn) > 1: deb('fn',fn); self.PuzzleFile=fn; 
			except: pass
		#self.PuzzleFile=xbmc.translatePath(os.path.join(self.PuzzlePath,PuF)); 
		deb('Random File Chosen',self.PuzzleFile); self.PuzzleFileHolder=Common._OpenFile(self.PuzzleFile); deb('Length of Grid File',str(len(self.PuzzleFileHolder))); 
		self.lineBreaker='||'; #'\n\n'; 
		self.PuzzleGridA=self.PuzzleFileHolder.split(self.lineBreaker)[0].replace('\n','').replace('\a','').replace('\r',''); deb('Length of GridA',str(len(self.PuzzleFileHolder))); 
		self.PuzzleGridA=self.PuzzleGridA.replace(' ','+').replace('=','+').replace('?','')
		self.PuzzleGridB=self.PuzzleFileHolder.split(self.lineBreaker)[1].replace('\n','').replace('\a','').replace('\r',''); deb('Length of GridB',str(len(self.PuzzleFileHolder))); 
		self.PuzzleWordList=self.PuzzleFileHolder.split(self.lineBreaker)[2].replace('\n','').replace('\a','').replace('\r','').replace(', ','\n').replace(' ','\n').replace(',','\n'); deb('Length of Word List',str(len(self.PuzzleFileHolder))); 
		self.PuzzleGridAList=list(self.PuzzleGridA); 
		self.PuzzleFileHolder=self.PuzzleFileHolder.replace('\a','\n').replace('\r','\n')
		for i in range(0,len(self.PuzzleGridAList)):
			#if self.PuzzleGridAList[i] in [' ','+','=','?']:
			if self.PuzzleGridAList[i]=='+':
				z=str(chr(random.randint(65,90)))
				self.PuzzleGridAList[i]=z
				#self.PuzzleGridA[i]=chr(random.randint(65,90))
		#self.PuzzleGridA=''.join(str(e) for e in self.PuzzleGridAList); 
		#self.PuzzleGridA=str(self.PuzzleGridAList) #.join(); 
		self.PuzzleGridA=''
		for e in self.PuzzleGridAList: self.PuzzleGridA+=e
def RemoveUrlToList(url=''):
	if (url==''): url=showkeyboard(txtMessage=url,txtHeader="Add URL:  ")
	if (url=='') or (url=='none') or (url==None) or (url==False): return
	url=url.replace("'","")
	deb('Removing url for',url)
	dd=_OpenFile(workingFileWP)
	dd=dd.replace("\n'"+url+"'\n","")
	_SaveFile(workingFileWP,dd)
	RefreshList()
def SectionMenu():
	cNumber ='8'; cNumber2='2'; cNumber3='4'; 
	_addon.add_directory({'mode':'About','site':site},{'title':cFL_('About',colors['9'])},is_folder=False,fanart=fanartSite,img='http://i.imgur.com/0h78x5V.png') # iconSite
	if isFile(checkedFileWP)==False: _SaveFile(checkedFileWP,'')
	checkedFileList=_OpenFile(checkedFileWP)
	if isFile(workingFileWP)==False: MiscTag='  '+cFL('<<','red')+'  ['+cFL('Use Updater','blue')+']'
	else: MiscTag=''
	_addon.add_directory({'mode':'CustomUpdate','path':'/addon/','filename':workingFile,'url':workingFile,'site':site},{'title':cFL(cFL_('Click to update the data file for updates.'+MiscTag,colors['9']),colors['0'])+'[CR][May Take a few moments.]'},is_folder=False,fanart=fanartSite,img=iconSite)
	if isFile(workingFileWP)==True: _addon.add_directory({'mode':'TextBoxFile','url':workingFileWP,'title':cFL('Updates',colors['9'])},{'title':cFL_('Read Update\' documentation',colors[cNumber2])},is_folder=False,fanart=fanartSite,img=iconSite)
	#DownloadThis(workingUrl+workingFile,workingFile,_addonPath,useResolver=False)
	#if isFile(workingFileWP)==False: DownloadThis(workingUrl+workingFile,workingFile,_addonPath,useResolver=False)
	if isFile(workingFileWP)==True:
		dd=_OpenFile(workingFileWP)
		debob(dd)
		s="'(.*?)'\s*:\s*'([A-Za-z0-9\.\-_\[\]\(\)]*)'"; 
		try: matches=re.compile(s).findall(dd) #,re.DOTALL
		except: matches=''
		ItemCount=len(matches)
		if ItemCount > 0:
			debob(matches)
			for _path,_name in matches:
				#if not _name in checkedFileList:
				img=iconSite; fimg=fanartSite; 
				_title=cFL(_name,colors[cNumber])+CR+' ['+_path+']'
				pars={'mode':'CustomUpdate','path':_path,'filename':_name,'site':site,'section':section,'url':_name}
				_addon.add_directory(pars,{'title':_title},is_folder=False,fanart=fimg,img=img,total_items=ItemCount)
		#
	#
	#
	eod()
	return
	#
	_addon.add_directory({'mode':'TextBoxUrl','site':site,'title':'Updater Info','url':workingUrl+'updater.txt'},{'title':cFL_('Check Updater Info',colors['9'])},is_folder=False,fanart='http://s9.postimg.org/6izlt73n3/1011445_473021149448994_84427075_n.jpg',img='http://s9.postimg.org/uy7tu92jz/1013960_471938356223940_1093377719_n.jpg')
	#
	_addon.add_directory({'mode':'UpdateURPlugs','site':site,'url':'URPlugs'},{'title':cFL_('Update: Host Plugins List [Sub-Folder]',colors[cNumber])},is_folder=False,fanart=fanartSite,img=iconSite)
	_addon.add_directory({'mode':'UpdateRepos','site':site,'url':'Repos'},{'title':cFL_('Update: Repo List',colors[cNumber])},is_folder=False,fanart=fanartSite,img=iconSite)
	_addon.add_directory({'mode':'UpdateMisc','site':site,'url':'Misc'},{'title':cFL_('Update: Misc [Sub-Folder]',colors[cNumber])},is_folder=False,fanart=fanartSite,img=iconSite)
	_addon.add_directory({'mode':'UpdateArt','site':site,'url':'Art'},{'title':cFL_('Update: Art [Sub-Folder]',colors[cNumber])},is_folder=False,fanart=fanartSite,img=iconSite)
	_addon.add_directory({'mode':'UpdateRes','site':site,'url':'Res'},{'title':cFL_('Update: Resources [Sub-Folder]',colors[cNumber])},is_folder=False,fanart=fanartSite,img=iconSite)
	_addon.add_directory({'mode':'UpdateAddon','site':site,'url':'Addon'},{'title':cFL_('Update: Addon [This Addon]',colors[cNumber])},is_folder=False,fanart=fanartSite,img=iconSite)
	#_addon.add_directory({'mode':'Update','site':site},{'title':cFL_('Update: Repo List',colors[cNumber])},is_folder=False,fanart=fanartSite,img=iconSite)
	#
	#
	eod()
示例#6
0
def MenuSection():
	#common.check_database() #Checks rather the Database needs initialized or updated.
	##import splash_highway as splash; #splash.do_My_Splash(_addon.get_fanart(),2,False); 
	##splash.do_My_Splash(HowLong=5,resize=False); 
	SpecialCODE=addst('special-code',''); LocalLists=[]; 
	
	try: nURL(mainSite,cookie_file=CookFile,save_cookie=True)
	except: deb("Error","Couldn't save cookie file."); pass
	
	_addon.add_directory({'mode':'MenuTopBar','site':site},{'title':AFColoring('Top Bar')},is_folder=True,fanart=fanartSite,img=psgn('topbar'))
	_addon.add_directory({'mode':'MenuBrowse','site':site},{'title':AFColoring('Browse')},is_folder=True,fanart=fanartSite,img=psgn('browse'))
	
	#_addon.add_directory({'mode':'BrowseCat2','site':site,'cat':'rooms','type':'js|featured'},{'title':AFColoring('Featured')},is_folder=True,fanart=fanartSite,img=psgn('browse featured'))
	#_addon.add_directory({'mode':'MenuSpecial','url':'http://raw.github.com/HIGHWAY99/plugin.stream.vaughnlive.tv/master/lists/DevsFeaturedList.txt','site':site},{'title':AFColoring("Dev's Featured List")},is_folder=True,fanart=fanartSite,img=psgn('browse devs featured'))
	
	LocalLists.append(['MyPicksList.txt','My Picks List','browse my picks list'])
	LocalLists.append(['LocalList.txt','Local List','browse local list'])
	##LocalLists.append(['','','browse'])
	for (urlA,TiTLE,iMg) in LocalLists:
		urlB=TPapp(urlA)
		if isFile(urlB)==True:
			html=common._OpenFile(urlB)
			if len(html) > 10:
				_addon.add_directory({'mode':'MenuSpecial','url':urlA,'site':site},{'title':AFColoring(TiTLE)},is_folder=True,fanart=fanartSite,img=psgn(iconSite)) #iMg
	
	#if SpecialCODE==ps('special-code'):
	#	_addon.add_directory({'mode':'MenuDevFeatured','site':site},{'title':AFColoring("Dev's Featured List[CR][Hard Coded]")},is_folder=True,fanart=fanartSite,img=psgn('browse devs featured'))
	
	#_addon.add_directory({'mode':'Search','site':site,'url':'/search/'},{'title':AFColoring('Search')+cFL(' Channels',colorB)},is_folder=True,fanart=fanartSite,img=psgn('search'))
	#_addon.add_directory({'mode':'Search','site':site,'url':'/search/_s_/users.js'},{'title':AFColoring('Search')+cFL(' People',colorB)},is_folder=True,fanart=fanartSite,img=psgn('search user'))
	#_addon.add_directory({'mode':'History101','site':site,'url':''},{'title':AFColoring('History')+cFL(' 101',colorB)},is_folder=True,fanart=fanartSite,img=psgn('history 101'))
	
	#
	#if SpecialCODE==ps('special-code'):
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section             },{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.1.name'),colorB)},fanart=fanartSite,img=psgn('favorites 1'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'2'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.2.name'),colorB)},fanart=fanartSite,img=psgn('favorites 2'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'3'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.3.name'),colorB)},fanart=fanartSite,img=psgn('favorites 3'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'4'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.4.name'),colorB)},fanart=fanartSite,img=psgn('favorites 4'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'5'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.5.name'),colorB)},fanart=fanartSite,img=psgn('favorites 5'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'6'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.6.name'),colorB)},fanart=fanartSite,img=psgn('favorites 6'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'7'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.7.name'),colorB)},fanart=fanartSite,img=psgn('favorites 7'))
	###
	#if (len(addst("LastShowListedURL")) > 0): 
	#	pars={'site':site,'section':section,'mode':'ListEpisodes','url':addst("LastShowListedURL"),'title':addst("LastShowListedNAME"),'imdb_id':addst("LastShowListedIMDBID"),'img':addst("LastShowListedIMG"),'fimg':addst("LastShowListedFANART")}; 
	#	title=AFColoring(addst("LastShowListedNAME"))+CR+cFL('[Last Show]',colorA); 
	#	_addon.add_directory(pars,{'title':title},fanart=addst("LastShowListedFANART"),img=addst("LastShowListedIMG"),is_folder=True); 
	#if (len(addst("LastEpisodeListedURL")) > 0): 
	#	pars={'site':site,'section':section,'mode':'GetMedia','url':addst("LastEpisodeListedURL"),'title':addst("LastEpisodeListedNAME"),'imdb_id':addst("LastEpisodeListedIMDBID"),'img':addst("LastEpisodeListedIMG"),'fimg':addst("LastEpisodeListedFANART"),'stitle':addst("LastEpisodeListedSTITLE"),'etitle':addst("LastEpisodeListedETITLE"),'e':addst("LastEpisodeListedEpNo"),'s':addst("LastEpisodeListedSNo"),'e2':addst("LastEpisodeListedEpNo2")}; 
	#	title=AFColoring(addst("LastEpisodeListedNAME"))+CR+cFL('[Last Episode]',colorA); 
	#	_addon.add_directory(pars,{'title':title},fanart=addst("LastEpisodeListedFANART"),img=addst("LastEpisodeListedIMG"),is_folder=True); 
	###
	_addon.add_directory({'mode':'About','site':site,'section':section},{'title':AFColoring('About')},is_folder=True,fanart=fanartSite,img=artj('About')) # 'http://i.imgur.com/0h78x5V.png' # iconSite
	###
	set_view('list',view_mode=addst('default-view')); eod()
def MenuSection():
	#common.check_database() #Checks rather the Database needs initialized or updated.
	##import splash_highway as splash; #splash.do_My_Splash(_addon.get_fanart(),2,False); 
	##splash.do_My_Splash(HowLong=5,resize=False); 
	SpecialCODE=addst('special-code',''); LocalLists=[]; 
	
	try: nURL(mainSite,cookie_file=CookFile,save_cookie=True)
	except: deb("Error","Couldn't save cookie file."); pass
	
	_addon.add_directory({'mode':'MenuTopBar','site':site},{'title':AFColoring('Top Bar')},is_folder=True,fanart=fanartSite,img=psgn('topbar'))
	_addon.add_directory({'mode':'MenuBrowse','site':site},{'title':AFColoring('Browse')},is_folder=True,fanart=fanartSite,img=psgn('browse'))
	
	#_addon.add_directory({'mode':'BrowseCat2','site':site,'cat':'rooms','type':'js|featured'},{'title':AFColoring('Featured')},is_folder=True,fanart=fanartSite,img=psgn('browse featured'))
	#_addon.add_directory({'mode':'MenuSpecial','url':'http://raw.github.com/HIGHWAY99/plugin.stream.vaughnlive.tv/master/lists/DevsFeaturedList.txt','site':site},{'title':AFColoring("Dev's Featured List")},is_folder=True,fanart=fanartSite,img=psgn('browse devs featured'))
	
	LocalLists.append(['MyPicksList.txt','My Picks List','browse my picks list'])
	LocalLists.append(['LocalList.txt','Local List','browse local list'])
	##LocalLists.append(['','','browse'])
	for (urlA,TiTLE,iMg) in LocalLists:
		urlB=TPapp(urlA)
		if isFile(urlB)==True:
			html=common._OpenFile(urlB)
			if len(html) > 10:
				_addon.add_directory({'mode':'MenuSpecial','url':urlA,'site':site},{'title':AFColoring(TiTLE)},is_folder=True,fanart=fanartSite,img=psgn(iconSite)) #iMg
	
	#if SpecialCODE==ps('special-code'):
	#	_addon.add_directory({'mode':'MenuDevFeatured','site':site},{'title':AFColoring("Dev's Featured List[CR][Hard Coded]")},is_folder=True,fanart=fanartSite,img=psgn('browse devs featured'))
	
	#_addon.add_directory({'mode':'Search','site':site,'url':'/search/'},{'title':AFColoring('Search')+cFL(' Channels',colorB)},is_folder=True,fanart=fanartSite,img=psgn('search'))
	#_addon.add_directory({'mode':'Search','site':site,'url':'/search/_s_/users.js'},{'title':AFColoring('Search')+cFL(' People',colorB)},is_folder=True,fanart=fanartSite,img=psgn('search user'))
	#_addon.add_directory({'mode':'History101','site':site,'url':''},{'title':AFColoring('History')+cFL(' 101',colorB)},is_folder=True,fanart=fanartSite,img=psgn('history 101'))
	
	#
	#if SpecialCODE==ps('special-code'):
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section             },{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.1.name'),colorB)},fanart=fanartSite,img=psgn('favorites 1'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'2'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.2.name'),colorB)},fanart=fanartSite,img=psgn('favorites 2'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'3'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.3.name'),colorB)},fanart=fanartSite,img=psgn('favorites 3'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'4'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.4.name'),colorB)},fanart=fanartSite,img=psgn('favorites 4'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'5'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.5.name'),colorB)},fanart=fanartSite,img=psgn('favorites 5'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'6'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.6.name'),colorB)},fanart=fanartSite,img=psgn('favorites 6'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'7'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.7.name'),colorB)},fanart=fanartSite,img=psgn('favorites 7'))
	###
	#if (len(addst("LastShowListedURL")) > 0): 
	#	pars={'site':site,'section':section,'mode':'ListEpisodes','url':addst("LastShowListedURL"),'title':addst("LastShowListedNAME"),'imdb_id':addst("LastShowListedIMDBID"),'img':addst("LastShowListedIMG"),'fimg':addst("LastShowListedFANART")}; 
	#	title=AFColoring(addst("LastShowListedNAME"))+CR+cFL('[Last Show]',colorA); 
	#	_addon.add_directory(pars,{'title':title},fanart=addst("LastShowListedFANART"),img=addst("LastShowListedIMG"),is_folder=True); 
	#if (len(addst("LastEpisodeListedURL")) > 0): 
	#	pars={'site':site,'section':section,'mode':'GetMedia','url':addst("LastEpisodeListedURL"),'title':addst("LastEpisodeListedNAME"),'imdb_id':addst("LastEpisodeListedIMDBID"),'img':addst("LastEpisodeListedIMG"),'fimg':addst("LastEpisodeListedFANART"),'stitle':addst("LastEpisodeListedSTITLE"),'etitle':addst("LastEpisodeListedETITLE"),'e':addst("LastEpisodeListedEpNo"),'s':addst("LastEpisodeListedSNo"),'e2':addst("LastEpisodeListedEpNo2")}; 
	#	title=AFColoring(addst("LastEpisodeListedNAME"))+CR+cFL('[Last Episode]',colorA); 
	#	_addon.add_directory(pars,{'title':title},fanart=addst("LastEpisodeListedFANART"),img=addst("LastEpisodeListedIMG"),is_folder=True); 
	###
	_addon.add_directory({'mode':'About','site':site,'section':section},{'title':AFColoring('About')},is_folder=True,fanart=fanartSite,img=artj('About')) # 'http://i.imgur.com/0h78x5V.png' # iconSite
	###
	set_view('list',view_mode=addst('default-view')); eod()
def Tool_Fix_Fixit(AddonFolder,AddonFile,StringOld,StringNew):
	if (len(AddonFolder)==0) or (len(AddonFile)==0) or (len(StringOld)==0): myNote(eMsgHead,'Missing Fixit Data.'); return
	eMsgHead='Fixing: '+'('+AddonFolder+'/'+AddonFile+')'
	destPath=xbmc.translatePath(os.path.join('special://home','addons',AddonFolder))
	if isPath(destPath)==False: myNote(eMsgHead,'Folder not found.'); return
	destFile=xbmc.translatePath(os.path.join(destPath,AddonFile))
	if isFile(destFile)==False: myNote(eMsgHead,'File not found.'); return
	CopyAFile(destFile,destFile+'.bup'); 
	tt=_OpenFile(destFile); 
	tt=tt.replace(StringOld,StringNew); 
	_SaveFile(destFile,tt); 
	myNote(eMsgHead,'File should now be fixed.')
def Tool_Fix_1Channel_Remove_HostHandledCheck():
	eMsgHead='Fixing: '+'(plugin.video.1channel/default.py)'
	StringOld="if urlresolver.HostedMediaFile(item['url']).valid_url():"
	StringNew="if item==item: #urlresolver.HostedMediaFile(item['url']).valid_url():"
	destPath=xbmc.translatePath(os.path.join('special://home','addons','plugin.video.1channel'))
	if isPath(destPath)==False: myNote(eMsgHead,'Folder not found.'); return
	destFile=xbmc.translatePath(os.path.join(destPath,'default.py'))
	if isFile(destFile)==False: myNote(eMsgHead,'File not found.'); return
	CopyAFile(destFile,destFile+'.bup'); 
	tt=_OpenFile(destFile); 
	tt=tt.replace(StringOld,StringNew); 
	_SaveFile(destFile,tt); 
	myNote(eMsgHead,'File should now be fixed.')
def Tool_Fix_LastFM_Restore_AccountNotice():
	eMsgHead='Fixing: '+'(plugin.audio.lastfm/utils.py)'
	StringOld=" ttTempFixTT='' #xbmc.executebuiltin('Notification(%s,%s,%i)' % (LANGUAGE(32011), LANGUAGE(32027), 7000))"
	StringNew=" xbmc.executebuiltin('Notification(%s,%s,%i)' % (LANGUAGE(32011), LANGUAGE(32027), 7000))"
	destPath=xbmc.translatePath(os.path.join('special://home','addons','plugin.audio.lastfm'))
	if isPath(destPath)==False: myNote(eMsgHead,'Folder not found.'); return
	destFile=xbmc.translatePath(os.path.join(destPath,'utils.py'))
	if isFile(destFile)==False: myNote(eMsgHead,'File not found.'); return
	CopyAFile(destFile,destFile+'.bup'); 
	tt=_OpenFile(destFile); 
	tt=tt.replace(StringOld,StringNew); 
	_SaveFile(destFile,tt); 
	myNote(eMsgHead,'File should now be fixed.')
def SectionMenu():
	cNumber ='8'; cNumber2='2'; cNumber3='0'; cNumber4='9'; 
	contextMenuItems=[]; 
	#contextMenuItems.append(('Add URL','XBMC.RunPlugin(%s)' % _addon.build_plugin_url({'site':site,'mode':'AddUrlToList'}) ))
	_addon.add_directory({'mode':'About','site':site},{'title':cFL_('About',colors['9'])},is_folder=False,contextmenu_items=contextMenuItems,fanart=fanartSite,img='http://i.imgur.com/0h78x5V.png') # iconSite
	#if (_debugging==True): _addon.add_directory({'mode':'AddUrlToList','site':site},{'title':cFL_('Add Url',colors[cNumber3])},is_folder=True,contextmenu_items=contextMenuItems,fanart=fanartSite,img='http://i.imgur.com/0h78x5V.png') # iconSite
	_addon.add_directory({'tag':'english','mode':'SectionMenuEnglish','site':site},{'title':'['+cFL('English',colors[cNumber3])+']'},is_folder=True,contextmenu_items=contextMenuItems,fanart=fanartSite,img=iconSite); 
	#_addon.add_directory({'tag':'premium','mode':'SectionMenuEnglish','site':site},{'title':'['+cFL('Premium',colors[cNumber3])+']'},is_folder=True,contextmenu_items=contextMenuItems,fanart=fanartSite,img=iconSite); 
	_addon.add_directory({'tag':'foriegn','mode':'SectionMenuEnglish','site':site},{'title':'['+cFL('Foriegn',colors[cNumber3])+']'},is_folder=True,contextmenu_items=contextMenuItems,fanart=fanartSite,img=iconSite); 
	
	if isFile(workingFileWP)==False: _SaveFile(workingFileWP,'\n')
	else:
		s1=[]; dd=_OpenFile(workingFileWP); deb('length of workingfile',str(len(dd))); #debob(dd)
		##s="\n+'(.*?)':'([A-Za-z0-9]+)':'(.+?)'\n+"; #deb('s',s); 
		##s1.append("\n+#EN'(.*?\s+\[EN\])':'([A-Za-z0-9]+)':'(.+?)'"); 
		s1.append("\n+#[A-Z\#]*'(.*?)':'([A-Za-z0-9]+)':'(.+?)'"); 
		#s1.append("\n+#EN'(.*?)':'([A-Za-z0-9]+)':'(.+?)'"); 
		#s1.append("\n+'(.*?\s+\[EN\])':'([A-Za-z0-9]+)':'(.+?)'"); 
		#s1.append("\n+#P'(.*?)':'([A-Za-z0-9]+)':'(.+?)'"); 
		#s1.append("\n+'(.*?)':'([A-Za-z0-9]+)':'(.+?)'"); 
		#s1.append("\n+#'(.*?)':'([A-Za-z0-9]+)':'(.+?)'"); 
		#s1.append("\n+#F'(.*?)':'([A-Za-z0-9]+)':'(.+?)'"); 
		#s1.append("\n+##'(.*?)':'([A-Za-z0-9]+)':'(.+?)'"); 
		for s in s1:
			try: matches=re.compile(s).findall(dd); debob(matches); #,re.DOTALL
			except: matches=''; 
			ItemCount=len(matches); deb('# of matches',str(ItemCount)); i=1
			if ItemCount > 0:
				for name,tag,cid in matches:
					if   tag=='megafun':
						match='http://m24.megafun.vn/live.vs?c=%s&q=%s' % (cid,'high'); 
						_title=cFL('[HTTP] '+cid+'.)  ',colors[cNumber4])+cFL(name,colors[cNumber])#+CR+match; 
					elif tag=='megafun2':
						match='rtmp://m22.megafun.vn/hctv//%s' % (cid); 
						_title=cFL('[RTMP] '+cid+'.)  ',colors[cNumber4])+cFL(name,colors[cNumber])#+CR+match; 
					elif tag=='megafun3':
						#rtmp://$OPT:rtmp-raw=rtmp://m22.megafun.vn/hctv playpath=vstv009?token=CQ0T1Xvn0YlJQibmvBPpaA&time=1375431732&q=rtmp swfUrl=http://megafun.vn/common/player/player.swf live=1 pageUrl=http://baoquangninh.com.vn/truyen-hinh/?c=12
						match='rtmp://m22.megafun.vn/hctv playpath=%s swfUrl=http://megafun.vn/common/player/player.swf live=1' % (cid); 
						_title=cFL(cid+'.)  ',colors[cNumber4])+cFL(name,colors[cNumber])#+CR+match; 
					else:
						match=cid; _title=str(i)+'.)  '+cFL_(name,colors[cNumber])+CR+match; 
					contextMenuItems=[]; img=iconSite; fimg=fanartSite; pars={'mode':'PlayURL','url':match,'site':site,'section':section}; 
					#contextMenuItems.append(('Try URL With UrlResolver','XBMC.RunPlugin(%s)' % _addon.build_plugin_url({'site':site,'mode':'PlayURLs','url':match}) ))
					#contextMenuItems.append(('Remove URL','XBMC.RunPlugin(%s)' % _addon.build_plugin_url({'site':site,'mode':'RemoveUrlToList','url':match})))
					#contextMenuItems.append(('Add URL','XBMC.RunPlugin(%s)' % _addon.build_plugin_url({'site':site,'mode':'AddUrlToList'}) ))
					try: _addon.add_directory(pars,{'title':_title},is_folder=False,contextmenu_items=contextMenuItems,total_items=ItemCount,fanart=fimg,img=img); i=i+1; 
					except: pass
	eod()
def SpecialMenu(url):
	try: 
		if not '://' in url: html=common._OpenFile(TPapp(url))
		else: html=nURL(url)
		html=html.replace('\n','').replace('\r','').replace('\a','').replace('\t',''); data=eval(html); 
	except: data=[]
	iC=len(data); 
	if iC > 0:
		for (tag1,pars,tag2,labs) in data:
			img=pars['img'].replace('https://','http://'); fimg=pars['fimg'].replace('https://','http://'); 
			if fimg.lower()=='[fanart]': fimg=fanartSite
			debob(['pars',pars,'labs',labs]); 
			try: _addon.add_directory(pars,labs,is_folder=False,fanart=fimg,img=img,total_items=iC,context_replace=False)
			except: pass
	#set_view('list',view_mode=addst('default-view')); eod()
	set_view('tvshows',view_mode=addst('tvshows-view')); eod()
def SectionMenu():
	#import splash_highway as splash; #splash.do_My_Splash(_addon.get_fanart(),2,False); 
	#splash.do_My_Splash(HowLong=5,resize=False); 
	SpecialCODE=addst('special-code',''); LocalLists=[]; 
	_addon.add_directory({'mode':'BrowseMenu','site':site},{'title':AFColoring('Browse')},is_folder=True,fanart=fanartSite,img=psgn('browse'))
	_addon.add_directory({'mode':'SpecialMenu','url':'http://raw.github.com/HIGHWAY99/plugin.video.streamup/master/lists/DevsFeaturedList.txt','site':site},{'title':AFColoring("Dev's Featured List")},is_folder=True,fanart=fanartSite,img=psgn('browse'))
	
	LocalLists.append(['MyPicksList.txt','My Picks List','browse'])
	LocalLists.append(['LocalList.txt','Local List','browse'])
	#LocalLists.append(['','','browse'])
	for (urlA,TiTLE,iMg) in LocalLists:
		urlB=TPapp(urlA)
		if isFile(urlB)==True:
			html=common._OpenFile(urlB)
			if len(html) > 10:
				_addon.add_directory({'mode':'SpecialMenu','url':urlA,'site':site},{'title':AFColoring(TiTLE)},is_folder=True,fanart=fanartSite,img=psgn(iMg))
	
	if SpecialCODE==ps('special-code'):
		_addon.add_directory({'mode':'DevFeaturedMenu','site':site},{'title':AFColoring("Dev's Featured List[CR][Hard Coded]")},is_folder=True,fanart=fanartSite,img=psgn('browse'))
	
	_addon.add_directory({'mode':'BrowseCat2','site':site,'cat':'rooms','type':'js|featured'},{'title':AFColoring('Featured')},is_folder=True,fanart=fanartSite,img=psgn('browse'))
	_addon.add_directory({'mode':'Search','site':site,'url':'/search/'},{'title':AFColoring('Search')+cFL(' Channel',colorB)},is_folder=True,fanart=fanartSite,img=psgn('search'))
	_addon.add_directory({'mode':'Search','site':site,'url':'/search/_s_/users.js'},{'title':AFColoring('Search')+cFL(' People',colorB)},is_folder=True,fanart=fanartSite,img=psgn('search user'))
	#
	#if SpecialCODE==ps('special-code'):
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section             },{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.1.name'),colorB)},fanart=fanartSite,img=psgn('favorites 1'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'2'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.2.name'),colorB)},fanart=fanartSite,img=psgn('favorites 2'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'3'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.3.name'),colorB)},fanart=fanartSite,img=psgn('favorites 3'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'4'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.4.name'),colorB)},fanart=fanartSite,img=psgn('favorites 4'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'5'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.5.name'),colorB)},fanart=fanartSite,img=psgn('favorites 5'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'6'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.6.name'),colorB)},fanart=fanartSite,img=psgn('favorites 6'))
	#_addon.add_directory({'mode':'FavoritesList','site':site,'section':section,'subfav':'7'},{'title':cFL(ps('WhatRFavsCalled'),colorA)+cFL(addst('fav.tv.7.name'),colorB)},fanart=fanartSite,img=psgn('favorites 7'))
	###
	#if (len(addst("LastShowListedURL")) > 0): 
	#	pars={'site':site,'section':section,'mode':'ListEpisodes','url':addst("LastShowListedURL"),'title':addst("LastShowListedNAME"),'imdb_id':addst("LastShowListedIMDBID"),'img':addst("LastShowListedIMG"),'fimg':addst("LastShowListedFANART")}; 
	#	title=AFColoring(addst("LastShowListedNAME"))+CR+cFL('[Last Show]',colorA); 
	#	_addon.add_directory(pars,{'title':title},fanart=addst("LastShowListedFANART"),img=addst("LastShowListedIMG"),is_folder=True); 
	#if (len(addst("LastEpisodeListedURL")) > 0): 
	#	pars={'site':site,'section':section,'mode':'GetMedia','url':addst("LastEpisodeListedURL"),'title':addst("LastEpisodeListedNAME"),'imdb_id':addst("LastEpisodeListedIMDBID"),'img':addst("LastEpisodeListedIMG"),'fimg':addst("LastEpisodeListedFANART"),'stitle':addst("LastEpisodeListedSTITLE"),'etitle':addst("LastEpisodeListedETITLE"),'e':addst("LastEpisodeListedEpNo"),'s':addst("LastEpisodeListedSNo"),'e2':addst("LastEpisodeListedEpNo2")}; 
	#	title=AFColoring(addst("LastEpisodeListedNAME"))+CR+cFL('[Last Episode]',colorA); 
	#	_addon.add_directory(pars,{'title':title},fanart=addst("LastEpisodeListedFANART"),img=addst("LastEpisodeListedIMG"),is_folder=True); 
	###
	#_addon.add_directory({'mode':'About','site':site,'section':section},{'title':AFColoring('About')},is_folder=True,fanart=fanartSite,img='http://i.imgur.com/0h78x5V.png') # iconSite
	###
	set_view('list',view_mode=addst('default-view')); eod()
示例#14
0
	def LoadGridFile(self):
		self.PuzzlePath=xbmc.translatePath(os.path.join(Config.path,'puzzles')); 
		self.PuzzleFiles=os.listdir(self.PuzzlePath); debob(self.PuzzleFiles); 
		zz=self.PuzzleFiles; 
		for z in zz:
			if '.bak' in z: self.PuzzleFiles.remove(z)
		PuF=self.PuzzleFiles[random.randint(0,len(self.PuzzleFiles)-1)]; 
		self.PuzzleFile=xbmc.translatePath(os.path.join(self.PuzzlePath,PuF)); 
		if tfalse(SettingG("select-puzzle"))==True:
			dialog=xbmcgui.Dialog()
			fn=str(dialog.browse(1,'Select Puzzle','files','.txt|.puzzle|.puz',False,False,self.PuzzleFile,False))
			try:
				if (fn==False) or (len(fn)==0): self.close; return
				if len(fn) > 1: deb('fn',fn); self.PuzzleFile=fn; 
			except: pass
		#self.PuzzleFile=xbmc.translatePath(os.path.join(self.PuzzlePath,PuF)); 
		deb('Random File Chosen',self.PuzzleFile); self.PuzzleFileHolder=Common._OpenFile(self.PuzzleFile); deb('Length of Grid File',str(len(self.PuzzleFileHolder))); 
		self.PuzzleFileHolder=self.PuzzleFileHolder.strip().replace('\a','\n').replace('\r','\n').replace('\n\n','\n').strip()
		self.PuzzleFileHolder_Original=''+self.PuzzleFileHolder
		self.PuzzleFileHolder=self.PuzzleFileHolder.replace(self.cStart,self.cUser,1)
		self.LineLength=len(self.PuzzleFileHolder.split('\n')[0]);
def SectionMenu():
	cNumber ='8'; cNumber2='2'; cNumber3='0'; 
	contextMenuItems=[]; 
	contextMenuItems.append(('Add URL','XBMC.RunPlugin(%s)' % _addon.build_plugin_url({'site':site,'mode':'AddUrlToList'}) ))
	_addon.add_directory({'mode':'About','site':site},{'title':cFL_('About',colors['9'])},is_folder=False,contextmenu_items=contextMenuItems,fanart=fanartSite,img='http://i.imgur.com/0h78x5V.png') # iconSite
	if (_debugging==True): _addon.add_directory({'mode':'AddUrlToList','site':site},{'title':cFL_('Add Url',colors[cNumber3])},is_folder=True,contextmenu_items=contextMenuItems,fanart=fanartSite,img='http://i.imgur.com/0h78x5V.png') # iconSite
	if isFile(workingFileWP)==False: _SaveFile(workingFileWP,'\n')
	else:
		dd=_OpenFile(workingFileWP); deb('length of workingfile',str(len(dd))); #debob(dd)
		s="'([A-Za-z0-9]+://.+)'"; 
		try: matches=re.compile(s).findall(dd); debob(matches) #,re.DOTALL
		except: matches=''
		ItemCount=len(matches); deb('# of matches',str(ItemCount)); i=1
		if ItemCount > 0:
			for match in matches:
				contextMenuItems=[]; img=iconSite; fimg=fanartSite; pars={'mode':'PlayURL','url':match,'site':site,'section':section}; 
				_title=str(i)+'.)  '+cFL(match,colors[cNumber]); 
				contextMenuItems.append(('Try URL With UrlResolver','XBMC.RunPlugin(%s)' % _addon.build_plugin_url({'site':site,'mode':'PlayURLs','url':match}) ))
				contextMenuItems.append(('Remove URL','XBMC.RunPlugin(%s)' % _addon.build_plugin_url({'site':site,'mode':'RemoveUrlToList','url':match})))
				contextMenuItems.append(('Add URL','XBMC.RunPlugin(%s)' % _addon.build_plugin_url({'site':site,'mode':'AddUrlToList'}) ))
				try: _addon.add_directory(pars,{'title':_title},is_folder=False,contextmenu_items=contextMenuItems,total_items=ItemCount,fanart=fimg,img=img); i=i+1; 
				except: pass
	eod()
def CopyPlugin2(fomPath,fromFile,toPath):
	debob([fomPath,fromFile,toPath])
	eMsgHead='Copy File'+fromFile
	destPath=xbmc.translatePath(toPath) #xbmc.translatePath(os.path.join(toPath,'lib','urlresolver','plugins'))
	if isPath(destPath)==True: myNote(eMsgHead,'Repository seems to already be installed: '+destFolder1); #return
	if isFile(xbmc.translatePath(os.path.join(destPath,fromFile)))==True: 
		myNote(eMsgHead,'filename already exists.')
		_SaveFile(xbmc.translatePath(os.path.join(destPath,fromFile+'.bup')),_OpenFile(xbmc.translatePath(os.path.join(destPath,fromFile))))
	r=popYN('Would you like to copy this File?',fromFile,'to:  '+destPath,'',n='Cancel',y='Copy It')
	#myNote(eMsgHead,'r='+str(r))
	if r==False: popOK('File could not be copied.',title=eMsgHead,line2='',line3='')
	else:
		if isPath(destPath)==False: os.mkdir(destPath)
		if isPath(destPath)==False: myNote(eMsgHead,'Could not create folder: '+destFolder1); #return
		#
		ttFileName='fanart.jpg'; tFrom=xbmc.translatePath(os.path.join(fomPath,fromFile[:-4]+'.'+ttFileName)); tTo=xbmc.translatePath(os.path.join(destPath,ttFileName))
		if (isFile(tFrom)==True) and (isFile(tTo)==False): CopyAFile(tFrom,tTo)
		ttFileName='icon.png'; tFrom=xbmc.translatePath(os.path.join(fomPath,fromFile[:-4]+'.'+ttFileName)); tTo=xbmc.translatePath(os.path.join(destPath,ttFileName))
		if (isFile(tFrom)==True) and (isFile(tTo)==False): CopyAFile(tFrom,tTo)
		ttFileName='changelog.txt'; tFrom=xbmc.translatePath(os.path.join(fomPath,fromFile[:-4]+'.'+ttFileName)); tTo=xbmc.translatePath(os.path.join(destPath,ttFileName))
		if (isFile(tFrom)==True) and (isFile(tTo)==False): CopyAFile(tFrom,tTo)
		ttFileName='addon.xml'; tFrom=xbmc.translatePath(os.path.join(fomPath,fromFile)); tTo=xbmc.translatePath(os.path.join(destPath,ttFileName))
		if (isFile(tFrom)==True) and (isFile(tTo)==False): CopyAFile(tFrom,tTo); popOK('File should now be copied.',title=eMsgHead,line2='',line3='')
示例#17
0
def MenuSpecial(url):
	try: 
		if not '://' in url: html=common._OpenFile(TPapp(url))
		else: html=nURL(url)
		html=html.replace('\n','').replace('\r','').replace('\a','').replace('\t',''); data=eval(html); 
	except: data=[]
	iC=len(data); 
	if iC > 0:
		for (tag1,pars,tag2,labs) in data:
			try: img=pars['img'].replace('https://','http://'); 
			except: 
				try: img=labs['img'].replace('https://','http://'); 
				except: img=iconSite
			try: fimg=pars['fimg'].replace('https://','http://'); 
			except: 
				try: fimg=labs['fimg']; 
				except: fimg=fanartSite
			img=img.replace('https://','http://'); fimg=fimg.replace('https://','http://'); debob([tag1,pars,tag2,labs]); 
			if  img.lower()=='[icon]':    img=  iconSite
			if fimg.lower()=='[fanart]': fimg=fanartSite
			try: _addon.add_directory(pars,labs,is_folder=False,fanart=fimg,img=img,total_items=iC,context_replace=False)
			except: pass
	#set_view('list',view_mode=addst('default-view')); eod()
	set_view('tvshows',view_mode=addst('tvshows-view')); eod()
def PlayStreamUP(pageUrl='',Name='',Thumb='',roomId='',roomSlug='',plot='',liVe='',streamUrl='',streamkey=''):
	debob("--DO A PLAYER SPLIT HERE--"); debob(['pageUrl',pageUrl,'Name',Name,'Thumb',Thumb,'roomId',roomId,'roomSlug',roomSlug,'plot',plot,'liVe',liVe,'streamUrl',streamUrl]); 
	PlayerMethod=addst("core-player"); youtubekey=''; 
	if   (PlayerMethod=='DVDPLAYER'): PlayerMeth=xbmc.PLAYER_CORE_DVDPLAYER
	elif (PlayerMethod=='MPLAYER'): PlayerMeth=xbmc.PLAYER_CORE_MPLAYER
	elif (PlayerMethod=='PAPLAYER'): PlayerMeth=xbmc.PLAYER_CORE_PAPLAYER
	else: PlayerMeth=xbmc.PLAYER_CORE_AUTO
	play=xbmc.Player(PlayerMeth) ### xbmc.PLAYER_CORE_AUTO | xbmc.PLAYER_CORE_DVDPLAYER | xbmc.PLAYER_CORE_MPLAYER | xbmc.PLAYER_CORE_PAPLAYER
	#play=xbmc.Player(xbmc.PLAYER_CORE_AUTO) ### xbmc.PLAYER_CORE_AUTO | xbmc.PLAYER_CORE_DVDPLAYER | xbmc.PLAYER_CORE_MPLAYER | xbmc.PLAYER_CORE_PAPLAYER
	if len(streamUrl) > 10: 
		url=streamUrl
	else: 
		html=messupText(nolines(nURL(pageUrl)),True,True); 
		if len(roomId)==0:
			try:    roomId=re.compile("flashvars.roomId\s*=\s*'(.+?)';").findall(html)[0]
			except: roomId=''
		if len(Thumb)==0:
			try:    Thumb=re.compile("flashvars.roomAvatar\s*=\s*'(.+?)';").findall(html)[0]
			except: Thumb=iconSite
		if len(roomSlug)==0:
			try:    roomSlug=re.compile("flashvars.roomSlug\s*=\s*'(.+?)';").findall(html)[0]
			except: roomSlug=''
		if len(Name)==0:
			try:    Name=re.compile("flashvars.roomName\s*=\s*'(.+?)';").findall(html)[0]
			except: Name='Unknown'
		
		
		#logging.Logger("streamup-test").setLevel(10); 
		#url='rtmpdump -r rtmp://%s/%s -y XXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxz -v -V -o test.mp4' % ('66.55.92.79',roomId)
		
		url='rtmp://%s/%s/%s' % ('66.55.92.79',roomId,streamkey)
		if len(streamkey)==0:
			DoTD(); #DoA("ToggleDebug"); 
			url='rtmp://%s/%s' % ('66.55.92.79',roomId)
			play.play(url)
			xbmc.sleep(8000)
			xbmcLogData=common._OpenFile(xbmcLogFile)
			if "--DO A PLAYER SPLIT HERE--" in xbmcLogData: xbmcLogData=xbmcLogData.split("--DO A PLAYER SPLIT HERE--")[-1]
			DoTD(); #DoA("ToggleDebug"); 
			deb("test file",TPapp("-- player-test.txt")); 
			common._SaveFile(TPapp("-- player-test.txt"),xbmcLogData); 
			try: streamkey=   re.compile('INFO:\s+Property:\s+<Name:\s+.*?,\s+STRING:\s+{"message":"startShowMode","name":".*?","active":\D*,"streamKey":"([0-9A-Za-z]+)","uuid":".*?","type":"\D*"}>').findall(xbmcLogData)[-1]
			except: pass
			url='rtmp://%s/%s/%s' % ('66.55.92.79',roomId,streamkey)
			if (len(streamkey)==0) and (len(youtubekey)==0):
				try: youtubekey=re.compile(':"startYoutubeMode",.*"videoID":"(.+?)"').findall(xbmcLogData)[-1]
				except: pass
				deb("youtubekey",youtubekey); 
				#INFO: Property: <Name:           no-name., STRING:	{"message":"startYoutubeMode","position":2982,"isActive":true,"currentIndex":0,"duration":5596,"playlistCount":1,"videoID":"sG3bmmcg6tw","paused":false,"loop":"false","uuid":"050f342c-ad54-4798-86de-94db6b8a92dc","type":"youtube"}>
				#INFO: Property: <Name:           no-name., STRING:	{"message":"startYoutubeMode","position":2365,"isActive":true,"currentIndex":5,"duration":3028,"playlistCount":12,"videoID":"qmjVOUW3Szo","paused":false,"loop":"true","uuid":"2750e6ee-354c-4fa7-8b8b-6f7a07b821f1","type":"youtube"}>
				#INFO: Property: <Name:           no-name., STRING:	{"message":"startYoutubeMode","position":280,"isActive":true,"currentIndex":0,"duration":1763,"playlistCount":18,"videoID":"5f75fpSU9_I","paused":false,"loop":"false","uuid":"2750e6ee-354c-4fa7-8b8b-6f7a07b821f1","type":"youtube"}>
				url='plugin://plugin.video.youtube/?path=/root/video&action=play_video&videoid=%s' % (youtubekey)
				#url = 'plugin://plugin.video.youtube/?action=play_video&videoid=%s' % youtubekey
				try: _addon.resolve_url(url)
				except: t=''
				#xbmc.executebuiltin("xbmc.PlayMedia("+url+")"); 
				#return
			##
		
		
		#url='rtmp://%s/%s/%s' % ('66.55.92.79',roomId,streamkey)
		#url='rtmp://%s/%s%s' % ('66.55.92.79/app',roomId,'.flv')
		#url='rtmp://%s/%s%s' % ('66.55.92.79:1935/app',roomId,'.flv')
		#url='rtmp://%s playpath=%s%s' % ('66.55.92.79:1935/'+roomSlug,roomId,'')
		#url='rtmp://%s/%s%s' % ('66.55.92.79:1935/'+roomSlug,roomId,'')
		#url='rtmp://%s?%s%s' % ('66.55.92.79:1935/'+roomSlug,roomId,'')
		#url='rtmp://%s/%s%s' % ('66.55.92.79:1935/'+roomId,roomSlug,'')
		#url='rtmp://%s?%s%s' % ('66.55.92.79:1935/'+roomId,roomSlug,'')
		#url='rtmp://%s?%s%s' % ('66.55.92.79:1935/app',roomSlug,'')
		#url='rtmp://%s?%s%s' % ('66.55.92.79:1935/app',roomId,'')
		#url='rtmp://%s/%s%s' % ('66.55.92.79:1935/app',roomSlug,'')
		#url='rtmp://%s/%s%s' % ('66.55.92.79:1935/app',roomId,'')
		#url='rtmp://%s playpath=%s%s' % ('66.55.92.79:1935/app',roomId,'')
		#url='rtmp://%s playpath=%s%s' % ('66.55.92.79:1935/live',roomId,'')
		#url='rtmp://%s/%s%s' % ('66.55.92.79:1935/live',roomId,'')
		#url='rtmp://%s/%s%s swfUrl=%s live=%s pageUrl=%s tcUrl=rtmp://%s/%s' % ('66.55.92.79',roomId,'','http://streamup.com/assets/StreamupVideoChat.swf','1',pageUrl,'66.55.92.79',roomId)
		#url='rtmp://%s/%s%s playpath=%s swfUrl=%s live=%s pageUrl=%s tcUrl=rtmp://%s/%s' % ('66.55.92.79',roomId,'',roomId,'http://streamup.com/assets/StreamupVideoChat.swf','1',pageUrl,'66.55.92.79',roomId)
		#url='rtmp://%s/%s%s playpath=%s swfUrl=%s live=%s pageUrl=%s tcUrl=rtmp://%s/%s' % ('66.55.92.79',roomId,'',roomId,'http://streamup.com/assets/StreamupEmbeddable.swf','1',pageUrl,'66.55.92.79',roomId)
		#url='rtmp://%s/%s/%s playpath=%s swfUrl=%s live=%s pageUrl=%s' % ('66.55.92.79',roomId,'',roomId,'http://streamup.com/assets/StreamupEmbeddable.swf','1',pageUrl)
		#url='rtmp://%s/%s/%s' % ('66.55.92.79',roomId,'158ac323a7267312370c')
		##url='rtmp://%s/%s%s' % ('66.55.92.79',roomId,'')
	## ### ## 
	#try: _addon.resolve_url(url)
	#except: t=''
	#try: play.play(url)
	#except: t=''
	## ### ## 
	deb('stream url',str(url)); 
	infoLabels={"Studio":liVe,"ShowTitle":Name,"Title":Name,"cover_url":Thumb,'plot':plot}; 
	li=xbmcgui.ListItem(Name,iconImage=Thumb,thumbnailImage=Thumb); 
	li.setInfo(type="Video", infoLabels=infoLabels ); li.setProperty('IsPlayable', 'true'); 
	try: _addon.resolve_url(url)
	except: t=''
	try: play.play(url, li)
	except:
		try: play.play(url)
		except: t=''
示例#19
0
 def LoadGridFile(self):
     self.PuzzlePath = xbmc.translatePath(
         os.path.join(Config.path, 'puzzles'))
     self.PuzzleFiles = os.listdir(self.PuzzlePath)
     debob(self.PuzzleFiles)
     zz = self.PuzzleFiles
     for z in zz:
         if '.bak' in z: self.PuzzleFiles.remove(z)
     PuF = self.PuzzleFiles[random.randint(0,
                                           len(self.PuzzleFiles) - 1)]
     self.PuzzleFile = xbmc.translatePath(os.path.join(
         self.PuzzlePath, PuF))
     if tfalse(SettingG("select-puzzle")) == True:
         dialog = xbmcgui.Dialog()
         fn = str(
             dialog.browse(1, 'Select Puzzle', 'files', '.txt|.puzzle|.puz',
                           False, False, self.PuzzleFile, False))
         try:
             if (fn == False) or (len(fn) == 0):
                 self.close
                 return
             if len(fn) > 1:
                 deb('fn', fn)
                 self.PuzzleFile = fn
         except:
             pass
     #self.PuzzleFile=xbmc.translatePath(os.path.join(self.PuzzlePath,PuF));
     deb('Random File Chosen', self.PuzzleFile)
     self.PuzzleFileHolder = Common._OpenFile(self.PuzzleFile)
     deb('Length of Grid File', str(len(self.PuzzleFileHolder)))
     self.lineBreaker = '||'
     #'\n\n';
     self.PuzzleGridA = self.PuzzleFileHolder.split(
         self.lineBreaker)[0].replace('\n',
                                      '').replace('\a',
                                                  '').replace('\r', '')
     deb('Length of GridA', str(len(self.PuzzleFileHolder)))
     self.PuzzleGridA = self.PuzzleGridA.replace(' ', '+').replace(
         '=', '+').replace('?', '')
     self.PuzzleGridB = self.PuzzleFileHolder.split(
         self.lineBreaker)[1].replace('\n',
                                      '').replace('\a',
                                                  '').replace('\r', '')
     deb('Length of GridB', str(len(self.PuzzleFileHolder)))
     self.PuzzleWordList = self.PuzzleFileHolder.split(
         self.lineBreaker)[2].replace('\n', '').replace('\a', '').replace(
             '\r', '').replace(', ', '\n').replace(' ',
                                                   '\n').replace(',', '\n')
     deb('Length of Word List', str(len(self.PuzzleFileHolder)))
     self.PuzzleGridAList = list(self.PuzzleGridA)
     self.PuzzleFileHolder = self.PuzzleFileHolder.replace('\a',
                                                           '\n').replace(
                                                               '\r', '\n')
     for i in range(0, len(self.PuzzleGridAList)):
         #if self.PuzzleGridAList[i] in [' ','+','=','?']:
         if self.PuzzleGridAList[i] == '+':
             z = str(chr(random.randint(65, 90)))
             self.PuzzleGridAList[i] = z
             #self.PuzzleGridA[i]=chr(random.randint(65,90))
     #self.PuzzleGridA=''.join(str(e) for e in self.PuzzleGridAList);
     #self.PuzzleGridA=str(self.PuzzleGridAList) #.join();
     self.PuzzleGridA = ''
     for e in self.PuzzleGridAList:
         self.PuzzleGridA += e
def iLiveBrowseLIVE(channel='',iLive_Sort='',iLive_Language='',iLive_category='',search=''):
	iLive_category=channel
	if len(iLive_Sort)==0: iLive_Sort="0"
	##channel=channel.replace(" ","%20"); 
	#### \/ Catching the first page.
	##if len(search) > 0: tUrl="http://www.ilive.to/channels/?q=%s"%search
	##else: tUrl="http://www.ilive.to/channels/"+channel.replace(" ","%20")+"?sort="+iLive_Sort+"&lang="+iLive_Language; 
	##else: 
	##tUrl="http://www.ilive.to/api/live.xml"; tUrl="http://www.streamlive.to/api/live.xml"; 
	#ApiLiveDomain=addst('DefaultApiLiveList','Default')
	tUrl=doMain+"api/live.xml"; 
	#if   ApiLiveDomain=='ilive.to': tUrl="http://www.ilive.to/api/live.xml"; 
	#elif ApiLiveDomain=='streamlive.to': tUrl="http://www.streamlive.to/api/live.xml"; 
	#else: tUrl="http://www.streamlive.to/api/live.xml"; 
	#if   ApiLiveDomain=='ilive.to': headers={'Referer':'http://www.ilive.to/'}; 
	#elif ApiLiveDomain=='streamlive.to': headers={'Referer':'http://www.streamlive.to/'}; 
	#else: headers={'Referer':'http://www.streamlive.to/'}; 
	deb("url",tUrl); 
	html=nURL(tUrl,headers=headers); deb("length of remote xml",str(len(html))); 
	LocalXML=os.path.join(_addonPath,'live.xml')
	if len(html) > 20:
		try: _SaveFile(LocalXML,html)
		except: pass
	elif isFile(LocalXML):
		deb("Faild to load Remote File","Attempting to load local file."); myNote("Faild to load Remote File","Attempting to load local file."); 
		try: html=_OpenFile(LocalXML)
		except: html=''
		deb("length of local xml",str(len(html))); 
		if len(html) < 20:
			deb("Faild to load Remote File","Unable to locate local file."); myNote("Faild to load Remote File","Unable to locate local file."); 
	else: 
		deb("Faild to load Remote File","Unable to locate local file."); myNote("Faild to load Remote File","Unable to locate local file."); 
		pass
	if ('/api/' in tUrl) and ('.xml' in tUrl):
		iLive_Language=LanguageNoToNa(iLive_Language)
		debob({'iLive_Language':iLive_Language,'iLive_category':iLive_category,'search':search}); 
		if '</channels>' in html:
			html=nolines(html).split('</channels>')[0]
			if '<channels>' in html:
				html=html.split('<channels>')[1]; html=html.replace('</channel><channel>','</channel>\n\r<channel>').replace('</channel>','</channel\n\r>'); deb('Length of HTML',str(len(html))); #debob(html); 
				##  <channel><name>SKY S</name><url> http://   www.  ilive.to/view/68276 </url><image> http://snapshots.ilive.to/snapshots/wf9hh_snapshot.jpg</image><category>Live S</category><language>Engli</language><views>116.5</views></channel>
				#s="<channel><name>(.+?)</name><url>(http://(?:www.)?(?:ilive.to|streamlive.to)?/view/(\d+))</url><image>(http://snapshots.\D+.\D+/snapshots/(.+?)_snapshot.jpg)</image><category>(.+?)</category><language>(.*?)</language><views>(.*?)</views></channel"; 
				s="<channel><name>(.+?)</name><url>(http://(?:www.)?(?:ilive.to|streamlive.to)?/(?:view|\D+-channel|%s)?/(\d+))</url><image>(http://snapshots.\D+.\D+/snapshots/(.+?)_snapshot.jpg)</image><category>(.+?)</category><language>(.*?)</language><views>(.*?)</views></channel"%UrlTAG; 
				try: match=re.compile(s).findall(html); 
				except: match=[]
				ItemCount=len(match); deb('number of matches',str(ItemCount)); #debob(match); 
				if ItemCount > 0:
					match=sorted(match,key=lambda i:(i[5],i[0],i[6],i[7]),reverse=False)
					for (ChName,ChUrl,ChId,ChImg,ChImgId,ChCat,ChLang,ChViews) in match:
						#debob({'ChName':ChName,'ChUrl':ChUrl,'ChId':ChId,'ChImg':ChImg,'ChImgId':ChImgId,'ChCat':ChCat,'ChLang':ChLang,'ChViews':ChViews})
						if (len(search) > 0) and (not search.lower() in ChName.lower()): pass
						elif (len(iLive_Language) > 0) and (not iLive_Language.lower()==ChLang.lower()): pass
						elif (len(iLive_category) > 0) and (not iLive_category.lower()==ChCat.lower()): pass
						else:
							debob({'ChName':ChName,'ChUrl':ChUrl,'ChId':ChId,'ChImg':ChImg,'ChImgId':ChImgId,'ChCat':ChCat,'ChLang':ChLang,'ChViews':ChViews})
							contextMenuItems=[]; unCacheAnImage(ChImg); 
							pars={'mode':'iLivePlay','site':site,'section':section,'title':ChName,'url':ChUrl,'fanart':ChImg,'img':ChImg,'link':'99'}; 
							pars0={'mode':'iLivePlay','site':site,'section':section,'title':ChName,'url':ChUrl,'fanart':ChImg,'img':ChImg,'link':'0'}; 
							pars1={'mode':'iLivePlay','site':site,'section':section,'title':ChName,'url':ChUrl,'fanart':ChImg,'img':ChImg,'link':'1'}; 
							pars2={'mode':'iLivePlay','site':site,'section':section,'title':ChName,'url':ChUrl,'fanart':ChImg,'img':ChImg,'link':'2'}; 
							PlotD=cFL("[CR]Language: "+ChLang+"[CR]Category: "+ChCat+"[CR]Views: "+ChViews,"tan"); 
							contextMenuItems.append(('Channel Information','XBMC.Action(Info)'))
							#contextMenuItems.append(('Play [HLS]' ,'XBMC.Container.Update(%s)'%_addon.build_plugin_url(pars0) ))
							#contextMenuItems.append(('Play [RTMP]','XBMC.Container.Update(%s)'%_addon.build_plugin_url(pars1) ))
							#contextMenuItems.append(('Play [RTSP]','XBMC.Container.Update(%s)'%_addon.build_plugin_url(pars2) ))
							contextMenuItems.append(('Play [HLS]' ,'XBMC.RunPlugin(%s)'%_addon.build_plugin_url(pars0) ))
							contextMenuItems.append(('Play [RTMP]','XBMC.RunPlugin(%s)'%_addon.build_plugin_url(pars1) ))
							contextMenuItems.append(('Play [RTSP]','XBMC.RunPlugin(%s)'%_addon.build_plugin_url(pars2) ))
							
							try: _addon.add_directory(pars,{'title':ChName+'  ['+cFL(ChLang,colors['6'])+']','plot':PlotD},is_folder=False,fanart=ChImg,img=ChImg,total_items=ItemCount,contextmenu_items=contextMenuItems,context_replace=False)
							except: pass
	else:
		### \/ Catching the rest of the pages.
		if '<p align="center" class="pages"><strong>Page: </strong>' in html:
			phtml=html.split('<p align="center" class="pages"><strong>Page: </strong>')[1].split('</span></p>')[0]; deb("length of phtml",str(len(phtml))); 
			try: ppages=re.compile('<a href="(http://www.(?:ilive.to|streamlive.to)?/channels/.+?)">\s*(\d+)\s*</a>').findall(phtml)
			except: ppages=[]
			deb("number of pages",str(len(ppages)+1)); debob(ppages); 
			dialogWait=xbmcgui.DialogProgress(); loaded=1; ptotal=len(ppages)+1; ret=dialogWait.create('Please wait...'); 
			percent=(loaded * 100)/ptotal; remaining_display='[B]Page '+str(loaded)+' of '+str(ptotal)+'[/B].'; dialogWait.update(percent,'[B]Loading Pages...[/B]',remaining_display); 
			for (ppage,pname) in ppages: 
				time.sleep(1); html+=nURL(ppage.replace(" ","%20")); 
				loaded=loaded+1; percent=(loaded * 100)/ptotal; remaining_display='[B]Page '+str(loaded)+' of '+str(ptotal)+'[/B].'; dialogWait.update(percent,'[B]Loading Pages...[/B]',remaining_display); 
			dialogWait.close(); del dialogWait
		### \/ Catching Items.
		html=nolines(messupText(html.replace("&nbsp;",""),True,True)); 
		deb("length of all pages",str(len(html))); 
		s='<noscript><img width="\d+" height="\d+" src="(http://snapshots.(?:ilive.to|streamlive.to)?/snapshots/[0-9a-zA-Z]+_snapshot.jpg)" alt=".+?"\s*/></noscript>\s*</a>\s*\n*\s*'; 
		s+='<a href="(http://www.(?:ilive.to|streamlive.to)?/(?:view|\D+-channel|%s)?/\d+/.+?)"><strong>\s*(.+?)\s*</strong></a><br/>\s*'%UrlTAG; 
		s+='<span class="viewers">([0-9\,]+)</span>\s*'; 
		s+='<span class="totalviews">([0-9\,]+)</span><br/>\s*'; 
		s+='<a href="http://www.(?:ilive.to|streamlive.to)?/channels/.+?">([A-Za-z0-9\s]*)</a>\s*'; s+='<a href="http://www.(?:ilive.to|streamlive.to)?/channels\?lang=\d*">([A-Za-z0-9\s]*)</a>\s*</li>'; 
		#debob(html); 
		match=re.compile(s).findall(html); ItemCount=len(match); 
		debob(match); 
		#match=sorted(match, key=lambda item: item[2], reverse=False)
		#match=sorted(match, key=lambda item: item[3], reverse=False)
		### \/ Links
		for thumb,url,name,iViewers,iTotalViews,Category,lang in match:
			unCacheAnImage(thumb); 
			pars={'mode':'iLivePlay','site':site,'section':section,'title':name,'url':url,'fanart':thumb,'img':thumb}; 
			PlotD=cFL("[CR]Language: "+lang+"[CR]Category: "+Category+"[CR]Viewers: "+iViewers+"[CR]TotalViews: "+iTotalViews,"tan"); 
			#debob(pars); 
			try: _addon.add_directory(pars,{'title':name+'  ['+cFL(lang,colors['6'])+']','plot':PlotD},is_folder=False,fanart=thumb,img=thumb,total_items=ItemCount)
			except: pass
	###
	set_view('movies',view_mode=addst('movies-view')); 
	#set_view('tvshows',view_mode=addst('tvshows-view')); 
	#set_view('list',view_mode=addst('default-view')); 
	eod(); 
def PlayStreamUP(pageUrl='',Name='',Thumb='',roomId='',roomSlug='',plot='',liVe='',streamUrl='',streamkey='',youtubekey='',sourcetype='show'):
	PlayerMethod=addst("core-player"); url=''; print "--DO A PLAYER SPLIT HERE--"; debob(['pageUrl',pageUrl,'Name',Name,'Thumb',Thumb,'roomId',roomId,'roomSlug',roomSlug,'plot',plot,'liVe',liVe,'streamUrl',streamUrl]); 
	if   (PlayerMethod=='DVDPLAYER'): PlayerMeth=xbmc.PLAYER_CORE_DVDPLAYER
	elif (PlayerMethod=='MPLAYER'): PlayerMeth=xbmc.PLAYER_CORE_MPLAYER
	elif (PlayerMethod=='PAPLAYER'): PlayerMeth=xbmc.PLAYER_CORE_PAPLAYER
	else: PlayerMeth=xbmc.PLAYER_CORE_AUTO
	play=xbmc.Player(PlayerMeth) ### xbmc.PLAYER_CORE_AUTO | xbmc.PLAYER_CORE_DVDPLAYER | xbmc.PLAYER_CORE_MPLAYER | xbmc.PLAYER_CORE_PAPLAYER
	#play=xbmc.Player(xbmc.PLAYER_CORE_AUTO) ### xbmc.PLAYER_CORE_AUTO | xbmc.PLAYER_CORE_DVDPLAYER | xbmc.PLAYER_CORE_MPLAYER | xbmc.PLAYER_CORE_PAPLAYER
	if len(streamUrl) > 10: url=streamUrl
	else: 
		html=messupText(nolines(nURL(pageUrl)),True,True); 
		if len(roomId)==0:
			try:    roomId=re.compile("flashvars.roomId\s*=\s*'(.+?)';").findall(html)[0]
			except: roomId=''
		if len(Thumb)==0:
			try:    Thumb=re.compile("flashvars.roomAvatar\s*=\s*'(.+?)';").findall(html)[0]
			except: Thumb=iconSite
		if len(roomSlug)==0:
			try:    roomSlug=re.compile("flashvars.roomSlug\s*=\s*'(.+?)';").findall(html)[0]
			except: roomSlug=''
		if len(Name)==0:
			try:    Name=re.compile("flashvars.roomName\s*=\s*'(.+?)';").findall(html)[0]
			except: Name='Unknown'
		## ### ## 
		## ### ## 
		## ### ## 
		NeedToToggleDebug=False; #NeedToToggleDebug=True; 
		if (len(url)==0) and (len(streamUrl)==0) and (len(streamkey)==0) and (len(youtubekey)==0):
				if NeedToToggleDebug==True: DoTD(); #DoA("ToggleDebug"); 
				url='rtmp://%s/%s' % ('66.55.92.79',roomId)
				play.play(url)
				xbmc.sleep(3000)
				if NeedToToggleDebug==True: DoTD(); #DoA("ToggleDebug"); 
				xbmcLogData=common._OpenFile(xbmcLogFile)
				if "--DO A PLAYER SPLIT HERE--" in xbmcLogData: xbmcLogData=xbmcLogData.split("--DO A PLAYER SPLIT HERE--")[-1]
				deb("test file",TPapp("-- player-test.txt")); 
				common._SaveFile(TPapp("-- player-test.txt"),xbmcLogData); 
				if "NetStream.Play.StreamNotFound" in xbmcLogData: deb("stream problem","could not find a stream."); 
				elif "STRING:	Failed to play ; stream not found." in xbmcLogData: deb("stream problem","failed to play, stream not found."); 
				try: sourcetype=re.compile('STRING:	{"message":"(.+?)"').findall(xbmcLogData)[-1]
				except: debob("no message found"); return
				deb("sourcetype",str(sourcetype));
				if (sourcetype.lower()=='startyoutubemode'): 
						debob('fetching youtubekey'); 
						try: youtubekey=re.compile('"message":"startYoutubeMode",.*"videoID":"(.+?)"').findall(xbmcLogData)[-1]
						except: debob("no youtubekey found"); return
						deb("youtubekey",youtubekey); 
				if (sourcetype.lower()=='startshowmode'):
						#try: streamkey=re.compile('INFO:\s+Property:\s+<Name:\s+.*?,\s+STRING:\s+{"message":"startShowMode","name":".*?","active":\D*,"streamKey":"([0-9A-Za-z]+)","uuid":".*?","type":"\D*"}>').findall(xbmcLogData)[-1]
						#try: streamkey=re.compile('"message":"startShowMode",.*"streamKey":"([0-9A-Za-z]+)"').findall(xbmcLogData)[-1]
						try: streamkey=re.compile('"message":"startShowMode",.*"streamKey":"(.+?)"').findall(xbmcLogData)[-1]
						except: pass
						deb('streamkey',streamkey); 
		if (sourcetype.lower()=='youtube') or (sourcetype.lower()=='startyoutubemode'):
				deb("youtubekey",youtubekey); 
				url='plugin://plugin.video.youtube/?path=/root/video&action=play_video&videoid=%s' % (youtubekey)
				#url = 'plugin://plugin.video.youtube/?action=play_video&videoid=%s' % youtubekey
		elif (sourcetype.lower()=='') or (sourcetype.lower()=='auto') or (sourcetype.lower()=='show') or (sourcetype.lower()=='streamup') or (sourcetype.lower()=='rtmp') or (sourcetype.lower()=='startshowmode'):
				deb('streamkey',streamkey); 
				url='rtmp://%s/%s/%s' % ('66.55.92.79',roomId,streamkey)
		else: debob("unknown sourcetype and not enough info available."); return
		## ### ## 
	## ### ## 
	#try: _addon.resolve_url(url)
	#except: pass
	#try: play.play(url)
	#except: pass
	## ### ## 
	deb('stream url',str(url)); 
	infoLabels={"Studio":liVe,"ShowTitle":Name,"Title":Name,"cover_url":Thumb,'plot':plot}; 
	li=xbmcgui.ListItem(Name,iconImage=Thumb,thumbnailImage=Thumb); 
	li.setInfo(type="Video", infoLabels=infoLabels ); li.setProperty('IsPlayable', 'true'); 
	try: _addon.resolve_url(url)
	except: pass
	try: play.play(url, li)
	except:
		try: play.play(url)
		except: pass
示例#22
0
def Menu_CustomMenu():
	#AnimeGet
	#Anime44
	#AnimePlus
	#AnimeZone
	#DubbedAnimeOn
	#DubHappy.eu
	#WatchDub
	#GoodDrama
	#
	#
	cNumber ='8'; cNumber2='2'; cNumber3='4'; cNumber4='12'
	#_addon.add_directory({'mode':'SectionMenu','site':'AnimeGet'},{'title':cFL_('AnimeGet',colors[cNumber])},is_folder=True,fanart=_artFanart,img=_artIcon)
	#_addon.add_directory({'mode':'SectionMenu','site':'Anime44'},{'title':cFL_('Anime44',colors[cNumber])},is_folder=True,fanart=_artFanart,img=_artIcon)
	#_addon.add_directory({'mode':'SectionMenu','site':'AnimePlus'},{'title':cFL_('AnimePlus *',colors[cNumber])},is_folder=True,fanart=_artFanart,img=_artIcon)
	#_addon.add_directory({'mode':'SectionMenu','site':'AnimeZone'},{'title':cFL_('AnimeZone *',colors[cNumber])},is_folder=True,fanart=_artFanart,img=_artIcon)
	#_addon.add_directory({'mode':'SectionMenu','site':'DubbedAnimeOn'},{'title':cFL_('DubbedAnimeOn *',colors[cNumber])},is_folder=True,fanart=_artFanart,img=_artIcon)
	#_addon.add_directory({'mode':'SectionMenu','site':'DubHappyeu'},{'title':cFL_('DubHappy.eu *',colors[cNumber])},is_folder=True,fanart=_artFanart,img=_artIcon)
	#_addon.add_directory({'mode':'SectionMenu','site':'WatchDub'},{'title':cFL_('WatchDub *',colors[cNumber])},is_folder=True,fanart=_artFanart,img=_artIcon)
	#_addon.add_directory({'mode':'SectionMenu','site':'GoodDrama'},{'title':cFL_('GoodDrama *',colors[cNumber])},is_folder=True,fanart=_artFanart,img=_artIcon)
	#_addon.add_directory({'mode':'SectionMenu','site':'iLiveTo'},{'title':cFL_('iLiveTo',colors[cNumber])},is_folder=True,fanart=_artFanart,img=_artIcon)
	#
	#_addon.add_directory({'mode':'SectionMenu','site':'ResolverPlugins'},{'title':cFL_('Attempt to Fix/Add [CR]Resolver Host Plugins',colors[cNumber3])},is_folder=True,fanart=_artFanart,img=_artIcon)
	#
	#
	for root, d, names in os.walk(_addonPath):
		if root==_addonPath:
			#deb('root',root); deb('dir',str(len(d))) #; debob(names)
			for filename in names:
				fe=getFileExtension(filename); fullF=xbmc.translatePath(os.path.join(root,filename))
				if (filename[:1]==collartag) and (fe=='py') and (isFile(fullF)==True):
					pyName=filename[:-3]
					tt=_OpenFile(fullF)
					try: 
						if   "SiteName='" in tt: pyTitle=re.compile("SiteName='(.+?)'").findall(tt)[0]
						elif 'SiteName="' in tt: pyTitle=re.compile('SiteName="(.+?)"').findall(tt)[0]
						elif "SiteName = '" in tt: pyTitle=re.compile("SiteName = '(.+?)'").findall(tt)[0]
						elif 'SiteName = "' in tt: pyTitle=re.compile('SiteName = "(.+?)"').findall(tt)[0]
						else: pyTitle=filename[1:-3]
					except: pyTitle=filename[1:-3]
					try: 
						if   "iconSite='" in tt: img=re.compile("iconSite='(.+?)'").findall(tt)[0]
						elif 'iconSite="' in tt: img=re.compile('iconSite="(.+?)"').findall(tt)[0]
						elif "iconSite = '" in tt: img=re.compile("iconSite = '(.+?)'").findall(tt)[0]
						elif 'iconSite = "' in tt: img=re.compile('iconSite = "(.+?)"').findall(tt)[0]
						else: img=_artIcon
					except: img=_artIcon
					try: 
						if   "fanartSite='" in tt: fimg=re.compile("fanartSite='(.+?)'").findall(tt)[0]
						elif 'fanartSite="' in tt: fimg=re.compile('fanartSite="(.+?)"').findall(tt)[0]
						elif "fanartSite = '" in tt: fimg=re.compile("fanartSite = '(.+?)'").findall(tt)[0]
						elif 'fanartSite = "' in tt: fimg=re.compile('fanartSite = "(.+?)"').findall(tt)[0]
						else: fimg=_artFanart
					except: fimg=_artFanart
					MiscTag=''
					if (pyName=='tUpdater2') or (pyName=='tUpdater2b'):
						if isFile(TPap('updating','.txt'))==False: MiscTag='  '+cFL('<<','red')+'  ['+cFL('Use Updater','blue')+']'
						else: MiscTag=''
					elif (pyName=='tUpdater_4_SubAddons_[DropBox]') or (pyName=='tUpdater_4_SubAddons_[GitHub]'):
						if isFile(TPap('subaddons','.txt'))==False: MiscTag='  '+cFL('<<','red')+'  ['+cFL('Use Updater','blue')+']'
						else: MiscTag=''
					if pyTitle[:1] is not '[': pyTitle=cFL_(pyTitle,colors['0'])
					_addon.add_directory({'mode':'SectionMenu','site':pyName},{'title':pyTitle+ps('filemarker')+MiscTag},is_folder=True,fanart=fimg,img=img)
	#
	_addon.add_directory({'mode':'XBMCHUB','site':site},{'title':cFL_('#'+cFL('XBMCHUB','blue')+' @ '+cFL('irc.freenode.net','red')+' [CR]www.'+cFL('XBMCHUB','blue')+'.com',colors['9'])},is_folder=False,fanart=ps('fiHubIrc'),img=ps('iiHubIrc'))
	_addon.add_directory({'mode':'TextBoxFile','site':site,'title':'XBMC.Log [File]','url':xbmc.translatePath(os.path.join('special://logpath','xbmc.log'))},{'title':cFL_('View XBMC.Log',colors['9'])},is_folder=False,fanart='http://s9.postimg.org/6izlt73n3/1011445_473021149448994_84427075_n.jpg',img='http://s9.postimg.org/uy7tu92jz/1013960_471938356223940_1093377719_n.jpg')
	_addon.add_directory({'mode':'TextBoxFile','site':site,'title':'XBMC.old.Log [File]','url':xbmc.translatePath(os.path.join('special://logpath','xbmc.old.log'))},{'title':cFL_('View XBMC.old.Log',colors['9'])},is_folder=False,fanart='http://s9.postimg.org/6izlt73n3/1011445_473021149448994_84427075_n.jpg',img='http://s9.postimg.org/uy7tu92jz/1013960_471938356223940_1093377719_n.jpg')
	#
	#
	_addon.add_directory({'mode':'TextBoxFile','url':xbmc.translatePath(os.path.join(_addonPath,'resources','urlresolver','list.txt')),'title':cFL('My list.txt for (UrlResolver) related information.',colors['9'])},{'title':cFL_('List.txt [Local]',colors[cNumber2])},is_folder=False,fanart='https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-ash4/c0.32.851.315/p851x315/1052535_473020589449050_121345808_o.jpg',img='http://provoketive.com/wp-content/uploads/2012/02/list5.jpg')
	_addon.add_directory({'mode':'TextBoxFile','url':xbmc.translatePath(os.path.join(_addonPath,'changelog.txt')),'title':cFL('ChangeLog',colors['9'])},{'title':cFL_('ChangeLog  [Local]',colors[cNumber2])},is_folder=False,fanart='https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-ash4/c0.32.851.315/p851x315/1052535_473020589449050_121345808_o.jpg',img='http://www.carando.com/images/utility/paper.png')
	_addon.add_directory({'mode':'Settings'}, 			 {'title':  cFL_('Plugin Settings',colors[cNumber2])}			,is_folder=False,fanart=_artFanart,img=_artIcon)
	_addon.add_directory({'mode':'ResolverSettings'},{'title':  cFL_('Url-Resolver Settings',colors[cNumber3])},is_folder=False,fanart='http://i1204.photobucket.com/albums/bb404/ThisRoger/screenshot022.png',img='http://i887.photobucket.com/albums/ac80/Abrasher1/SkinnySidnature5WHEREHAVEYOUBEEN.png')
	#_addon.add_directory({'mode':'ResolverUpdateHostFiles'},{'title':  cFL_('Url-Resolver Update Host Files',colors[cNumber3])},is_folder=False,img=_artIcon,fanart=_artFanart)
	#_addon.add_directory({'site':site,'mode':'Settings'},{'title':cFL_('',colors[cNumber4])},is_folder=False,fanart=_artFanart,img=_artIcon)
	#_addon.add_directory({'site':site,'mode':'Settings'},{'title':cFL_('',colors[cNumber4])},is_folder=False,fanart=_artFanart,img=_artIcon)
	
	
	#
	eod()