Ejemplo n.º 1
0
def get_movies(movie_type):
    movies = []
    url = '%s.json?apikey=%s' % (movie_type, RT_KEY)
    results = utils.get_JSON_response(BASE_URL + url, folder="RottenTomatoes")
    if not results or "movies" not in results:
        return []
    for item in results["movies"]:
        if "alternate_ids" not in item:
            continue
        imdb_id = str(item["alternate_ids"]["imdb"])
        if addon.bool_setting("infodialog_onclick"):
            path = PLUGIN_BASE + 'extendedinfo&&imdb_id=%s' % imdb_id
        else:
            search_string = "%s %s trailer" % (item["title"], item["year"])
            path = PLUGIN_BASE + "playtrailer&&title=%s&&imdb_id=%s" % (search_string, imdb_id)
        movie = ListItem(label=item.get('title'),
                         path=path)
        movie.set_infos({'title': item["title"],
                         'mediatype': "movie",
                         'duration': item["runtime"] * 60,
                         'year': item["year"],
                         'premiered': item["release_dates"].get("theater", ""),
                         'rating': item["ratings"]["audience_score"] / 10.0,
                         'plot': item["synopsis"],
                         'imdbnumber': imdb_id,
                         'mpaa': item["mpaa_rating"]})
        movie.set_properties({'imdb_id': imdb_id,
                              'duration(h)': utils.format_time(item["runtime"], "h"),
                              'duration(m)': utils.format_time(item["runtime"], "m")})
        movie.set_artwork({'thumb': item["posters"]["original"],
                           'poster': item["posters"]["original"]})
        movies.append(movie)
    return local_db.merge_with_local(media_type="movie",
                                     items=movies,
                                     library_first=False)
Ejemplo n.º 2
0
def handle_movies(results):
    movies = ItemList(content_type="movies")
    path = 'extendedinfo&&id=%s' if addon.bool_setting(
        "infodialog_onclick") else "playtrailer&&id=%s"
    for i in results:
        item = i["movie"] if "movie" in i else i
        trailer = "%syoutubevideo&&id=%s" % (
            PLUGIN_BASE, utils.extract_youtube_id(item["trailer"]))
        movie = VideoItem(label=item["title"],
                          path=PLUGIN_BASE + path % item["ids"]["tmdb"])
        movie.set_infos({
            'title':
            item["title"],
            'duration':
            item["runtime"] * 60 if item["runtime"] else "",
            'tagline':
            item["tagline"],
            'mediatype':
            "movie",
            'trailer':
            trailer,
            'year':
            item["year"],
            'mpaa':
            item["certification"],
            'plot':
            item["overview"],
            'imdbnumber':
            item["ids"]["imdb"],
            'premiered':
            item["released"],
            'rating':
            round(item["rating"], 1),
            'votes':
            item["votes"],
            'genre':
            " / ".join(item["genres"])
        })
        movie.set_properties({
            'id': item["ids"]["tmdb"],
            'imdb_id': item["ids"]["imdb"],
            'trakt_id': item["ids"]["trakt"],
            'watchers': item.get("watchers"),
            'language': item.get("language"),
            'homepage': item.get("homepage")
        })
        art_info = tmdb.get_movie(item["ids"]["tmdb"], light=True)
        movie.set_artwork(
            tmdb.get_image_urls(poster=art_info.get("poster_path"),
                                fanart=art_info.get("backdrop_path")))
        movies.append(movie)
    movies = local_db.merge_with_local(media_type="movie",
                                       items=movies,
                                       library_first=False)
    movies.set_sorts(["mpaa", "duration"])
    return movies
