9 Commits

Author SHA1 Message Date
mcarlton00
4288c032db Merge pull request #74 from mcarlton00/version-0.4.4
Version bump
2021-05-31 12:55:21 -04:00
Matt
04a5378a87 Version bump 2021-05-31 12:48:13 -04:00
mcarlton00
ca5918ded9 Merge pull request #73 from mcarlton00/next-episodes
Fix next episode dialog
2021-05-29 21:12:37 -04:00
Matt
2e7737c1af Use variable instead of calling player multiple times 2021-05-29 20:46:57 -04:00
Matt
441bb10624 Fix next episode dialog 2021-05-28 23:33:13 -04:00
mcarlton00
9adb23b280 Merge pull request #72 from mcarlton00/external-subs-again
Include position ticks in external sub call
2021-05-28 09:21:12 -04:00
Matt
7b547b2bc8 Include position ticks in external sub call 2021-05-27 22:45:37 -04:00
mcarlton00
4ec75ad266 Merge pull request #67 from nvllsvm/img
optimize images
2021-04-19 19:43:21 -04:00
Andrew Rabert
7dcf68d2be optimize images 2021-04-18 13:14:00 -04:00
10 changed files with 53 additions and 31 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 32 KiB

BIN
icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 13 KiB

BIN
kodi.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -1,7 +1,8 @@
version: '0.4.3'
version: '0.4.4'
changelog: |
- #62 - Change unicode to str
- #63 - Fix displaying public user list
- #67 - Optimize images
- #72 - Include position ticks in external sub call
- #73 - Fix next episode dialog
dependencies:
py2:
- addon: 'xbmc.python'

View File

