예제 #1
0
def update_show(media_id, original_title, tagline):
    if original_title is None and tagline is None:
        PlexLog.warn("Missing original_title and tagline!")
        return
    query = {}
    if tagline is not None:
        query["tagline.value"] = tagline
    if original_title is not None:
        query["originalTitle.value"] = original_title
    update_put(media_id, 2, query)
예제 #2
0
def update_put(media_id, update_type, parameters):
    token = Prefs["Token"]
    if not token:
        PlexLog.warn("Missing token!")
        return
    localhost = "http://127.0.0.1:32400"
    page_url = localhost + "/library/metadata/" + media_id
    xml_element = XML.ElementFromURL(page_url)
    container = xml_element.xpath("//MediaContainer")[0]
    section = String.Unquote(container.get("librarySectionID").encode("utf-8"))
    query = {
        "type": update_type,
        "id": media_id,  # Movie Type 1
        "X-Plex-Token": token
    }
    query.update(parameters)

    request_url = localhost + "/library/sections/" + section + "/all?"
    response = requests.put(request_url, params=query)
    if not response.ok:
        PlexLog.error("Fail to put update (%d)" % response.status_code)
예제 #3
0
def update_track(media_id, artist):
    if artist is None:
        PlexLog.warn("Missing artist!")
    query = {"originalTitle.value": artist}
    update_put(media_id, 10, query)
예제 #4
0
def update_season_summary(media_id, summary):
    if summary is None:
        PlexLog.warn("Missing summary!")
        return
    query = {"summary.value": summary}
    update_put(media_id, 3, query)