Home

Script oscam.svird Creator adaptado al OS Spark Triplex...

HSA2000

Aprendiendo...
Loco por OpenSPA
Fan de OpenSPA
19 Ene 2013
461
184
0
52
Hola...

He adaptado el scrip oscam.svird Creator al OS Spark Triplex, para crear ficheros para el oscam.srvid actualizado con la pagina http://en.kingofsat.net/packages.php y los proveedores de oscam.provid...

Fichero 1config.sh:
Código:
#!/bin/sh
#
# Author: Newcs-Team for http://www.satgate-team.ouba.com
# Date: 2011-11-15
#
# Modification/Modificion:
#        Author/Autor: HSA2000
#        Date/Fecha: 2013-01-30
#
#        Description/Descripcion:
#            Added to locate a file from providers who want to
#            update the channel list to update ids oscam.srvid...
#
#            Añadido que se busque desde un fichero los proveedores
#            de los que se quieres actualizar la lista de canales
#            para actualizar los ids de oscam.srvid...
#
clear
if test $# -lt 1
then
echo "--------------------------------------------------------------------"
echo " ** ERROR!!!: run ./1config.sh <file_prov> "
echo "--------------------------------------------------------------------"
exit
fi
if [ -f $1 ]
then
    DATFILE="package.list"
    echo "Downloading package list from KingOfSat.net"
    echo "-------------------------------------------"
    wget -O  ${DATFILE} http://en.kingofsat.net/packages.php
 
    #
    # Delete the file eviar srvidsatgate.cfg for errors...
    #
    # Borrar el fichero srvidsatgate.cfg para evitar errores...
    #
    rm srvidsatgate.cfg
 
    #
    # Read the file where is the list of suppliers to find...
    #
    # Leer el fichero donde esta la lista de los proveedores a buscar...
    #
    while read linea
    do
        awk -F '>' -v MyID="$linea" 'BEGIN { package="none" }
        /target="_blank">/ {    packdisname = substr($3,1,length($3)-3)
            }
        /<TD><A class="A3">/ {    packdisname = substr($3,1,length($3)-3)
            }   
        /<A class="bld" HREF=/ { 
                    packurl = substr($4,22,length($4)-22)
                    if ( length(packurl) == 0) next
                    packcountry = substr($2,1,length($2)-4)
                    if ( packdisname == MyID )
                        printf "%-25s|%-20s|%s\n", packdisname, packcountry, packurl
                            packdisname="NONE"
                            packcountry="NONE"
                            packurl="NONE"
                    next
                }' ${DATFILE} >> srvidsatgate.cfg
    done < $1
    echo "Done"
    echo "--------------------------------------------------------------------"
    echo " ** Please edit the file srvidsatgate.cfg and remove "
    echo " ** the # from the lines with the packages that you want to generate"
    echo "--------------------------------------------------------------------"
else
    echo "--------------------------------------------------------------------"
    echo " ** ERROR!!!: FILE $1 NOT FOUND... "
    echo "--------------------------------------------------------------------"
                           
fi

Continua...

Salu2...
 

HSA2000

Aprendiendo...
Loco por OpenSPA
Fan de OpenSPA
19 Ene 2013
461
184
0
52
Hola...

Fichero 2srvidsatgate.sh:
Código:
# Date: 2011-11-15
#
# inspired from a script available here: http://www.satgate-team.ouba.com/showthread.php?754-Generator-oscam.srvid
# Thanks to its author: lao
#
# This script will generate an oscam.srvid compatible file
# the package information will come from  http://www.kingofsat.net
# the CAID information will come from http://streamboard.gmc.to/wiki/OSCam/en/Config/oscam.provid
#
# Source url for the packages
#
sourceurl="http://en.kingofsat.net/"
#
# Modification/Modificion:
#        Author/Autor: HSA2000
#        Date/Fecha: 2013-01-30
#
#        Description/Descripcion:
#            Script Adaptation of the OS SPARK TRIPLEX, corrected the mismatch that has the product name
#            http://en.kingofsat.net/packages.php and the file oscam.provid with CANAL+/DIGITAL+...
#
#            Adaptacion del script al OS SPARK TRIPLEX, se ha corregido el desfase de nombre que tiene la pagina
#            http://en.kingofsat.net/packages.php y el fichero de oscam.provid con CANAL+/DIGITAL+...
#
# downint= to avoid overloading kingofsat if the package list has been downloaded below this interval it won't be downloaded again
#          this parameter is expressed in second, default is 43200 (12 hours)
downint=$((60*60*12)) # 12 horas, si quieres seis días: downint=$((60*60*24*6))
#
# Change the information below only if you understand what you do
#
# Definition of files.
 