@@ -427,6 +427,12 @@ def play_file(play_info):
data["play_action_type"] = "play"
data["item_type"] = result.get("Type", None)
data["can_delete"] = result.get("CanDelete", False)
# Check for next episodes
if result.get('Type') == 'Episode':
next_episode = get_next_episode(result)
data["next_episode"] = next_episode
home_window.set_property('now_playing', json.dumps(data))
list_item.setPath(playurl)
@@ -494,10 +500,6 @@ def play_file(play_info):
else:
log.info("PlaybackResumrAction : Playback resumed")
next_episode = get_next_episode(result)
data["next_episode"] = next_episode
send_next_episode_details(result, next_episode)
def __build_label2_from(source):
videos = [item for item in source.get('MediaStreams', {}) if item.get('Type') == "Video"]
@@ -630,7 +632,7 @@ def send_next_episode_details(item, next_episode):
"force_transcode": False
}
}
send_event_notification("upnext_data", next_info)
send_event_notification("upnext_data", next_info, True)
def set_list_item_props(item_id, list_item, result, server, extra_props, title):
@@ -835,10 +837,10 @@ def external_subs(media_source, list_item, item_id):
url_root = '{}/Videos/{}/{}/Subtitles/{}'.format(server, item_id, source_id, index)
if language:
url = '{}/Stream.{}.{}?api_key={}'.format(
url = '{}/0/Stream.{}.{}?api_key={}'.format(
url_root, language, codec, token)
else:
url = '{}/Stream.{}?api_key={}'.format(url_root, codec, token)
url = '{}/0/Stream.{}?api_key={}'.format(url_root, codec, token)
default = ""
if stream['IsDefault']:
@@ -1048,6 +1050,10 @@ def stop_all_playback(played_information):
def get_playing_data():
home_window = HomeWindow()
play_data_string = home_window.get_property('now_playing')
play_data = json.loads(play_data_string)
settings = xbmcaddon.Addon()
server = settings.getSetting('server_address')
try:
@@ -1057,10 +1063,9 @@ def get_playing_data():
return None
log.debug("get_playing_data : getPlayingFile() : {0}".format(playing_file))
if server in playing_file:
url_data = urlparse(playing_file)
query = parse_qs(url_data.query)
return play_data_map.get(playing_file)
return play_data
else:
return {}
class Service(xbmc.Player):
@@ -1166,7 +1171,7 @@ class PlaybackService(xbmc.Monitor):
home_window.set_property('exit', 'True')
return
if sender[-7:] != '.SIGNAL':
if sender != 'plugin.video.jellycon':
return
signal = method.split('.', 1)[-1]
@@ -1174,16 +1179,12 @@ class PlaybackService(xbmc.Monitor):
return
data_json = json.loads(data)
message_data = data_json[0]
log.debug("PlaybackService:onNotification:{0}".format(message_data))
decoded_data = base64.b64decode(message_data)
play_info = json.loads(decoded_data)
play_info = data_json[0]
log.debug("PlaybackService:onNotification:{0}".format(play_info))
if signal == "jellycon_play_action":
log.info("Received jellycon_play_action : {0}".format(play_info))
play_file(play_info, self.monitor)
play_file(play_info)
elif signal == "jellycon_play_youtube_trailer_action":
log.info("Received jellycon_play_trailer_action : {0}".format(play_info))
trailer_link = play_info["url"]
xbmc.executebuiltin(trailer_link)
elif signal == "set_view":

View File

@@ -1,5 +1,6 @@
from __future__ import division, absolute_import, print_function, unicode_literals
import json
import os
import threading
@@ -9,6 +10,7 @@ import xbmcaddon
from .loghandler import LazyLogger
from .play_utils import send_event_notification
from .kodi_utils import HomeWindow
log = LazyLogger(__name__)
@@ -32,6 +34,8 @@ class PlayNextService(threading.Thread):
play_next_triggered = False
is_playing = False
now_playing = None
while not xbmc.Monitor().abortRequested() and not self.stop_thread:
player = xbmc.Player()
@@ -42,6 +46,13 @@ class PlayNextService(threading.Thread):
play_next_trigger_time = int(settings.getSetting('play_next_trigger_time'))
log.debug("New play_next_trigger_time value: {0}".format(play_next_trigger_time))
now_playing_file = player.getPlayingFile()
if now_playing_file != now_playing:
# If the playing file has changed, reset the play next values
play_next_dialog = None
play_next_triggered = False
now_playing = now_playing_file
duration = player.getTotalTime()
position = player.getTime()
trigger_time = play_next_trigger_time # 300
@@ -51,7 +62,7 @@ class PlayNextService(threading.Thread):
play_next_triggered = True
log.debug("play_next_triggered hit at {0} seconds from end".format(time_to_end))
play_data = get_playing_data(self.monitor.played_information)
play_data = get_playing_data()
log.debug("play_next_triggered play_data : {0}".format(play_data))
next_episode = play_data.get("next_episode")
@@ -78,6 +89,7 @@ class PlayNextService(threading.Thread):
play_next_dialog = None
is_playing = False
now_playing = None
if xbmc.Monitor().waitForAbort(1):
break

View File

@@ -5,6 +5,7 @@ import xbmcaddon
import xbmc
import xbmcvfs
import binascii
import string
import random
import json
@@ -14,6 +15,7 @@ import math
from datetime import datetime
import calendar
import re
from six import ensure_text, ensure_binary
from six.moves.urllib.parse import urlencode
from .downloadutils import DownloadUtils
@@ -295,14 +297,19 @@ def single_urlencode(text):
return text.decode('utf-8') # return the result again as unicode
def send_event_notification(method, data):
message_data = json.dumps(data)
source_id = "jellycon"
base64_data = base64.b64encode(message_data.encode())
escaped_data = '\\"[\\"{0}\\"]\\"'.format(base64_data)
command = 'XBMC.NotifyAll({0}.SIGNAL,{1},{2})'.format(source_id, method, escaped_data)
log.debug("Sending notification event data: {0}".format(command))
xbmc.executebuiltin(command)
def send_event_notification(method, data=None, hexlify=False):
'''
Send events through Kodi's notification system
'''
data = data or {}
if hexlify:
# Used exclusively for the upnext plugin
data = ensure_text(binascii.hexlify(ensure_binary(json.dumps(data))))
sender = 'plugin.video.jellycon'
data = '"[%s]"' % json.dumps(data).replace('"', '\\"')
xbmc.executebuiltin('NotifyAll(%s, %s, %s)' % (sender, method, data))
def datetime_from_string(time_string):

Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 B

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 109 B

View File

@@ -67,6 +67,7 @@ image_server = HttpImageServerThread()
image_server.start()
# set up all the services
monitor = Service()
playback_service = PlaybackService(monitor)
home_window = HomeWindow()