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

lib updates #3

Open
wants to merge 24 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@ Temporary Items

# VSCode
/.vscode

#pycharm
/.idea/

/.urlquick.cache/
/venv/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ The information below use the CLI format but you can easily find the correspondi
* **--auto-exploration**:
* Enable the auto exploration mode of the simulator

* **--entry-points STRING**:
* **--entry-point STRING**:
* By default the auto exploration starts from the root menu but you can specify one or more entry points of the addon to start the auto exploration (e.g. 1, 1-2-1, 1-3-4-1)

* **--max-items-per-menu INT**:
Expand Down
Empty file added cache_check
Empty file.
586 changes: 451 additions & 135 deletions config.py

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions configs/7_test_modules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{

"_comment": "Try to load each Python files of the addon to detect errors",

"addon_path": "../plugin.video.catchuptvandmore",
"test_modules": true
}
24 changes: 24 additions & 0 deletions configs/8_live_tv_fr_urls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{

"_comment": "Open each FR live TV URL",

"addon_path": "../plugin.video.catchuptvandmore",
"entry_point": "1-1-1",
"exit_after_x_errors": 5,
"disable_video_player": true,
"kodi_version": "MATRIX",
"print_all_explored_items": true,
"disable_image_check": true,
"autoreload_addon": false,

"kodi_log_level": "debug",
"disable_xbmcaddon_mock_log": false,
"disable_xbmc_mock_log": false,

"auto_exploration": true,
"max_items_per_menu": -1,
"wait_time": 0.0,
"max_items_to_explore": -1,
"exploration_strategy": "FIRST",
"max_depth": 2
}
5 changes: 5 additions & 0 deletions configs/pickle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"_comment": "Pickle test",
"addon_path": "c:\\Users\\user\\AppData\\Roaming\\Kodi\\addons\\plugin.video.catchuptvandmore\\",
"pickle": "plugin://plugin.video.catchuptvandmore/resources/lib/channels/fr/6play/get_video_url/?_pickle_=80049551000000000000007d94288c075f7469746c655f948c15c3897069736f64652031202d205061727469652031948c076974656d5f6964948c026d36948c08766964656f5f6964948c0d636c69705f313239353931363294752e"
}
3 changes: 3 additions & 0 deletions fake_userdata/menus_settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}
141 changes: 99 additions & 42 deletions libs/fake_xbmc_modules/xbmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

log_ = CustomLogger(__name__)

if Config.get('disable_xbmc_mock_log'):
log_.set_log_level('ERROR')
if Config.get("disable_xbmc_mock_log"):
log_.set_log_level("ERROR")

LOGDEBUG = 0
LOGINFO = 1
Expand All @@ -20,31 +20,84 @@


levelno_dict = {
0: 'debug',
1: 'info',
2: 'notice',
3: 'warning',
4: 'error',
5: 'severe',
6: 'fatal',
7: 'none'
0: "debug",
1: "info",
2: "notice",
3: "warning",
4: "error",
5: "severe",
6: "fatal",
7: "none",
}

levelstr_dict = {
'debug': 0,
'info': 1,
'notice': 2,
'warning': 3,
'error': 4,
'severe': 5,
'fatal': 6,
'none': 6
"debug": 0,
"info": 1,
"notice": 2,
"warning": 3,
"error": 4,
"severe": 5,
"fatal": 6,
"none": 6,
}


def executeJSONRPC(jsonrpccommand: str) -> str:
"""
Execute an JSONRPC command.

:param jsonrpccommand: string - jsonrpc command to execute.
:return: jsonrpc return string

List of commands -Example::

..
response = xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "method": "JSONRPC.Introspect", "id": 1 }')
..
"""
if jsonrpccommand == ('{"method": "Settings.GetSettingValue", "params": {"setting": "network.usehttpproxy"}, '
'"id": 0, "jsonrpc": "2.0"}'):
return """
{
"result": {
"value": false
}
}
"""

