示例#1
0
    print("\n=== Processing file %s ===" % inputFile)
    ret = call(['odt2html', inputFile])

    if ret != 0:
        print('Failed converting "%s"' % inputFile)
        sys.exit(1)

    baseInput = inputFile.split('/')[-1][:-4]
    date = baseInput.split('_')[0]
    htmlFileSrc = '%s.html' % inputFile[:-4]

    fd = open(htmlFileSrc, 'r')
    buf = fd.read()
    fd.close()

    rawHead = parseDOM(buf, 'head')
    rawBody = parseDOM(buf, 'body')[0]

    dataTitle = parseDOM(rawHead, 'title')[0]
    dataTags = domMeta(rawHead, 'keywords').split(', ')
    dataShortTitle = domMeta(rawHead, 'classification')

    print('Title: %s' % dataTitle)
    print('Short title: %s' % dataShortTitle)
    print('Tags: %s' % dataTags)

    meta = {
        'longTitle' : dataTitle,
        'shortTitle' : dataShortTitle,
        'tags' : dataTags }
示例#2
0
def domMeta(dom, name):
    return parseDOM(dom, 'meta', ret='content', attrs={'name':name})[0]
                                listitem=li, isFolder=True)

    url = build_url({'mode': 'folder', 'foldername': 'shortfilms'})
    li = xbmcgui.ListItem('Short Films', iconImage='DefaultFolder.png')
    xbmcplugin.addDirectoryItem(handle=addon_handle, url=url,
                                listitem=li, isFolder=True)

    xbmcplugin.endOfDirectory(addon_handle)

elif mode[0] == 'folder':
    foldername = 'fiction'

    link_html = get_url('http://www.cinemargentino.com/category/type/%s' % foldername )

    #ret = parseDOM(link_html, "a", attrs = { "class": "title" }, ret = "href")
    ret = parseDOM(link_html, "div", attrs = { "class": "movie_list_cell" })

    for entry in ret:
      #link_html = get_url('http://www.cinemargentino.com' + link )

      print entry
      thumb_t = parseDOM(entry, "a", attrs = { "class": "subtitle_marker"})
      thumbnail = parseDOM(thumb_t, "img", ret = "src")
      print "==============================================================="
      print thumbnail
      print "==============================================================="
      entry_info = parseDOM(entry, "div", attrs = { "class": "movie_list_cell_info" })
      print entry_info
      link = parseDOM(entry_info, "a", attrs = { "class": "title" }, ret = "href")[0]
      title = parseDOM(entry_info, "a", attrs = { "class": "title" })[0]
      author = parseDOM(entry_info, "h3")[0]