Ejemplo n.º 3
0
def handle_movies(results):
    movies = []
    path = 'extendedinfo&&id=%s' if addon.bool_setting(
        "infodialog_onclick") else "playtrailer&&id=%s"
    for i in results:
        item = i["movie"] if "movie" in i else i
        movie = ListItem(label=item["title"],
                         path=PLUGIN_BASE + path % item["ids"]["tmdb"])
        movie.set_infos({
            'title': item["title"],
            'duration': item["runtime"] * 60,
            'tagline': item["tagline"],
            'mediatype': "movie",
            'trailer': utils.convert_youtube_url(item["trailer"]),
            'year': item["year"],
            'mpaa': item["certification"],
            'plot': item["overview"],
            'imdbnumber': item["ids"]["imdb"],
            'premiered': item["released"],
            'rating': round(item["rating"], 1),
            'votes': item["votes"],
            'genre': " / ".join(item["genres"])
        })
        movie.set_properties({
            'id':
            item["ids"]["tmdb"],
            'imdb_id':
            item["ids"]["imdb"],
            'trakt_id':
            item["ids"]["trakt"],
            'watchers':
            item.get("watchers"),
            'language':
            item.get("language"),
            'homepage':
            item.get("homepage"),
            'duration(h)':
            utils.format_time(item["runtime"], "h"),
            'duration(m)':
            utils.format_time(item["runtime"], "m")
        })
        movie.set_artwork({
            'poster': item["images"]["poster"]["full"],
            'fanart': item["images"]["fanart"]["full"],
            'clearlogo': item["images"]["logo"]["full"],
            'clearart': item["images"]["clearart"]["full"],
            'banner': item["images"]["banner"]["full"],
            'thumb': item["images"]["poster"]["thumb"]
        })
        movies.append(movie)
    movies = local_db.merge_with_local(media_type="movie",
                                       items=movies,
                                       library_first=False)
    return movies
Ejemplo n.º 4
0
 def open_search(self, control_id):
     if addon.bool_setting("classic_search"):
         result = xbmcgui.Dialog().input(heading=addon.LANG(16017),
                                         type=xbmcgui.INPUT_ALPHANUM)
         if result and result > -1:
             self.search(result.decode("utf-8"))
     else:
         T9Search(call=self.search,
                  start_value="",
                  history=self.__class__.__name__ + ".search")
     if self.total_items > 0:
         self.setFocusId(self.getCurrentContainerId())
Ejemplo n.º 5
0
 def emit(self, record):
     levels = {
         logging.CRITICAL: xbmc.LOGFATAL,
         logging.ERROR: xbmc.LOGERROR,
         logging.WARNING: xbmc.LOGWARNING,
         logging.INFO: xbmc.LOGINFO,
         logging.DEBUG: xbmc.LOGDEBUG,
         logging.NOTSET: xbmc.LOGNONE,
     }
     if addon.bool_setting('debug'):
         try:
             xbmc.log(self.format(record), levels[record.levelno])
         except UnicodeEncodeError:
             xbmc.log(self.format(record).encode('utf-8', 'ignore'), levels[record.levelno])
Ejemplo n.º 6
0
 def emit(self, record):
     levels = {
         logging.CRITICAL: xbmc.LOGFATAL,
         logging.ERROR: xbmc.LOGERROR,
         logging.WARNING: xbmc.LOGWARNING,
         logging.INFO: xbmc.LOGINFO,
         logging.DEBUG: xbmc.LOGDEBUG,
         logging.NOTSET: xbmc.LOGNONE,
     }
     if addon.bool_setting('debug'):
         try:
             xbmc.log(self.format(record), levels[record.levelno])
         except UnicodeEncodeError:
             xbmc.log(self.format(record).encode('utf-8', 'ignore'), levels[record.levelno])
def get_movies(movie_type):
    movies = []
    url = '%s.json?apikey=%s' % (movie_type, RT_KEY)
    results = utils.get_JSON_response(BASE_URL + url, folder="RottenTomatoes")
    if not results or "movies" not in results:
        return []
    for item in results["movies"]:
        if "alternate_ids" not in item:
            continue
        imdb_id = str(item["alternate_ids"]["imdb"])
        if addon.bool_setting("infodialog_onclick"):
            path = PLUGIN_BASE + 'extendedinfo&&imdb_id=%s' % imdb_id
        else:
            search_string = "%s %s trailer" % (item["title"], item["year"])
            path = PLUGIN_BASE + "playtrailer&&title=%s&&imdb_id=%s" % (
                search_string, imdb_id)
        movie = ListItem(label=item.get('title'), path=path)
        movie.set_infos({
            'title': item["title"],
            'mediatype': "movie",
            'duration': item["runtime"] * 60,
            'year': item["year"],
            'premiered': item["release_dates"].get("theater", ""),
            'rating': item["ratings"]["audience_score"] / 10.0,
            'plot': item["synopsis"],
            'imdbnumber': imdb_id,
            'mpaa': item["mpaa_rating"]
        })
        movie.set_properties({
            'imdb_id':
            imdb_id,
            'duration(h)':
            utils.format_time(item["runtime"], "h"),
            'duration(m)':
            utils.format_time(item["runtime"], "m")
        })
        movie.set_artwork({
            'thumb': item["posters"]["original"],
            'poster': item["posters"]["original"]
        })
        movies.append(movie)
    return local_db.merge_with_local(media_type="movie",
                                     items=movies,
                                     library_first=False)
Ejemplo n.º 8
0
def handle_movies(results):
    movies = []
    path = 'extendedinfo&&id=%s' if addon.bool_setting("infodialog_onclick") else "playtrailer&&id=%s"
    for i in results:
        item = i["movie"] if "movie" in i else i
        movie = ListItem(label=item["title"],
                         path=PLUGIN_BASE + path % item["ids"]["tmdb"])
        movie.set_infos({'title': item["title"],
                         'duration': item["runtime"] * 60,
                         'tagline': item["tagline"],
                         'mediatype': "movie",
                         'trailer': utils.convert_youtube_url(item["trailer"]),
                         'year': item["year"],
                         'mpaa': item["certification"],
                         'plot': item["overview"],
                         'imdbnumber': item["ids"]["imdb"],
                         'premiered': item["released"],
                         'rating': round(item["rating"], 1),
                         'votes': item["votes"],
                         'genre': " / ".join(item["genres"])})
        movie.set_properties({'id': item["ids"]["tmdb"],
                              'imdb_id': item["ids"]["imdb"],
                              'trakt_id': item["ids"]["trakt"],
                              'watchers': item.get("watchers"),
                              'language': item.get("language"),
                              'homepage': item.get("homepage"),
                              'duration(h)': utils.format_time(item["runtime"], "h"),
                              'duration(m)': utils.format_time(item["runtime"], "m")})
        movie.set_artwork({'poster': item["images"]["poster"]["full"],
                           'fanart': item["images"]["fanart"]["full"],
                           'clearlogo': item["images"]["logo"]["full"],
                           'clearart': item["images"]["clearart"]["full"],
                           'banner': item["images"]["banner"]["full"],
                           'thumb': item["images"]["poster"]["thumb"]})
        movies.append(movie)
    movies = local_db.merge_with_local(media_type="movie",
                                       items=movies,
                                       library_first=False)
    return movies
Ejemplo n.º 9
0
def handle_movies(results):
    movies = ItemList(content_type="movies")
    path = 'extendedinfo&&id=%s' if addon.bool_setting("infodialog_onclick") else "playtrailer&&id=%s"
    for i in results:
        item = i["movie"] if "movie" in i else i
        trailer = "%syoutubevideo&&id=%s" % (PLUGIN_BASE, utils.extract_youtube_id(item["trailer"]))
        movie = VideoItem(label=item["title"],
                          path=PLUGIN_BASE + path % item["ids"]["tmdb"])
        movie.set_infos({'title': item["title"],
                         'duration': item["runtime"] * 60 if item["runtime"] else "",
                         'tagline': item["tagline"],
                         'mediatype': "movie",
                         'trailer': trailer,
                         'year': item["year"],
                         'mpaa': item["certification"],
                         'plot': item["overview"],
                         'imdbnumber': item["ids"]["imdb"],
                         'premiered': item["released"],
                         'rating': round(item["rating"], 1),
                         'votes': item["votes"],
                         'genre': " / ".join(item["genres"])})
        movie.set_properties({'id': item["ids"]["tmdb"],
                              'imdb_id': item["ids"]["imdb"],
                              'trakt_id': item["ids"]["trakt"],
                              'watchers': item.get("watchers"),
                              'language': item.get("language"),
                              'homepage': item.get("homepage")})
        art_info = tmdb.get_movie(item["ids"]["tmdb"], light=True)
        movie.set_artwork(tmdb.get_image_urls(poster=art_info.get("poster_path"),
                                              fanart=art_info.get("backdrop_path")))
        movies.append(movie)
    movies = local_db.merge_with_local(media_type="movie",
                                       items=movies,
                                       library_first=False)
    movies.set_sorts(["mpaa", "duration"])
    return movies
Ejemplo n.º 10
0
import xbmcgui
import xbmcvfs

import TheMovieDB as tmdb

from kodi65 import windows
from kodi65 import addon
from kodi65 import utils
from kodi65 import busy
from kodi65 import player
from kodi65 import local_db

INFO_XML_CLASSIC = u'script-%s-DialogVideoInfo.xml' % (addon.ID)
LIST_XML_CLASSIC = u'script-%s-VideoList.xml' % (addon.ID)
ACTOR_XML_CLASSIC = u'script-%s-DialogInfo.xml' % (addon.ID)
if addon.bool_setting("force_native_layout") and addon.setting("xml_version") != addon.VERSION:
    addon.set_setting("xml_version", addon.VERSION)
    INFO_XML = u'script-%s-DialogVideoInfo-classic.xml' % (addon.ID)
    LIST_XML = u'script-%s-VideoList-classic.xml' % (addon.ID)
    ACTOR_XML = u'script-%s-DialogInfo-classic.xml' % (addon.ID)
    path = os.path.join(addon.PATH, "resources", "skins", "Default", "1080i")
    xbmcvfs.copy(strSource=os.path.join(path, INFO_XML_CLASSIC),
                 strDestnation=os.path.join(path, INFO_XML))
    xbmcvfs.copy(strSource=os.path.join(path, LIST_XML_CLASSIC),
                 strDestnation=os.path.join(path, LIST_XML))
    xbmcvfs.copy(strSource=os.path.join(path, ACTOR_XML_CLASSIC),
                 strDestnation=os.path.join(path, ACTOR_XML))
else:
    INFO_XML = INFO_XML_CLASSIC
    LIST_XML = LIST_XML_CLASSIC
    ACTOR_XML = ACTOR_XML_CLASSIC
Ejemplo n.º 11
0
import xbmcgui
import xbmcvfs

from . import TheMovieDB as tmdb

from kodi65 import windows
from kodi65 import addon
from kodi65 import utils
from kodi65 import busy
from kodi65 import player
from kodi65 import local_db

INFO_XML_CLASSIC = 'script-%s-DialogVideoInfo.xml' % (addon.ID)
LIST_XML_CLASSIC = 'script-%s-VideoList.xml' % (addon.ID)
ACTOR_XML_CLASSIC = 'script-%s-DialogInfo.xml' % (addon.ID)
if addon.bool_setting("force_native_layout"
                      ) and addon.setting("xml_version") != addon.VERSION:
    addon.set_setting("xml_version", addon.VERSION)
    INFO_XML = 'script-%s-DialogVideoInfo-classic.xml' % (addon.ID)
    LIST_XML = 'script-%s-VideoList-classic.xml' % (addon.ID)
    ACTOR_XML = 'script-%s-DialogInfo-classic.xml' % (addon.ID)
    path = os.path.join(addon.PATH, "resources", "skins", "Default", "1080i")
    xbmcvfs.copy(strSource=os.path.join(path, INFO_XML_CLASSIC),
                 strDestination=os.path.join(path, INFO_XML))
    xbmcvfs.copy(strSource=os.path.join(path, LIST_XML_CLASSIC),
                 strDestination=os.path.join(path, LIST_XML))
    xbmcvfs.copy(strSource=os.path.join(path, ACTOR_XML_CLASSIC),
                 strDestination=os.path.join(path, ACTOR_XML))
else:
    INFO_XML = INFO_XML_CLASSIC
    LIST_XML = LIST_XML_CLASSIC
    ACTOR_XML = ACTOR_XML_CLASSIC