This repository was archived by the owner on Mar 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathtest.py
More file actions
43 lines (39 loc) · 1.33 KB
/
test.py
File metadata and controls
43 lines (39 loc) · 1.33 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
37
38
39
40
41
42
43
#!/usr/bin/python
# encoding: utf-8
# HBO Go EU Add-on lib Test Script
# Copyright (C) 2019-2020 ArvVoid (https://github.com/arvvoid)
#
# USAGE:
# > python test.py [TEST_TYPE] [PARAM1] [PARAM2] ...
#
# SUBTITLES TEST
# > python test.py ttml2srt ttml_subs.xml
#
# OUTPUT:
# Messages on the console
# The test_sub.srt file will contain the result of the conversion
#
# SPDX-License-Identifier: GPL-2.0-or-later
#########################################################
from __future__ import absolute_import, division
import sys
if __name__ == '__main__':
print("HBO GO EU Test Script")
print("---------------------")
if len(sys.argv) > 2:
test_type = str(sys.argv[1])
if test_type == "ttml2srt":
from libs.ttml2srt import Ttml2Srt
input_subs_path = str(sys.argv[2])
print("Loading TTML file " + input_subs_path + " ...")
ttml = Ttml2Srt(input_subs_path, 25)
print("Converting...")
srt_file = ttml.write2file(ttml.mfn2srtfn("test_sub", ttml.lang, False))
print("DONE!")
else:
print("Ivalid test!")
else:
print("USAGE:")
print(" python test.py [TEST_TYPE] [PARAM1] [PARAM2] ...")
print("TTML2SRT Test:")
print(" python test.py ttml2srt ttml_subs.xml")