Groovy: Select all
{ source, target ->
XML(target.dir / target.nameWithoutExtension + '.xml') {
nfo {
title(target.nameWithoutExtension)
originaltitle(source.nameWithoutExtension)
aired(d)
runtime(minutes)
fileinfo {
streamdetails {
target.mediaInfo.Video.each{ v ->
video {
codec(v.'Encoded_Library/Name' ?: v.'CodecID/Hint' ?: v.'Format')
aspect(v.'DisplayAspectRatio')
width(v.'Width')
height(v.'Height')
}
}
target.mediaInfo.Audio.each{ a ->
audio {
codec(a.'CodecID/Hint' ?: a.'Format')
language(a.'Language/String3')
channels(a.'Channel(s)_Original' ?: a.'Channel(s)')
}
}
}
}
}
}
}
Console Output: Select all
$ ls
REC_2016-10-03_01.mp4
REC_2016-10-03_01.xml
xml: Select all
<nfo>
<title>REC_2016-10-03_01</title>
<originaltitle>GH010104</originaltitle>
<aired>2016-10-03</aired>
<runtime>5</runtime>
<fileinfo>
<streamdetails>
<video>
<codec>AVC</codec>
<aspect>1.778</aspect>
<width>1920</width>
<height>1080</height>
</video>
<audio>
<codec>AAC</codec>
<language>eng</language>
<channels>2</channels>
</audio>
</streamdetails>
</fileinfo>
</nfo>