예제 #1
0
파일: rta.py 프로젝트: ahua/python
class RtAgent(object):
    def __init__(self, conf):
        self.gb = GeneralBase(conf)
        self.app = App(conf)
        self.vod = Vod(conf)
        self.guide = Guide(conf)
        self.cat = Cat(conf)

    def interrupt(self):
        pass

    def accept(self, p, isnew = True):
        if p.get('_type') != 'normal':
            return

        if p.get('_device', '').lower() not in ['a11', 'a21', 'k72', 'k82', 'ud10a', 'ds70a', 'lx750a', 'lx755a', 'lx850a', 'lx960a', 'k91', 's31', 's51', 's61', 'e31', 'e62']:
            return

        if p.get('event') not in ['video_exit', 'app_start', 'launcher_vod_click', 'video_category_out']:
            return

        if isnew:
            if self.gb.run(p):
                self.app.run(p)
                self.vod.run(p)
                self.guide.run(p)
                self.cat.run(p)
        else:
            self.vod.run(p)
예제 #2
0
def query(vod_id):
    start = request.args.get('start')
    end = request.args.get('end')
    quality = request.args.get('quality')

    if not start:
        return 'Missing start parameter'
    if not end:
        return 'Missing end parameter'

    vod = Vod(vod_id)
    if request.args.get('delete'):
        vod.delete()

    vod.query(start.replace('-', ' '), end.replace('-', ' '), quality)
    if vod.status == 'downloaded':
        return 'Downloaded! <a href={}>Download link</a>'.format(
            '{}download/{}'.format(request.url_root, vod_id))
    else:
        return vod.status
예제 #3
0
def download(vod_id):
    vod = Vod(vod_id)
    if vod.status == 'downloaded':
        return send_from_directory(app.root_path, vod.filename)
    else:
        return 'Not downloaded yet'
예제 #4
0
파일: rta.py 프로젝트: ahua/python
 def __init__(self, conf):
     self.gb = GeneralBase(conf)
     self.app = App(conf)
     self.vod = Vod(conf)
     self.guide = Guide(conf)
     self.cat = Cat(conf)