# Name of the downloaded file from kingofsat
DATFILE="kingofsat"
# prefix of the generated file, package name will be automatically append to it
SVCFILE="oscam.srvid"
# Download package URL
sourceURL="http://en.kingofsat.net/"
 
# internal variable
downking=1
 
clear
echo "srvidsatgate.sh is a script to generate oscam.srvid files to use with OScam"
echo "------------------------------------------------------------------------"
 
 
#
# Generating the real configuration file used by this script
#
CONFFILE="srvidsatgate.cfg"
awk -F '|' 'BEGIN { endurl="none" }
    /#/ {    next
    }
    // {
        endurl = substr($3,1,length($3))
        if (length(endurl) == 0) next
        printf "%s\n", endurl
        next
    }' ${CONFFILE} > srvidsatgate.cfg.tmp
 
numline=`wc -l < srvidsatgate.cfg.tmp`
if [ $numline -eq 0 ]; then
    echo "You need to generate a configuration file before launching this script"
    echo "1) run ./1config.sh  <file_prov>"
    echo "2) edit the file srvidsatgate.cfg and remove the # on the lines"
    echo "  with the packages that you want to generate"
    echo "3) run again this script:  ./2srvidsatgate.sh"
    exit 1
fi
 
# Fetching data from website.
 
echo "Starting process..."
 
#
# Retrieving oscam.provid from OScam wiki
#
PROVIDFILE="rawprovid.list"
downprov=1
find $PROVIDFILE
if [ $(echo $?) -eq 0 ]; then
  # kingofsat file already exist
    # The time in seconds Last updated...
    #
    # Fecha y hora en segundos de ultima actualizacion...
    fichero=`stat -c %Y $PROVIDFILE`
 
    # Current Time in seconds ...
    #
    # Fecha y hora actual en segundos...
    ahora=`date +%s`
 
    # Calculate the difference...
    #
    # Calculamos la diferencia...
    diferencia=$((${ahora} - ${fichero}))
 
    if [ ${diferencia} -gt ${downint} ]; then
      echo " ** File $PROVIDFILE is outdated, download required."
      downprov=1
    else
      echo " ** File $PROVIDFILE is up-to-date"
      downprov=0
    fi
else
    echo " ** File $PROVIDFILE doesn't exist, download required."
    downprov=1
fi
if [ $downprov -eq 1 ]; then
    echo " ** Retrieving oscam.provid file from Internet"
    rm -f $PROVIDFILE.old
    if [ -f $PROVIDFILE ]
    then
        mv $PROVIDFILE $PROVIDFILE.old
    fi
    wget -O $PROVIDFILE http://streamboard.tv/wiki/OSCam/en/Config/oscam.provid
fi
 
awk -F '|' 'BEGIN { caid="none" }
    /#/ {    next
    }
    // {
        if ((index(toupper($0),"(OLD)") != 0) || (index(toupper($0),"(ID.") != 0 ) ) next
        if ( NF >= 2 && NF <= 10)
        {
            provider = toupper(substr($2,1,length($2)))
            caid = substr($1,1,4)
            provid = substr($1,6,length($1)-6)
            printf "%4s|%s\n", caid, provider;
            next
        }
    }' $PROVIDFILE > provid.list
echo "----------------------------------------------"
 
exec<srvidsatgate.cfg.tmp
while read line
    do
        DATFILE=$line
        prov="local"
        find $DATFILE.$prov
        if [ $(echo $?) -eq 0 ]; then
      # kingofsat file already exist
      # The time in seconds Last updated...
            #
            # Fecha y hora en segundos de ultima actualizacion...
            fichero=`stat -c %Y $DATFILE.$prov`
       
            # Current Time in seconds ...
            #
            # Fecha y hora actual en segundos...
            ahora=`date +%s`
       
            # Calculate the difference...
              #
            # Calculamos la diferencia...
            diferencia=$((${ahora} - ${fichero}))
       
            if [ ${diferencia} -gt ${downint} ]; then
                echo " ** File $DATFILE.$prov is outdated, download required."
                downprov=1
            else
                echo " ** File $DATFILE.$prov is up-to-date"
                downprov=0
            fi
        else
            echo " ** File $DATFILE.$prov doesn't exist, download required."
            downking=1
        fi
        if [ $downking -eq 1 ]; then
            echo " ** Fetching data from web-site for ${prov}"
            rm -f ${DATFILE}.${prov}.old
            if [ -f ${DATFILE}.${prov} ]
            then
                mv ${DATFILE}.${prov} ${DATFILE}.${prov}.old
            fi
            wget -O ${DATFILE}.${prov} $sourceURL$line
        fi
