爱咪哆 发表于 2017-11-27 08:16

刮削文件名生成剧集nfo的bat脚本

效果:自动生成剧集nfo
缺点:不能自动生成tvshow.nfo
求助:求大牛把当前文件夹名写入tvshow.nfo
@if (@a)==(@b) @End /*
@echo off &setlocal
for /r %%i in (*.mkv *.avi *.mp4 *.mpg *.m2ts *.m4v *.mov *.rm *.rmvb *.flv *.f4v *.wmv *.webm) do (
cscript //nologo //e:jscript "%~fs0" "%%~fi"
)
for %%i in (*.mkv *.avi *.mp4 *.mpg *.m2ts *.m4v *.mov *.rm *.rmvb *.flv *.f4v *.wmv *.webm)
for %%i in (*.nfo)
pause
exit /b
*/
var objXmlDoc = new ActiveXObject('Microsoft.XMLDOM'),
    objXsltDoc = new ActiveXObject('Microsoft.XMLDOM'),
    objShell = new ActiveXObject('Shell.Application'),
    objFSO = new ActiveXObject('Scripting.FileSystemObject'),
    objADOS = new ActiveXObject('ADODB.Stream');
objADOS.Type = 2; // adTypeText
var strFullName = WScript.Arguments(0),
    strPath = objFSO.GetParentFolderName(strFullName),
    strBaseName = objFSO.GetBaseName(strFullName),
    objItem = objShell.Namespace(strPath).ParseName(objFSO.GetFileName(strFullName)),
    strTitle = getProperty(objItem, 'DocTitle'),
    strRuntime = (Math.round(Number(getProperty(objItem, 'Duration')) / 600000000)).toString(),
    strS25 = '                         ',
    objNode;
WScript.StdOut.Write((strBaseName + strS25).substr(0, 25) + '' + (strTitle + strS25).substr(0, 25) + '' + ('    ' + strRuntime).slice(-4) + ' min.\n');
objXmlDoc.loadXML('<?xml version="1.0" encoding="UTF-16"?><episodedetails><title /><plot /><runtime /></episodedetails>');
objXsltDoc.loadXML(
'<?xml version="1.0"?>\n' +
'<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n' +
' <xsl:output method="xml" version="1.0" encoding="UTF-8" standalone="yes" indent="yes" />\n' +
' <xsl:template match="node()|@*">\n' +
'<xsl:copy>\n' +
'   <xsl:apply-templates select="node()|@*" />\n' +
'</xsl:copy>\n' +
' </xsl:template>\n' +
'</xsl:stylesheet>');
objXmlDoc.transformNodeToObject(objXsltDoc, objXmlDoc);
objNode = objXmlDoc.documentElement.selectSingleNode('title');
objNode.text = strBaseName;
objNode = objXmlDoc.documentElement.selectSingleNode('plot');
objNode.text = strBaseName;
objNode = objXmlDoc.documentElement.selectSingleNode('runtime');
objNode.text = strRuntime;
objXmlDoc.save(objFSO.BuildPath(strPath, strBaseName + '.nfo'));
function getProperty(objShFI, strPropName) {
objADOS.Open();
objADOS.WriteText(objShFI.ExtendedProperty(strPropName));
objADOS.Position = 0;
var value = objADOS.ReadText();
objADOS.Close();
return value;
}
页: [1]
查看完整版本: 刮削文件名生成剧集nfo的bat脚本