Last active
May 15, 2024 06:53
-
-
Save yoshimov/836044bc2218604311deeeca4ea6847b to your computer and use it in GitHub Desktop.
generate dvdstyler xml prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# XMLファイルの出力先 | |
$xmlFile = "dvdstyler.xml" | |
# 動画ファイルのフルパスが記載されたファイル | |
$videoList = "dvdstyler-list.txt" | |
# XMLドキュメントを作成 | |
$xmlDoc = New-Object System.Xml.XmlDocument | |
# XML宣言を追加 | |
$xmlDecl = $xmlDoc.CreateXmlDeclaration("1.0", "utf-8", $null) | |
$xmlDoc.AppendChild($xmlDecl) | Out-Null | |
# dvdstyler要素を作成 | |
$dvdstyler = $xmlDoc.CreateElement("dvdstyler") | |
$dvdstyler.SetAttribute("format", "4") | |
$dvdstyler.SetAttribute("template", "Basic\textAuto1WS.dvdt") | |
$dvdstyler.SetAttribute("isoFile", "C:\Media\Video\Drama\dvd.iso") | |
$dvdstyler.SetAttribute("name", "DramaDVD") | |
$dvdstyler.SetAttribute("defPostCommand", "2") | |
$dvdstyler.SetAttribute("emptyMenu", "0") | |
$dvdstyler.SetAttribute("videoFormat", "3") | |
$dvdstyler.SetAttribute("audioFormat", "3") | |
$dvdstyler.SetAttribute("aspectRatio", "2") | |
# colours要素を作成 | |
$colours = $xmlDoc.CreateElement("colours") | |
$colours.SetAttribute("colour0", "#404040") | |
$colours.SetAttribute("colour2", "#202020") | |
$colours.SetAttribute("colour5", "#ff0000") | |
$colours.SetAttribute("colour8", "#ffff00") | |
$dvdstyler.AppendChild($colours) | Out-Null | |
# vmgm要素を作成 | |
$vmgm = $xmlDoc.CreateElement("vmgm") | |
$fpc = $xmlDoc.CreateElement("fpc") | |
$fpc.InnerText = "jump title 1;" | |
$vmgm.AppendChild($fpc) | Out-Null | |
$menus = $xmlDoc.CreateElement("menus") | |
$video = $xmlDoc.CreateElement("video") | |
$video.SetAttribute("format", "ntsc") | |
$video.SetAttribute("aspect", "16:9") | |
$video.SetAttribute("widescreen", "nopanscan") | |
$menus.AppendChild($video) | Out-Null | |
$audio = $xmlDoc.CreateElement("audio") | |
$audio.SetAttribute("lang", "JA") | |
$menus.AppendChild($audio) | Out-Null | |
$vmgm.AppendChild($menus) | Out-Null | |
$dvdstyler.AppendChild($vmgm) | Out-Null | |
# titleset要素を作成 | |
$titleset = $xmlDoc.CreateElement("titleset") | |
$menus = $xmlDoc.CreateElement("menus") | |
$video = $xmlDoc.CreateElement("video") | |
$video.SetAttribute("format", "ntsc") | |
$video.SetAttribute("aspect", "16:9") | |
$video.SetAttribute("widescreen", "nopanscan") | |
$menus.AppendChild($video) | Out-Null | |
$audio = $xmlDoc.CreateElement("audio") | |
$audio.SetAttribute("lang", "JA") | |
$menus.AppendChild($audio) | Out-Null | |
$titleset.AppendChild($menus) | Out-Null | |
$titles = $xmlDoc.CreateElement("titles") | |
$video = $xmlDoc.CreateElement("video") | |
$video.SetAttribute("format", "ntsc") | |
$video.SetAttribute("aspect", "16:9") | |
$video.SetAttribute("widescreen", "nopanscan") | |
$titles.AppendChild($video) | Out-Null | |
$audio = $xmlDoc.CreateElement("audio") | |
$audio.SetAttribute("lang", "JA") | |
$titles.AppendChild($audio) | Out-Null | |
# 動画ファイルのフルパスを読み込む | |
$videos = Get-Content -Encoding UTF8 $videoList | |
# タイトル番号を初期化 | |
$titleNum = 1 | |
# 動画ファイルごとにpgc要素を作成 | |
foreach ($video in $videos) { | |
$pgc = $xmlDoc.CreateElement("pgc") | |
$vob = $xmlDoc.CreateElement("vob") | |
$vob.SetAttribute("file", $video) | |
# チャプターを10分ごとに設定 | |
$chapters = "0:00,10:00,20:00,30:00,40:00" | |
$vob.SetAttribute("chapters", $chapters) | |
$video = $xmlDoc.CreateElement("video") | |
$video.SetAttribute("format", "3") | |
$vob.AppendChild($video) | Out-Null | |
$audio = $xmlDoc.CreateElement("audio") | |
$audio.SetAttribute("format", "3") | |
$vob.AppendChild($audio) | Out-Null | |
$pgc.AppendChild($vob) | Out-Null | |
$post = $xmlDoc.CreateElement("post") | |
$post.InnerText = "jump next title;" | |
$pgc.AppendChild($post) | Out-Null | |
$titles.AppendChild($pgc) | Out-Null | |
$titleNum++ | |
} | |
# titleset要素にtitles要素を追加 | |
$titleset.AppendChild($titles) | Out-Null | |
# dvdstyler要素にtitleset要素を追加 | |
$dvdstyler.AppendChild($titleset) | Out-Null | |
# XMLドキュメントにdvdstyler要素を追加 | |
$xmlDoc.AppendChild($dvdstyler) | Out-Null | |
Write-Output $xmlDoc.OuterXml | |
# XMLファイルに保存 | |
$xmlDoc.Save($xmlFile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
動画ファイルのフルパスが列挙されたファイルを読み込んで、順番にタイトルに入れたdvdstylerタグのxmlを生成するPowerShellスクリプトを書いてください。 | |
- 各タイトルのvideo formatは3, audio formatは3 | |
- 動画ファイルのフルパスはdvdstyler-list.txtに記載。エンコーディングはUTF-8 | |
- xmlファイルはdvdstyler.xmlとして出力 | |
以下はdvdstylerのxmlのサンプル | |
<?xml version="1.0" encoding="utf-8"?> | |
<dvdstyler format="4" template="Basic\textAuto1WS.dvdt" isoFile="C:\dvd.iso" name="dvd" defPostCommand="2" emptyMenu="0" videoFormat="3" audioFormat="3" aspectRatio="2"> | |
<colours colour0="#404040" colour2="#202020" colour5="#ff0000" colour8="#ffff00"/> | |
<!--************** VMGM **************--> | |
<vmgm> | |
<fpc>jump title 1;</fpc> | |
<menus> | |
<video format="ntsc" aspect="16:9" widescreen="nopanscan"/> | |
<audio lang="JA"/> | |
</menus> | |
</vmgm> | |
<!--************** TITLESET 1 **************--> | |
<titleset> | |
<menus> | |
<video format="ntsc" aspect="16:9" widescreen="nopanscan"/> | |
<audio lang="JA"/> | |
</menus> | |
<titles> | |
<video format="ntsc" aspect="16:9" widescreen="nopanscan"/> | |
<audio lang="JA"/> | |
<!--************** TITLE 1 **************--> | |
<pgc> | |
<vob file="C:\ep1.mkv" chapters="0:00,10:00,20:00,30:00,40:00"> | |
<video format="3"/> | |
<audio format="3"/> | |
</vob> | |
<post>jump next title;</post> | |
</pgc> | |
<!--************** TITLE 2 **************--> | |
<pgc> | |
<vob file="C:\ep2.mkv" chapters="0:00,10:00,20:00,30:00,40:00"> | |
<video format="3"/> | |
<audio format="3"/> | |
</vob> | |
<post>jump next title;</post> | |
</pgc> | |
</titles> | |
</titleset> | |
</dvdstyler> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment