Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add params for refresh #95

Open
ChomArStudio opened this issue Jun 4, 2021 · 0 comments
Open

Add params for refresh #95

ChomArStudio opened this issue Jun 4, 2021 · 0 comments

Comments

@ChomArStudio
Copy link

ChomArStudio commented Jun 4, 2021

in module addon.py:
add param "refresh_addon_id" for method refresh in Addon class
and change in body method :`

        # Fetch channels
        if refresh_addon_id and refresh_addon_id == addon.addon_id:
            data = addon.get_channels()
            addon.save_data('.channels.cache', data)
        else:
            data = addon.read_data('.channels.cache')

        channels.append(dict(
            addon_id=addon.addon_id,
            addon_name=kodiutils.addon_name(addon.addon_obj),
            channels=data,
        ))

[...]

        # Fetch EPG
        if refresh_id and refresh_id == addon.addon_id:
            data = addon.get_epg()
            addon.save_data('.epg.cache', data)
        else:
            data = addon.read_data('.epg.cache')
            
        epg.append(data)

`

in module funcions.py
add params: "addon_id", "show_progress", "open_settings" for funcion refresh:
and change body funcion to:`

def refresh(addon_id=None, show_progress=False, open_settings=False):
    Addon.refresh(addon_id, show_progress)
    if open_settings:
        kodiutils.open_settings()

`
add to body funcion run:

`

    params = {}
    if len(args) > 2:
        params['addon_id'] = args[2]
    if len(args) > 3:
        if 'show_progress' in args: params['show_progress'] = True
        if 'open_settings' in args: params['open_settings'] = True
    function_map.get(function)(**params)

`

and change setting in settings.xml
from:
`

    <setting label="30803" type="action" action="RunScript(service.iptv.manager,refresh)"/> <!-- Force refresh now -->

to

    <setting label="30803" type="action" action="RunScript(service.iptv.manager,refresh,,show_progress,open_settings)"/> <!-- Force refresh now -->

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant