forked from DickyB/LANTV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fshow
executable file
·53 lines (44 loc) · 1.24 KB
/
fshow
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
#!/usr/bin/python
#
# fshow: Dicky B ([email protected])
#
# Displays preShow Channel Identification video
# no overlays
# very simple script
#
import os
import sys
#get basepath
basepath=os.path.dirname(os.path.realpath(__file__))+'/'
if len(sys.argv)!= 3:
print "Usage: fshow <channel name> <full video path>"
exit()
#fill in channel config info
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() == 'ffmpeg':
ffmpegname=line[1].strip()
if line[0].strip() == 'ffmpegpath':
ffmpegpath=line[1].strip()
if line[0].strip() == 'feedurl':
feedurl=line[1].strip()
#note: only bother to parse what we need. Treat the config like a salad bar.
#derive more from config
ffmpegcmd = ffmpegpath+ffmpegname
# make sure all cruft is clean
os.system(basepath+'killcruft '+channelName)
#bust up the monster ffmpeg line for ease of neatness
precmd=ffmpegcmd+' -re -i '+sys.argv[2]+' '
midcmd='-c:v mpeg2video -b:v 6000k -c:a libfaac -b:a 128k -f mpegts - | '
postcmd=ffmpegcmd+' -re -i - '+feedurl
#slap it back together
fullcmd=precmd+midcmd+postcmd
#run that pig
os.system(fullcmd)