[Metadata][XBMC] Add fileinfo to nfo
Also fixed a int / int = int divide bug
This commit is contained in:
@@ -454,7 +454,7 @@ class Scanner(Plugin):
|
|||||||
data['resolution_width'] = meta.get('resolution_width', 720)
|
data['resolution_width'] = meta.get('resolution_width', 720)
|
||||||
data['resolution_height'] = meta.get('resolution_height', 480)
|
data['resolution_height'] = meta.get('resolution_height', 480)
|
||||||
data['audio_channels'] = meta.get('audio_channels', 2.0)
|
data['audio_channels'] = meta.get('audio_channels', 2.0)
|
||||||
data['aspect'] = meta.get('resolution_width', 720) / meta.get('resolution_height', 480)
|
data['aspect'] = round(float(meta.get('resolution_width', 720)) / meta.get('resolution_height', 480), 2)
|
||||||
except:
|
except:
|
||||||
log.debug('Error parsing metadata: %s %s', (cur_file, traceback.format_exc()))
|
log.debug('Error parsing metadata: %s %s', (cur_file, traceback.format_exc()))
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -139,6 +139,30 @@ class XBMC(MetaDataBase):
|
|||||||
trailer = SubElement(nfoxml, 'trailer')
|
trailer = SubElement(nfoxml, 'trailer')
|
||||||
trailer.text = toUnicode(data['files']['trailer'][0])
|
trailer.text = toUnicode(data['files']['trailer'][0])
|
||||||
|
|
||||||
|
# Add file metadata
|
||||||
|
fileinfo = SubElement(nfoxml, 'fileinfo')
|
||||||
|
streamdetails = SubElement(fileinfo, 'streamdetails')
|
||||||
|
|
||||||
|
# Video data
|
||||||
|
if data['meta_data'].get('video'):
|
||||||
|
video = SubElement(streamdetails, 'video')
|
||||||
|
codec = SubElement(video, 'codec')
|
||||||
|
codec.text = toUnicode(data['meta_data']['video'])
|
||||||
|
aspect = SubElement(video, 'aspect')
|
||||||
|
aspect.text = str(data['meta_data']['aspect'])
|
||||||
|
width = SubElement(video, 'width')
|
||||||
|
width.text = str(data['meta_data']['resolution_width'])
|
||||||
|
height = SubElement(video, 'height')
|
||||||
|
height.text = str(data['meta_data']['resolution_height'])
|
||||||
|
|
||||||
|
# Audio data
|
||||||
|
if data['meta_data'].get('audio'):
|
||||||
|
audio = SubElement(streamdetails, 'audio')
|
||||||
|
codec = SubElement(audio, 'codec')
|
||||||
|
codec.text = toUnicode(data['meta_data'].get('audio'))
|
||||||
|
channels = SubElement(audio, 'channels')
|
||||||
|
channels.text = toUnicode(data['meta_data'].get('audio_channels'))
|
||||||
|
|
||||||
# Clean up the xml and return it
|
# Clean up the xml and return it
|
||||||
nfoxml = xml.dom.minidom.parseString(tostring(nfoxml))
|
nfoxml = xml.dom.minidom.parseString(tostring(nfoxml))
|
||||||
xml_string = nfoxml.toprettyxml(indent = ' ')
|
xml_string = nfoxml.toprettyxml(indent = ' ')
|
||||||
|
|||||||
Reference in New Issue
Block a user