Skip to content

Commit

Permalink
release: v1.41.0
Browse files Browse the repository at this point in the history
  • Loading branch information
newt-sc committed May 15, 2022
1 parent 2015efb commit 4e5ab75
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 11 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
* [v1.41.0](https://github.com/newt-sc/a4kStreaming/releases/tag/plugin.video.a4kstreaming%2Fplugin.video.a4kstreaming-1.41.0):
* Fix trailers

* [v1.40.0](https://github.com/newt-sc/a4kStreaming/releases/tag/plugin.video.a4kstreaming%2Fplugin.video.a4kstreaming-1.40.0):
* Fix issue when searching returns no results

Expand Down
15 changes: 8 additions & 7 deletions a4kStreaming/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __set_title_contextmenu(core, title, list_item):
has_rating = title.get('userRating', None) is not None
context_menu_items = [
('IMDb: %s rating' % ('Update' if has_rating else 'Set'), 'RunPlugin(%s?action=profile&type=rate&id=%s)' % (core.url, title['id'])),
('IMDb: Trailer', 'RunPlugin(%s?action=trailer&id=%s&play=true)' % (core.url, trailer)),
('IMDb: Trailer', 'RunPlugin(%s?action=trailer&id=%s&vi=%s&play=true)' % (core.url, title['id'], trailer)),
('IMDb: Cast & Crew', 'ActivateWindow(Videos,%s?action=query&type=browse&id=%s,return)' % (core.url, title['id'])),
]

Expand Down Expand Up @@ -456,7 +456,7 @@ def __add_titles(core, titles, browse, silent=False):
'mpaa': title.get('certificate', None),
'genre': title.get('genres', None),
'country': title.get('countriesOfOrigin', None),
'trailer': '%s?action=trailer&id=%s' % (core.url, title['primaryVideos'][0]) if title.get('primaryVideos', None) else None,
'trailer': '%s?action=trailer&id=%s&vi=%s' % (core.url, title['id'], title['primaryVideos'][0]) if title.get('primaryVideos', None) else None,
'plot': title.get('plot', None),
'tagline': next(iter(title.get('taglines', [])), None),
'overlay': overlay,
Expand Down Expand Up @@ -1943,7 +1943,7 @@ def profile(core, params):
return True

def trailer(core, params):
if not params.id:
if not params.id or not params.vi:
core.kodi.notification('Trailer not found')
core.utils.end_action(core, False)
return
Expand All @@ -1953,9 +1953,10 @@ def trailer(core, params):

request = {
'method': 'GET',
'url': 'https://www.imdb.com/ve/data/VIDEO_PLAYBACK_DATA',
'url': 'https://www.imdb.com/_next/data/kIv45L5XxdjXg8DM2TV9c/video/%s.json' % params.vi,
'params': {
'key': core.base64.b64encode(core.json.dumps({ 'type': 'VIDEO_PLAYER', 'subType': 'FORCE_LEGACY', 'id': params.id }).encode('ascii'))
'playlistId': params.id,
'viconst': params.vi,
},
'headers': {
'content-type': 'application/json',
Expand All @@ -1972,8 +1973,8 @@ def trailer(core, params):

parsed_response = core.json.loads(response.content)
try:
all = parsed_response[0]['videoLegacyEncodings']
filtered = filter(lambda v: v['definition'] != 'AUTO', all)
all = parsed_response['pageProps']['videoPlaybackData']['video']['playbackURLs']
filtered = filter(lambda v: v['displayName']['value'] != 'AUTO', all)
trailerUrl = next(iter(filtered), iter(all))['url']
except:
core.kodi.close_busy_dialog()
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="plugin.video.a4kstreaming"
name="a4kStreaming"
version="1.40.0"
version="1.41.0"
provider-name="Unknown">
<requires>
<import addon="script.module.requests"/>
Expand Down Expand Up @@ -32,6 +32,9 @@ Designed for low-end devices and Estuary skin.
<screenshot>screenshot-06.jpg</screenshot>
</assets>
<news>
[v1.41.0]:
* Fix trailers

[v1.40.0]:
* Fix issue when searching returns no results

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="plugin.video.a4kstreaming"
name="a4kStreaming"
version="1.40.0"
version="1.41.0"
provider-name="Unknown">
<requires>
<import addon="script.module.requests"/>
Expand Down Expand Up @@ -35,6 +35,9 @@ Designed for low-end devices and Estuary skin.
<screenshot>screenshot-06.jpg</screenshot>
</assets>
<news>
[v1.41.0]:
* Fix trailers

[v1.40.0]:
* Fix issue when searching returns no results

Expand Down
2 changes: 1 addition & 1 deletion packages/addons.xml.crc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3960e01b1011e96b49930daf43f5e8bfa7de45ec
d6fe7cf6bd1f8f3193077abed37fc93e8badd90e
2 changes: 1 addition & 1 deletion tests/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def prerun():
def test_trailer():
a4kstreaming_api = api.A4kStreamingApi({'kodi': True})

trailer = __invoke(a4kstreaming_api, 'trailer', { 'id': 'vi727367449' })
trailer = __invoke(a4kstreaming_api, 'trailer', { 'id': 'tt10048342', 'vi': 'vi1185857817' })

assert len(trailer.results) > 0

Expand Down

0 comments on commit 4e5ab75

Please sign in to comment.