comparison src/channelscan_pt1.sh @ 150:036ae90f1b01

EXPERIMENTAL: Add channel scan script. require: epgdump, XML::Simple
author Naoya OYAMA <naoya.oyama@gmail.com>
date Fri, 31 Aug 2012 05:12:44 +0900
parents
children
comparison
equal deleted inserted replaced
149:a9f60d56d673 150:036ae90f1b01
1 #!/bin/bash
2 # channelscan_pt1.sh -- Scan channel info by TS.
3 #
4 # Copyright 2012 Naoya OYAMA <naoya.oyama@gmail.com>
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19 TMP="/var/tmp"
20 ISDBT_Time="16"
21 BS_Time="60"
22 CS_Time="60"
23
24 ISDBT_Info=~/.recpt1_ISDB
25 BS_Info=~/.recpt1_BS
26 CS_Info=~/.recpt1_CS
27
28 for i in ${ISDBT_Info} ${BS_Info} ${CS_Info}; do
29 test -e "${i}" && rm -f "${i}"
30 done
31
32 echo "Start ISDB-T scan."
33 for i in `seq 13 62` ; do
34 TSFILE="${TMP}/$i.ts"
35 XMLFILE="${TMP}/$i.xml"
36 recpt1 $i ${ISDBT_Time} "${TSFILE}" >/dev/null 2>&1
37 epgdump $i "${TSFILE}" "${XMLFILE}"
38 if [ -e "${XMLFILE}" ] ; then
39 epgdump_xml_parse.pl "${XMLFILE}" >> ${ISDBT_Info} 2>/dev/null
40 rm -f "${TSFILE}" "${XMLFILE}"
41 else
42 rm -f "${TSFILE}"
43 fi
44 done
45
46 echo "start BS scan."
47 TSFILE="${TMP}/BS.ts"
48 XMLFILE="${TMP}/BS.xml"
49 recpt1 101 ${BS_Time} "${TSFILE}" >/dev/null 2>&1
50 epgdump /BS "${TSFILE}" "${XMLFILE}"
51 if [ -e "${XMLFILE}" ] ; then
52 epgdump_xml_parse.pl "${XMLFILE}" > ${BS_Info} 2>/dev/null
53 rm -f "${TSFILE}" "${XMLFILE}"
54 else
55 rm -f "${TSFILE}"
56 fi
57
58 echo "start CS scan."
59 for i in `seq 1 12` ; do
60 i=$((i*2));
61 TSFILE="${TMP}/CS.ts"
62 XMLFILE="${TMP}/CS.xml"
63 recpt1 CS$i ${CS_Time} "${TSFILE}" > /dev/null 2>&1
64 epgdump /CS "${TSFILE}" "${XMLFILE}"
65 if [ -e "${XMLFILE}" ] ; then
66 epgdump_xml_parse.pl "${XMLFILE}" >> ${CS_Info} 2>/dev/null
67 rm -f "${TSFILE}" "${XMLFILE}"
68 else
69 rm -f "${TSFILE}"
70 fi
71 done
72 if [ -e ${CS_Info} ] ; then
73 sort -n ${CS_Info} | uniq > ${CS_Info}.tmp
74 mv -f ${CS_Info}.tmp ${CS_Info}
75 fi
76
77 test -e ~/.recpt1-channels && mv ~/.recpt1-channels ~/.recpt1-channels_`date +%Y%m%d%H%M%S`
78 if [ -e ${ISDB_Info} ] ; then
79 echo ---------------------ISDB-T------------------------ > ~/.recpt1-channels
80 echo SID,channel,name >> ~/.recpt1-channels
81 cat ${ISDBT_Info} >> ~/.recpt1-channels
82 fi
83 if [ -e ${BS_Info} ] ; then
84 echo -----------------------BS-------------------------- >> ~/.recpt1-channels
85 echo SID,channel,name >> ~/.recpt1-channels
86 cat ${BS_Info} >> ~/.recpt1-channels
87 fi
88 if [ -e ${CS_Info} ] ; then
89 echo -----------------------CS-------------------------- >> ~/.recpt1-channels
90 echo SID,channel,name >> ~/.recpt1-channels
91 cat ${CS_Info} >> ~/.recpt1-channels
92 fi