NFO video metadata
#1
Does anyone have a python snippet to write an nfo file for a particular video? Even better would be an instance of xml.etree.ElementTree or a root element of the xml for the nfo file that could be processed and then written to disk.

The broader context is that I'm looking to be able to create an nfo file for a video as a place to save its watched status, but if I only write the watched status, then when you reload the library Kodi won't load any of the other video details, which all remain blank.

The ultimate best option would be to be able to save and restore the watched status from/to an nfo file, but to nonetheless make Kodi go out to the online databases to fetch the rest of the associated video info. My sense is that this isn't possible, but is that correct?
Reply
#2
here's a snippet using minidom to create .nfo files

Code:
import xbmcvfs
from xml.dom.minidom import Document

movienfo = xbmcvfs.File('/path/to/file.nfo', 'w')
# Create the minidom document
xmldoc = Document()
# Create the <movie> base element
xmlroot = xmldoc.createElement('movie')
xmldoc.appendChild(xmlroot)
# Create the main <title> element
xmlname = xmldoc.createElement('title')
xmlroot.appendChild(xmlname)
# Give the <title> element some text
xmltext = xmldoc.createTextNode('name of the movie')
xmlname.appendChild(xmltext)
...
movienfo.write(xmldoc.toprettyxml(encoding='utf-8'))
movienfo.close()
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
You can include a URL that a scraper recognizes to your NFO file, and Kodi will grab all the info from the scraper, then add your NFO bits. I haven't gotten it to work for individual episode NFOs, though.
Reply
#4
Thanks to both of you for the responses. @rmrector: that sounds like a good option for me. I'll give it a shot.
Reply

Logout Mark Read Team Forum Stats Members Help
NFO video metadata0