Skip to content

Commit

Permalink
release: v2.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
newt-sc committed Jun 22, 2021
1 parent 3c91762 commit b0ff63f
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 7 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
* [v2.7.0](https://github.com/newt-sc/a4kSubtitles/releases/tag/service.subtitles.a4ksubtitles%2Fservice.subtitles.a4ksubtitles-2.7.0):
* Support tvshow imdb id, along with season and episode passed from video file url.

* [v2.6.0](https://github.com/newt-sc/a4kSubtitles/releases/tag/service.subtitles.a4ksubtitles%2Fservice.subtitles.a4ksubtitles-2.6.0):
* Support imdb id passed from video file url.
* Support imdb id (movie or episode) passed from video file url.

* [v2.5.0](https://github.com/newt-sc/a4kSubtitles/releases/tag/service.subtitles.a4ksubtitles%2Fservice.subtitles.a4ksubtitles-2.5.0):
* Add TLS adapter fallback
Expand Down
13 changes: 12 additions & 1 deletion a4kSubtitles/lib/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,22 @@ def __get_basic_info():
meta.filename_without_ext = meta.filename
meta.imdb_id = xbmc.getInfoLabel('VideoPlayer.IMDBNumber')

filename_and_path = xbmc.getInfoLabel('Player.FilenameAndPath')
if meta.imdb_id == '':
regex_result = re.search(r'.*(tt\d{7,}).*', xbmc.getInfoLabel('Player.FilenameAndPath'), re.IGNORECASE)
regex_result = re.search(r'.*(tt\d{7,}).*', filename_and_path, re.IGNORECASE)
if regex_result:
meta.imdb_id = regex_result.group(1)

if meta.season == '':
regex_result = re.search(r'.*season=(\d{1,}).*', filename_and_path, re.IGNORECASE)
if regex_result:
meta.season = regex_result.group(1)

if meta.episode == '':
regex_result = re.search(r'.*episode=(\d{1,}).*', filename_and_path, re.IGNORECASE)
if regex_result:
meta.episode = regex_result.group(1)

return meta

def get_meta(core):
Expand Down
7 changes: 5 additions & 2 deletions 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="2.6.0"
version="2.7.0"
provider-name="Unknown">
<requires>
<import addon="script.module.requests"/>
Expand All @@ -27,8 +27,11 @@ Supports: OpenSubtitles, BSPlayer, Podnadpisi.NET, Subscene, Addic7ed
<screenshot>screenshot-03.png</screenshot>
</assets>
<news>
[v2.7.0]:
* Support tvshow imdb id, along with season and episode passed from video file url.

[v2.6.0]:
* Support imdb id passed from video file url.
* Support imdb id (movie or episode) passed from video file url.

[v2.5.0]:
* Add TLS adapter fallback
Expand Down
7 changes: 5 additions & 2 deletions 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="2.6.0"
version="2.7.0"
provider-name="Unknown">
<requires>
<import addon="script.module.requests"/>
Expand All @@ -30,8 +30,11 @@ Supports: OpenSubtitles, BSPlayer, Podnadpisi.NET, Subscene, Addic7ed
<screenshot>screenshot-03.png</screenshot>
</assets>
<news>
[v2.7.0]:
* Support tvshow imdb id, along with season and episode passed from video file url.

[v2.6.0]:
* Support imdb id passed from video file url.
* Support imdb id (movie or episode) passed from video file url.

[v2.5.0]:
* Add TLS adapter fallback
Expand Down
2 changes: 1 addition & 1 deletion packages/addons.xml.crc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3e49ed72de384e85712a5c6e9074690f8c7a8520
a07bc81fc66ec05637abfa1e2c2a7a045ce9d912
36 changes: 36 additions & 0 deletions tests/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,42 @@ def test_opensubtitles_tvshow_missing_imdb_id():

assert len(search.results) > 0

def test_opensubtitles_tvshow_missing_imdb_id_but_in_url():
a4ksubtitles_api = api.A4kSubtitlesApi({'kodi': True})
__remove_all_cache(a4ksubtitles_api)

# search
settings = {
'opensubtitles.enabled': 'true',
}
video_meta = {
'imdb_id': '',
'season': '',
'episode': '',
'url': 'https://example.com/example.mkv?imdb_id=tt11610548'
}
search = __search_movie(a4ksubtitles_api, settings, video_meta)

assert len(search.results) > 0

def test_opensubtitles_tvshow_missing_imdb_id_but_in_url_with_show_id_and_meta_for_ep_and_season():
a4ksubtitles_api = api.A4kSubtitlesApi({'kodi': True})
__remove_all_cache(a4ksubtitles_api)

# search
settings = {
'opensubtitles.enabled': 'true',
}
video_meta = {
'imdb_id': '',
'season': '',
'episode': '',
'url': 'https://example.com/example.mkv?imdb_id=tt10155688&season=1&episode=2'
}
search = __search_movie(a4ksubtitles_api, settings, video_meta)

assert len(search.results) > 0

def test_bsplayer():
a4ksubtitles_api = api.A4kSubtitlesApi({'kodi': True})
__remove_all_cache(a4ksubtitles_api)
Expand Down

0 comments on commit b0ff63f

Please sign in to comment.