當前位置: 首頁>>代碼示例>>Python>>正文


Python VideoMetadata.releasedate方法代碼示例

本文整理匯總了Python中MythTV.VideoMetadata.releasedate方法的典型用法代碼示例。如果您正苦於以下問題:Python VideoMetadata.releasedate方法的具體用法?Python VideoMetadata.releasedate怎麽用?Python VideoMetadata.releasedate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MythTV.VideoMetadata的用法示例。


在下文中一共展示了VideoMetadata.releasedate方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: buildSingle

# 需要導入模塊: from MythTV import VideoMetadata [as 別名]
# 或者: from MythTV.VideoMetadata import releasedate [as 別名]
def buildSingle(inetref, opts):
    from MythTV.tmdb3.tmdb_exceptions import TMDBRequestInvalid
    from MythTV.tmdb3 import Movie
    from MythTV import VideoMetadata
    from lxml import etree

    import re
    if re.match('^0[0-9]{6}$', inetref):
        movie = Movie.fromIMDB(inetref)
    else:
        movie = Movie(inetref)

    tree = etree.XML(u'<metadata></metadata>')
    mapping = [['runtime',      'runtime'],     ['title',       'originaltitle'],
               ['releasedate',  'releasedate'], ['tagline',     'tagline'],
               ['description',  'overview'],    ['homepage',    'homepage'],
               ['userrating',   'userrating'],  ['popularity',  'popularity'],
               ['budget',       'budget'],      ['revenue',     'revenue']]
    m = VideoMetadata()
    for i,j in mapping:
        try:
            if getattr(movie, j):
                setattr(m, i, getattr(movie, j))
        except TMDBRequestInvalid:
            sys.stdout.write(etree.tostring(tree, encoding='UTF-8', pretty_print=True,
                                            xml_declaration=True))
            sys.exit()

    if movie.title:
        m.title = movie.title

    releases = movie.releases.items()

    if opts.country:
        try:
            # resort releases with selected country at top to ensure it
            # is selected by the metadata libraries
            index = zip(*releases)[0].index(opts.country)
            releases.insert(0, releases.pop(index))
        except IndexError, ValueError:
            pass
        else:
            m.releasedate = releases[0][1].releasedate
開發者ID:shyamalschandra,項目名稱:mythtv,代碼行數:45,代碼來源:tmdb3.py

示例2: buildSingle

# 需要導入模塊: from MythTV import VideoMetadata [as 別名]
# 或者: from MythTV.VideoMetadata import releasedate [as 別名]
def buildSingle(inetref, opts):
    from MythTV.tmdb3 import Movie
    from MythTV import VideoMetadata
    from lxml import etree

    import re
    if re.match('^0[0-9]{6}$', inetref):
        movie = Movie.fromIMDB(inetref)
    else:
        movie = Movie(inetref)

    tree = etree.XML(u'<metadata></metadata>')
    mapping = [['runtime',      'runtime'],     ['title',       'originaltitle'],
               ['releasedate',  'releasedate'], ['tagline',     'tagline'],
               ['description',  'overview'],    ['homepage',    'homepage'],
               ['userrating',   'userrating'],  ['popularity',  'popularity'],
               ['budget',       'budget'],      ['revenue',     'revenue']]
    m = VideoMetadata()
    for i,j in mapping:
        if getattr(movie, j):
            setattr(m, i, getattr(movie, j))

    if movie.title:
        m.title = movie.title

    releases = movie.releases.items()

    if opts.country:
        try:
            # resort releases with selected country at top to ensure it
            # is selected by the metadata libraries
            index = zip(*releases)[0].index(opts.country)
            releases.insert(0, releases.pop(index))
        except ValueError:
            pass
        else:
            m.releasedate = releases[0][1].releasedate

    m.inetref = str(movie.id)
    if movie.collection:
        m.collectionref = str(movie.collection.id)
    if movie.releasedate:
        m.year = movie.releasedate.year
    for country, release in releases:
        if release.certification:
            m.certifications[country] = release.certification
    for genre in movie.genres:
        m.categories.append(genre.name)
    for studio in movie.studios:
        m.studios.append(studio.name)
    for country in movie.countries:
        m.countries.append(country.name)
    for cast in movie.cast:
        d = {'name':cast.name, 'character':cast.character, 'department':'Actors',
             'job':'Actor', 'url':'http://www.themoviedb.org/people/{0}'.format(cast.id)}
        if cast.profile: d['thumb'] = cast.profile.geturl()
        m.people.append(d)
    for crew in movie.crew:
        d = {'name':crew.name, 'job':crew.job, 'department':crew.department,
             'url':'http://www.themoviedb.org/people/{0}'.format(crew.id)}
        if crew.profile: d['thumb'] = crew.profile.geturl()
        m.people.append(d)
    for backdrop in movie.backdrops:
        m.images.append({'type':'fanart', 'url':backdrop.geturl(),
                        'thumb':backdrop.geturl(backdrop.sizes()[0]),
                        'height':str(backdrop.height),
                        'width':str(backdrop.width)})
    for poster in movie.posters:
        m.images.append({'type':'coverart', 'url':poster.geturl(),
                        'thumb':poster.geturl(poster.sizes()[0]),
                        'height':str(poster.height),
                        'width':str(poster.width)})
    tree.append(m.toXML())
    sys.stdout.write(etree.tostring(tree, encoding='UTF-8', pretty_print=True,
                                    xml_declaration=True))
    sys.exit()
