This repository was archived by the owner on Dec 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathgcores.py
More file actions
36 lines (33 loc) · 1.21 KB
/
gcores.py
File metadata and controls
36 lines (33 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from gadio.crawlers.crawler import *
from gadio.models.radio import *
from gadio.media.video import *
from gadio.text.text import *
import sys
def main(id: int, skip_crawling: bool, with_quote: bool):
parsed_json = Crawler.crawl(id)
cache_dir = os.sep.join([os.curdir, 'cache', str(id), 'data.json'])
with open(cache_dir, 'r', encoding='utf-8') as file:
radio = Radio.load_from_json(parsed_json)
if (not skip_crawling):
Crawler.download_assets(radio, os.curdir+os.sep+'cache', with_quote)
Video.create_video(radio)
if __name__ == "__main__":
skip_crawling = False
with_quote = False
if (len(sys.argv) == 1 or sys.argv[1] == '-s' or sys.argv[1] == '-q'):
if "-q" in sys.argv:
with_quote = True
print("----------")
print("Start to create the latest gadio video...")
id = Crawler.get_latest()
print(id)
main(id, False, with_quote)
else:
title = sys.argv[1]
skip_crawling = False
if (len(sys.argv) > 2):
if ("-s" in sys.argv):
skip_crawling = True
elif "-q" in sys.argv:
with_quote = True
main(int(title), skip_crawling, with_quote)