def set_play_param(url): global menu_type_list global menu_focus print 'play url',url if menu_type_list[menu_focus]=='hlstv': print 'hlstv' PPlive.start_tv(url) elif menu_type_list[menu_focus]=='qq': print 'v.qq.com' vfs={} if len(url)>0: vfs=getvideoinfos.geturls(url) download_manage.set_url(vfs)
def gen_video_infos_by_type(strtype,url=''): global videos global total_pic_infos if strtype=='qq': if len(url)<7: url="http://v.qq.com/" videos=getvideoinfos.get_qq_video_infos(url) elif strtype=='hlstv': videos=PPlive.getppliveurl() if len(videos)>0: total_pic_infos = len(videos) gen_pic_infos(videos,0)
def start(): #start download thread gen_video_infos_by_type('hlstv') menu_infos.append(getmenu_info("PPTV")) menu_infos.append(getmenu_info("QQ视频")) PPlive.init_tv() download_manage.setDaemon(True) download_manage.start() print 'init finish' while True: start_gui(600,480) start_evdev() #start key manage to deal the player control print 'startplay' #check if need restart player if menu_type_list[menu_focus]=='hlstv': os.system('/root/omxplayer.bin http://localhost/index.m3u8') else: #find start file... play_file() set_play_param('') #exit key manage pygame will deal the key event print 'restart gui'