Ejemplo n.º 1
0
def history_play():
    global controller
    if controller:
        controller.stopAll()
    controller = Controller(None)
    controller.parseHistory(request.query.id, request.query.start)
    _render(wait=True, redirect_to='/')
Ejemplo n.º 2
0
def history_play():
    global controller
    if controller:
        controller.stopAll()
    controller = Controller(None)
    controller.parseHistory(request.query.id, request.query.start)
    _render(wait=True, redirect_to='/')
Ejemplo n.º 3
0
def forward():
    global current_website, controller
    format, dbid = None, None
    if 'site' in request.query:
        current_website = request.query.site
    if 'format' in request.query:
        format = int(request.query.format)
    if 'dbid' in request.query:
        dbid = request.query.dbid
    url = request.query.url
    # if it's the same url with the nextPlayer then just stop the current player.
    if controller and controller.nextPlayer and urllib2.unquote(
            url) == urllib2.unquote(controller.nextPlayer.video.url):
        controller.stopCurrentPlayer()
        _render(wait=True, redirect_to='/')
    logging.info("Forwarding to %s", url)
    if current_website and url.startswith('/'):
        url = websites[current_website]['url'] + url
    logging.debug("forward to url: %s", url)
    if current_website == 'youtube' and 'search_query' in request.query:
        url = "%s?%s" % ('http://www.youtube.com/results',
                         request.query_string)
        logging.debug("The url for youtube search is: %s", url)
    if current_website == 'youku' and 'searchdomain' in request.query:
        url = "http://www.soku.com/search_video/q_" + urllib.quote_plus(
            request.query.q.encode('utf8'))
        logging.debug("The url for youku search is: %s", url)
    if current_website in ('qq', 'qqmp4') and 'ms_key' in request.query:
        url = "http://v.qq.com/search.html"
        logging.debug("The url for youku search is: %s", url)
    if current_website == 'wangyi' and 'vs' in request.query and not url:
        url = "http://so.open.163.com/movie/search/searchprogram/ot0/%s/1.html?vs=%s&pltype=2" \
            % (request.query.vs, request.query.vs)
        logging.debug("The url for wangyi search is: %s", url)
    if current_website == 'sohu' and 'wd' in request.query and not url:
        url = "http://so.tv.sohu.com/mts?box=1&wd=%s" % (request.query.wd)
        logging.debug("The url for sohu search is: %s", url)
    newController = Controller(current_website)
    if dbid:
        res = newController.parseHistory(dbid, -1, format)
    else:
        res = newController.parse(url, format)
    if res:
        return res
    else:
        if controller:
            controller.stopAll()
        controller = newController
    _render(wait=True, redirect_to='/')
Ejemplo n.º 4
0
def forward():
    global current_website, controller
    format, dbid = None, None
    if 'site' in request.query:
        current_website = request.query.site
    if 'format' in request.query:
        format = int(request.query.format)
    if 'dbid' in request.query:
        dbid = request.query.dbid
    url = request.query.url
    # if it's the same url with the nextPlayer then just stop the current player.
    if controller and controller.nextPlayer and urllib2.unquote(url) == urllib2.unquote(controller.nextPlayer.video.url):
        controller.stopCurrentPlayer()
        _render(wait=True, redirect_to='/')
    logging.info("Forwarding to %s", url)
    if current_website and url.startswith('/'):
        url = websites[current_website]['url'] + url
    logging.debug("forward to url: %s", url)
    if current_website == 'youtube' and 'search_query' in request.query:
        url = "%s?%s" % ('http://www.youtube.com/results', request.query_string)
        logging.debug("The url for youtube search is: %s", url)
    if current_website == 'youku' and 'searchdomain' in request.query:
        url = "http://www.soku.com/search_video/q_" + urllib.quote_plus(request.query.q.encode('utf8'))
        logging.debug("The url for youku search is: %s", url)
    if current_website in ('qq', 'qqmp4') and 'ms_key' in request.query:
        url = "http://v.qq.com/search.html"
        logging.debug("The url for youku search is: %s", url)
    if current_website == 'wangyi' and 'vs' in request.query and not url:
        url = "http://so.open.163.com/movie/search/searchprogram/ot0/%s/1.html?vs=%s&pltype=2" \
            % (request.query.vs, request.query.vs)
        logging.debug("The url for wangyi search is: %s", url)
    if current_website == 'sohu' and 'wd' in request.query and not url:
        url = "http://so.tv.sohu.com/mts?box=1&wd=%s" % (request.query.wd)
        logging.debug("The url for sohu search is: %s", url)
    newController = Controller(current_website)
    if dbid:
        res = newController.parseHistory(dbid, -1, format)
    else:
        res = newController.parse(url, format)
    if res:
        return res 
    else:
        if controller:
            controller.stopAll()
        controller = newController
    _render(wait=True, redirect_to='/')