mirror of
https://github.com/fastogt/fastocloud_admin.git
synced 2025-03-09 23:38:52 +00:00
1.5.0 Release
This commit is contained in:
commit
4ac16f3288
127 changed files with 16598 additions and 0 deletions
31
scripts/create_provider.py
Executable file
31
scripts/create_provider.py
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from mongoengine import connect
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
||||
from app.home.entry import ProviderUser
|
||||
|
||||
PROJECT_NAME = 'create_provider'
|
||||
|
||||
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')
|
||||
parser.add_argument('--email', help='Provider email')
|
||||
parser.add_argument('--password', help='Provider password')
|
||||
parser.add_argument('--country', help='Provider country', default='US')
|
||||
|
||||
argv = parser.parse_args()
|
||||
email = argv.email
|
||||
password = argv.password
|
||||
|
||||
mongo = connect(host=argv.mongo_uri)
|
||||
if not mongo:
|
||||
sys.exit(1)
|
||||
|
||||
new_user = ProviderUser.make_provider(email=email, password=password, country=argv.country)
|
||||
new_user.status = ProviderUser.Status.ACTIVE
|
||||
new_user.save()
|
||||
print('Successfully created provider email: {0}, password: {1}'.format(email, password))
|
||||
25
scripts/parse_json_out.py
Normal file
25
scripts/parse_json_out.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env python3
|
||||
import json
|
||||
|
||||
if __name__ == '__main__':
|
||||
f = open("out.m3u", "w")
|
||||
f.write('#EXTM3U\n')
|
||||
with open('test.json') as json_file:
|
||||
data = json.load(json_file)
|
||||
idx = 0
|
||||
for p in data:
|
||||
name = p['name']
|
||||
icon = p['icon']
|
||||
group = p['group']
|
||||
sid = p['input']['urls'][0]['id']
|
||||
input = p['input']['urls'][0]['uri']
|
||||
f.write('#EXTINF:{0} tvg-id="{1}" tvg-name="" tvg-logo="{3}" group-title="{4}",{2}\n{5}\n'.format(
|
||||
idx,
|
||||
sid,
|
||||
name,
|
||||
icon,
|
||||
group,
|
||||
input))
|
||||
idx += 1
|
||||
|
||||
f.close()
|
||||
27
scripts/parse_streams_collection.py
Executable file
27
scripts/parse_streams_collection.py
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/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_input_playlist(False))
|
||||
f.close()
|
||||
34
scripts/test_life.py
Executable file
34
scripts/test_life.py
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from mongoengine import connect
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
||||
from app.common.stream.entry import TestLifeStream
|
||||
from app.service.service import ServiceSettings
|
||||
from app.common.utils.m3u_parser import M3uParser
|
||||
|
||||
PROJECT_NAME = 'test_life'
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(prog=PROJECT_NAME, usage='%(prog)s [options]')
|
||||
parser.add_argument('uri', help='Uri to m3u8 list')
|
||||
parser.add_argument('mongo_uri', help='MongoDB credentials')
|
||||
|
||||
argv = parser.parse_args()
|
||||
|
||||
mongo = connect(argv.mongo_uri)
|
||||
if mongo:
|
||||
service_settings = ServiceSettings.objects().first()
|
||||
m3u_parser = M3uParser()
|
||||
m3u_parser.read_m3u(argv.uri)
|
||||
m3u_parser.parse()
|
||||
for file in m3u_parser.files:
|
||||
stream = TestLifeStream.make_stream(service_settings)
|
||||
stream.input.urls[0].uri = file['link']
|
||||
stream.name = '{0}({1})'.format(file['tvg-group'], file['title'])
|
||||
service_settings.streams.append(stream)
|
||||
|
||||
service_settings.save()
|
||||
Loading…
Add table
Add a link
Reference in a new issue