#
# Extract Package Name from KingOfSat file
#
        awk -F '>' 'BEGIN { disprov="NONE" }
        /TITLE>Packages:/ {
                    disprov=substr($2,11,length($2)-29)
                    if (length(disprov) == 0) next;
                    disprovUP=toupper(disprov)
                    printf"%s", disprovUP
                    next
                }' ${DATFILE}.${prov} > package.tmp
        package=$(cat package.tmp)
        echo " ** Package = $package"
        # Remove DIGITURK special char
        pack1=$(echo "$package" | sed 's/[üü]/U/g')
        # Remove Telewizja na karte  special char
        pack2=$(echo "$pack1" | sed 's/[Ä™]/E/g')
        # Remove Global special char
        pack=$(echo "$pack2" | sed 's/[ ¹Ã¼ü\+()/\-]/_/g')
 
   
# Parsing the data and creating service files.
 
        echo " ** Creating file ${SVCFILE}.${pack}"
        rm -f ${SVCFILE}.${pack}.old
        if [ -f ${SVCFILE}.${pack} ]
        then
            mv ${SVCFILE}.${pack} ${SVCFILE}.${pack}.old
        fi
#
# Cleaning-up channel name known to contain > character in the name (this cause problem with the script)
# since > is used as separator
# Known channels:
#  I>TELE -> I-TELE
#  i>TELE -> i-TELE
#
        sed -i '/I>TELE/s/I>TELE/I-TELE/g' ${DATFILE}.${prov}
        sed -i '/i>TELE/s/i>TELE/i-TELE/g' ${DATFILE}.${prov}
#
# Clean-up done
#   
        echo " ** Processing: ${DATFILE}.${prov}"
 
# Corrected the mismatch that has the product name
#    http://en.kingofsat.net/packages.php and the file oscam.provid with CANAL+/DIGITAL+...
#
# Corregido el desfase de nombre que tiene la pagina
# http://en.kingofsat.net/packages.php y el fichero de oscam.provid con CANAL+/DIGITAL+...
if [ "$package" = "CANAL+ (ASTRA)" ];
then
  package="DIGITAL+ (ASTRA) [TUNNELED SECANAGRA]"
fi
if [ "$package" = "CANAL+ (HISPASAT)" ];
then
  package="DIGITAL+ (HISPASAT) (30W/19E)[ROM180]"
fi
 
#
# Creating caid list for this package
#
        awk -v inprovider="$package"  -F '|' 'BEGIN { listcaid="" }
            /#/ {    next
                }
            // {
                if (index($0,toupper(inprovider)) == 0) next
                caid = substr($0,1,4)
                if (index(listcaid,caid) == 0 ) listcaid = listcaid caid","
                next
                }
            END {
                if (length(listcaid) == 0) result="UNKNOWN"
                else result= substr(listcaid,1,length(listcaid)-1)
            printf "%s\n", result}' provid.list  > listcaid.tmp
            caid=$(cat listcaid.tmp)

Continua fichero 2srvidsatgate.sh...

Salu2...
 

HSA2000

Aprendiendo...
Loco por OpenSPA
Fan de OpenSPA
19 Ene 2013
461
184
0
52
Hola...

