예제 #1
0
    def play(self, sid):
        stream = IStream.objects(id=sid).first()
        if stream:
            return Response(stream.generate_playlist(),
                            mimetype='application/x-mpequrl'), 200

        return jsonify(status='failed'), 404
예제 #2
0
 def update_entry(self, entry: IStream) -> IStream:
     entry.tvg_id = self.tvg_id.data
     entry.name = self.name.data
     entry.tvg_name = self.tvg_name.data
     entry.tvg_logo = self.tvg_logo.data
     entry.group = self.group.data
     entry.price = self.price.data
     entry.visible = self.visible.data
     entry.output = self.output.get_data()
     return entry
#!/usr/bin/env python3
import argparse
import os
import sys
from mongoengine import connect

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))

PROJECT_NAME = 'parse_streams_collection'

from app.common.stream.entry import IStream

if __name__ == '__main__':
    parser = argparse.ArgumentParser(prog=PROJECT_NAME,
                                     usage='%(prog)s [options]')
    parser.add_argument('--mongo_uri',
                        help='MongoDB credentials',
                        default='mongodb://localhost:27017/iptv')

    argv = parser.parse_args()

    mongo = connect(host=argv.mongo_uri)
    if mongo:
        streams = IStream.objects()
        f = open("out.m3u", "w")
        f.write('#EXTM3U\n')
        idx = 0
        for stream in streams:
            f.write(stream.generate_playlist(False))
        f.close()
예제 #4
0
 def __init_stream_runtime_fields(self, stream: IStream):
     stream.set_server_settings(self._settings)
예제 #5
0
 def make_entry(self) -> IStream:
     return self.update_entry(IStream())