本帖最后由 爱咪哆 于 2017-11-27 11:50 编辑
功能:
1.自动复制tvshow.nfo文件并替换标题为当前文件夹名;
2.自动生成剧集nfo文件,标题为文件名
3.自动替换文件名中的空格为-
4.将图片自动添加-poster
代码详解
[Asm] 纯文本查看 复制代码 @if (@a)==(@b) [url=home.php?mod=space&uid=262062]@End[/url] /*
@echo off &setlocal enabledelayedexpansion
for /f "delims=" %%a in ('dir /a-d/b') do (
set var=%%a
setlocal enabledelayedexpansion
ren "!var!" "!var: =-!"
endlocal
)
ren *.jpg *-poster.jpg
xcopy /y D:\Programs\脚本\tvshow.nfo
for /f %%i in ("%cd%") do set FolderName=%%~ni
for /f "delims=" %%a in (tvshow.nfo) do (
set aa=%%a
set "aa=!aa:替换=%FolderName%!"
echo !aa!>>temp.nfo
)
del tvshow.nfo
ren "temp.nfo" "tvshow.nfo"
@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;
}
脚本和tvshow.nfo模板
剧集.zip
(2.09 KB, 下载次数: 51)
|