return """
{
"result": {}
}
"""


def getCondVisibility(condition: str) -> bool:
"""
Get visibility conditions

:param condition: string - condition to check
:return: True (1) or False (0) as a bool

List of Conditions -http://kodi.wiki/view/List_of_Boolean_Conditions

.. note::
You can combine two (or more) of the above settings by
using ``+`` as an AND operator, ``|`` as an OR operator, ``!``
as a NOT operator, and ``[`` and ``]`` to bracket expressions.

Example::

..
visible = xbmc.getCondVisibility('[Control.IsVisible(41) + !Control.IsVisible(12)]')
..
"""
return True


def log(msg, level=LOGDEBUG):
if level >= levelstr_dict.get(Config.get('kodi_log_level'), 0):
log_.info('[{} level] {}'.format(levelno_dict.get(level, 'unknown'), msg))
if level >= levelstr_dict.get(Config.get("kodi_log_level"), 0):
log_.info("[{} level] {}".format(levelno_dict.get(level, "unknown"), msg))
RuntimeErrorCQ.last_error_message += msg
pass

Expand All @@ -54,20 +107,26 @@ def translatePath(path):


def getInfoLabel(id_):
if id_ == 'System.BuildVersion':
if Config.get('kodi_version') == 'JARVIS':
return '16.3 fakefakefakefakefake'
if Config.get('kodi_version') == 'KRYPTON':
return '17.5 fakefakefakefakefake'
if Config.get('kodi_version') == 'LEIA':
return '18.0 fakefakefakefakefake'
return ''
if id_ == "System.BuildVersion":
if Config.get("kodi_version") == "JARVIS":
return "16.3 fakefakefakefakefake"
if Config.get("kodi_version") == "KRYPTON":
return "17.5 fakefakefakefakefake"
if Config.get("kodi_version") == "LEIA":
return "18.0 fakefakefakefakefake"
if Config.get("kodi_version") == "MATRIX":
return "19.0 fakefakefakefakefake"
if Config.get("kodi_version") == "NEXUS":
return "20.2 fakefakefakefakefake"
if Config.get("kodi_version") == "OMEGA":
return "21.0 fakefakefakefakefake"
return ""


def getLocalizedString(id_):
result = str(id_)
if id_ in Config.get('xbmc_labels'):
result = Config.get('xbmc_labels')[id_]
if id_ in Config.get("xbmc_labels"):
result = Config.get("xbmc_labels")[id_]
log_.debug('getLocalizedString of "{}" --> "{}"'.format(id_, result))
return result

Expand All @@ -80,7 +139,7 @@ def doModal(self, autoclose=0):
pass

def getText(self):
if Config.get('auto_exploration'):
if Config.get("auto_exploration"):
return "Chien"
else:
entry = input("Kodi keyboard entry: ")
Expand All @@ -91,35 +150,34 @@ def isConfirmed(self):


class PlayList(object):

def __init__(self, playList):
# type: (int) -> None
pass

def getPlayListId(self):
return 0

def add(self, url, listitem=None, index=-1):
pass

def load(self, filename):
return True

def remove(self, filename):
pass

def clear(self):
pass

def size(self):
return 0

def shuffle(self):
pass

def unshuffle(self):
pass

def getposition(self):
return 0

Expand Down Expand Up @@ -148,4 +206,3 @@ def getposition(self):
TRAY_CLOSED_MEDIA_PRESENT = 96
TRAY_CLOSED_NO_MEDIA = 64
TRAY_OPEN = 16

25 changes: 19 additions & 6 deletions libs/fake_xbmc_modules/xbmcaddon.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,51 @@
'plugin.video.catchuptvandmore': Config.get('addon_settings'),
'script.module.codequick': Config.get('codequick_fake_settings'),
'script.module.inputstreamhelper': Config.get('inputstreamhelper_fake_settings'),
'script.module.youtube.dl': Config.get('youtubedl_fake_settings')
'script.module.youtube.dl': Config.get('youtubedl_fake_settings'),
'inputstream.adaptive': Config.get('addon_settings')
}


