def _render(wait=False, redirect_to=None): if (wait): while not (controller.currentPlayer and controller.currentPlayer.video and controller.currentPlayer.isAlive()): time.sleep(0.1) if redirect_to: redirect(redirect_to) if controller and controller.currentPlayer and controller.currentPlayer.video and controller.currentPlayer.isAlive(): return template("index", websites=websites, currentVideo=controller.currentPlayer.video, actionDesc=actionDesc, history=db_getHistory()) else: return template("index", websites=websites, currentVideo=None, actionDesc=actionDesc, history=db_getHistory())
def _render(wait=False, redirect_to=None): if (wait): while not (controller.currentPlayer and controller.currentPlayer.video and controller.currentPlayer.isAlive()): time.sleep(0.1) if redirect_to: redirect(redirect_to) if controller and controller.currentPlayer and controller.currentPlayer.video and controller.currentPlayer.isAlive( ): return template("index", websites=websites, currentVideo=controller.currentPlayer.video, actionDesc=actionDesc, history=db_getHistory()) else: return template("index", websites=websites, currentVideo=None, actionDesc=actionDesc, history=db_getHistory())
def history(): videos = db_getHistory() responseString = "" for video in videos: responseString += """ <li> <a href="/play?id=%s&start=-1" class="ui-link-inherit" data-ajax="false"> <h3>%s(%s)</h3> <p>总共%s(上次播放到%s)</p> </a> <a href="#" onclick="deleteHistory('%s');return false" class="split-button-custom ui-btn ui-btn-up-b ui-shadow ui-btn-corner-all ui-btn-icon-notext" data-role="button" data-icon="delete" data-iconpos="notext" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" data-theme="b" title=""><span class="ui-btn-inner"><span class="ui-btn-text"></span><span class="ui-icon ui-icon-delete ui-icon-shadow"> </span></span></a> <a href="/play?id=%s&start=0" class="split-button-custom ui-btn ui-btn-up-b ui-shadow ui-btn-corner-all ui-btn-icon-notext" data-role="button" data-icon="refresh" data-iconpos="notext" data-ajax="false" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" data-theme="b" title=""><span class="ui-btn-inner"><span class="ui-btn-text"></span><span class="ui-icon ui-icon-refresh ui-icon-shadow"> </span></span></a> <a href="#" style="display: none;">Dummy</a> </li> """ % (video.dbid, video.title, websites[video.site]['title'], video.durationToStr(), Video.formatDuration(video.progress), video.dbid, video.dbid) return responseString
def history(): videos = db_getHistory() responseString = "" for video in videos: responseString += """ <li> <a href="/play?id=%s&start=-1" class="ui-link-inherit" data-ajax="false"> <h3>%s(%s)</h3> <p>总共%s(上次播放到%s)</p> </a> <a href="#" onclick="deleteHistory('%s');return false" class="split-button-custom ui-btn ui-btn-up-b ui-shadow ui-btn-corner-all ui-btn-icon-notext" data-role="button" data-icon="delete" data-iconpos="notext" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" data-theme="b" title=""><span class="ui-btn-inner"><span class="ui-btn-text"></span><span class="ui-icon ui-icon-delete ui-icon-shadow"> </span></span></a> <a href="/play?id=%s&start=0" class="split-button-custom ui-btn ui-btn-up-b ui-shadow ui-btn-corner-all ui-btn-icon-notext" data-role="button" data-icon="refresh" data-iconpos="notext" data-ajax="false" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" data-theme="b" title=""><span class="ui-btn-inner"><span class="ui-btn-text"></span><span class="ui-icon ui-icon-refresh ui-icon-shadow"> </span></span></a> <a href="#" style="display: none;">Dummy</a> </li> """ % ( video.dbid, video.title, websites[video.site]['title'], video.durationToStr(), Video.formatDuration( video.progress), video.dbid, video.dbid) return responseString