"Fossies" - the Fresh Open Source Software Archive

Member "kaffeine-2.0.18/tools/map_xmltv_channels.sh" (14 May 2019, 1032 Bytes) of package /linux/misc/kaffeine-2.0.18.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 
    3 # This example map file relies on this grabber
    4 # tv_grab_eu_dotmedia >eu_dotmedia.xmltv
    5 
    6 # In order to get DVB Channel list, use:
    7 # echo 'select name from Channels;' | sqlite3 ~/.local/share/kaffeine/sqlite.db
    8 
    9 # Just a random senseless map - Modify it for your own needs,
   10 # adding just the channels that didn't map by default
   11 map[0]="action.sky.de;E! HD"
   12 map[1]="13thstreet.de;RIT"
   13 map[2]="1bar.dazn.de;TNT HD"
   14 
   15 #
   16 # Don't touch on anything below
   17 #
   18 
   19 if [ "$2" == "" ]; then
   20     echo "Usage: $0 <origin_file.xmltv> <dest_file.xmltv>"
   21     exit 1
   22 fi
   23 
   24 set -e
   25 
   26 # Original file
   27 orig="$1"
   28 
   29 # Parsed file, to be used in Kaffeine
   30 dest="$2"
   31 
   32 tmpfile1="tmp1_$$.xmltv"
   33 tmpfile2="tmp2_$$.xmltv"
   34 
   35 trap "rm -f $tmpfile1 $tmpfile2 2>/dev/null" EXIT
   36 cp $orig $tmpfile2
   37 
   38 IFS=$','
   39 for i in ${map[@]}; do
   40     array=(${i/;/,})
   41     channel=${array[0]}
   42     name=${array[1]}
   43 
   44     echo "$channel -> $name"
   45 
   46     mv $tmpfile2 $tmpfile1
   47     xmlstarlet ed -s "tv/channel[@id='$channel']" -t elem -n display-name \
   48     -v "$name" $tmpfile1 > $tmpfile2
   49 done
   50 mv $tmpfile2 $dest