開發者ID:imclab,項目名稱:mythtv,代碼行數:78,代碼來源:tmdb3.py

示例3: buildSingle

# 需要導入模塊: from MythTV import VideoMetadata [as 別名]
# 或者: from MythTV.VideoMetadata import releasedate [as 別名]
def buildSingle(inetref, opts):
    from MythTV.tmdb3 import Movie
    from MythTV import VideoMetadata
    from lxml import etree

    import re

    if re.match("^0[0-9]{6}$", inetref):
        movie = Movie.fromIMDB(inetref)
    else:
        movie = Movie(inetref)

    tree = etree.XML(u"<metadata></metadata>")
    mapping = [
        ["runtime", "runtime"],
        ["title", "originaltitle"],
        ["releasedate", "releasedate"],
        ["tagline", "tagline"],
        ["description", "overview"],
        ["homepage", "homepage"],
        ["userrating", "userrating"],
        ["popularity", "popularity"],
        ["budget", "budget"],
        ["revenue", "revenue"],
    ]
    m = VideoMetadata()
    for i, j in mapping:
        if getattr(movie, j):
            setattr(m, i, getattr(movie, j))

    if movie.title:
        m.title = movie.title

    releases = movie.releases.items()

    if opts.country:
        try:
            # resort releases with selected country at top to ensure it
            # is selected by the metadata libraries
            index = zip(*releases)[0].index(opts.country)
            releases.insert(0, releases.pop(index))
        except ValueError:
            pass
        else:
            m.releasedate = releases[0][1].releasedate

    m.inetref = str(movie.id)
    if movie.collection:
        m.collectionref = str(movie.collection.id)
    if movie.releasedate:
        m.year = movie.releasedate.year
    for country, release in releases:
        if release.certification:
            m.certifications[country] = release.certification
    for genre in movie.genres:
        m.categories.append(genre.name)
    for studio in movie.studios:
        m.studios.append(studio.name)
    for country in movie.countries:
        m.countries.append(country.name)
    for cast in movie.cast:
        d = {
            "name": cast.name,
            "character": cast.character,
            "department": "Actors",
            "job": "Actor",
            "url": "http://www.themoviedb.org/people/{0}".format(cast.id),
        }
        if cast.profile:
            d["thumb"] = cast.profile.geturl()
        m.people.append(d)
    for crew in movie.crew:
        d = {
            "name": crew.name,
            "job": crew.job,
            "department": crew.department,
            "url": "http://www.themoviedb.org/people/{0}".format(crew.id),
        }
        if crew.profile:
            d["thumb"] = crew.profile.geturl()
        m.people.append(d)
    for backdrop in movie.backdrops:
        m.images.append({"type": "fanart", "url": backdrop.geturl(), "thumb": backdrop.geturl(backdrop.sizes()[0])})
    for poster in movie.posters:
        m.images.append({"type": "coverart", "url": poster.geturl(), "thumb": poster.geturl(poster.sizes()[0])})
    tree.append(m.toXML())
    sys.stdout.write(etree.tostring(tree, encoding="UTF-8", pretty_print=True, xml_declaration=True))
    sys.exit()
開發者ID:,項目名稱:,代碼行數:90,代碼來源:


注:本文中的MythTV.VideoMetadata.releasedate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。