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

[script.extendedinfo] 6.0.9 #2651

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion script.extendedinfo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Example:
- keep Attention to the parameter separators ("&&")


### Rotten Tomatoes
### Rotten Tomatoes (No longer available for Kodi users)

```
RunScript(script.extendedinfo,info=intheatermovies)
Expand Down
4 changes: 2 additions & 2 deletions script.extendedinfo/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.extendedinfo" name="ExtendedInfo Script" version="6.0.7" provider-name="scott967">
<addon id="script.extendedinfo" name="ExtendedInfo Script" version="6.0.9" provider-name="scott967">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="resource.images.studios.white" version="0.0.25"/>
Expand All @@ -24,7 +24,7 @@
<forum>http://forum.kodi.tv/showthread.php?tid=160558</forum>
<source>https://github.com/scott967/script.extendedinfo</source>
<email>[email protected]</email>
<news>Python 3 fixes and Omega/Nexus/Matrix updates by scott967. Original addon for Leia and prior by phil65 (Philipp Temminghoff).</news>
<news>Python 3 fixes and Piers/Omega/Nexus/Matrix updates by scott967. Original addon for Leia and prior by phil65 (Philipp Temminghoff).</news>
<assets>
<icon>resources/icon.png</icon>
<fanart>resources/fanart.jpg</fanart>
Expand Down
24 changes: 23 additions & 1 deletion script.extendedinfo/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
v6.0.9
- language handling improved for tmdb. New language settings for
<lang code>-<country code> used by tmdb
- tmdb art now prioritizes the tmdb language in settings
- fixed a logic error when displaying tvshow info dialog for seasons
- fixed caching of query results in local addon_data
- use "playmedia" instead of "runscript" to launch youtube addon
- fix handling of trakt "airing episodes" using current api
- improve design of LoginProvider class to better manage tmdb user logins
- use f-strings instead of %s or .format() style when modifying code
- add documentation (docstrings and type annotations) when modifying code
- make some functions private as needed
- improve debug level logging- fix handling of JSON responses for various urls
- improve query of video database uniqueid
- fix moviedbbrowser
- fix issue where filters not always removed in Video List dialog
- fix live Youtube videos exception on parsing duration P0D
- fix context menu to update local artwork was not available
- fix skinned dialogs not displaying local poster
- fix issue where favorite status for tmdb items not correctly set/unset
- fix classic keyboard (on screen keyboard) input exceptions

v6.0.7
- reworked tmdb logon / accreditation
- various code refactoring / pylint items / docstrings (WIP)
Expand All @@ -7,7 +29,7 @@ v6.0.5
- removed support for youtube-dl
- renamed all files to lowercase
- various code refactoring to current python 3.8 standards
- remove dependency on kutils (incorporate mdoules within addon)
- remove dependency on kutils (incorporate modules within addon)
- addon.xml bump ver 6.0.5
- add menucontrol to skin files
- add dependency on autocompletion (required due to changes in autocompletion library)
Expand Down
2 changes: 2 additions & 0 deletions script.extendedinfo/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def __init__(self):
"""
utils.log(f"version {addon.VERSION} started")
addon.set_global("extendedinfo_running", "true")
if not addon.bool_setting("setting_update_6.0.9"):
addon.update_lang_setting()
self._parse_argv()
for info in self.infos:
listitems = process.start_info_actions(info, self.params)
Expand Down
2 changes: 2 additions & 0 deletions script.extendedinfo/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def __init__(self):
"""
utils.log(f"plugin version {addon.VERSION} started")
addon.set_global("extendedinfo_running", "true")
if not addon.bool_setting("setting_update_6.0.9"):
addon.update_lang_setting()
self._parse_argv()
for info in self.infos:
listitems = process.start_info_actions(info, self.params)
Expand Down
16 changes: 15 additions & 1 deletion script.extendedinfo/resources/kutil131/busyhandler.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Copyright (C) 2015 - Philipp Temminghoff <[email protected]>
# This program is Free Software see LICENSE file for details
"""_summary_Creates a Busyhandler instance as busyhandler

Returns:
Busyhandler: manage display of "busy" dialog
Note that kutil131 __init__ imports busyhandler as "busy"
"""

import traceback
from functools import wraps
Expand All @@ -15,6 +21,9 @@ class BusyHandler:
Class to deal with busydialog handling
"""
def __init__(self, *args, **kwargs):
"""Initializes the handler with no dialog and enabled
self.busy is the nember of active busy requests
"""
self.busy = 0
self.enabled = True

Expand All @@ -41,6 +50,11 @@ def show_busy(self):
self.busy += 1

def set_progress(self, percent):
"""Not implemented

Args:
percent (int): 0-99 completion
"""
pass

def hide_busy(self):
Expand All @@ -66,7 +80,7 @@ def decorator(cls, *args, **kwargs):
result = func(cls, *args, **kwargs)
except Exception:
utils.log(traceback.format_exc())
utils.notify("Error", "please contact add-on author")
utils.notify("Busy Error", "please contact add-on author")
finally:
self.hide_busy()
return result
Expand Down
39 changes: 21 additions & 18 deletions script.extendedinfo/resources/kutil131/dialogbaselist.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@


class DialogBaseList:
"""
BaseList for MediaBrowsers (handles filtering, sorting)
"""
viewid = {
'WALL 3D' : '67',
'BANNER' : '52',
Expand Down Expand Up @@ -50,12 +53,6 @@ class DialogBaseList:
'Fanart' : '502'
}



"""
BaseList for MediaBrowsers (handles filtering, sorting)
"""

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.search_str = kwargs.get('search_str', "")
Expand Down Expand Up @@ -180,7 +177,7 @@ def open_search(self, control_id):
if addon.bool_setting("classic_search"):
result = xbmcgui.Dialog().input(heading=addon.LANG(16017),
type=xbmcgui.INPUT_ALPHANUM)
if result and result > -1:
if result:
self.search(result)
else:
T9Search(call=self.search,
Expand Down Expand Up @@ -243,12 +240,13 @@ def set_filter_label(self):
build filter label for UI based on active filters
"""
filters = []
self.filter_label = ''
for item in self.filters:
filter_label = item["label"].replace("|", " | ").replace(",", " + ")
filters.append("[COLOR FFAAAAAA]%s:[/COLOR] %s" % (item["typelabel"], filter_label))
filters.append(f"[COLOR FFAAAAAA]{item['typelabel']}:[/COLOR] {filter_label}")
self.filter_label: str = " - ".join(filters)

def update_content(self, force_update=False):
def update_content(self, force_update:bool=False):
"""
fetch listitems and pagination info based on current state
"""
Expand Down Expand Up @@ -333,10 +331,14 @@ def update(self, force_update=False):
self.update_content(force_update=force_update)
self.update_ui()

def choose_sort_method(self, sort_key):
"""
open dialog and let user choose sortmethod
returns True if sorthmethod changed
def choose_sort_method(self, sort_key:str) -> bool:
"""open dialog and let user choose sortmethod

Args:
sort_key (str): enum string for sort options movie/tv/favorites/list/rating

Returns:
bool: True if sorthmethod changed
"""
listitems = list(self.SORTS[sort_key].values())
sort_strings = list(self.SORTS[sort_key].keys())
Expand All @@ -350,12 +352,13 @@ def choose_sort_method(self, sort_key):
self.sort_label = listitems[index]
return True

def choose_filter(self, filter_code, header, options):
def choose_filter(self, filter_code:str, header:int, options:list[tuple]):
"""
open dialog and let user choose filter from *options
filter gets removed in case value is empty
filter_code: filter code from API
options: list of tuples with 2 items each: first is value, second is label
filter_code(str): filter code from API
header(int): strings.po localized index
options(list[tuple]): list of tuples with 2 items each: first is value, second is label
"""
values = [i[0] for i in options]
labels = [i[1] for i in options]
Expand All @@ -379,7 +382,7 @@ def toggle_filter(self, filter_code):
else:
pass # add filter...

def find_filter_position(self, filter_code):
def find_filter_position(self, filter_code:str):
"""
find position of specific filter in filter list
"""
Expand All @@ -388,7 +391,7 @@ def find_filter_position(self, filter_code):
return i
return -1

def remove_filter(self, filter_code):
def remove_filter(self, filter_code:str):
"""
remove filter with specific filter_code from filter list
"""
Expand Down
53 changes: 53 additions & 0 deletions script.extendedinfo/resources/kutil131/kodiaddon.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,49 @@

HOME = xbmcgui.Window(10000)

TMDB_ISO_639 = {"ar-EG": "Arabic-Egy",
"ar-SA": "Arabic-Sau",
"bg-BG": "Bulgarian",
"ca-ES": "Catalan",
"hr-HR": "Croatian",
"cs-CZ": "Czech",
"da-DK": "Danish",
"nl-BE": "Dutch-Bel",
"nl-NL": "Dutch-Nld",
"en-AU": "English-Aus",
"en-CA": "English-Can",
"en-GB": "English-Gbr",
"en-US": "English-Usa",
"fi-FI": "Finnish",
"fr-CA": "French-Can",
"fr-FR": "French-Fra",
"de-DE": "German",
"el-GR": "Greek",
"he-IL": "Hebrew",
"hi-IN": "Hindi",
"hu-HU": "Hungarian",
"ga-IE": "Irish",
"it-IT": "Italian",
"ja-JP": "Japanese",
"kn-IN": "Kannada",
"ko-KR": "Korean",
"zh-CN": "Mandarin-China",
"zh-SG": "Mandarin-Sgp",
"zh-TW": "Mandarin-Twn",
"no-NO": "Norwegian",
"fa-IR": "Persian",
"pl-PL": "Polish",
"pt-BR": "Portuguese-Bra",
"pt-PT": "Portuguese-Por",
"ru-RU": "Russian",
"sl-SL": "Slovenian",
"es-AR": "Spanish-Arg",
"es-ES": "Spanish-Esp",
"es-MX": "Spanish-Mex",
"sv-SE": "Swedish",
"th-TH": "Thai",
"tr-TR": "Turkish"}


class Addon:
"""
Expand Down Expand Up @@ -91,6 +134,16 @@ def set_global(self, setting_name: str, setting_value: str) ->None:
"""
HOME.setProperty(setting_name, setting_value)

def update_lang_setting(self) -> None:
"""updates user settings from old ISO 639-1 to ISO 639-1-ISO 3166
"""
old_lang = self.addon.getSetting("LanguageID")
for lang_key in TMDB_ISO_639:
if lang_key.startswith(old_lang):
self.addon.setSetting("LanguageIDv2", lang_key)
self.addon.setSettingBool("setting_update_6.0.9", True)
break

def get_global(self, setting_name):
return HOME.getProperty(setting_name)

Expand Down
31 changes: 22 additions & 9 deletions script.extendedinfo/resources/kutil131/kodijson.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,31 @@ def get_favourites():
params={"type": None, "properties": ["path", "thumbnail", "window", "windowparameter"]})


def set_art(media_type, art, dbid):
"""
set artwork via json
def set_art(media_type:str, art:dict, dbid:int) -> dict:
"""set artwork via json

Args:
media_type (str): enum Kodi media type for JSON
art (dict): dict of str arttype : str art URL
dbid (int): Kodi media id from dataabase

Returns:
dict: the JSON results from Kodi
"""
return get_json(method="VideoLibrary.Set%sDetails" % media_type,
return get_json(method=f"VideoLibrary.Set{media_type}Details",
params={"art": art,
"%sid" % media_type.lower(): int(dbid)})
f"{media_type.lower()}id": int(dbid)})


def get_json(method, params):
"""
communicate with kodi JSON-RPC
def get_json(method:str, params) -> dict:
"""communicate with kodi JSON-RPC

Args:
method (str): the JSON-RPC method
params (dict): the JSON_RPC params

Returns:
dict: JSON_RPC results
"""
json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "%s", "params": %s, "id": 1}' % (method, json.dumps(params)))
json_query = xbmc.executeJSONRPC(f'{{"jsonrpc": "2.0", "method": "{method}", "params": {json.dumps(params)}, "id": 1}}')
return json.loads(json_query)
25 changes: 22 additions & 3 deletions script.extendedinfo/resources/kutil131/listitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,13 @@ def get_properties(self):
return {k: v for k, v in self._properties.items() if v}

def get_listitem(self) -> xbmcgui.ListItem:
#listitem: xbmcgui.ListItem
"""Creates a Kodi listitem from kutil131 ListItem --
handles setting listitem for Kodi Matrix and post-Matrix methods
(videoInfoTag)

Returns:
xbmcgui.ListItem: the Kodi listitem
"""
listitem = xbmcgui.ListItem(label=str(self.label) if self.label else "",
label2=str(self.label2) if self.label2 else "",
path=self.path)
Expand Down Expand Up @@ -408,7 +414,7 @@ def __repr__(self):

def from_listitem(self, listitem: xbmcgui.ListItem):
"""
xbmcgui listitem -> kutils131 listitem
xbmcgui listitem -> kutil131 listitem
"""
info = listitem.getVideoInfoTag()
self.label = listitem.getLabel()
Expand Down Expand Up @@ -442,7 +448,15 @@ def from_listitem(self, listitem: xbmcgui.ListItem):
"imdbnumber": info.getIMDBNumber(),
"year": info.getYear()}

def update_from_listitem(self, listitem: ListItem):
def update_from_listitem(self, listitem: ListItem) -> VideoItem:
"""Updates a VideoItem from Kodi xbmc.ListItem

Args:
listitem (xbmcgui.ListItem): a Kodi ListItem

Returns:
VideoItem: the kutil131 VideoItem with added info
"""
if not listitem:
return None
super().update_from_listitem(listitem)
Expand All @@ -452,6 +466,11 @@ def update_from_listitem(self, listitem: ListItem):
self.set_cast(listitem.cast)

def get_listitem(self) -> xbmcgui.ListItem:
"""Gets Kodi ListItem and adds video-unique data from VideoItem

Returns:
xbmcgui.ListItem: the Kodi ListItem using new classes for post-Matrix
"""
listitem = super().get_listitem()
#Use listitem for Matrix, Nexus complains so use videoinfo tag setters
if KODI_MATRIX:
Expand Down
Loading
Loading