Skip to content

Commit

Permalink
release: v3.18.1
Browse files Browse the repository at this point in the history
  • Loading branch information
newt-sc committed Oct 15, 2024
1 parent a747112 commit 182235d
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* [v3.18.1](https://github.com/newt-sc/a4kSubtitles/releases/tag/service.subtitles.a4ksubtitles%2Fservice.subtitles.a4ksubtitles-3.18.1):
* Fix IMDB ID not found

* [v3.18.0](https://github.com/newt-sc/a4kSubtitles/releases/tag/service.subtitles.a4ksubtitles%2Fservice.subtitles.a4ksubtitles-3.18.0):
* Use the newer InfoTagVideo KODI API (contributed by @kiamvdd)

Expand Down
12 changes: 8 additions & 4 deletions a4kSubtitles/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, mocks=None):
os.environ[api_mode_env_name] = json.dumps(api_mode)
self.core = importlib.import_module('a4kSubtitles.core')

def __mock_video_meta(self, meta={}):
def __mock_video_meta(self, meta):
def get_info_label(label):
if label == 'System.BuildVersionCode':
return meta.get('version', '19.1.0')
Expand Down Expand Up @@ -78,13 +78,17 @@ def restore():
self.core.kodi.addon.getSetting = default
return restore

def search(self, params, settings={}, video_meta={}):
def search(self, params, settings=None, video_meta=None):
restore_settings = None
restore_video_meta = None

try:
restore_settings = self.mock_settings(settings)
restore_video_meta = self.__mock_video_meta(video_meta)
if settings is not None:
restore_settings = self.mock_settings(settings)

if video_meta is not None:
restore_video_meta = self.__mock_video_meta(video_meta)

return self.core.search(self.core, params)
finally:
if restore_settings:
Expand Down
10 changes: 9 additions & 1 deletion a4kSubtitles/lib/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ def __update_info_from_imdb(core, meta, pagination_token=''):

def __get_basic_info(core):
meta = utils.DictAsObject({})
filename_and_path = ''

if core.kodi.get_version_major() >= 20: # The InfoTagVideo API was added in kodi v20
video_info = xbmc.Player().getVideoInfoTag()
Expand All @@ -311,17 +312,24 @@ def __get_basic_info(core):

meta.imdb_id = video_info.getUniqueID('imdb')
filename_and_path = video_info.getFilenameAndPath()
else:

if not meta.year:
meta.year = xbmc.getInfoLabel('VideoPlayer.Year')
if not meta.season:
meta.season = xbmc.getInfoLabel('VideoPlayer.Season')
if not meta.episode:
meta.episode = xbmc.getInfoLabel('VideoPlayer.Episode')
if not meta.tvshow:
meta.tvshow = xbmc.getInfoLabel('VideoPlayer.TVShowTitle')

if not meta.title:
meta.title = xbmc.getInfoLabel('VideoPlayer.OriginalTitle')
if meta.title == '':
meta.title = xbmc.getInfoLabel('VideoPlayer.Title')

if not meta.imdb_id:
meta.imdb_id = xbmc.getInfoLabel('VideoPlayer.IMDBNumber')
if not filename_and_path:
filename_and_path = xbmc.getInfoLabel('Player.FilenameAndPath')

meta.tvshow_year = ''
Expand Down
5 changes: 4 additions & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="service.subtitles.a4ksubtitles"
name="a4kSubtitles"
version="3.18.0"
version="3.18.1"
provider-name="Unknown">
<requires>
<import addon="script.module.requests"/>
Expand All @@ -27,6 +27,9 @@ Supports: OpenSubtitles, BSPlayer, Podnadpisi.NET, SubDL, Addic7ed
<screenshot>screenshot-03.png</screenshot>
</assets>
<news>
[v3.18.1]:
* Fix IMDB ID not found

[v3.18.0]:
* Use the newer InfoTagVideo KODI API (contributed by @kiamvdd)

Expand Down
5 changes: 4 additions & 1 deletion packages/addons.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<addons>
<addon id="service.subtitles.a4ksubtitles"
name="a4kSubtitles"
version="3.18.0"
version="3.18.1"
provider-name="Unknown">
<requires>
<import addon="script.module.requests"/>
Expand All @@ -30,6 +30,9 @@ Supports: OpenSubtitles, BSPlayer, Podnadpisi.NET, SubDL, Addic7ed
<screenshot>screenshot-03.png</screenshot>
</assets>
<news>
[v3.18.1]:
* Fix IMDB ID not found

[v3.18.0]:
* Use the newer InfoTagVideo KODI API (contributed by @kiamvdd)

Expand Down
2 changes: 1 addition & 1 deletion packages/addons.xml.crc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
988edaac8ac1382f3e7d9936d7639aed9cb23d71
f25ab410db7f2fa919a10fba60723f58f8742576
2 changes: 1 addition & 1 deletion tests/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def test_search_missing_imdb_id():
'languages': 'English',
'preferredlanguage': '',
}
a4ksubtitles_api.search(params)
a4ksubtitles_api.search(params, {}, {})

log_error_spy.restore()
log_error_spy.called_with('missing imdb id!')
Expand Down

0 comments on commit 182235d

Please sign in to comment.