From 9d357153d3d36e68fa55c03e555821b5b934dd39 Mon Sep 17 00:00:00 2001 From: fatratknight Date: Tue, 8 Jun 2010 02:12:32 +0000 Subject: [PATCH] Whoops, overwrote a useful function without realizing it. It was a function that wrote to a text file. It's back in, now. --- output/luaScripts/Subtitler.lua | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/output/luaScripts/Subtitler.lua b/output/luaScripts/Subtitler.lua index 17606e87..d0ab0773 100644 --- a/output/luaScripts/Subtitler.lua +++ b/output/luaScripts/Subtitler.lua @@ -157,7 +157,7 @@ end --***************************************************************************** -local function SaveToFile() +local function SaveToFm2() --***************************************************************************** -- Saves to a copy of the currently playing .fm2. It will append _S to the new -- filename, so run MySweetMovie.fm2, this script makes MySweetMovie_S.fm2 @@ -218,6 +218,29 @@ local function SaveToFile() return true end + +--***************************************************************************** +local function SaveToTxt() +--***************************************************************************** + FixSubs() + local OutFile, Err= io.open(SaveToThisFile,"w") + if not OutFile then + print("File write fail") + print(Err) + return false + end + local Subs= GetSortedSubs() + for i= 1, #Subs do + OutFile:write("subtitle ".. Subs[i] .." ".. WordyWords[Subs[i]] .."\n") + end + OutFile:close() + print("Saved",#Subs,"lines to",SaveToThisFile) + + return true +end + + + --***************************************************************************** local KeyFunctions= {} --***************************************************************************** @@ -264,7 +287,7 @@ KeyFunctions[PntAll]= KeyFunctions._PntAll function KeyFunctions._SaveTxt() --Save to a file - SaveToFile() + SaveToTxt() end KeyFunctions[SaveTxt]= KeyFunctions._SaveTxt @@ -288,7 +311,7 @@ function KeyFunctions._SvToMov() --Saves directly to the movie itself print("Movie detected. Hit",SvToMov,"again to stop movie and", "save subtitles directly into movie! Advance a frame to cancel.") else - SaveToFile() + SaveToFm2() end end KeyFunctions[SvToMov]= KeyFunctions._SvToMov @@ -332,7 +355,7 @@ end local function Ex() --***************************************************************************** if SaveOnExit then - if not SaveToFile() then + if not SaveToTxt() then print("Dumping subtitles in message box instead!") print("===========================") local S= GetSortedSubs()