Skip to content

Commit

Permalink
release: v1.16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
newt-sc committed Feb 12, 2021
1 parent b65d028 commit 45e868a
Show file tree
Hide file tree
Showing 15 changed files with 373 additions and 25 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ exclude =
tmp,
providers,
providerModules,
a4kStreaming/lib/goto.py,
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
* [v1.16.0](https://github.com/newt-sc/a4kStreaming/releases/tag/plugin.video.a4kstreaming%2Fplugin.video.a4kstreaming-1.16.0):
* New settings:
* Autoplay - instead of showing source select, auto choose the first source that resolves
* New context menu:
* Force source select - only available when Autoplay is enabled
* Add more episode auto selection checks
* Allow browsing cast and crew to find titles which they are known for. (This is new API which currently returns test results)

* [v1.15.0](https://github.com/newt-sc/a4kStreaming/releases/tag/plugin.video.a4kstreaming%2Fplugin.video.a4kstreaming-1.15.0):
* Add RD expired notification

Expand Down
1 change: 1 addition & 0 deletions a4kStreaming/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
utils,
cache,
debrid,
goto
)

core = sys.modules[__name__]
Expand Down
73 changes: 63 additions & 10 deletions a4kStreaming/explorer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# -*- coding: utf-8 -*-

from .lib.goto import with_goto

__action_menu_style = '[COLOR white][B]%s[/B][/COLOR]'

def __get_season_title(core, season, year, episodes):
Expand Down Expand Up @@ -93,6 +97,11 @@ def __set_title_contextmenu(core, title, list_item):
context_menu_items.extend([
('Debrid: Add sources', 'RunPlugin(plugin://plugin.video.a4kstreaming/?action=cache_sources&id=%s)' % title['id'])
])
if core.kodi.get_bool_setting('general.autoplay'):
context_menu_items.extend([
('Force source select', 'RunPlugin(plugin://plugin.video.a4kstreaming/?action=play&id=%s&force_sourceselect=true)' % title['id'])
])

list_item.addContextMenuItems(context_menu_items)

def __generate_mutation_query(action, ids, vars=''):
Expand Down Expand Up @@ -532,7 +541,7 @@ def __add_titles(core, titles, browse, silent=False):
return type
elif titleType in ['person']:
action = 'query'
type = 'person'
type = 'knownfor'
else: # tvSeries
if browse or browse is None:
action = 'query'
Expand Down Expand Up @@ -1238,6 +1247,32 @@ def query(core, params):
}
}
}),
'knownfor': lambda: core.utils.get_graphql_query({
'query': '''
query fn($id: ID!, $limit: Int!, $EXTRA_PARAMS) {
name(id: $id) {
credits(first: $limit) {
titles: edges {
node {
title {
...Title
}
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
}
''',
'operationName': 'fn',
'variables': {
'id': params.id,
'limit': page_size,
}
}),
'browse': lambda: core.utils.get_graphql_query({
'query': '''
query fn($id: ID!, $EXTRA_PARAMS) {
Expand Down Expand Up @@ -1990,6 +2025,7 @@ def cache():

results.pop(results_keys[selection])

@with_goto
def play(core, params):
general = core.cache.get_general()

Expand Down Expand Up @@ -2175,10 +2211,15 @@ def sorter():
core.kodi.notification('No results for specified quality. Showing all results.')

result_style = '[LIGHT]%s[/LIGHT]'
selection = core.kodi.xbmcgui.Dialog().select(
'Choose source',
[__action_menu_style % 'New Search'] + [result_style % results[key].get('title_with_debrid', results[key]['title']) for key in results_keys],
)
autoplay = core.kodi.get_bool_setting('general.autoplay') and not params.force_sourceselect

if not autoplay:
selection = core.kodi.xbmcgui.Dialog().select(
'Choose source',
[__action_menu_style % 'New Search'] + [result_style % results[key].get('title_with_debrid', results[key]['title']) for key in results_keys],
)
else:
selection = 1

if selection == -1:
general.last_action_time = core.utils.time_ms()
Expand All @@ -2200,6 +2241,7 @@ def sorter():
else:
selection -= 1

label .begin # type: ignore # noqa: F821
result = results[results_keys[selection]]
video_ext = list(map(lambda v: '.%s' % v.upper(), core.utils.video_containers()))
size = 1048576 * 100
Expand Down Expand Up @@ -2329,17 +2371,24 @@ def delete_magnet():
if len(files) > 1 and result['ref'].mediatype == 'episode':
season_zfill = str(result['ref'].season).zfill(2)
episode_zfill = str(result['ref'].episode).zfill(2)
episode_zfill_3 = episode_zfill.zfill(3)
season = 'S%s' % season_zfill
episode = 'E%s' % episode_zfill
episode_0 = 'E0%s' % episode_zfill
matches = [
'%s%s' % (season, episode),
'%s %s' % (season, episode),
'%sX%s' % (season_zfill, episode_zfill),
'%sX%s' % (season, episode_zfill),
' %s%s ' % (season, episode),
' %s%s ' % (season, episode_0),
' %s %s ' % (season, episode),
' %s %s ' % (season, episode_0),
' %sX%s ' % (season_zfill, episode_zfill),
' %sX%s ' % (season_zfill, episode_zfill_3),
' %sX%s ' % (season, episode_zfill),
' %sX%s ' % (season, episode_zfill_3),
' %s%s ' % (result['ref'].season, episode_zfill),
' %s%s ' % (result['ref'].season, episode_zfill_3),
]
episodes = list(filter(lambda file: any(match in core.utils.clean_release_title(file['path']) for match in matches), files))
if len(episodes) == 1:
if len(episodes) > 0:
files = episodes
filtered = True
except Exception as e:
Expand Down Expand Up @@ -2380,6 +2429,10 @@ def delete_magnet():
link = file.get('link', file.get('stream_link', None))

if not link:
if selection + 1 < len(results_keys) and autoplay:
selection += 1
goto .begin # type: ignore # noqa: F821

general.last_action_time = core.utils.time_ms()
core.cache.save_general(general)
core.kodi.notification('Failed to resolve debrid')
Expand Down
2 changes: 2 additions & 0 deletions a4kStreaming/lib/database.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

import hashlib
from . import kodi
from .utils import open_file_wrapper, os, re, json, time, provider_temp_dir
Expand Down
2 changes: 2 additions & 0 deletions a4kStreaming/lib/debrid.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-

def premiumize_transfers(apikey):
return {
'method': 'GET',
Expand Down
Loading

0 comments on commit 45e868a

Please sign in to comment.