Skip to content

Commit

Permalink
v2.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz89B committed Mar 12, 2023
1 parent 6d619f9 commit 42f4376
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 47 deletions.
8 changes: 6 additions & 2 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon id="plugin.video.viaplay" version="2.4.3" name="Viaplay" provider-name="mariusz89b, emilsvennesson, heppen-dev">
<addon id="plugin.video.viaplay" version="2.4.4" name="Viaplay" provider-name="mariusz89b, emilsvennesson, heppen-dev">
<requires>
<import addon="script.module.requests" version="2.9.1" />
<import addon="script.module.iso8601" version="0.1.11" />
Expand All @@ -24,7 +24,11 @@
<platform>all</platform>
<license>GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 and MIT LICENSE.</license>
<source>https://github.com/Mariusz89B/plugin.video.viaplay</source>
<news>v2.4.3 (2023-03-06)
<news>v2.4.4 (2023-03-12)
- Fixed bug when returning from search.
- Added option to enable/disable synchronization.

v2.4.3 (2023-03-06)
- Added profile selector.
- Added supported countries.
- Added synchronization with watched list.
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v2.4.4 (2023-03-12)
- Fixed bug when returning from search.
- Added option to enable/disable synchronization.

v2.4.3 (2023-03-06)
- Added profile selector.
- Added supported countries.
Expand Down
4 changes: 4 additions & 0 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -371,4 +371,8 @@ msgstr ""

msgctxt "#30092"
msgid "Remove watched content"
msgstr ""

msgctxt "#30093"
msgid "Synchronize content"
msgstr ""
6 changes: 5 additions & 1 deletion resources/language/resource.language.pl_pl/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -367,4 +367,8 @@ msgstr "Zawartość usunięto z listy"

msgctxt "#30092"
msgid "Remove watched content"
msgstr "Usuń oglądaną zawartość"
msgstr "Usuń oglądaną zawartość"

msgctxt "#30093"
msgid "Synchronize content"
msgstr "Synchronizuj zawartość"
8 changes: 6 additions & 2 deletions resources/language/resource.language.sv_se/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ msgstr "Användarnamn"

msgctxt "#30074"
msgid "Password"
msgstr "Användarnamn"
msgstr "Lösenord"

msgctxt "#30075"
msgid "Wrong login credentials"
Expand Down Expand Up @@ -367,4 +367,8 @@ msgstr "Innehåll borttaget från listan"

msgctxt "#30092"
msgid "Remove watched content"
msgstr "Ta bort sett innehåll"
msgstr "Ta bort sett innehåll"

msgctxt "#30093"
msgid "Synchronize content"
msgstr "Synkronisera innehåll"
98 changes: 57 additions & 41 deletions resources/lib/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,57 +429,73 @@ def start():

@plugin.route('/search')
def search():
file_name = os.path.join(profile_path, 'title_search.list')
f = xbmcvfs.File(file_name, "rb")
searches = sorted(f.read().splitlines())
f.close()
pages = helper.vp.get_root_page()
title = [x['title'] for x in pages if x['name'] == 'viaplay:search'][0]

actions = [helper.language(30079), helper.language(30080)] + searches
file_search = os.path.join(profile_path, 'last_search.list')

action = helper.dialog(dialog_type='select', heading=helper.language(30081), options=actions)
title = None
if xbmc.getInfoLabel('ListItem.Label') == title:
file_name = os.path.join(profile_path, 'title_search.list')
f = xbmcvfs.File(file_name, 'rb')
searches = sorted(f.read().splitlines())
f.close()

if action == -1:
return
elif action == 0:
pass
elif action == 1:
which = helper.dialog(dialog_type='multiselect', heading=helper.language(30080), options=searches)
if which is None:
return
else:
for item in reversed(which):
del searches[item]
actions = [helper.language(30079), helper.language(30080)] + searches

f = xbmcvfs.File(file_name, "wb")
if sys.version_info[0] < 3:
searches = [x.decode('utf-8') for x in searches]
f.write(bytearray('\n'.join(searches), 'utf-8'))
f.close()
action = helper.dialog(dialog_type='select', heading=helper.language(30081), options=actions)
title = None

if action == -1:
return
else:
if searches:
title = searches[action - 2]
elif action == 0:
pass
elif action == 1:
which = helper.dialog(dialog_type='multiselect', heading=helper.language(30080), options=searches)
if which is None:
return
else:
for item in reversed(which):
del searches[item]

f = xbmcvfs.File(file_name, 'wb')
if sys.version_info[0] < 3:
searches = [x.decode('utf-8') for x in searches]
f.write(bytearray('\n'.join(searches), 'utf-8'))
f.close()
return
else:
if searches:
title = searches[action - 2]

if action == 0:
search = helper.get_user_input(helper.language(30015))
if action == 0:
search = helper.get_user_input(helper.language(30015))

else:
if sys.version_info[0] > 2:
search = title
else:
search = title.encode('utf-8')
if sys.version_info[0] > 2:
search = title
else:
search = title.encode('utf-8')

if not search:
return
searches = (set([search] + searches))
f = xbmcvfs.File(file_name, "wb")
if sys.version_info[0] < 3:
searches = [x.decode('utf-8') for x in searches]
f.write(bytearray('\n'.join(searches), 'utf-8'))
f.close()
if not search:
return
searches = (set([search] + searches))
f = xbmcvfs.File(file_name, 'wb')
if sys.version_info[0] < 3:
searches = [x.decode('utf-8') for x in searches]
f.write(bytearray('\n'.join(searches), 'utf-8'))
f.close()

if search != '':
f = xbmcvfs.File(file_search, 'w')
f.write(search)
f.close()

list_products(plugin.args['url'][0], search_query=search)
else:
f = xbmcvfs.File(file_search, 'r')
search = f.read().splitlines()
f.close()

if search != '':
list_products(plugin.args['url'][0], search_query=search)


Expand Down
3 changes: 2 additions & 1 deletion resources/lib/viaplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ def get_stream(self, guid, pincode=None, tve='false', url=''):
'position': 0
}

response = self.make_request(url=url, method='post', payload=json.dumps(json_data), params=params, status=True)
if self.get_setting('synchronize'):
response = self.make_request(url=url, method='post', payload=json.dumps(json_data), params=params, status=True)

if 'viaplay:media' in data['_links']:
mpd_url = data['_links']['viaplay:media']['href']
Expand Down
5 changes: 5 additions & 0 deletions resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
<default>false</default>
<control type="toggle"/>
</setting>
<setting help="" id="synchronize" label="30093" type="boolean">
<level>0</level>
<default>true</default>
<control type="toggle"/>
</setting>
<setting help="" id="subtitles" label="30012" type="boolean">
<level>0</level>
<default>true</default>
Expand Down

0 comments on commit 42f4376

Please sign in to comment.