File: ccx_to_python_g608.py

package info (click to toggle)
ccextractor 0.88%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 11,912 kB
  • sloc: ansic: 201,481; makefile: 782; sh: 669; python: 319
file content (63 lines) | stat: -rw-r--r-- 1,854 bytes parent folder | download | duplicates (2)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from __future__ import print_function
from builtins import str
def g608_grid_former(line,text,color,font):
    if "text[" in line:
        line = str(line.split(":", 1)[1])
        line = str(line.split("\n")[0])
        text.append(line)
    if "color[" in line:
        line = str(line.split(":", 1)[1])
        line = str(line.split("\n")[0])
        color.append(line)
    if "font[" in line:
        line = str(line.split(":", 1)[1])
        line = str(line.split("\n")[0])
        font.append(line)

def return_g608_grid(case,text,color,font):
    ret_val = {'text':" ",'color':" ",'font':" "}
    help_string = """
    Case is the value that would give the desired output.
    case = 0 --> print start_time,end_time,text,color,font
    case = 1 --> print start_time,end_time,text
    case = 2 --> print start_time,end_time,color
    case = 3 --> print start_time,end_time,font
    case = 4 --> print start_time,end_time,text,color
    case = 5 --> print start_time,end_time,text,font
    case = 6 --> print start_time,end_time,color,font
    """
    if case==0:
        if text:
            ret_val['text']=text
        if color:
            ret_val['color']=color
        if font:
            ret_val['font']=font
        
    elif case==1:
        if text:
            ret_val['text']=text
    elif case==2:
        if color:
            ret_val['color']=color
    elif case==3:
        if font:
            ret_val['font']=font
    elif case==4:
        if text:
            ret_val['text']=text
        if color:
            ret_val['color']=color
    elif case==5:
        if text:
            ret_val['text']=text
        if font:
            ret_val['font']=font
    elif case==6:
        if color:
            ret_val['color']=color
        if font:
            ret_val['font']=font
    else:
        print(help_string)
    return ret_val