Skip to content

Commit

Permalink
Merge pull request #90 from mediathekview/develop
Browse files Browse the repository at this point in the history
Improvements after Kodi-PR-Review
  • Loading branch information
tuxpoldo authored Aug 9, 2018
2 parents 6eb8f07 + c108c7c commit a677a7c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
6 changes: 2 additions & 4 deletions addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,8 @@ def run( self ):
Downloader( self ).download_episode( filmid, quality )
elif mode == 'playwithsrt':
filmid = self.get_arg( 'id', 0 )
external = self.get_arg( 'external', 'False' ) == 'True'
Downloader( self ).play_movie_with_subs( filmid, external )
# elif mode == 'enqueue':
# self.enqueue_film( self.get_arg( 'id', 0 ) )
only_sru = self.get_arg( 'only_set_resolved_url', 'False' ) == 'True'
Downloader( self ).play_movie_with_subs( filmid, only_sru )

# cleanup saved searches
if mode is None or mode != 'search':
Expand Down
2 changes: 1 addition & 1 deletion resources/language/resource.language.it_it/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ msgstr "Preferisci alta definizione"

msgctxt "#30111"
msgid "Autoplay Subtitles"
msgstr "Mostra Sottotitoli"
msgstr "Riproduci sempre con sottotitoli"

msgctxt "#30112"
msgid "No future videos (usually trailers)"
Expand Down
12 changes: 6 additions & 6 deletions resources/lib/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,24 @@ def __init__( self, plugin ):
self.settings = plugin.settings
self.notifier = plugin.notifier

def play_movie_with_subs( self, filmid, external ):
def play_movie_with_subs( self, filmid, only_set_resolved_url ):
film = self.database.RetrieveFilmInfo( filmid )
if film is None:
self.notifier.ShowError( 30990, self.plugin.language( 30991 ) )
return
ttmname = self.plugin.datapath + '/subtitle.ttml'
srtname = self.plugin.datapath + '/subtitle.srt'
ttmname = os.path.join( self.plugin.datapath, 'subtitle.ttml' )
srtname = os.path.join( self.plugin.datapath, 'subtitle.srt' )
subs = []
if self.download_subtitle( film, ttmname, srtname, 'subtitle' ):
subs.append( srtname )
( videourl, listitem ) = FilmUI( self.plugin ).get_list_item( None, film )
if listitem:
if subs:
listitem.setSubtitles( subs )
if external:
xbmc.Player().play( videourl, listitem )
else:
if only_set_resolved_url:
self.plugin.setResolvedUrl( True, listitem )
else:
xbmc.Player().play( videourl, listitem )

def download_subtitle( self, film, ttmname, srtname, filename ):
ret = False
Expand Down
8 changes: 5 additions & 3 deletions resources/lib/filmui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# pylint: disable=mixed-indentation, bad-whitespace, bad-continuation, missing-docstring

# -- Imports ------------------------------------------------
import os

import xbmcgui
import xbmcplugin

Expand Down Expand Up @@ -52,7 +54,7 @@ def Add( self, alttitle = None, totalItems = None ):
self.plugin.build_url( {
'mode': "playwithsrt",
'id': self.id,
'external': True
'only_set_resolved_url': False
} )
)
) )
Expand Down Expand Up @@ -110,7 +112,7 @@ def Add( self, alttitle = None, totalItems = None ):
videourl = self.plugin.build_url( {
'mode': "playwithsrt",
'id': self.id,
'external': False
'only_set_resolved_url': True
} )

if totalItems is not None:
Expand Down Expand Up @@ -172,7 +174,7 @@ def get_list_item( self, alttitle, film = None ):
info_labels['aired'] = airedstring
info_labels['dateadded'] = airedstring

icon = 'special://home/addons/' + self.plugin.addon_id + '/resources/icons/' + film.channel.lower() + '-m.png'
icon = os.path.join( self.plugin.addon.getAddonInfo( 'path' ), 'resources', 'icons', film.channel.lower() + '-m.png' )

listitem = xbmcgui.ListItem( resultingtitle, path = videourl )
listitem.setInfo( type = 'video', infoLabels = info_labels )
Expand Down

0 comments on commit a677a7c

Please sign in to comment.