Skip to content

Commit

Permalink
Merge pull request #2453 from im85288/service.upnext@leia
Browse files Browse the repository at this point in the history
[service.upnext@leia] 1.1.9
  • Loading branch information
pkscout authored May 20, 2023
2 parents fdaa93d + 7eeb18a commit f6e4f56
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 74 deletions.
7 changes: 7 additions & 0 deletions service.upnext/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ For [Addon Integration](https://github.com/im85288/service.upnext/wiki/Integrati

## Releases

### v1.1.9 (2023-05-10)
- Fix handling of non-ASCII filenames for Kodi18 (@MoojMidge)
- Fix failing ci workflow (@MoojMidge)
- Update Swedish translation (@Sopor)
- Explicitly set sonarcloud coverage path (@MoojMidge)
- Fix error when kodi is not playing video any longer (@AnonTester)

### v1.1.8 (2022-09-13)
- Never ask if Still Watching? if playedInARow is 0 (@MoojMidge)
- Still Watching? checks number of plays not number+1 (@MoojMidge)
Expand Down
2 changes: 1 addition & 1 deletion service.upnext/addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="service.upnext" name="Up Next" version="1.1.8" provider-name="im85288">
<addon id="service.upnext" name="Up Next" version="1.1.9" provider-name="im85288">
<requires>
<import addon="xbmc.python" version="2.25.0"/>
</requires>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgstr ""
"Project-Id-Version: service.upnext\n"
"Report-Msgid-Bugs-To: https://github.com/im85288/service.upnext\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2018-02-26 13:31+0000\n"
"PO-Revision-Date: 2023-02-19 00:00+0000\n"
"Last-Translator: Sopor\n"
"Language-Team: Swedish\n"
"MIME-Version: 1.0\n"
Expand All @@ -24,7 +24,7 @@ msgstr "Titta nu"

msgctxt "#30008"
msgid "Up Next"
msgstr "Strax"
msgstr "Up Next"

msgctxt "#30009"
msgid "Ends at: $INFO[Window.Property(endtime)]"
Expand Down Expand Up @@ -52,7 +52,7 @@ msgstr "Stäng"

msgctxt "#30035"
msgid "Continue watching in [COLOR FFFF4081]$INFO[Window.Property(remaining)][/COLOR] seconds"
msgstr "Fortsätt titta i [COLOR FFFF4081]$INFO[Window.Property(remaining)][/COLOR] sekunder"
msgstr "Fortsätt titta om [COLOR FFFF4081]$INFO[Window.Property(remaining)][/COLOR] sekunder"

msgctxt "#30036"
msgid "Up next in [COLOR FFFF4081]$INFO[Window.Property(remaining)][/COLOR] seconds"
Expand Down Expand Up @@ -118,7 +118,7 @@ msgstr "Ställ in visningsläget för aviseringarna"

msgctxt "#30505"
msgid "Show a \"Stop\" button instead of a \"Close\" button"
msgstr "Visa en \"stoppknapp\" i stället för en \"stängknapp\""
msgstr "Visa en \"Stoppknapp\" i stället för en \"Stängknapp\""

msgctxt "#30600"
msgid "Behaviour"
Expand All @@ -138,7 +138,7 @@ msgstr "Inkludera redan visade avsnitt"

msgctxt "#30607"
msgid "Number of episodes before \"Still there?\" query"
msgstr "Antal avsnitt innan frågan \"tittar du fortfarande?\""
msgstr "Antal avsnitt innan frågan \"Tittar du fortfarande?\""

msgctxt "#30609"
msgid "Duration in seconds for notification to be shown"
Expand All @@ -150,23 +150,23 @@ msgstr "Anpassa den automatiska uppspelningslängden efter avsnittets längd"

msgctxt "#30613"
msgid "All episodes [COLOR gray]any length[/COLOR]"
msgstr "Alla avsnitt [COLOR gray]any length[/COLOR]"
msgstr "Alla avsnitt [COLOR gray]oavsett längd[/COLOR]"

msgctxt "#30615"
msgid "Very short episodes [COLOR gray]< 10 mins[/COLOR]"
msgstr "Väldigt korta avsnitt [COLOR gray]< 10 min[/COLOR]"

msgctxt "#30617"
msgid "Short episodes [COLOR gray]> 10 mins[/COLOR]"
msgstr "Korta avsnitt [COLOR gray]> 10 mins[/COLOR]"
msgstr "Korta avsnitt [COLOR gray]> 10 min[/COLOR]"

msgctxt "#30619"
msgid "Medium episodes [COLOR gray]> 20 mins[/COLOR]"
msgstr "Medellånga avsnitt [COLOR gray]> 20 min[/COLOR]"

msgctxt "#30621"
msgid "Long episodes [COLOR gray]> 40 mins[/COLOR]"
msgstr "Långa avsnitt [COLOR gray]> 40 mins[/COLOR]"
msgstr "Långa avsnitt [COLOR gray]> 40 min[/COLOR]"

msgctxt "#30623"
msgid "Very long episodes [COLOR gray]> 60 mins[/COLOR]"
Expand Down Expand Up @@ -198,16 +198,16 @@ msgstr "Aktivera DEMO-läge"

msgctxt "#30805"
msgid "Show an UpNext pop-up…"
msgstr "Visa en popup för UpNext…"
msgstr "Visa en UpNext-popup…"

msgctxt "#30807"
msgid "Show an UpNextSimple pop-up…"
msgstr "Visa en enkel popup för UpNext…"
msgstr "Visa en enkel UpNext-popup…"

msgctxt "#30809"
msgid "Show a StillWatching pop-up…"
msgstr "Visa en popup för \"tittar du fortfarande\"…"
msgstr "Visa en popup för \"Tittar du fortfarande\"…"

msgctxt "#30811"
msgid "Show a StillWatchingSimple pop-up…"
msgstr "Visa en enkel popup för \"tittar du fortfarande\"…"
msgstr "Visa en enkel popup för \"Tittar du fortfarande\"…"
90 changes: 45 additions & 45 deletions service.upnext/resources/lib/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def addon_data_received(self, data, encoding='base64'):

@staticmethod
def play_kodi_item(episode):
jsonrpc(method='Player.Open', id=0, params=dict(item=dict(episodeid=episode.get('episodeid'))))
jsonrpc(method='Player.Open', id=0, params={'item': {'episodeid': episode.get('episodeid')}})

@staticmethod
def _get_playerid(playerid_cache=[None]): # pylint: disable=dangerous-default-value
Expand Down Expand Up @@ -96,10 +96,10 @@ def queue_next_item(self, episode):
jsonrpc(
method='Playlist.Add',
id=0,
params=dict(
playlistid=Api.get_playlistid(),
item=next_item
)
params={
'playlistid': Api.get_playlistid(),
'item': next_item
}
)

return bool(next_item)
Expand All @@ -110,10 +110,10 @@ def dequeue_next_item():
jsonrpc(
method='Playlist.Remove',
id=0,
params=dict(
playlistid=Api.get_playlistid(),
position=1
)
params={
'playlistid': Api.get_playlistid(),
'position': 1
}
)
return False

Expand All @@ -123,21 +123,21 @@ def reset_queue():
jsonrpc(
method='Playlist.Remove',
id=0,
params=dict(
playlistid=Api.get_playlistid(),
position=0
)
params={
'playlistid': Api.get_playlistid(),
'position': 0
}
)

def get_next_in_playlist(self, position):
result = jsonrpc(method='Playlist.GetItems', params=dict(
playlistid=Api.get_playlistid(),
result = jsonrpc(method='Playlist.GetItems', params={
'playlistid': Api.get_playlistid(),
# limits are zero indexed, position is one indexed
limits=dict(start=position, end=position + 1),
properties=['art', 'dateadded', 'episode', 'file', 'firstaired', 'lastplayed',
'playcount', 'plot', 'rating', 'resume', 'runtime', 'season',
'showtitle', 'streamdetails', 'title', 'tvshowid', 'writer'],
))
'limits': {'start': position, 'end': position + 1},
'properties': ['art', 'dateadded', 'episode', 'file', 'firstaired', 'lastplayed',
'playcount', 'plot', 'rating', 'resume', 'runtime', 'season',
'showtitle', 'streamdetails', 'title', 'tvshowid', 'writer'],
})

item = result.get('result', {}).get('items')

Expand Down Expand Up @@ -166,9 +166,9 @@ def get_next_in_playlist(self, position):
def play_addon_item(self):
if self.data.get('play_url'):
self.log('Playing the next episode directly: %(play_url)s' % self.data, 2)
jsonrpc(method='Player.Open', params=dict(item=dict(file=self.data.get('play_url'))))
jsonrpc(method='Player.Open', params={'item': {'file': self.data.get('play_url')}})
else:
self.log('Sending %(encoding)s data to add-on to play: %(play_info)s' % dict(encoding=self.encoding, **self.data), 2)
self.log('Sending %(encoding)s data to add-on to play: %(play_info)s' % dict(encoding=self.encoding, **self.data), 2) # pylint: disable=use-dict-literal
event(message=self.data.get('id'), data=self.data.get('play_info'), sender='upnextprovider', encoding=self.encoding)

def handle_addon_lookup_of_next_episode(self):
Expand Down Expand Up @@ -221,21 +221,21 @@ def get_now_playing(self):

# Get details of the playing media
self.log('Getting details of now playing media', 2)
result = jsonrpc(method='Player.GetItem', params=dict(
playerid=playerid,
properties=['episode', 'genre', 'playcount', 'plotoutline', 'season', 'showtitle', 'tvshowid'],
))
result = jsonrpc(method='Player.GetItem', params={
'playerid': playerid,
'properties': ['episode', 'genre', 'playcount', 'plotoutline', 'season', 'showtitle', 'tvshowid'],
})
self.log('Got details of now playing media %s' % result, 2)
return result

def handle_kodi_lookup_of_episode(self, tvshowid, current_file, include_watched, current_episode_id):
result = jsonrpc(method='VideoLibrary.GetEpisodes', params=dict(
tvshowid=tvshowid,
properties=['art', 'dateadded', 'episode', 'file', 'firstaired', 'lastplayed',
'playcount', 'plot', 'rating', 'resume', 'runtime', 'season',
'showtitle', 'streamdetails', 'title', 'tvshowid', 'writer'],
sort=dict(method='episode'),
))
result = jsonrpc(method='VideoLibrary.GetEpisodes', params={
'tvshowid': tvshowid,
'properties': ['art', 'dateadded', 'episode', 'file', 'firstaired', 'lastplayed',
'playcount', 'plot', 'rating', 'resume', 'runtime', 'season',
'showtitle', 'streamdetails', 'title', 'tvshowid', 'writer'],
'sort': {'method': 'episode'},
})

if not result.get('result'):
return None
Expand All @@ -247,13 +247,13 @@ def handle_kodi_lookup_of_episode(self, tvshowid, current_file, include_watched,
return self.find_next_episode(result, current_file, include_watched, current_episode_id)

def handle_kodi_lookup_of_current_episode(self, tvshowid, current_episode_id):
result = jsonrpc(method='VideoLibrary.GetEpisodes', params=dict(
tvshowid=tvshowid,
properties=['art', 'dateadded', 'episode', 'file', 'firstaired', 'lastplayed',
'playcount', 'plot', 'rating', 'resume', 'runtime', 'season',
'showtitle', 'streamdetails', 'title', 'tvshowid', 'writer'],
sort=dict(method='episode'),
))
result = jsonrpc(method='VideoLibrary.GetEpisodes', params={
'tvshowid': tvshowid,
'properties': ['art', 'dateadded', 'episode', 'file', 'firstaired', 'lastplayed',
'playcount', 'plot', 'rating', 'resume', 'runtime', 'season',
'showtitle', 'streamdetails', 'title', 'tvshowid', 'writer'],
'sort': {'method': 'episode'},
})

if not result.get('result'):
return None
Expand All @@ -275,7 +275,7 @@ def handle_kodi_lookup_of_current_episode(self, tvshowid, current_episode_id):

@staticmethod
def showtitle_to_id(title):
result = jsonrpc(method='VideoLibrary.GetTVShows', id='libTvShows', params=dict(properties=['title']))
result = jsonrpc(method='VideoLibrary.GetTVShows', id='libTvShows', params={'properties': ['title']})

for tvshow in result.get('result', {}).get('tvshows', []):
if tvshow.get('label') == title:
Expand All @@ -286,10 +286,10 @@ def showtitle_to_id(title):
def get_episode_id(showid, show_season, show_episode):
show_season = int(show_season)
show_episode = int(show_episode)
result = jsonrpc(method='VideoLibrary.GetEpisodes', params=dict(
properties=['episode', 'season'],
tvshowid=int(showid),
))
result = jsonrpc(method='VideoLibrary.GetEpisodes', params={
'properties': ['episode', 'season'],
'tvshowid': int(showid),
})

episodeid = 0
for episode in result.get('result', {}).get('episodes', []):
Expand Down
8 changes: 4 additions & 4 deletions service.upnext/resources/lib/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from api import Api
from playbackmanager import PlaybackManager
from player import UpNextPlayer
from statichelper import from_unicode
from statichelper import to_unicode
from utils import decode_json, get_property, get_setting_bool, kodi_version_major, log as ulog


Expand Down Expand Up @@ -57,7 +57,7 @@ def run(self): # pylint: disable=too-many-branches

last_file = self.player.get_last_file()
try:
current_file = self.player.getPlayingFile()
current_file = to_unicode(self.player.getPlayingFile())
except RuntimeError:
self.log('Up Next tracking stopped, failed player.getPlayingFile()', 2)
self.player.disable_tracking()
Expand All @@ -73,7 +73,7 @@ def run(self): # pylint: disable=too-many-branches
self.playback_manager.demo.hide()
continue

if last_file and last_file == from_unicode(current_file):
if last_file and last_file == current_file:
# Already processed this playback before
continue

Expand Down Expand Up @@ -104,7 +104,7 @@ def run(self): # pylint: disable=too-many-branches
# Media hasn't reach notification time yet, waiting a bit longer...
continue

self.player.set_last_file(from_unicode(current_file))
self.player.set_last_file(current_file)
self.log('Show notification as episode (of length %d secs) ends in %d secs' % (total_time, notification_time), 2)
self.playback_manager.launch_up_next()
self.log('Up Next style autoplay succeeded', 2)
Expand Down
6 changes: 3 additions & 3 deletions service.upnext/resources/lib/playbackmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from xbmc import sleep
from api import Api
from demo import DemoOverlay
from player import Player
from player import UpNextPlayer
from playitem import PlayItem
from state import State
from stillwatching import StillWatching
Expand All @@ -21,7 +21,7 @@ def __init__(self):
self.api = Api()
self.play_item = PlayItem()
self.state = State()
self.player = Player()
self.player = UpNextPlayer()
self.demo = DemoOverlay(12005)

def log(self, msg, level=2):
Expand Down Expand Up @@ -117,7 +117,7 @@ def launch_popup(self, episode, source=None):

self.log('playing media episode', 2)
# Signal to trakt previous episode watched
event(message='NEXTUPWATCHEDSIGNAL', data=dict(episodeid=self.state.current_episode_id), encoding='base64')
event(message='NEXTUPWATCHEDSIGNAL', data={'episodeid': self.state.current_episode_id}, encoding='base64')
if source == 'playlist' or self.state.queued:
# Play playlist media
if should_play_non_default:
Expand Down
6 changes: 3 additions & 3 deletions service.upnext/resources/lib/playitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from __future__ import absolute_import, division, unicode_literals
from xbmc import PlayList
from api import Api
from player import Player
from player import UpNextPlayer
from state import State
from utils import log as ulog

Expand All @@ -15,7 +15,7 @@ class PlayItem:
def __init__(self):
self.__dict__ = self._shared_state
self.api = Api()
self.player = Player()
self.player = UpNextPlayer()
self.state = State()

def log(self, msg, level=2):
Expand Down Expand Up @@ -58,7 +58,7 @@ def get_next(self):

# Next video from Kodi library
else:
current_file = self.player.getPlayingFile()
current_file = self.player.get_last_file()
# Get the active player
result = self.api.get_now_playing()
self.handle_now_playing_result(result)
Expand Down
13 changes: 7 additions & 6 deletions service.upnext/resources/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ def event(message, data=None, sender=None, encoding='base64'):
if not encoded:
return

jsonrpc(method='JSONRPC.NotifyAll', params=dict(
sender='%s.SIGNAL' % sender,
message=message,
data=[encoded],
))
jsonrpc(method='JSONRPC.NotifyAll', params={
'sender': '%s.SIGNAL' % sender,
'message': message,
'data': [encoded],
})


def log(msg, name=None, level=1):
Expand Down Expand Up @@ -191,7 +191,8 @@ def jsonrpc(**kwargs):

def get_global_setting(setting):
"""Get a Kodi setting"""
result = jsonrpc(method='Settings.GetSettingValue', params=dict(setting=setting))
result = jsonrpc(method='Settings.GetSettingValue',
params={'setting': setting})
return result.get('result', {}).get('value')


Expand Down

0 comments on commit f6e4f56

Please sign in to comment.