105 lines
3.3 KiB
C#
105 lines
3.3 KiB
C#
using System;
|
|
using JDSongConverter.Utils;
|
|
using TeaBox.Macros;
|
|
|
|
namespace JDSongConverter.Tasks
|
|
{
|
|
/// <summary>
|
|
/// Updates the karaoke part of JD2015 songs to new format
|
|
/// One shot, not useful anymore.
|
|
/// </summary>
|
|
class UpdateJd2015KaraokeTask : Task
|
|
{
|
|
public override string Name { get { return "Update Karaoke part"; } set { } }
|
|
|
|
public override string ProgressText
|
|
{
|
|
get { return "Updating Karaoke part"; }
|
|
}
|
|
|
|
public override TaskResult Process(IExecutionContext executionContext)
|
|
{
|
|
var timelineFile = AppDefinitions.Default.AbsoluteMapPath(MapPathType.TimelineTpl, Context.Song);
|
|
var ktapeFile = AppDefinitions.Default.AbsoluteMapPath(MapPathType.KaraokeTapeFile, Context.OutputMap.Folder, Context.Song.Name, JDSongVersion.JD2015, JDFolderLayout.Engine);
|
|
var lyricsFile = AppDefinitions.Default.AbsoluteMapPath(MapPathType.LyricsFile, Context.OutputMap.Folder, Context.Song.Name, JDSongVersion.JD2015, JDFolderLayout.Engine);
|
|
|
|
var convertTask = new ConvertTimelineToKtapeTask {Context = Context};
|
|
convertTask.Init(timelineFile, ktapeFile, lyricsFile);
|
|
convertTask.Process(executionContext);
|
|
|
|
var actFile = ktapeFile.Replace(".ktape", ".act");
|
|
using (var file = FileUtils.OpenOrCreateFile(actFile))
|
|
{
|
|
var content = String.Format(ActFile, Context.OutputMap.Folder.RelativeUri, Context.Song.Name);
|
|
file.WriteLine(content);
|
|
}
|
|
|
|
var tplFile = ktapeFile.Replace(".ktape", ".tpl");
|
|
using (var file = FileUtils.OpenOrCreateFile(tplFile))
|
|
{
|
|
var content = String.Format(TplFile, Context.OutputMap.Folder.RelativeUri, Context.Song.Name);
|
|
file.WriteLine(content);
|
|
}
|
|
|
|
return TaskResult.Ok;
|
|
}
|
|
|
|
|
|
|
|
private const string ActFile = @"params =
|
|
{{
|
|
NAME = ""Actor"",
|
|
Actor =
|
|
{{
|
|
LUA = ""{0}/Timeline/{1}_TML_Karaoke.tpl"",
|
|
COMPONENTS =
|
|
{{
|
|
{{
|
|
NAME = ""TapeCase_Component"",
|
|
}}
|
|
}}
|
|
}}
|
|
}}
|
|
";
|
|
|
|
private const string TplFile = @"params =
|
|
{{
|
|
NAME = ""Actor_Template"",
|
|
Actor_Template =
|
|
{{
|
|
COMPONENTS =
|
|
{{
|
|
{{
|
|
NAME = ""TapeCase_Template"",
|
|
TapeCase_Template =
|
|
{{
|
|
TapesRack =
|
|
{{
|
|
{{
|
|
TapeGroup =
|
|
{{
|
|
Entries =
|
|
{{
|
|
{{
|
|
TapeEntry =
|
|
{{
|
|
Label = ""TML_Karaoke"",
|
|
Path = ""{0}/Timeline/{1}_TML_Karaoke.ktape"",
|
|
}},
|
|
}},
|
|
}},
|
|
}},
|
|
}},
|
|
}},
|
|
}},
|
|
}}
|
|
}}
|
|
}}
|
|
}}
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|