Skip the [Aegisub Project Garbage] and [Aegisub Extradata] sections when exporting to ASS
This commit is contained in:
parent
57d66be785
commit
c41e97cec1
4 changed files with 21 additions and 1 deletions
|
@ -91,7 +91,7 @@ void AssExporter::Export(agi::fs::path const& filename, std::string const& chars
|
|||
if (!writer)
|
||||
throw agi::InvalidInputException("Unknown file type.");
|
||||
|
||||
writer->WriteFile(&subs, filename, c->project->Timecodes(), charset);
|
||||
writer->ExportFile(&subs, filename, c->project->Timecodes(), charset);
|
||||
}
|
||||
|
||||
wxSizer *AssExporter::GetSettingsSizer(std::string const& name) {
|
||||
|
|
|
@ -106,6 +106,15 @@ public:
|
|||
/// @param forceEncoding Encoding to use or empty string for default
|
||||
virtual void WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding="") const { }
|
||||
|
||||
/// Export a subtitle file
|
||||
///
|
||||
/// This is used when saving via Export As..., for subtitle formats which
|
||||
/// want to distinguish between exporting a final version of a script and
|
||||
/// saving a project.
|
||||
virtual void ExportFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding="") const {
|
||||
WriteFile(src, filename, fps, encoding);
|
||||
}
|
||||
|
||||
/// Get the wildcards for a save or load dialog
|
||||
/// @param mode 0: load 1: save
|
||||
static std::string GetWildcards(int mode);
|
||||
|
|
|
@ -160,3 +160,11 @@ void AssSubtitleFormat::WriteFile(const AssFile *src, agi::fs::path const& filen
|
|||
writer.Write(src->Events);
|
||||
writer.WriteExtradata(src->Extradata);
|
||||
}
|
||||
|
||||
void AssSubtitleFormat::ExportFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const {
|
||||
Writer writer(filename, encoding);
|
||||
writer.Write(src->Info);
|
||||
writer.Write(src->Styles);
|
||||
writer.Write(src->Attachments);
|
||||
writer.Write(src->Events);
|
||||
}
|
||||
|
|
|
@ -28,4 +28,7 @@ public:
|
|||
|
||||
void ReadFile(AssFile *target, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& forceEncoding) const override;
|
||||
void WriteFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const override;
|
||||
|
||||
// Does not write [Aegisub Project Garbage] and [Aegisub Extradata] sections when exporting
|
||||
void ExportFile(const AssFile *src, agi::fs::path const& filename, agi::vfr::Framerate const& fps, std::string const& encoding) const override;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue