예제 #1
0
def display_directions():
    koding.Text_Box('Directions','1. Open the settings and enter your TMDB api key and, Trakt user name and Client id.\n'
                                 'The TMDB api key is needed for ALL lists.\n'
                                 '2. Click on TMDB, IMDB, or Trakt Lists and you will be promted for a folder name.\n'
                                 'This will create a folder in the userdata/addon_data/plugin.program.xmlerator/xmls folder with the name that you chose.\n'
                                 'The xmls will be created in this folder.\n'
                                 '3. Enter your list number or list name in the dialog box.\n'
                                 'Trakt lists require a user name with a matching list name.\n'
                                 'Both are in the url, example: https://trakt.tv/users/tony5856/lists/test-movies.\n'
                                 'The user name goes in the settings, and the list name in the popup dialog box.\n'
                                 '4. The xmls will be created in your specified folder along with a txt file\n'
                                 'called missing_art. This is a list of the movies, tv shows, or episodes that\n'
                                 'did not return any artwork.\n'
                                 '5. Put the xmls on your host or locally and link to them from your main.xml\n'
                                 '6. Tv shows in the generated xml will need a link to the location of\n'
                                 'the seasons xml for that show. The seasons xml will need a link to the location\n'
                                 'of the episodes xml.')
예제 #2
0
def __replace_gif(url):
    """ put gifs in local cache
    try to put gif in cache to enable motion
    Keyword Arguments:
    url -- url pointing to gif
    """
    if not url.endswith(".gif"):
        return url
    else:
        base_folder = xbmcaddon.Addon().getSetting("cache_folder")
        dest_folder = os.path.join(xbmc.translatePath(base_folder), "artcache")
        xbmcvfs.mkdirs(dest_folder)
        parts = url.split("/")
        dest = xbmc.makeLegalFilename(
            # TODO make sure this is unique
            os.path.join(dest_folder, parts[-2] + parts[-1]))
        if not xbmcvfs.exists(dest):
            try:
                response = requests.get(url, timeout=10, verify=False)
            except:
                return None
            if response.status_code == 200:
                with open(dest, 'wb') as out_file:
                    data = response.content
                    response.close()
                    out_file.write(data)
                    # shutil.copyfileobj(response.raw, out_file)
                    del data
                    del response
                if os.path.getsize(dest) == 0:
                    koding.dolog("0 size gif: " + repr(dest))
                    os.remove(dest)
                    return None
                else:
                    koding.dolog("size: " + repr(os.path.getsize(dest)))
            else:
                koding.Text_Box(xbmcaddon.Addon().getAddonInfo('name'),
                                "gif not found: " + url)
                return None
        xbmc.log("gif done: " + repr(dest))
        return dest
예제 #3
0
def show_message(message):
    import xbmcgui
    if len(message) > 80:
        koding.Text_Box(addon_name, message)
    else:
        xbmcgui.Dialog().ok(addon_name, message)
예제 #4
0
params = dict(urlparse.parse_qsl(sys.argv[2].replace('?', '')))

try: name           = params["name"]
except: name        = ''

try: description    = params["description"]
except: description = name

try: fanart         = params["fanart"]
except: fanart      = ''

try: iconimage      = params["iconimage"]
except: iconimage   = ''

try: mode           = params["mode"]
except: mode        = None

try: url            = params["url"]
except: url         = ''

if mode in master_modes:
    try:
        eval(master_modes[mode])
    except:
        koding.Text_Box('ERROR IN CODE',koding.Last_Error())
elif mode == None:
    Main_Menu()
else:
    dialog.ok('MODE DOES NOT EXIST','The following mode does not exist in your master_modes dictionary:','[COLOR=dodgerblue]%s[/COLOR]'%mode)

xbmcplugin.endOfDirectory(int(sys.argv[1]))