vanhofen
6 years ago
5 changed files with 4 additions and 226 deletions
@ -1,7 +0,0 @@ |
|||
type=4 |
|||
name=EPG Filter |
|||
desc=EPG Filter |
|||
needfb=0 |
|||
needrc=0 |
|||
needvtxtpid=0 |
|||
needoffsets=0 |
@ -1,74 +0,0 @@ |
|||
--- EPG Filter by PauleFoul |
|||
--- Version 003 |
|||
|
|||
local posix = require "posix" |
|||
|
|||
function script_path() |
|||
return posix.dirname(debug.getinfo(2, "S").source:sub(2)).."/" |
|||
end |
|||
|
|||
--- Dekleration |
|||
epgfilter = {} |
|||
epgfilter_hint = {} |
|||
|
|||
|
|||
epgfilter[1] = "EPG nur TV (Alle)" |
|||
epgfilter_hint[1] = "Es wird der EPG aller TV Sender angezeigt" |
|||
|
|||
epgfilter[2] = "EPG nur Radio (Alle)" |
|||
epgfilter_hint[2] = "Es wird der EPG aller Radio Sender angezeigt" |
|||
|
|||
epgfilter[3] = "EPG nur TV (Alle) + Now&Next" |
|||
epgfilter_hint[3] = "Es wird der EPG aller TV Sender angezeigt, zudem Now&Next EGP der restlichen Sender" |
|||
|
|||
epgfilter[4] = "EPG nur Radio (Alle) + Now&Next" |
|||
epgfilter_hint[4] = "Es wird der EPG aller Radio Sender angezeigt, zudem Now&Next EGP der restlichen Sender" |
|||
|
|||
epgfilter[5] = "EPG nur TV&Radio (Favoriten)" |
|||
epgfilter_hint[5] = "Es wird der EPG aller Sender (nur Favoriten) angezeigt" |
|||
|
|||
epgfilter[6] = "EPG nur TV&Radio (Favoriten) + Now&Next" |
|||
epgfilter_hint[6] = "Es wird der EPG aller Sender (nur Favoriten) angezeigt, zudem Now&Next EGP der restlichen Sender" |
|||
|
|||
epgfilter[7] = "EPG nur TV (Favoriten)" |
|||
epgfilter_hint[7] = "Es wird der EPG aller TV Sender (nur Favoriten) angezeigt" |
|||
|
|||
epgfilter[8] = "EPG nur TV (Favoriten) + Now&Next" |
|||
epgfilter_hint[8] = "Es wird der EPG aller TV Sender (nur Favoriten) angezeigt, zudem Now&Next EGP der restlichen Sender" |
|||
|
|||
|
|||
|
|||
--- Funktionen |
|||
function delete() |
|||
local h = hintbox.new{caption="EPG Filter", text="Epgfilter.xml wird gelöscht! Bitte warten ..."} |
|||
h:paint() |
|||
os.execute("rm /var/tuxbox/config/zapit/epgfilter.xml") |
|||
posix.sleep(3) |
|||
h:hide() |
|||
local ret = messagebox.exec{caption="EPG Filter", text="Epgfilter.xml erfolgreich gelöscht", buttons={"ok"}} |
|||
end |
|||
|
|||
function filter(k, v) |
|||
select = k |
|||
local h = hintbox.new{caption="EPG Filter", text="Epgfilter.xml wird erstellt!\nBitte warten ...\n(Vorgang kann durchaus Minuten in Anspruch nehmen!)"} |
|||
h:paint() |
|||
print(script_path() .. "epgfilter.sri " .. select) |
|||
os.execute(script_path() .. "epgfilter.sri " .. select) |
|||
h:hide() |
|||
local ret = messagebox.exec{caption="EPG Filter", text="Epgfilter.xml wurde erfolgreich erstellt", buttons={"ok"}} |
|||
end |
|||
|
|||
|
|||
--- Menueanzeige |
|||
local m = menu.new{name="EPG Filter", icon="lock"} |
|||
m:addItem{type="back"} |
|||
m:addItem{type="separatorline"} |
|||
|
|||
local i |
|||
for i = 1, 8 do |
|||
m:addItem{type="forwarder", name=epgfilter[i], action="filter", id=i, icon=i, hint=epgfilter_hint[i], hint_icon="hint_reload", directkey=RC[tostring(i)]} |
|||
end |
|||
|
|||
m:addItem{type="separatorline"} |
|||
m:addItem{type="forwarder", name="EPG Filter deaktivieren", action="delete", icon="rot", hint="Hier können Sie den EPG Filter deaktivieren. Dadurch wird die Datei epgfilter.xml gelöscht", hint_icon="hint_reload", directkey=RC["red"]} |
|||
m:exec() |
@ -1,141 +0,0 @@ |
|||
#!/bin/sh |
|||
# EPG Daten ausfiltern |
|||
# by PauleFoul |
|||
|
|||
select=$1 |
|||
Myself="EPGFilter - EPG Daten ausfiltern" |
|||
Version="V003" |
|||
Headline="${Myself} - - - ${Version}" |
|||
|
|||
echo $Myself $Version $select |
|||
|
|||
|
|||
#Daten aus der Service.xml auslesen und filtern |
|||
services_data () |
|||
{ |
|||
#Zeilen (hier die t="2" enthalten) in services.xml suchen und kopieren |
|||
grep -E "$1" /var/tuxbox/config/zapit/services.xml > /tmp/epgtmp1.xml |
|||
|
|||
#Text loeschen und umwandeln |
|||
sed -e 's/<S //' -e 's/ t=".*>//g' -e 's/v=".*"//g' -e 's/*//' -e 's/^[ \t]*//' -e '/^\s*$/d' -e 's/i="//' -e 's/^0*//' -e 's/^/"/' -e 's/n="/name="/' /tmp/epgtmp1.xml | sort -u > /tmp/epgtmp3.xml |
|||
|
|||
#Text die ersten 10 Zeichen abschneiden |
|||
#cut -c 10- "/tmp/epgtmp2.xml" > "/tmp/epgtmp3.xml" |
|||
} |
|||
|
|||
|
|||
bouquets_data () |
|||
{ |
|||
#Zeilen (hier die <S i=" enthalten) in bouquets.xml suchen und kopieren |
|||
grep '<S i="' $1 > /tmp/epgtmp4.xml |
|||
|
|||
#Format der Serviceparameter anpassen ( aus i wird z.B. serviceID) |
|||
sed -e 's/.s=".*"//g' -e 's/.frq=".*"//g' -e 's/<S/<filter/' -e 's/i="/serviceID="/' -e 's/n="/name="/' -e 's/t="/tsid="/' -e 's/on="/onid="/' -e 's/^[ \t]*//' /tmp/epgtmp4.xml | sort -u > /tmp/epgtmp5.xml |
|||
} |
|||
|
|||
|
|||
sender_suchen () |
|||
{ |
|||
|
|||
#Zeilen/Senderanzahl ermitteln |
|||
zeilen=`sed -n -e "$=" /tmp/epgtmp3.xml` |
|||
#zeilen=$(expr $zeilen - 1) |
|||
|
|||
tab1=1; step=1 |
|||
|
|||
Anzeigetext="~c Senderliste erstellen..."; msga |
|||
while [ "$tab1" -le "$zeilen" ]; do |
|||
a1=`sed -n -e "$tab1"p /tmp/epgtmp3.xml` |
|||
a2=`grep -e "$a1" /tmp/epgtmp5.xml` |
|||
echo -e "$a2" >> /tmp/epgtmp6.xml |
|||
tab1=`expr "$tab1" + $step` |
|||
done |
|||
} |
|||
|
|||
|
|||
kopfzeile () |
|||
{ |
|||
#Dateikopf schreiben |
|||
echo '<?xml version="1.0" encoding="UTF-8"?>' >> /tmp/epgtmp6.xml |
|||
echo "<epgfilter is_whitelist=$1 except_current_next=$2>" >> /tmp/epgtmp6.xml |
|||
} |
|||
|
|||
|
|||
rm /tmp/epgtmp*.xml |
|||
|
|||
|
|||
case $select in # |
|||
1) #EPG nur TV (Alle) |
|||
services_data 't="1"|t="19"|t="d3' |
|||
bouquets_data /var/tuxbox/config/zapit/bouquets.xml |
|||
kopfzeile '"0"' '"0"' |
|||
sender_suchen |
|||
sleep 1;; |
|||
|
|||
2) #EPG nur Radio (Alle) |
|||
services_data 't="2"' |
|||
bouquets_data /var/tuxbox/config/zapit/bouquets.xml |
|||
kopfzeile '"1"' '"0"' |
|||
sender_suchen |
|||
sleep 1;; |
|||
|
|||
3) #EPG nur TV (Alle) + Now&Next |
|||
services_data 't="1"|t="19"|t="d3' |
|||
bouquets_data /var/tuxbox/config/zapit/bouquets.xml |
|||
kopfzeile '"0"' '"1"' |
|||
sender_suchen |
|||
sleep 1;; |
|||
|
|||
4) #EPG nur Radio (Alle) + Now&Next |
|||
services_data 't="2"' |
|||
bouquets_data /var/tuxbox/config/zapit/bouquets.xml |
|||
kopfzeile '"1"' '"1"' |
|||
sender_suchen |
|||
sleep 1;; |
|||
|
|||
5) #EPG nur TV&Radio (Favoriten) |
|||
bouquets_data /var/tuxbox/config/zapit/ubouquets.xml |
|||
kopfzeile '"1"' '"0"' |
|||
cat /tmp/epgtmp5.xml >> /tmp/epgtmp6.xml |
|||
sleep 1;; |
|||
|
|||
6) #EPG nur TV&Radio (Favoriten) + Now&Next |
|||
bouquets_data /var/tuxbox/config/zapit/ubouquets.xml |
|||
kopfzeile '"1"' '"1"' |
|||
cat /tmp/epgtmp5.xml >> /tmp/epgtmp6.xml |
|||
sleep 1;; |
|||
|
|||
7) #EPG nur TV (Favoriten) |
|||
services_data 't="1"|t="19"|t="d3"' |
|||
bouquets_data /var/tuxbox/config/zapit/ubouquets.xml |
|||
kopfzeile '"1"' '"0"' |
|||
sender_suchen |
|||
sleep 1;; |
|||
|
|||
8) #EPG nur TV (Favoriten) + Now&Next |
|||
services_data 't="1"|t="19"|t="d3"' |
|||
bouquets_data /var/tuxbox/config/zapit/ubouquets.xml |
|||
kopfzeile '"1"' '"1"' |
|||
sender_suchen |
|||
sleep 1;; |
|||
|
|||
*) #Keine Auswahl |
|||
exit;; |
|||
|
|||
esac |
|||
|
|||
|
|||
#Sortieren und doppelte Eintraege loeschen |
|||
cat /tmp/epgtmp6.xml | sort -u > /tmp/epgtmp7.xml |
|||
|
|||
#Dateiende schreiben |
|||
echo '</epgfilter>' >> /tmp/epgtmp7.xml |
|||
|
|||
sed -e 's/<filter/\t<filter/' -e '/^\s*$/d' /tmp/epgtmp7.xml > /tmp/epgtmp8.xml |
|||
|
|||
cp /tmp/epgtmp8.xml /var/tuxbox/config/zapit/epgfilter.xml |
|||
|
|||
rm /tmp/epgtmp*.xml |
|||
|
|||
exit |
|||
######################################################################################### |
Before Width: | Height: | Size: 103 B |
Loading…
Reference in new issue