bebo-dot-dev / m3u-epg-editor

a python m3u / epg optimizer
120 stars 27 forks source link

Allow use of external config file #12

Closed timhobbs closed 6 years ago

timhobbs commented 6 years ago

I realize that you can set up a script to enter the args, but if you get some complex combos of groups and channels it could get a bit hairy. It would be nice to have a JSON (or whatever) config file that could contain the values for the args.

bebo-dot-dev commented 6 years ago

Hi Tim, that's a feature I've been thinking about for a while. JSON is probably a good call. If you've got any thoughts what the file might look like, please attach an example here. I'm away at the moment but I'll take a look asap when I return.

timhobbs commented 6 years ago

Sure. Assuming a breakdown of the example:

$ python ./m3u-epg-editor.py 
-m="http://xxx.xxx.xxx/vget?username=<USERNAME>&password=<PASSWORD>&format=ts" 
-e="http://xxx.xxx/p2.xml.gz" 
-g="'sports','premium movies'" 
-c="'willow hd','bein sports espanol hd'" 
-s="'sky cinema drama hd','sky cinema comedy hd','sky cinema villians hd','sky cinema premiere hd','sky cinema sci-fi & horror hd','sky cinema thriller hd','sky cinema select hd','sky cinema family hd','sky cinema disney hd'" 
-r=12 
-d="/home/target_directory" 
-f="output_file"

Also including the other args, I'd say something like this makes sense:

{
    m3uurl: 'http://xxx.xxx.xxx/vget?username=<USERNAME>&password=<PASSWORD>&format=ts',
    epgurl: 'http://xxx.xxx/p2.xml.gz',
    groups: ['sports','premium movies'],
    channels: ['willow hd','bein sports espanol hd'],
    range: 12,
    sortchannels: [
        'sky cinema drama hd',
        'sky cinema comedy hd',
        'sky cinema villians hd',
        'sky cinema premiere hd',
        'sky cinema sci-fi & horror hd',
        'sky cinema thriller hd',
        'sky cinema select hd',
        'sky cinema family hd',
        'sky cinema disney hd'
    ],
    tvh_offset: 0,
    outdirectory: '/home/target_directory',
    outfilename: 'output_file'
}

It sticks to your current args format and you could probably make it fit very easily into the logic you've already got in place.

Honestly I have not yet used your script as I am still kicking around what my options may be, but it looks very cool and having something like this would be the cherry on top.

I'm not a python guy otherwise I'd have just submitted a PR, but if push came to shove I could probably work it out.

bebo-dot-dev commented 6 years ago

I finally got around to taking a stab at this. There is a new --json_cfg /-j argument that has been introduced that can be used to describe a file path to a JSON configuration file that looks like: https://github.com/jjssoftware/m3u-epg-editor/blob/master/sample_input_args.json

I've updated the readme with a new "Supplying arguments via a JSON configuration file" section.

Please feel free to test / let me know if you see any issues.

Many thanks