-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostprocess.yml
110 lines (96 loc) · 3.42 KB
/
postprocess.yml
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# DEFINING A TASK:
# Order of operation:
# 1) selectors: Select objects to be processed
# - func(ssafile, **kwargs) -> list[obj]
# 2) filter: filter out object from selectors
# - func(ssafile, item, **kwargs) -> bool
# 3) actions: run actions for each item that was selected
# - func(ssafile, item, **kwargs) -> output
# 4) run misc function
# - func(ssafile,**kwargs) -> output
#
# defining id saves the output of an action to a dict: outputs
# the value can be accessed using: {{outputs['id'][0]['PlayResX']}}
#
#
# SEE actions.py for list of actions
ass:
tasks:
- selectors:
- uses: info_select_current_info # only one item
actions:
# create a copy of the old actions for saving in outputs['old_info']
- uses: info_action_save
id: old_info
# update info for ssafile and save the current reference to outputs['info']
- uses: info_action_update
id: info
with:
ScaledBorderAndShadow: "yes"
PlayResX: 1920
PlayResY: 1080
#### Modify styling information ####
- selectors:
- uses: styles_select_all # select all the styles ssafile
actions:
# Scales Existing font / margins with new player resolution
- uses: styles_action_scale_margins
with:
x_old: "{{outputs['old_info'][0]['PlayResX']}}"
y_old: "{{outputs['old_info'][0]['PlayResY']}}"
x_new: "{{outputs['info'][0]['PlayResX']}}"
y_new: "{{outputs['info'][0]['PlayResY']}}"
# Force all font to use arial format
- uses: styles_action_update_properties
with:
fontname: "Arial"
# Select the main style (i.e. most used style) and give the following styling format
- selectors:
- uses: styles_select_top
actions:
- uses: styles_action_update_properties
with:
fontname: "Arial"
borderstyle: 1
outline: 1
shadow: 1
fontsize: 60
marginl: 30
marginr: 30
marginv: 54 # 5% of 1080p
- selectors:
- uses: events_select_all
actions:
# Scales Existing inline margins with new player resolution
- uses: events_action_scale_margins
with:
x_old: "{{outputs['old_info'][0]['PlayResX']}}"
y_old: "{{outputs['old_info'][0]['PlayResY']}}"
x_new: "{{outputs['info'][0]['PlayResX']}}"
y_new: "{{outputs['info'][0]['PlayResY']}}"
# Scales text position with new resolution
- uses: events_action_scale_position
with:
x_old: "{{outputs['old_info'][0]['PlayResX']}}"
y_old: "{{outputs['old_info'][0]['PlayResY']}}"
x_new: "{{outputs['info'][0]['PlayResX']}}"
y_new: "{{outputs['info'][0]['PlayResY']}}"
# run ssafile.remove_miscellaneous_events()
- misc:
- uses: "events_misc_remove_miscellaneous_events"
srt:
tasks:
- selectors:
- uses: events_select_all
filters:
- uses: "events_filter_regex"
with:
regex: ".*"
# replace positioning tags left behind by FFMPEG when extracting/converting subtitles
actions:
- uses: "events_action_regex_substitution"
with:
regex: '{\\an\d}'
replace: "[+] "
- misc:
- uses: "events_misc_remove_miscellaneous_events"