Continuacion del fichero 2srvidsatgate.sh:
Código:
#
# Parsing file to retrieve informations
#
        awk -v discaid=$caid -F '>' 'BEGIN {chan = "invalid"}
        /TITLE>Packages:/ {
                    disprov=substr($2,11,length($2)-29)
                    if (length(disprov) == 0) next;
                }
        /color="yellow"/ {
                satpos = substr($4,1,length($4) - 6)
                gsub(/\&deg\;/,"",satpos)
                next
                }
        /title="Id: / {
                chan = substr($3,1,length($3) - 3)
                tvradio = "TV"
                }
        /TD WIDTH="15%"><i/ {
                chan = substr($3,1,length($3) - 3)
                tvradio = "TV"
                }
        /src="\/zap.gif"/ {
                tvradio = "TV"
                }
        /src="\/radio.gif"/ {
                tvradio = "RADIO"
                }         
        /src="\/data.gif"/ {
                tvradio = "DATA"
                }
        /<TD WIDTH="11%">/ {
                category = substr($2,1,length($2) - 4)
                }
        /<TD WIDTH="10%">/ {
                crypto = substr($2,1,length($2) - 4)
                if ( crypto == "Clear") chan = "invalid";
                }
        /colspan=3/ {
                chan = substr($2,1,length($2) - 4)
                }
        /class="s"/ {
                sid = substr($2,1,length($2) - 4)
                if (chan == "invalid") next
                printf "%s:%04X|%s %s|%s|%s|%s|\n",discaid, sid, disprov, satpos, chan, tvradio, category
                chan = "invalid"
                category = ""
                }' ${DATFILE}.${prov} > ${SVCFILE}.${pack}
        echo " ** Done: $package"
        echo "----------------------------------------------"
    done
rm listcaid.tmp
rm provid.list
rm package.tmp
rm srvidsatgate.cfg.tmp
echo " *** New service files are ready now!"

Para poder ejecutarlos debeis ponerlo en una carpeta los dos junto y darles permiso de ejecucion:
Código:
chmod 755 1config.sh
chmod 755 2srvidsatgate.sh

Hay que crear un fichero donde deberemos meter los proveedores que queremos generar los ids y nombre de los canales, esos nombre los sacaremos de la pagina http://en.kingofsat.net/packages.php, por ejemplo:
Código:
vi lista
 
--Contenido del fichero lista---
Canal+ (Astra)
Canal+ (Hispasat)
--------------------------------

Una vez creado el fichero ejecutamos:
Código:
./1config.sh lista

Generaremos un fichero con los proveedores del fichero "lista" y ejecutamos:
Código:
./2srvidsatgate.sh

No generara tantos ficheros con los proveedores que tenga el fichero "lista":
Código:
oscam.srvid.CANAL___ASTRA_
oscam.srvid.CANAL___HISPASAT_

Contenido de los ficheros generados:
Código:
...
0100:6FF4|Canal+ (Astra) 19.2E|Nickelodeon Spain|TV|Children|
0100:6FB8|Canal+ (Astra) 19.2E|MTV Live HD|TV|Music|
0100:6FB9|Canal+ (Astra) 19.2E|MTV Live HD|TV||
0100:1F4C|Canal+ (Astra) 19.2E|MEZZO.|TV||
...

Mi intencion ahora es hacer que actualize automaticamente el fichero oscam.srvid y se pueda ejecutar como un plugin, asin podremos tener siempre actualizado el fichero oscam.srvid cada vez que ejecutemos el script...

Salu2...
 

Adjuntos

  • oscam.svird_Creator.zip
    4,3 KB · Visitas: 14
  • Me gusta
Reactions: Mecha

Mecha

Usuario Destacado
Loco por OpenSPA
Fan de OpenSPA
14 Ene 2010
4.132
819
0
España
y para dejar totalmente productivo el oscam.srvid, una vez lo tengamos actualizado con el metodo descrito por HSA2000 , con un editor de texto,
buscamos todos los: 0100:
y lo reemplazamos todos por: 0100,1810:
asi tendremos los identificadores de los servicios para los dos CAID con los que emite dicha plataforma.

P.D.- seguramente se podrá efectuar este reemplazo con algún comando al final del script.
 

HSA2000

Aprendiendo...
Loco por OpenSPA
Fan de OpenSPA
19 Ene 2013
461
184
0
52
Hola...

Efectivamente Mecha, estoy modificando el script en una segunda version para que actualize directamente el fichero oscam.srvid, guardando el antiguo como oscam.srvid.old por seguridad. Lo que tambien me gustaría es poder ponerlo como plugin para poder ejecutarlo desde los menus del deco, pero por ahora no se como hacerlo, estoy buscando info para eso...

Salu2...
 
  • Me gusta
Reactions: Mecha