吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 3409|回复: 1
收起左侧

[其他转载] 文件名剧集刮削(加强版)脚本代码与说明

[复制链接]
爱咪哆 发表于 2017-11-27 11:44
本帖最后由 爱咪哆 于 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)





发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

huangxu 发表于 2017-11-27 11:59
感谢楼主分享,,辛苦了
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-11-15 08:34

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表