Ejemplo n.º 1
0
def GetMetadata(metadata, error_log, TVDBid, title):
    url = 'http://tvthemes.plexapp.com/{}.mp3'.format(TVDBid)
    Log.Info("".ljust(157, '-'))
    if 'Plex' in Prefs['themes'] and TVDBid.isdigit():
        title = title or TVDBid
        result = '*' if url in metadata.themes else common.GetStatusCode(url)
        Log.Info(
            "Plex.GetMetadata() - Prefs['themes']: '{setting}, TVDBid: '{TVDBid}', result code: '{plex}', url: '{url}'"
            .format(setting=Prefs['themes'],
                    TVDBid=TVDBid,
                    plex=result in (200, '*'),
                    url=url))
        if result in (200, "*"):
            return {'themes': {url: ("Plex/%s.mp3" % TVDBid, 2, None)}}
        else:
            error_log['Plex themes missing'].append(
                "TVDBid: '{}' | Title: '{}' | {}".format(
                    common.WEB_LINK % (common.TVDB_SERIE_URL + TVDBid, title),
                    title, common.WEB_LINK %
                    ("mailto:[email protected]?cc=&subject=Missing%%20theme%%20song%%20-%%20'%s%%20-%%20%s.mp3'"
                     % (title, TVDBid), 'Upload')))
    else:
        Log.Info(
            "Plex.GetMetadata() - Not pulling meta - 'Plex' in Prefs['themes']: '{}', TVDBid: '{}'"
            .format('Plex' in Prefs['themes'], TVDBid))
    return {}
Ejemplo n.º 2
0
def GetMetadata(metadata, error_log, TVDBid, title):
    Log.Info("=== Plex.GetMetadata() ===".ljust(157, '='))
    url = THEME_URL.format(TVDBid)
    Plex_dict = {}

    Log.Info("Prefs['themes']: '{}', TVDBid: '{}'".format(
        Prefs['themes'], TVDBid))
    Log.Info("--- themes ---".ljust(157, '-'))
    if 'Plex' in Prefs['themes'] and TVDBid.isdigit():
        title = title or TVDBid
        result = '*' if url in metadata.themes else common.GetStatusCode(url)
        Log.Info("result code: '{plex}', url: '{url}'".format(plex=result,
                                                              url=url))
        if result in (200, "*"):
            Log.Info("[ ] theme: {}".format(
                SaveDict(("Plex/%s.mp3" % TVDBid, 2, None), Plex_dict,
                         'themes', url)))
        else:
            error_log['Plex themes missing'].append(
                "TVDBid: '{}' | Title: '{}' | {}".format(
                    common.WEB_LINK % (common.TVDB_SERIE_URL + TVDBid, title),
                    title, common.WEB_LINK %
                    ("mailto:[email protected]?cc=&subject=Missing%%20theme%%20song%%20-%%20'%s%%20-%%20%s.mp3'"
                     % (title, TVDBid), 'Upload')))
    else:
        Log.Info(
            "Not pulling meta - 'Plex' in Prefs['themes']: '{}', TVDBid: '{}'".
            format('Plex' in Prefs['themes'], TVDBid))

    Log.Info("--- return ---".ljust(157, '-'))
    Log.Info("Plex_dict: {}".format(DictString(Plex_dict, 1)))
    return Plex_dict
Ejemplo n.º 3
0
def GetMetadata(metadata, title1, title2):
    Log.Info("=== TVTunes.GetMetadata() ===".ljust(157, '='))
    THEME_URL = "http://www.televisiontunes.com/uploads/audio/{}.mp3"
    TVTunes_dict = {}

    Log.Info("Prefs['themes']: '{}', title: '{}', title2: '{}'".format(
        Prefs['themes'], title1, title2))
    Log.Info("--- themes ---".ljust(157, '-'))
    if 'TVTunes' in Prefs['themes'] and (title1 or title2):
        for url in [
                THEME_URL.format(String.Quote(t)) for t in (title1, title2)
                if t
        ]:
            result = '*' if url in metadata.themes or Data.Exists(
                url.split('/')[-1]) else common.GetStatusCode(url)
            Log.Info("Return code: '{}', url: '{}'".format(result, url))
            if result in (200, "*"):
                Log.Info("[ ] theme: {}".format(
                    SaveDict(
                        ("TelevisionTunes/" + url.split('/')[-1], 1, None),
                        TVTunes_dict, 'themes', url)))

    Log.Info("--- return ---".ljust(157, '-'))
    Log.Info("TVTunes_dict: {}".format(DictString(TVTunes_dict, 1)))
    return TVTunes_dict
Ejemplo n.º 4
0
def GetMetadata(metadata, title1, title2):
    THEME_URL = "http://www.televisiontunes.com/uploads/audio/{}.mp3"
    TVTunes_dict = {}
    Log.Info("".ljust(157, '-'))
    Log.Info(
        "TVTunes.GetMetadata() - 'themes' - title: '{}', title2: '{}', Prefs['themes']: '{}'"
        .format(title1, title2, Prefs['themes']))
    if 'TVTunes' in Prefs['themes'] and (title1 or title2):
        for url in set([
                THEME_URL.format(String.Quote(title1)),
                THEME_URL.format(String.Quote(title2))
        ]):
            result = '*' if url in metadata.themes or Data.Exists(
                url.split('/')[-1]) else common.GetStatusCode(url)
            Log.Info(
                "TVTunes.GetMetadata() - Return code: '{}', url: '{}'".format(
                    result, url))
            if result in (200, "*"):
                return {
                    'themes': {
                        url: ("TelevisionTunes/" + url.split('/')[-1], 1, None)
                    }
                }
    return {}