def browse():
    
    info = sys.listitem.getVideoInfoTag()
    type = info.getMediaType()
    title = info.getTVShowTitle()   

    params = utils.parse_paramstring(sys.argv[0])
    type = 'tv'
    season = info.getSeason() 
#   xbmc.log(str(season)+str(title)+'===>TMDBHelper', level=xbmc.LOGNOTICE)
    tmdb_id_no = Plugin().get_tmdb_id(query=title, itemtype='tv')
    xbmc.log(str(tmdb_id_no)+'===>TMDBHelper', level=xbmc.LOGNOTICE)
#    if type == 'episode' or type == 'tv':
#   	params['type'] = 'tv'
#	    tmdb_id_no = Plugin().get_tmdb_id(**params)

    tmdb_id = sys.listitem.getProperty('tvshow.tmdb_id')
    if tmdb_id == '' or tmdb_id == None:
	tmdb_id = tmdb_id_no
    tmdb_id = sys.listitem.getProperty('tvshow.tmdb_id')
    path = 'plugin://plugin.video.themoviedb.helper/'
    path = path + '?info=seasons&type=tv&nextpage=True&tmdb_id={}'.format(tmdb_id)
    path = path + '&fanarttv=True' if _addon.getSettingBool('fanarttv_lookup') else path
    command = 'Container.Update({})' if xbmc.getCondVisibility("Window.IsMedia") else 'ActivateWindow(videos,{},return)'
    xbmc.executebuiltin(command.format(path))
def play():
    with utils.busy_dialog():
        suffix = 'force_dialog=True'
        tmdb_id, season, episode = None, None, None
        dbtype = sys.listitem.getVideoInfoTag().getMediaType()

        if dbtype == 'episode':
            tmdb_id = sys.listitem.getProperty('tvshow.tmdb_id')
            season = sys.listitem.getVideoInfoTag().getSeason()
            episode = sys.listitem.getVideoInfoTag().getEpisode()
            suffix += ',season={},episode={}'.format(season, episode)

        elif dbtype == 'movie':
            tmdb_id = sys.listitem.getProperty('tmdb_id') or sys.listitem.getUniqueID('tmdb')

        # Try to lookup ID if we don't have it
        if not tmdb_id and dbtype == 'episode':
            id_details = TraktAPI().get_item_idlookup(
                'episode', parent=True, tvdb_id=sys.listitem.getUniqueID('tvdb'),
                tmdb_id=sys.listitem.getUniqueID('tmdb'), imdb_id=sys.listitem.getUniqueID('imdb'))
            tmdb_id = id_details.get('show', {}).get('ids', {}).get('tmdb')

        elif not tmdb_id and dbtype == 'movie':
            tmdb_id = Plugin().get_tmdb_id(
                itemtype='movie', imdb_id=sys.listitem.getUniqueID('imdb'),
                query=sys.listitem.getVideoInfoTag().getTitle(), year=sys.listitem.getVideoInfoTag().getYear())

        if not tmdb_id or not dbtype:
            return xbmcgui.Dialog().ok('TheMovieDb Helper', _addon.getLocalizedString(32157))

        xbmc.executebuiltin('RunScript(plugin.video.themoviedb.helper,play={},tmdb_id={},{})'.format(dbtype, tmdb_id, suffix))
示例#3
0
import sys
import xbmc
import xbmcvfs
import xbmcaddon
import xbmcgui
import datetime
import simplecache
from resources.lib.plugin import Plugin
from resources.lib.traktapi import TraktAPI
from resources.lib.constants import LIBRARY_ADD_LIMIT_TVSHOWS, LIBRARY_ADD_LIMIT_MOVIES
import resources.lib.utils as utils
_addon = xbmcaddon.Addon('plugin.video.themoviedb.helper')
_plugin = Plugin()
_debuglogging = _addon.getSettingBool('debug_logging')
_cache = simplecache.SimpleCache()
_basedir_movie = _addon.getSettingString('movies_library') or 'special://profile/addon_data/plugin.video.themoviedb.helper/movies/'
_basedir_tv = _addon.getSettingString('tvshows_library') or 'special://profile/addon_data/plugin.video.themoviedb.helper/tvshows/'


def replace_content(content, old, new):
    content = content.replace(old, new)
    return replace_content(content, old, new) if old in content else content


def clean_content(content, details='info=play'):
    content = content.replace('info=flatseasons', details)
    content = content.replace('info=details', details)
    content = content.replace('fanarttv=True', '')
    content = content.replace('widget=True', '')
    content = content.replace('localdb=True', '')
    content = content.replace('nextpage=True', '')
from resources.lib.plugin import Plugin
import resources.lib.ltl_api as api

plugin_id = 'plugin.video.latelelibre_fr'

localized_strings = {
    'Next page': 30010,
    'Type not suported': 30011,
    'Video not located': 30012,
    'Previous page': 30013,
    'All videos': 30014,
    'Search': 30015,
}

p = Plugin(plugin_id)

settings = p.get_plugin_settings()
translation = p.get_plugin_translation()

debug_flag = settings.getSetting("debug") == "true"

p.set_debug_mode(debug_flag)
api.set_debug(debug_flag)


def get_located_string(string_name):
    """This function returns the localized string if it is available."""
    return translation(localized_strings.get(string_name)).encode(
        'utf-8'
    ) or string_name if string_name in localized_strings else string_name
示例#5
0
'''
plugin.video.nowtv

A simple Kodi add-on which wraps 'NOW TV Player' to integrate with Kodi.

This script functions as the entrypoint into the plugin, however as we want to
keep this as simple as posible. As a result, this script simply sets up and
calls an instance of our plugin.
'''

from resources.lib.plugin import Plugin

# Kick it.
if __name__ == '__main__':
    instance = Plugin(sys.argv)  # noqa: F821
    instance.run()