aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgarret <garret@airmail.cc>2021-08-11 21:32:54 +0100
committergarret <garret@airmail.cc>2021-08-11 21:32:54 +0100
commit3c90e77dc7adfab7869cbd2f5344d7f441e3a2e1 (patch)
treeee5ef835ea2ca3eb6158fd7b91295931fc6236c4
parent39249b596fd066326b945a599c36c70c2b6ea752 (diff)
downloadaegisub-scripts-3c90e77dc7adfab7869cbd2f5344d7f441e3a2e1.tar.gz
aegisub-scripts-3c90e77dc7adfab7869cbd2f5344d7f441e3a2e1.tar.bz2
aegisub-scripts-3c90e77dc7adfab7869cbd2f5344d7f441e3a2e1.zip
compatibility with significance (same things can go in fx field)
also changed some wording
-rw-r--r--chapters.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/chapters.lua b/chapters.lua
index e9ade7d..a3f65f6 100644
--- a/chapters.lua
+++ b/chapters.lua
@@ -1,5 +1,5 @@
script_name = "Chapter Generator"
-script_description = "makes chapters"
+script_description = "Makes XML chapters for matroska."
script_author = "garret"
script_version = "2.0.0-dev"
@@ -38,8 +38,8 @@ function get_sane_path()
end
end
-function get_user_path(sane_path)
- local path = aegisub.dialog.save("Save Chapter File", sane_path, "chapters.xml", "XML files (.xml)|.xml|All Files (.)|.", false)
+function get_user_path(default_dir)
+ local path = aegisub.dialog.save("Save Chapter File", default_dir, "chapters.xml", "XML files (.xml)|.xml|All Files (.)|.", false)
return path
end
@@ -49,7 +49,8 @@ function main(sub)
for i=1,#sub do
local line = sub[i]
if line.class == "dialogue" then
- if line.effect == "chapter" then
+ local fx = line.effect
+ if fx:match("[Cc]hapter") or fx:match("[Cc]hptr") or fx:match("[Cc]hap") then
line.comment = true
table.insert(times, line.start_time)
table.insert(names, line.text)
@@ -58,7 +59,7 @@ function main(sub)
end
end
aegisub.set_undo_point(script_name)
- local chapters = "<?xml version=\"1.0\"?>\n<!-- <!DOCTYPE Chapters SYSTEM \"matroskachapters.dtd\"> -->\n<!-- generated by garret's chapter script -->\n<Chapters>\n <EditionEntry>\n"
+ local chapters = "<?xml version=\"1.0\"?>\n<!-- <!DOCTYPE Chapters SYSTEM \"matroskachapters.dtd\"> -->\n<Chapters>\n <EditionEntry>\n"
for j, k in ipairs(times) do
local humantime = ms_to_human(k)
local name = names[j]
@@ -73,7 +74,7 @@ function main(sub)
chapfile:close()
aegisub.log("saved to "..path)
else
- aegisub.log("<!-- Chapters not saved, logging here - select everything below this message and copy+paste into a .xml file -->\n\n")
+ aegisub.log("<!-- Chapters not saved, logging here - select everything below this message and copy+paste into an xml file -->\n\n")
aegisub.log(chapters)
end
end