picon

oscam-picons-converter.py

oscam-picons-converter.py

#####################################
###    Oscam Picons Converter     ###
###         .PNG to .TPL          ###
###      by s3n0 , 2019-2023      ###
###    https://github.com/s3n0    ###
#####################################

=============================================================================
python ./oscam-picons-converter.py <COMMANDS>
=============================================================================

=== ABOUT:

    Python script developed to convert PNG-picons (taken from Enigma2-SKIN)
    to TPL-picons (Oscam-Webif image files, i.e. 'Base64/template' file format).

    The algorithm processes all found PNG-picons belonging to Enigma2-SKIN.
    This means that all necessary .PNG files must exist in the SKIN picon directory.

    The TPL-picon file name consists of 'IC_<CAID>_<SID>.tpl' so therefore
    it is necessary to create a table of all CAID:SID as the first.

    I also recommend using the CAID filter, i.e. argument '-c CAIDs' in the case of argument '-a',
    to avoid very many TPL-picons belonging to all existing CAIDs in the Enigma2.

=== COMMANDS:

    ---------------------------------------------------------
    Method of creating table SID:CAIDs (choose it carefully):
    ---------------------------------------------------------

-1  
    make a table from all available SID:CAIDs in the 'oscam.srvid' file
        '-c CAIDs' argument is not necessary, but it may be used (as a filter)
        may be used in combination with '-2'

-2
    make a table from all available SID:CAIDs in the 'oscam.srvid2' file
        '-c CAIDs' argument is not necessary, but it may be used (as a filter)
        may be used in combination with '-1'
        
        A NOTE:  the 'oscam.srvid2' file especially may also contain FTA channels with CAID = FFFE,
                 which could also be included as TPL-picons, automatically in the generated table of CAIDs

    --------------------------------------
    USE THE -a OR USE THE -l ARGUMENT ONLY
    --------------------------------------

-a  
    make a table of SIDs obtained from all '*.PNG' files (from SKIN-picon directory),
    in this case there are no CAIDs,
    so the user-determined CAIDs will be added
        '-c CAIDs' argument is necessary ! to specify the user's own CAIDs !
        '-1' and '-2' arguments will be ignored here

-l "PROVIDER NAME 1[, PROVIDER NAME 2, ...]"
    
    make a table of SIDs obtained from all '*.PNG' files (from SKIN-picon directory),
    but according to the DVB-provider name, found in the `lamedb` file
        "PROVIDER-NAME" = the name(s) of your DVB-provider in quotation marks, separated by commas,
                          for example:  -l "SKY DE,M7 Group,Polsat"
        '-c CAIDs' argument is necessary ! to specify the user's own CAIDs ! 
                   because the `lamedb` file, unfortunately, does not always contain CAIDs
        '-1' and '-2' arguments will be ignored here

    -----------------------------------------------------------------------------------------
    Filtering or determining of CAIDs (important, in the case of the argument '-a' and '-l'):
    -----------------------------------------------------------------------------------------

-c CAID[,CAID,...]

     user-determined CAIDs separated by a comma (specifying user-defined CAIDs)
   --OR--
     filtered CAIDs - selecting the only required CAIDs what will retrieved from '.srvid' and/or '.srvid2' file
        
   --WARNING--
     if you do not specify the argument '-c' in the case of '-1' and '-2' arguments,
     then all found CAIDs will be used ! beware of the large number of CAIDs (TPL files) !

+++++++++++++++++++
Optional arguments:
+++++++++++++++++++

-o <PATH>   path to the Oscam cfg-directory, if the script did not find the Oscam cfg-directory automatically
-p <PATH>   path to the SKIN-picon directory, if the default '/usr/share/enigma2/picon' directory was not found
-q          higher quality TPL-image processing with antialiasing filter (higher quality means a larger .tpl file size!)
-d          delete the whole TPL-directory before processing

=== RECOMMENDED USAGE:

python ./oscam-picons-converter.py -d -a -c <all_your_CAIDs_with_FFFE_included>
python ./oscam-picons-converter.py -d -a -c <all_your_CAIDs_with_FFFE_included> -p <SKIN-PICON-DIRECTORY>

=== EXAMPLES:

python ./oscam-picons-converter.py -a -c 0624 -p /media/hdd/picon
python ./oscam-picons-converter.py -a -c 0624,0D96,FFFE -d
python ./oscam-picons-converter.py -1 -c 0624,0D96,FFFE -p /mnt/autofs/nas/picon
python ./oscam-picons-converter.py -1 -2 -q -p /media/mmc/picon
python ./oscam-picons-converter.py -1 -d
python ./oscam-picons-converter.py -2 -q -o /mnt/nas/oscamcfg -p /mnt/nas/picon
python ./oscam-picons-converter.py -d -q -a -c 0624,0D96,FFFE
python ./oscam-picons-converter.py -l "M7 Group, Towercom" -c 0624,0D96,FFFE

=============================================================================