Jump to content

rich

Keywelt-Plugingenieur
  • Gesamte Inhalte

    1.132
  • Benutzer seit

  • Letzter Besuch

  • Tagessiege

    1

Beiträge erstellt von rich

  1. Hier mal wieder die neuste Version.

    Bitte teste!

     

    /var/plugins/remote_timer.sh

    #!/bin/sh
    ############# Einstellungen ########################
    IP_BOX2=192.168.0.55	# IP der Box2 anpassen	#
    linemax=8  # Maximale EPG-Zeilen	 #
    ####################################################
    wget -q -O /tmp/t_sender http://localhost/control/zapto
    wget -q -O /tmp/t_jetzt http://localhost/control/epg?ext
    wget -q -O /tmp/t_prog http://localhost/control/epg?`cat /tmp/t_sender`
    wget -q -O /tmp/t_kanal http://localhost/control/channellist
    kanal=$(sed -n "s/`cat /tmp/t_sender` //p" /tmp/t_kanal)
    sed -n '/^'`cat /tmp/t_sender`" "'/p' /tmp/t_jetzt > /tmp/t_sendung
    start=$(cut -d" " -f2 /tmp/t_sendung)
    ende1=$(expr $start + `cut -d" " -f3 /tmp/t_sendung`)
    sed -n '/'" "$ende1" "'/p' /tmp/t_prog > /tmp/t_sendung2
    ende2=$(expr $ende1 + `cut -d" " -f3 /tmp/t_sendung2`)
    case "$1" in
    "JETZT")
    if [ $(grep -c '$' /tmp/t_prog) -le "0" ]; then
     wget -q -O /dev/null http://localhost/control/message?nmsg=Fehler:%20Keine%20EPG-Daten%20vorhanden%20!!!%0ATimer%20kann%20nicht%20gesetzt%20werden.
     rm /tmp/t_*
     exit;
    fi;
    wget -q -O /dev/null http://$IP_BOX2/control/timer?'action=new&type=5&alarm='$start'&stop='$ende1'&channel_id='`cat /tmp/t_sender`'&rs=1'
    if [ $? -eq "" ]; then
     wget -O /dev/null http://localhost/control/message?popup=Timer%20auf%20Remote-Box%20\($IP_BOX2\)%20wurde%20gesetzt!
     rm /tmp/t_*
     exit;
    fi;
    wget -q -O /dev/null http://localhost/control/message?nmsg=Fehler:%20Remote-Box%20\($IP_BOX2\)%20antwortet%20nicht%20!!!%0ATimer%20kann%20nicht%20gesetzt%20werden.
    ;;
    "NACH")
    if [ $(grep -c '$' /tmp/t_prog) -le "0" ]; then
     wget -q -O /dev/null http://localhost/control/message?nmsg=Fehler:%20Keine%20EPG-Daten%20vorhanden%20!!!%0ATimer%20kann%20nicht%20gesetzt%20werden.
     rm /tmp/t_*
     exit;
    fi;
    wget -q -O /dev/null http://$IP_BOX2/control/timer?'action=new&type=5&alarm='$ende1'&stop='$ende2'&channel_id='`cat /tmp/t_sender`'&rs=1'
    if [ $? -eq "" ]; then
     wget -O /dev/null http://localhost/control/message?popup=Timer%20auf%20Remote-Box%20\($IP_BOX2\)%20wurde%20gesetzt!
     rm /tmp/t_*
     exit;
    fi;
    wget -q -O /dev/null http://localhost/control/message?nmsg=Fehler:%20Remote-Box%20\($IP_BOX2\)%20antwortet%20nicht%20!!!%0ATimer%20kann%20nicht%20gesetzt%20werden.
    ;;
    "EPG")
    rm /tmp/epg.sh
    echo "COMMENT=`date +%d"."%m".  "%H:%M`  -  $kanal" >> /tmp/epg.sh
    if [ $(grep -c '$' /tmp/t_prog) -le "0" ]; then
     echo "COMMENT=" >> /tmp/epg.sh
     echo "COMMENT=Fehler: Keine EPG-Daten vorhanden !!!" >> /tmp/epg.sh
     rm /tmp/t_*
     exit;
    fi;
    wget -q -O /dev/null http://$IP_BOX2/control/getmode
    if [ $? -eq "" ]; then
    line=1
    linemin=1
    while [ $line -le `expr "$linemax" + "$linemin"` ]
    do
     sed -n 'y/'","'/'" "'/'"$line"'p' /tmp/t_prog > /tmp/t_zeile
     epg_start=$(cut -d" " -f2 /tmp/t_zeile)
     epg_lang=$(cut -d" " -f3 /tmp/t_zeile)
     epg_ende=$(expr $epg_start + `cut -d" " -f3 /tmp/t_zeile`)
     epg_eventid=$(cut -d" " -f1 /tmp/t_zeile)
     epg_titel=$(sed -n "s/^$epg_eventid $epg_start $epg_lang //p" /tmp/t_zeile)
     if [ `date +%s` -le "$epg_ende" ]; then
      echo "ACTION=$epg_titel, wget -q -O /dev/null http://$IP_BOX2/control/timer?'action=new&type=5&alarm='$epg_start'&stop='$epg_ende'&channel_id='`cat /tmp/t_sender`'&rs=1'; wget -O /dev/null http://localhost/control/message?popup=Timer%20auf%20Remote-Box%20\($IP_BOX2\)%20wurde%20gesetzt!" >> /tmp/epg.sh
    	  else
      linemin=$line
     fi;
     line=`expr $line + 1`
    done
    else
     echo "COMMENT=" >> /tmp/epg.sh
     echo "COMMENT=Fehler: Remote-Box ($IP_BOX2) antwortet nicht !!!" >> /tmp/epg.sh
     rm /tmp/t_*
     exit;
    fi;
    ;;
    *)
    echo "usage: remote_timer.sh [JETZT]|[NACH]|[EPG]"
    ;;  
    esac
    rm /tmp/t_*
    exit;

     

    und noch der Eintrag in shellexec.conf

     

    MENU=Remote Aufnahme-Timer
    ACTION=Aufnahme der laufenden Sendung,/var/plugins/remote_timer.sh JETZT
    ACTION=Aufnahme der folgenden Sendung,/var/plugins/remote_timer.sh NACH
    ACTION=&*Aktuelle EPG-Daten einlesen,/var/plugins/remote_timer.sh EPG,EPG-Daten werden verarbeitet.
    INCLUDE=/tmp/epg.sh
    ENDMENU

     

    rich

     

    Edit: Probleme gibt es nur noch bei Sendern ohne EPG-Daten.

     

    Edit: das aktuelle Plugin kann jetzt hier gezogen werden

  2. Hallo,

    hier noch einmal eine überarbeitete Version des Remote-Timers für die laufende und nachfolgende Sendung.

     

    /var/plugins/remote_timer.sh

    #!/bin/sh
    IP_BOX2="192.168.0.55"	# IP der Box2 anpassen
    ping -c 1 $IP_BOX2
    if [ $? -eq 0 ]; then
    wget -q -O /tmp/t_sender http://localhost/control/zapto
    wget -q -O /tmp/t_jetzt http://localhost/control/epg?ext
    wget -q -O /tmp/t_prog http://localhost/control/epg?`cat /tmp/t_sender`
    sed -n '/^'`cat /tmp/t_sender`" "'/p' /tmp/t_jetzt > /tmp/t_sendung
    start=$(cut -d" " -f2 /tmp/t_sendung)
    ende1=$(expr $start + `cut -d" " -f3 /tmp/t_sendung`)
    sed -n '/'" "$ende1" "'/p' /tmp/t_prog > /tmp/t_sendung2
    ende2=$(expr $ende1 + `cut -d" " -f3 /tmp/t_sendung2`)
    case "$1" in
     "JETZT")
       wget -q -O /dev/null http://$IP_BOX2/control/timer?'action=new&type=5&alarm='$start'&stop='$ende1'&channel_id='`cat /tmp/t_sender`'&rs=1'
    ;;
     "NACH")
       wget -q -O /dev/null http://$IP_BOX2/control/timer?'action=new&type=5&alarm='$ende1'&stop='$ende2'&channel_id='`cat /tmp/t_sender`'&rs=1'
    ;;
     *)
         echo "usage: remote_timer.sh [JETZT]|[NACH]"
    ;;  
    esac
    rm /tmp/t_*
    wget -O /dev/null http://localhost/control/message?popup=Timer%20auf%20Remote-Box%20\($IP_BOX2\)%20wurde%20gesetzt!
    exit;
    fi
    wget -q -O /dev/null http://localhost/control/message?popup=Fehler:%20Remote-Box%20\($IP_BOX2\)%20antwortet%20nicht.
    exit;

     

    und noch der Eintrag in shellexec.conf

    MENU=Remote Aufnahme-Timer
       ACTION=Aufnahme der laufenden Sendung,/var/plugins/remote_timer.sh JETZT
       ACTION=Aufnahme der folgenden Sendung,/var/plugins/remote_timer.sh NACH
    ENDMENU

     

    rich

  3. Ich habe hier mal grob was für die folgende Sendung zusammengebaut,

    funktioniert über FlexMenü recht gut.

     

    # Aufnahme der folgenden Sendung
    wget -q -O /tmp/sender http://localhost/control/zapto
    wget -q -O /tmp/jetzt http://localhost/control/epg?ext
    wget -q -O /tmp/programm http://localhost/control/epg?`cat /tmp/sender`
    sed -n '/'`cat /tmp/sender`'/p' /tmp/jetzt > /tmp/sendung
    cut -d" " -f2 /tmp/sendung > /tmp/start
    expr `cat /tmp/start` + `cut -d" " -f3 /tmp/sendung` > /tmp/ende
    sed -n '/'`cat /tmp/ende`'/p' /tmp/programm > /tmp/sendung2
    expr `cat /tmp/ende` + `cut -d" " -f3 /tmp/sendung2` > /tmp/ende2
    wget -q -O /dev/null 'http://192.168.0.55/control/timer?action=new&type=5&alarm='`cat /tmp/ende`'&stop='`cat /tmp/ende2`'&channel_id='`cat /tmp/sender`'&rs=1'
    rm /tmp/sender
    rm /tmp/jetzt
    rm /tmp/start
    rm /tmp/ende
    rm /tmp/ende2
    rm /tmp/sendung
    rm /tmp/sendung2
    rm /tmp/programm
    wget -O /dev/null http://localhost/control/message?popup=Timer%20auf%20Remote-Box%20der%20nachfolgende%20Sendung%20wurde%20gesetzt!

  4. Hallo,

     

    @drjv

    ich habe Dein Skript mal getestet, funktioniert bei mir aber leider nicht.

    Problem ist in meinem Image "| tail -1“ dadurch habe ich es für mich mal etwas geändert womit es bei mir dann klappt.

     

    wget -q -O /tmp/sender http://localhost/control/zapto
    wget -q -O /tmp/jetzt http://localhost/control/epg?ext
    sed -n '/'`cat /tmp/sender`'/p' /tmp/jetzt > /tmp/sendung
    cut -d" " -f2 /tmp/sendung > /tmp/start
    expr `cat /tmp/start` + `cut -d" " -f3 /tmp/sendung` > /tmp/ende
    wget -q -O /dev/null 'http://192.168.0.55/control/timer?action=new&type=5&alarm='`cat /tmp/start`'&stop='`cat /tmp/ende`'&channel_id='`cat /tmp/sender`'&rs=1'
    rm sender
    rm jetzt
    rm start
    rm ende
    rm sendung
    wget -O /dev/null http://localhost/control/message?popup=Timer%20auf%20Remote-Box%20wurde%20gesetzt!

     

    rich

     

    Edit: das aktuelle Plugin kann jetzt hier gezogen werden

  5. also Versuch ich es mal so

     

    Box1

    /var/tuxbox/plugins/zap_rec

    IP_BOX2="192.168.x.xx"	# IP von Box2 anpassen
    ping -c 2 $IP_BOX2
    if [ $? -eq 0 ]; then
    wget -q -O /tmp/rec_status http://$IP_BOX2/control/setmode?status
    if [ `grep "on" /tmp/rec_status` != "on" ]; then
     rm /tmp/zap_rec
     wget -q -O /dev/null http://$IP_BOX2/cgi-bin/exec?record
     wget -q -O /dev/null http://localhost/control/message?popup=Aufnahme%20auf%20Box2%20\($IP_BOX2\)%20wurde%20beendet.
     exit;
    else
     wget -q -O /tmp/zap_rec http://localhost/control/zapto
     wget -q -O /dev/null http://$IP_BOX2/control/zapto?`cat /tmp/zap_rec`
     wget -q -O /dev/null http://$IP_BOX2/cgi-bin/exec?record
     wget -q -O /dev/null http://localhost/control/message?popup=Aufnahme%20auf%20Box2%20\($IP_BOX2\)%20wurde%20gestartet.
     exit;
    fi
    fi
    wget -q -O /dev/null http://localhost/control/message?popup=Box2%20\($IP_BOX2\)%20antwortet%20nicht.
    exit;

     

    Box2

    /var/tuxbox/plugins/record.sh

    # Die rcsim-Befehle müssen eventuell noch etwas angepasst werden!
    if [ -e /tmp/record_on ]; then
    rm /tmp/record_on;
    wget -q -O /dev/null http://localhost/control/setmode?record=stop
    rcsim KEY_BLUE 1
    rcsim KEY_RED 1
    rcsim KEY_HOME 1
    else
    touch /tmp/record_on;
    wget -q -O /dev/null http://localhost/control/setmode?record=start
    rcsim KEY_BLUE 1
    rcsim KEY_RED 1
    fi;
    exit;

     

    noch Rechte und IP der Box2 anpassen bzw. Plugin durch "zap_rec.so" und "zap_rec.cfg" lauffähig machen.

     

    rich

     

    Leider sind im CODE von Box1 noch zwei Zeilenumbrüche bei "wget -q -O /dev/null" hinzugekommen, die müsste man noch entfernen.

    Wenn man den Inhalt der CODE-Fenster kopiert und z.B. bei UltraEdit einfügt sollte es wieder richtig werden.

×
×
  • Neu erstellen...