ADDONS_LABELS = {
'plugin.video.catchuptvandmore': Config.get('addon_labels'),
'script.module.codequick': Config.get('codequick_labels'),
'script.module.inputstreamhelper': Config.get('inputstreamhelper_labels'),
'script.module.youtube.dl': Config.get('youtubedl_labels')
'script.module.youtube.dl': Config.get('youtubedl_labels'),
'inputstream.adaptive': Config.get('addon_labels')
}


ADDONS_NAMES = {
'plugin.video.catchuptvandmore': 'Catch-up TV & More',
'script.module.codequick': 'CodeQuick',
'script.module.inputstreamhelper': 'InputStream Helper',
'script.module.youtube.dl': 'Youtube-dl'
'script.module.youtube.dl': 'Youtube-dl',
'inputstream.adaptive': 'inputstream.adaptive'
}


ADDONS_PATHS = {
'plugin.video.catchuptvandmore': Config.get('addon_path'),
'script.module.codequick': Config.get('codequick_addon_path'),
'script.module.inputstreamhelper': Config.get('inputstreamhelper_addon_path'),
'script.module.youtube.dl': Config.get('youtubedl_addon_path')
'script.module.youtube.dl': Config.get('youtubedl_addon_path'),
'inputstream.adaptive': Config.get('addon_path')
}

ADDONS_FANARTS = {
'plugin.video.catchuptvandmore': Config.get('addon_fanart_filepath'),
'script.module.codequick': Config.get('codequick_fanart_filepath'),
'script.module.inputstreamhelper': Config.get('inputstreamhelper_fanart_filepath'),
'script.module.youtube.dl': Config.get('youtubedl_fanart_filepath')
'script.module.youtube.dl': Config.get('youtubedl_fanart_filepath'),
'inputstream.adaptive': Config.get('addon_fanart_filepath')
}

ADDONS_ICONS = {
'plugin.video.catchuptvandmore': Config.get('addon_icon_filepath'),
'script.module.codequick': Config.get('codequick_icon_filepath'),
'script.module.inputstreamhelper': Config.get('inputstreamhelper_icon_filepath'),
'script.module.youtube.dl': Config.get('youtubedl_icon_filepath')
'script.module.youtube.dl': Config.get('youtubedl_icon_filepath'),
'inputstream.adaptive': Config.get('addon_icon_filepath')
}


Expand Down Expand Up @@ -95,6 +101,13 @@ def getSetting(self, setting_id):
log.debug('getSetting of "{}" --> "{}"'.format(setting_id, self._settings.get(setting_id)))
return self._settings.get(setting_id, '')

def getSettingBool(self, setting_id):
if setting_id not in self._settings:
log.error('Missing setting_id "{}" in {} settings (config.py)'.format(setting_id, self._id))
exit(-1)
log.debug('getSetting of "{}" --> "{}"'.format(setting_id, self._settings.get(setting_id)))
return self._settings.get(bool(setting_id), '')

def setSetting(self, _id, value):
log.debug('setSetting of "{}" --> "{}"'.format(_id, value))
self._settings[_id] = value
Expand Down
9 changes: 8 additions & 1 deletion libs/fake_xbmc_modules/xbmcgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
class Window(object):
def __init__(self, existingWindowId=-1):
# type: (int) -> None
self.dict = {}
self.dict = {
'cutv_labels__labels': None
}

def setProperty(self, key, value):
self.dict[key] = value
Expand Down Expand Up @@ -142,6 +144,11 @@ def iscanceled(self):
return True


class DialogProgressBG(object):
def __init__(self):
pass


# INT_MAX = sys.maxint
INT_MAX = 9223372036854775807

Expand Down
Loading