forked from DickyB/LANTV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleartext
executable file
·68 lines (55 loc) · 1.48 KB
/
cleartext
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
#!/usr/bin/python
#
# cleartext: Dicky B ([email protected])
#
# just clear the dynamic text files, no big deal.
#
# Note: Recompilation of ffmpeg will be needed if
# using text overlays, h.264, etc.
#
# Note: If text files used for overlays are not
# readable/existent, ffmpeg will crap out
# and exit. This also goes for any other
# overlay like image/video/whatever.
# I've modified my ffmpeg to ignore missing
# textfiles when video is running, but not
# when initially starting.
#
import os
import sys
#get basepath
basepath=os.path.dirname(os.path.realpath(__file__))+'/'
if len(sys.argv)!=2:
print "Usage: cleartext <channel directory>"
exit()
#read and fix
#should be simple, do it soon.
dyntext2=""
dyntext3=""
name = sys.argv[1]
channelName=name
channelPath=basepath+channelName+'/'
f = open(channelPath+'channel.conf')
lines=f.readlines()
f.close()
for b in lines:
c=b.strip()
line=c.split('=')
if line[0].strip() == 'dyntext2':
dyntext2=line[1].strip()
if line[0].strip() == 'dyntext3':
dyntext3=line[1].strip()
#note: only bother to parse what we need. Treat the config like a salad bar.
#semi-safely clear dynamic text files by NOT just writing to them
#or deleting them. This seems stupid, but it's to compensate for
#the insane way ffmpeg checks dynamic text files every frame.
f = open(dyntext2,"r+")
f.seek(0)
f.truncate(0)
f.write("\n\n")
f.close()
f = open(dyntext3,"r+")
f.seek(0)
f.truncate(0)
f.write("\n\n")
f.close()