Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SCRIPT] Enregistrer et regarder plusieurs chaînes DVB (TNT)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index French
View previous topic :: View next topic  
Author Message
THuLiuM
n00b
n00b


Joined: 13 Apr 2005
Posts: 19

PostPosted: Sun Dec 09, 2007 5:15 pm    Post subject: [SCRIPT] Enregistrer et regarder plusieurs chaînes DVB (TNT) Reply with quote

Salut

Bon j'avais pas envie d'installer un vdr et dvbstreamer marche mal chez moi donc j'ai fais ce script cet aprem pour enregistrer tous ou plusieurs flux d'un multiplex dvb-s/dvb-t en utilisant vlc. Il y a possibilité de matter toutes les chaînes dispo en même temps ainsi que celle(s) que vous enregistrée(s).

Attention au noms des chaînes exécuter sans nom pour avoir l'aide et voir les noms sans espaces.
Voilà enjoy moi ca m'aide pas mal ^^ :

J'ai tout commenter en anglais pour nos amis anglophones :)

Code:

#!/bin/sh
#Author: THuLiuM
#rev   : 1.1
#needs : vlc and a dvb card
#
#Script to watch and record all streams inside a dvb-s/dvb-t multiplex
#use : mpl_dvb_rec_watch.sh CHAN1 CHAN2 ... to record many chans in same time
#You can then watch the channels with the infos shown in the terminal
#enjoy !

clear

DATE=`date +%d-%m-%Y-%H:%M`
CONF="$HOME/Utils/DVBT/channels.conf"
FOLDER="$HOME/tv/"

#First port to use
PORT=1231
#Adress to bind to
ADR=127.0.0.1

streaming_line() {
        LINE="dst=standard{access=udp,mux=ts,url=$ADR:$3,sap,name=$1,group=\"DVB\"},select=\"program=$2\""
        echo $LINE
}

streaming_recording_line() {
        NAME=$FOLDER${DATE}_${1}".mpg"
        LINE="dst=standard{access=udp,mux=ts,url=$ADR:$3,sap,name=$1,group=\"DVB\"},select=\"program=$2\",dst=standard{mux=ts,dst=${NAME},access=file},select=\"program=$2\""
        echo $LINE
}

print_help() {
        #No channels given - printing help
        echo "_________  Names you can use __________"
        awk -F ':' '{gsub(/ /,"_",$1); print $1" freq=" $2 }' $CONF
        echo "_______________________________________"
        echo "sh mpl_dvb_rec_watch.sh CHAN1 CHAN2 ..."
}

if [ $# -ge 1 ]; then
#Step 1 : get frequency of the 1st channel
FREQ=`cat $CONF  | tr " " "_" | grep $1 | awk -F ':' '{ print $2; }'`

if [ -n "$FREQ" ]; then
        #Step 2 : get channels of the associated multiplex - removing spaces
        CHANNELS=`cat $CONF | grep $FREQ | tr " " "_"`

        #Step 3 : Prepare streaming and recording lines - Only channels in arguments will be recorded
        ALLPIDS=''
        ALLPLINE=''
        STREAMSINFOS=''

        for i in $CHANNELS
        do
                PID=`echo $i | awk -F ':' '{ print $13; }'`
                ALLPIDS=$ALLPIDS","$PID

                ID=`echo $i | awk -F ':' '{ print $1; }'`
                ISRECORD=`echo $* | grep $ID`

                if [ -n  "$ISRECORD" ]; then
                        PROGLINE=$(streaming_recording_line $ID $PID $PORT)
                else
                        PROGLINE=$(streaming_line $ID $PID $PORT)
                fi

                ALLPLINE=$ALLPLINE","$PROGLINE
                STREAMSINFOS=$STREAMSINFOS" udp://@"$ADR":"$PORT
                let PORT+=1
        done

        #Step 4 : removing coma in start of variables
        ALLPIDS=${ALLPIDS:1}
        ALLPLINE=${ALLPLINE:1}

        #Step 5 : ready to go !
        echo "______________________________________________"
        echo -e "\E[31;1mDVB-T streaming and recording machine v 1.0 \E[33;1m^^\033[0m"
        echo "To watch tv channels use this : "
        echo -e "\033[1mvlc$STREAMSINFOS\033[0m"
        echo -e "\033[1mCTRL+C\033[0m to quit :"
        echo "______________________________________________"

        #change dvb-t by dvb and add params needed if you have satellite
        vlc --intf rc --quiet --color --ttl=4 --ts-es-id-pid --programs $ALLPIDS dvb-t:adapter=0:frequency=$FREQ:bandwidth=8 --sout="#duplicate{$ALLPLINE}"
else
        echo "WARNING : Error in channel name - maybe a whitespace ??"
        print_help
fi

else
        print_help
fi


Si vous avez es commentaires hésitez pas ( on va éviter les mauvais quand même ) ^^
Back to top
View user's profile Send private message
THuLiuM
n00b
n00b


Joined: 13 Apr 2005
Posts: 19

PostPosted: Sun Dec 23, 2007 7:09 am    Post subject: Reply with quote

Petite correction à ce niveau :

Code:

#Step 1 : get frequency of the 1st channel
FREQ=`cat $CONF  | tr " " "_" | grep $1 | awk -F ':' '{ print $2; }'`


sinon il reconnait pas le nom de la chaîne :?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index French All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum