Editor de canale in Py, e un punct de pornire:
K1 Plus S2/T2 Editor
The general idea:
in absence of a channel editor provided by the Vigica box vendor or S805 chip maker I've written some scripts, using the Python language that is available in different Operating Systems, to make it possible to compose channel lists on the computer.
The idea is to use the file editor that your OS provides to do the work.
The script 'decompose-mw-s1.py' will fill a folder 'services_all' with files on basis of the mw-s1 file that resulted from the raw scanning of all satellites of interest to you.
One file per service.
You can then make a number of folders, one folder per satellite, and drop wanted services into those new folders by copying or moving services from the services_all folder.
The order in which the services will appear in your new channel list can be influenced by editing of the number in the beginning of the file names.
For details see below.
Edit the 'compose-mw-s1.py' script such that it will use the folders that you created to get the services that should be in the new channel list.
The compose script will create a new mw-s1 file called dvb_s_mw_s1_new that, after renaming it, should take the place of the one with the raw scan of services.
Then the complete set of files can be imported back into the Vigica box.
Before any work is done:
1. Back up all mw_xxx files
2. Make the satellite and transponder settings the way you want and need, using the set-top-box.
3. Do a blind scan for selected satellites that you are interested in.
4. Note that deselecting a satellite deletes all service definitions for that satellite!
5. Any new service listing mw_s1 you create will have to be combined with that particular mw_st1 file that was used to do the blind scan.
(mw_s1 does not contain absolute references to satellites and transponders; only indices, i.e. relative references)
The decompose-mw-s1 Python script makes a file per service in the 'services_all' directory.
The scripts gives each file a name that is formed as follows
'R/TV/U ~ n ~ servicename ~ E0 ~ Nn ~ Pn'
R/TV/U: Radio, TV, or Unknown type of service
n: count given from first service found in order of the blind scan [decimal]
servicename: a name derived from the service name found in the record and adapted to be fit for use in a file path name. Can be edited if the E0 flag is set E1.
E0: a flag string. When composing the new channel list can be edited by you.
E0 means service name not to be edited: use the service name in the record as found in the scan
E1 means change the service name: use the string between the second and third '~' as a new service name.
Nn: networkID i.e. nid found in the record. Sometimes the same service is found on a satellite but via different networks [decimal].
Only given to make keeping apart the same services via different providers easier.
Pn: the preference setting found in the record [decimal representation of a bit pattern]. Can be edited by you for the new channel list.
To try the decompose-mw-s1.py script put the mw_s1 data file from your box in the directory where the script resides and run it on a PC that has Python installed.
Rename is to dvb_s_mw_s1 , which is the same file but found under that name when you have access to the OS of the set-top-box.
Alternatively in the decompose script change the input file name to mw_s1.
Creation of a new channel list is done by creation of folders that may represent grouping by satellite and/or by preference.
Wanted channels can be copied from the services_all folder to those custom folders using the OS's file management program.
Inside these folders the order of the services in the new list can be determined by editing the n in the file names.
Not the absolute value of n is important but the relative value. The lowest n will be channel 1 for that folder.
The order in which inside each directory a scan is done for files is naturally sorted, not alphabetically.
TV-20~name... comes before
If there would be only these two, the TV-20~name... will be channel 1 and the TV-1000~name... will be channel 2
EDITING OF THE SERVICE NAME
Current firmware of the Vigica C100S contains a bug that causes the service names given by the satellite operators not to show up correctly when they contain characters outside the basic ASCII range. Of course a hex editor can be used to change individual records. But with some limitations also your file management program can be used.
Change the ~E0~ into ~E1~ in the file name. The compose script will see this flag and will use as a new service name the text in the filename between the second ~ and third ~.
Most file systems and file managers allow UTF-8 characters in filenames, so character from many languages are at your dipsosal.
The limitations stem from the fact that your OS will not accept certain characters as part of a file name.
< > : " / \ | ? * are not allowed. The decompose script puts % signs where it encountered characters that are not allowed in file names. It is also not advisable to have spaces in a filename. To alllow spaces to be in the new service name a character _ (underscore) will be interpreted to mean a space when ~E1~ is set.
The ~ character is not to be used either as it is aplied here to mark start and ending of the name string.
If you want an _ (underscore) in the service name you can put two consecutive ones, __, in the filename. This will produce one _ in the name inside the new listing.
The file name given to a service record will end with ~P and a number. During composition of a new channel list this number will be used to set preferences.
A service can have up to 10 preference groups to which it belongs. 0, zero, means no preference set.
The wanted preference setting follows from a calculation as follows
Add up the values for those preferences you want and make that the file name ending.
The compose script will interpret the given value after the last '~P' in the filename and change the record before adding it to the new list.
E.g. a ~P5 or ~P05 ending of the file name will make the service having preferences 1 and 3.
In the compose-mw-s1 script the names have to be entered, using an editor, of the custom directories from which you want the services being collected.
Keep the directories that will be scanned clean; only wanted and correct records should be in them.
The compose-mw-s1 script does no checks and just concatenates everything it finds in sorted order and adds the right file header to the resulting total.
The script produces a file called dvb_s_mw_s1_new ; this name choice can be set in the script, using an editor.
The crc-32-mpeg checksum gets calculated using the pycrc.py package, just very slightly modified to eliminate an utf-8 check that throws an error.
(the records contain random bytes and hence do not allow to be utf-8 interpreted)
All credits to the makers of pycrc.py for having added the mpeg variety of that checksum to their package! pycrc.py is distributed under MIT license.
the new service list can be installed as mw_s1 using a SD card in combination with the other mw_xxx files, or as dvb_s_mw_s1 using a file transfer program directly into /data/data/th.dtv followed by a restart of the th.dtv app.