2020-03-19 16:45:31 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
""" Addon code """
|
|
|
|
|
|
|
|
from __future__ import absolute_import, division, unicode_literals
|
|
|
|
|
2020-03-22 15:37:15 +01:00
|
|
|
import logging
|
|
|
|
|
2020-03-19 16:45:31 +01:00
|
|
|
from routing import Plugin
|
|
|
|
|
|
|
|
from resources.lib import kodilogging
|
|
|
|
|
|
|
|
kodilogging.config()
|
2020-03-25 08:08:15 +01:00
|
|
|
routing = Plugin() # pylint: disable=invalid-name
|
2020-03-22 15:37:15 +01:00
|
|
|
_LOGGER = logging.getLogger('addon')
|
2020-03-19 16:45:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
@routing.route('/')
|
|
|
|
def show_main_menu():
|
|
|
|
""" Show the main menu """
|
|
|
|
from resources.lib.modules.menu import Menu
|
|
|
|
Menu().show_mainmenu()
|
|
|
|
|
|
|
|
|
|
|
|
@routing.route('/channels')
|
|
|
|
def show_channels():
|
|
|
|
""" Shows Live TV channels """
|
|
|
|
from resources.lib.modules.channels import Channels
|
|
|
|
Channels().show_channels()
|
|
|
|
|
|
|
|
|
|
|
|
@routing.route('/channels/<channel>')
|
|
|
|
def show_channel_menu(channel):
|
|
|
|
""" Shows Live TV channels """
|
|
|
|
from resources.lib.modules.channels import Channels
|
|
|
|
Channels().show_channel_menu(channel)
|
|
|
|
|
|
|
|
|
|
|
|
@routing.route('/tvguide/channel/<channel>')
|
|
|
|
def show_tvguide_channel(channel):
|
|
|
|
""" Shows the dates in the tv guide """
|
|
|
|
from resources.lib.modules.tvguide import TvGuide
|
|
|
|
TvGuide().show_tvguide_channel(channel)
|
|
|
|
|
|
|
|
|
|
|
|
@routing.route('/tvguide/channel/<channel>/<date>')
|
|
|
|
def show_tvguide_detail(channel=None, date=None):
|
|
|
|
""" Shows the programs of a specific date in the tv guide """
|
|
|
|
from resources.lib.modules.tvguide import TvGuide
|
|
|
|
TvGuide().show_tvguide_detail(channel, date)
|
|
|
|
|
|
|
|
|
|
|
|
@routing.route('/catalog')
|
|
|
|
def show_catalog():
|
|
|
|
""" Show the catalog """
|
|
|
|
from resources.lib.modules.catalog import Catalog
|
|
|
|
Catalog().show_catalog()
|
|
|
|
|
|
|
|
|
|
|
|
@routing.route('/catalog/by-channel/<channel>')
|
|
|
|
def show_catalog_channel(channel):
|
|
|
|
""" Show a category in the catalog """
|
|
|
|
from resources.lib.modules.catalog import Catalog
|
|
|
|
Catalog().show_catalog_channel(channel)
|
|
|
|
|
|
|
|
|
|
|
|
@routing.route('/catalog/program/<channel>/<program>')
|
|
|
|
def show_catalog_program(channel, program):
|
|
|
|
""" Show a program from the catalog """
|
|
|
|
from resources.lib.modules.catalog import Catalog
|
|
|
|
Catalog().show_program(channel, program)
|
|
|
|
|
|
|
|
|
2020-03-22 15:37:15 +01:00
|
|
|
@routing.route('/catalog/program/<channel>/<program>/<season>')
|
2020-03-19 16:45:31 +01:00
|
|
|
def show_catalog_program_season(channel, program, season):
|
|
|
|
""" Show a program from the catalog """
|
|
|
|
from resources.lib.modules.catalog import Catalog
|
2020-03-22 15:37:15 +01:00
|
|
|
Catalog().show_program_season(channel, program, season)
|
2020-03-19 16:45:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
@routing.route('/search')
|
|
|
|
@routing.route('/search/<query>')
|
|
|
|
def show_search(query=None):
|
|
|
|
""" Shows the search dialog """
|
|
|
|
from resources.lib.modules.search import Search
|
|
|
|
Search().show_search(query)
|
|
|
|
|
|
|
|
|
2020-03-22 15:37:15 +01:00
|
|
|
@routing.route('/play/catalog/<uuid>')
|
|
|
|
def play(uuid):
|
2020-03-19 16:45:31 +01:00
|
|
|
""" Play the requested item """
|
|
|
|
from resources.lib.modules.player import Player
|
2020-03-22 15:37:15 +01:00
|
|
|
Player().play(uuid)
|
2020-03-19 16:45:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
@routing.route('/play/page/<channel>/<page>')
|
|
|
|
def play_from_page(channel, page):
|
|
|
|
""" Play the requested item """
|
|
|
|
try: # Python 3
|
|
|
|
from urllib.parse import unquote
|
|
|
|
except ImportError: # Python 2
|
|
|
|
from urllib import unquote
|
|
|
|
|
|
|
|
from resources.lib.modules.player import Player
|
|
|
|
Player().play_from_page(channel, unquote(page))
|
|
|
|
|
|
|
|
|
2020-03-22 15:37:15 +01:00
|
|
|
@routing.route('/metadata/update')
|
|
|
|
def metadata_update():
|
|
|
|
""" Update the metadata for the listings (called from settings) """
|
|
|
|
from resources.lib.modules.metadata import Metadata
|
|
|
|
Metadata().update()
|
|
|
|
|
|
|
|
|
2020-03-19 16:45:31 +01:00
|
|
|
def run(params):
|
|
|
|
""" Run the routing plugin """
|
|
|
|
routing.run(params)
|