diff --git a/.gitignore b/.gitignore
index 435e613..112c814 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,7 @@
+ComicInfo.xml
+ComicInfo.xml.template
+.directory
+
# ---> Rust
# Generated by Cargo
# will have compiled files and executables
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..b5dcc52
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,17 @@
+[package]
+name = "manga-hentai-metadata-generator"
+version = "0.1.0"
+edition = "2021"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+eframe = "0.22.0"
+egui = "0.22.0"
+env_logger = "0.10.0"
+quick-xml = { version = "0.29.0", features = ["serde", "serialize"] }
+rfd = "0.11.4"
+serde = { version = "1.0.170", features = ["derive"] }
+serde-xml-rs = "0.6.0"
+strum = "0.25.0"
+strum_macros = "0.25.0"
diff --git a/ComicInfo.xsd b/ComicInfo.xsd
new file mode 100644
index 0000000..02ea57c
--- /dev/null
+++ b/ComicInfo.xsd
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/README.md b/README.md
index a2342a1..fcc5a58 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,92 @@
-# comicinfo-editor
+# Manga + Hentai Metadata Generator
-App for easier creation of ComicInfo.xml files.
\ No newline at end of file
+
+
+## Getting started
+
+To make it easy for you to get started with GitLab, here's a list of recommended next steps.
+
+Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
+
+## Add your files
+
+- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
+- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
+
+```
+cd existing_repo
+git remote add origin https://gitlab.neshweb.net/Neshura/manga-hentai-metadata-generator.git
+git branch -M main
+git push -uf origin main
+```
+
+## Integrate with your tools
+
+- [ ] [Set up project integrations](https://gitlab.neshweb.net/Neshura/manga-hentai-metadata-generator/-/settings/integrations)
+
+## Collaborate with your team
+
+- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
+- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
+- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
+- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
+- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
+
+## Test and Deploy
+
+Use the built-in continuous integration in GitLab.
+
+- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
+- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
+- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
+- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
+- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
+
+***
+
+# Editing this README
+
+When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
+
+## Suggestions for a good README
+Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
+
+## Name
+Choose a self-explaining name for your project.
+
+## Description
+Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
+
+## Badges
+On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
+
+## Visuals
+Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
+
+## Installation
+Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
+
+## Usage
+Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
+
+## Support
+Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
+
+## Roadmap
+If you have ideas for releases in the future, it is a good idea to list them in the README.
+
+## Contributing
+State if you are open to contributions and what your requirements are for accepting them.
+
+For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
+
+You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
+
+## Authors and acknowledgment
+Show your appreciation to those who have contributed to the project.
+
+## License
+For open source projects, say how it is licensed.
+
+## Project status
+If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..4860892
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,457 @@
+use std::iter::Enumerate;
+
+use egui::{widgets, TextStyle};
+use metadata::{AgeRating, LanguageISO, Metadata};
+
+use eframe::egui;
+use parsers::Parsers;
+use strum::IntoEnumIterator;
+
+mod metadata;
+mod parsers;
+
+const TEXT_SIZE_SMALL: f32 = 1.0;
+const TEXT_SIZE_MEDIUM: f32 = 1.2;
+const TEXT_SIZE_LARGE: f32 = 1.4;
+
+fn main() -> Result<(), eframe::Error> {
+ env_logger::init();
+ let options = eframe::NativeOptions {
+ initial_window_size: Some(egui::vec2(1280.0, 720.0)),
+ ..Default::default()
+ };
+ eframe::run_native(
+ "Metadata Generator",
+ options,
+ Box::new(|cc| {
+ cc.egui_ctx.set_pixels_per_point(TEXT_SIZE_MEDIUM);
+ Box::::default()
+ }),
+ )
+}
+
+struct Generator<'a> {
+ show_all: bool,
+ metadata: Vec>,
+ selected_parser: Parsers,
+ use_file: bool,
+ meta_path: Option,
+ bundle: bool,
+ bundle_source: Option,
+ bundle_path: Option,
+ footer_height: f32,
+}
+
+impl Default for Generator<'_> {
+ fn default() -> Self {
+ Self {
+ show_all: false,
+ metadata: vec![Metadata::default()],
+ selected_parser: Parsers::JNovel,
+ use_file: true,
+ meta_path: None,
+ bundle: false,
+ bundle_source: None,
+ bundle_path: None,
+ footer_height: 0.0,
+ }
+ }
+}
+
+impl eframe::App for Generator<'_> {
+ fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
+ // Non-Metadata Options
+ egui::SidePanel::right("Options")
+ .resizable(false)
+ .min_width(ctx.screen_rect().width() / 3.0)
+ .max_width(ctx.screen_rect().width() / 3.0)
+ .show(ctx, |panel| {
+ panel.heading("Options");
+ panel.horizontal(|row| {
+ row.label("Parser: ");
+ egui::containers::ComboBox::from_label("")
+ .selected_text(self.selected_parser.to_string())
+ .show_ui(row, |ui| {
+ for rating in Parsers::iter() {
+ let text = rating.to_string().clone();
+ if ui
+ .selectable_value(&mut self.selected_parser, rating, text)
+ .clicked()
+ {
+ match self.selected_parser {
+ Parsers::Fakku | Parsers::Irodori => {
+ self.use_file = false; // TODO change to use Parser default
+ }
+ Parsers::JNovel => {
+ self.use_file = true; // TODO change to use Parser default
+ }
+ }
+ };
+ }
+ });
+ });
+
+ panel.horizontal(|row| {
+ row.label("Parser Source: ");
+ if row
+ .add(widgets::SelectableLabel::new(self.use_file, "File"))
+ .clicked()
+ {
+ self.use_file = true;
+ }
+
+ if row
+ .add(widgets::SelectableLabel::new(!self.use_file, "URL"))
+ .clicked()
+ {
+ self.use_file = false;
+ }
+ });
+
+ let file_label;
+ if self.use_file {
+ file_label = "File Path";
+ } else {
+ file_label = "URL";
+ }
+ text_input_option(panel, &mut self.meta_path, file_label, self.use_file);
+
+ // TODO this feels wrong, there must be a better way
+ panel.add_space(self.footer_height * 0.1);
+ panel.separator();
+ panel.add_space(self.footer_height * 0.1);
+
+ panel.horizontal(|row| {
+ row.label("Perform Bundle: ");
+ row.add(widgets::Checkbox::new(&mut self.bundle, ""));
+ });
+
+ if self.bundle {
+ text_input_option(panel, &mut self.bundle_source, "Images Folder", true);
+ text_input_option(panel, &mut self.bundle_path, "Output Path", true);
+ }
+
+ panel.add_space(self.footer_height * 2.0);
+
+ panel.horizontal(|elem| {
+ elem.vertical_centered(|centered| {
+ if centered.button("Generate Metadata").clicked() {
+ // Run Metadata Generation
+ // DO NOT SAVE RESULTS YET ONLY POPULATE DATA
+ println!("Ran Generation (not yet)");
+ }
+ })
+ });
+
+ panel.add_space(panel.available_height() - self.footer_height);
+
+ self.footer_height = panel
+ .horizontal(|row| {
+ let ppp = ctx.pixels_per_point();
+ row.label("Text Size:");
+ if row
+ .add(widgets::RadioButton::new(ppp == TEXT_SIZE_SMALL, "Small"))
+ .clicked()
+ {
+ ctx.set_pixels_per_point(TEXT_SIZE_SMALL);
+ }
+
+ if row
+ .add(widgets::RadioButton::new(ppp == TEXT_SIZE_MEDIUM, "Medium"))
+ .clicked()
+ {
+ ctx.set_pixels_per_point(TEXT_SIZE_MEDIUM);
+ }
+
+ if row
+ .add(widgets::RadioButton::new(ppp == TEXT_SIZE_LARGE, "Large"))
+ .clicked()
+ {
+ ctx.set_pixels_per_point(TEXT_SIZE_LARGE);
+ }
+ })
+ .response
+ .rect
+ .height();
+ });
+
+ // Metadata Options
+ egui::CentralPanel::default().show(ctx, |ui| {
+ ui.heading("Metadata");
+
+ // Title & Series
+ text_input(ui, &mut self.metadata[0].series, "Series", false);
+ text_input(ui, &mut self.metadata[0].title, "Title", false);
+
+ // Volume and Chapter Info
+ ui.horizontal(|row| {
+ row.label("Volume:");
+ if row.button("-").clicked() {
+ self.metadata[0].volume -= 1;
+ }
+ row.label(format!("{}", self.metadata[0].volume));
+ if row.button("+").clicked() {
+ self.metadata[0].volume += 1;
+ }
+
+ row.label("Chapter:");
+ if row.button("-").clicked() {
+ self.metadata[0].number -= 1;
+ }
+ row.label(format!("{}", self.metadata[0].number));
+ if row.button("+").clicked() {
+ self.metadata[0].number += 1;
+ }
+ });
+
+ ui.horizontal(|row| {
+ row.label("Series Chapter Count:");
+ if row.button("-").clicked() {
+ self.metadata[0].count -= 1;
+ }
+ row.label(format!("{}", self.metadata[0].count));
+ if row.button("+").clicked() {
+ self.metadata[0].count += 1;
+ }
+ });
+
+ // TODO Multiline Summary
+ ui.label("TODO: Summary Edit");
+ if let Some(summary) = &self.metadata[0].summary {
+ ui.label(summary);
+ }
+
+ // Date Inputs
+ let glyph_width = ctx
+ .fonts(|f| -> f32 { f.glyph_width(&TextStyle::Body.resolve(ui.style()), '0') });
+
+ let mut year_text = self.metadata[0].year.to_string();
+
+ ui.horizontal(|row| {
+ row.label("Release Date:");
+ if row
+ .add(
+ widgets::text_edit::TextEdit::singleline(&mut year_text)
+ .desired_width(5.0 * glyph_width),
+ )
+ .changed()
+ {
+ let trimmed = year_text.trim();
+ if trimmed == "0" {
+ self.metadata[0].year = -1;
+ self.metadata[0].month = -1;
+ self.metadata[0].day = -1;
+ } else {
+ self.metadata[0].year =
+ trimmed.parse::().unwrap_or(self.metadata[0].year);
+ }
+ };
+
+ if self.metadata[0].year >= 1970 {
+ let mut month_text = self.metadata[0].month.to_string();
+ if row
+ .add(
+ widgets::text_edit::TextEdit::singleline(&mut month_text)
+ .desired_width(3.0 * glyph_width),
+ )
+ .changed()
+ {
+ let trimmed = month_text.trim();
+ if trimmed == "0" {
+ self.metadata[0].month = -1;
+ self.metadata[0].day = -1;
+ } else {
+ self.metadata[0].month = month_text
+ .trim()
+ .parse::()
+ .unwrap_or(self.metadata[0].month);
+ }
+ };
+
+ if self.metadata[0].month >= 0 {
+ let mut day_text = self.metadata[0].day.to_string();
+ if row
+ .add(
+ widgets::text_edit::TextEdit::singleline(&mut day_text)
+ .desired_width(3.0 * glyph_width),
+ )
+ .changed()
+ {
+ let trimmed = day_text.trim();
+ if trimmed == "0" {
+ self.metadata[0].day = -1;
+ } else {
+ self.metadata[0].day = day_text
+ .trim()
+ .parse::()
+ .unwrap_or(self.metadata[0].day);
+ }
+ };
+ }
+ }
+ });
+
+ // People involved
+ text_input_option(ui, &mut self.metadata[0].writer, "Author", false);
+ text_input_option(ui, &mut self.metadata[0].letterer, "Typesetter", false);
+ text_input_option(ui, &mut self.metadata[0].editor, "Editor", false);
+ text_input_option(ui, &mut self.metadata[0].translator, "Translator", false);
+ text_input_option(ui, &mut self.metadata[0].publisher, "Publisher", false);
+
+ /*
+ tags: Vec,
+ characters: Vec,
+ */
+ text_input(ui, &mut self.metadata[0].genre, "Genre", false);
+ // TODO tag list (List of bordered labels with plus that opens a new text edit)
+ ui.horizontal(|row| {
+ row.label("Page Count:");
+ if row.button("-").clicked() {
+ self.metadata[0].page_count -= 1;
+ }
+ row.label(format!("{}", self.metadata[0].page_count));
+ if row.button("+").clicked() {
+ self.metadata[0].page_count += 1;
+ }
+ });
+ //text_input(ui, &mut self.metadata[0].page_count, "Page Count", false);
+
+ // Lang Drop Down
+ ui.horizontal(|row| {
+ row.label("Language: ");
+ egui::containers::ComboBox::from_label("a")
+ .selected_text(self.metadata[0].language.to_string())
+ .show_ui(row, |ui| {
+ for language in LanguageISO::iter() {
+ let text = language.to_string().clone();
+ ui.selectable_value(&mut self.metadata[0].language, language, text);
+ }
+ });
+ });
+
+ // TODO same as with Tags but for characters
+
+ // Age Rating Drop Down
+ ui.horizontal(|row| {
+ row.label("Age Rating: ");
+ egui::containers::ComboBox::from_label("b")
+ .selected_text(self.metadata[0].age_rating.to_string())
+ .show_ui(row, |ui| {
+ for rating in AgeRating::iter() {
+ let text = rating.to_string().clone();
+ ui.selectable_value(&mut self.metadata[0].age_rating, rating, text);
+ }
+ });
+ });
+
+ ui.horizontal(|elem| {
+ elem.vertical_centered(|centered| {
+ if centered.button("Save Metadata").clicked() {
+ // Run Metadata Generation
+ // DO NOT SAVE RESULTS YET ONLY POPULATE DATA
+ self.metadata[0].save_to_xml("/home/neshura/Repositories/manga-hentai-metadata-generator/ComicInfo.xml")
+ }
+ })
+ });
+
+ if self.show_all {
+ ui.label(format!("Not Implemented yet."));
+ }
+ });
+ }
+}
+
+pub(crate) fn text_input_option(
+ ui: &mut egui::Ui,
+ option: &mut Option,
+ label: &str,
+ file_picker: bool,
+) -> egui::InnerResponse<()> {
+ let zero_width =
+ 2.0 * ui.fonts(|f| -> f32 { f.glyph_width(&TextStyle::Body.resolve(ui.style()), '0') });
+
+ ui.horizontal(|row| {
+ row.label(format!("{}:", label));
+ if let Some(ref mut text) = option {
+ let dynamic_width = zero_width
+ + text
+ .chars()
+ .map(|c| {
+ row.fonts(|f| -> f32 {
+ f.glyph_width(&TextStyle::Body.resolve(row.style()), c)
+ })
+ })
+ .sum::();
+
+ row.add(
+ widgets::text_edit::TextEdit::singleline(text).desired_width(
+ if dynamic_width >= zero_width * 3.0 {
+ dynamic_width
+ } else {
+ zero_width * 3.0
+ },
+ ),
+ );
+ if text == "" {
+ *option = None;
+ }
+ } else {
+ let mut init = "".to_string();
+ row.add(
+ widgets::text_edit::TextEdit::singleline(&mut init).desired_width(zero_width * 3.0),
+ );
+ if init != "" {
+ *option = Some(init);
+ }
+ }
+
+ if file_picker {
+ if row.button("...").clicked() {
+ if let Some(path) = rfd::FileDialog::new().pick_file() {
+ *option = Some(path.display().to_string());
+ }
+ }
+ }
+ })
+}
+
+pub(crate) fn text_input(
+ ui: &mut egui::Ui,
+ option: &mut String,
+ label: &str,
+ file_picker: bool,
+) -> egui::InnerResponse<()> {
+ let zero_width =
+ 2.0 * ui.fonts(|f| -> f32 { f.glyph_width(&TextStyle::Body.resolve(ui.style()), '0') });
+
+ ui.horizontal(|row| {
+ row.label(format!("{}:", label));
+ let dynamic_width = zero_width
+ + option
+ .chars()
+ .map(|c| {
+ row.fonts(|f| -> f32 {
+ f.glyph_width(&TextStyle::Body.resolve(row.style()), c)
+ })
+ })
+ .sum::();
+
+ row.add(
+ widgets::text_edit::TextEdit::singleline(option).desired_width(
+ if dynamic_width >= zero_width * 3.0 {
+ dynamic_width
+ } else {
+ zero_width * 3.0
+ },
+ ),
+ );
+
+ if file_picker {
+ if row.button("...").clicked() {
+ if let Some(path) = rfd::FileDialog::new().pick_file() {
+ *option = path.display().to_string();
+ }
+ }
+ }
+ })
+}
diff --git a/src/metadata/mod.rs b/src/metadata/mod.rs
new file mode 100644
index 0000000..1d0dd42
--- /dev/null
+++ b/src/metadata/mod.rs
@@ -0,0 +1,179 @@
+use std::{fs::File, io::{Write, Cursor}};
+use quick_xml::{se::Serializer, events::BytesStart};
+use serde::{Serialize, Deserialize};
+
+use serde_xml_rs::{to_string, to_writer};
+
+
+#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
+pub(crate) struct Metadata<'a> {
+ #[serde(rename = "@xmlns:xsi")]
+ xsi: &'a str,
+
+ #[serde(rename = "@xsi:noNamespaceSchemaLocation")]
+ namespace: &'a str,
+
+ #[serde(rename(serialize="Title"))]
+ pub(crate) title: String,
+
+ #[serde(rename(serialize="Series"))]
+ pub(crate) series: String,
+
+ #[serde(rename(serialize="Number"))]
+ pub(crate) number: u16,
+
+ #[serde(rename(serialize="Count"))]
+ pub(crate) count: i16,
+
+ #[serde(rename(serialize="Volume"))]
+ pub(crate) volume: i16,
+
+ #[serde(rename(serialize="Summary"))]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub(crate) summary: Option,
+
+ #[serde(rename(serialize="Year"))]
+ pub(crate) year: i16,
+ #[serde(rename(serialize="Month"))]
+ pub(crate) month: i8,
+ #[serde(rename(serialize="Day"))]
+ pub(crate) day: i8,
+
+ #[serde(rename(serialize="Writer"))]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub(crate) writer: Option,
+
+ #[serde(rename(serialize="Letterer"))]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub(crate) letterer: Option,
+
+ #[serde(rename(serialize="Editor"))]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub(crate) editor: Option,
+
+ #[serde(rename(serialize="Translator"))]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub(crate) translator: Option,
+
+ #[serde(rename(serialize="Publisher"))]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub(crate) publisher: Option,
+
+ #[serde(rename(serialize="Genre"))]
+ pub(crate) genre: String,
+
+ #[serde(rename(serialize="Tags"))]
+ #[serde(skip_serializing_if = "Vec::is_empty")]
+ pub(crate) tags: Vec,
+
+ #[serde(rename(serialize="PageCount"))]
+ pub(crate) page_count: u16,
+
+ #[serde(flatten)]
+ pub(crate) language: LanguageISO,
+
+ #[serde(rename(serialize="Characters"))]
+ #[serde(skip_serializing_if = "Vec::is_empty")]
+ pub(crate) characters: Vec,
+
+ #[serde(flatten)]
+ pub(crate) age_rating: AgeRating
+}
+
+impl Default for Metadata<'_> {
+ fn default() -> Self {
+ Self {
+ xsi: "http://www.w3.org/2001/XMLSchema-instance",
+ namespace: "ComicInfo.xsd",
+ title: "".into(),
+ series: "".into(),
+ number: 0,
+ count: -1,
+ volume: -1,
+ summary: None,
+ year: -1,
+ month: -1,
+ day: -1,
+ writer: None,
+ letterer: None,
+ editor: None,
+ translator: None,
+ publisher: None,
+ genre: "".into(),
+ tags: vec![],
+ page_count: 0,
+ language: LanguageISO::EN,
+ characters: vec![],
+ age_rating: AgeRating::Unknown
+ }
+ }
+}
+
+impl Metadata<'_> {
+ pub(crate) fn save_to_xml(&self, path: &str) {
+ let mut file = File::create(path).unwrap();
+ let mut buffer = String::new();
+ let root = "ComicInfo";
+
+ let mut ser = Serializer::with_root(&mut buffer, Some(root)).unwrap();
+ ser.indent(' ', 4);
+
+ self.serialize(ser).unwrap();
+ file.write(buffer.as_bytes()).unwrap();
+ }
+}
+
+#[derive(strum_macros::Display, Debug, PartialEq, strum_macros::EnumIter, Serialize, Deserialize, Clone)]
+#[serde(tag = "AgeRating")]
+pub(crate) enum AgeRating {
+ #[strum(serialize="Unknown")]
+ Unknown,
+ #[strum(serialize="Adults Only 18+")]
+ #[serde(rename="Adults Only 18+")]
+ AdultsOnly,
+ #[strum(serialize="Early Childhood")]
+ #[serde(rename="Early Childhood")]
+ EarlyChildhood,
+ #[strum(serialize="Everyone")]
+ Everyone,
+ #[strum(serialize="Everyone 10+")]
+ #[serde(rename="Everyone 10+")]
+ Everyone10,
+ #[strum(serialize="G")]
+ G,
+ #[strum(serialize="Kids to Adults")]
+ #[serde(rename="Kids to Adults")]
+ KidsAdults,
+ #[strum(serialize="M")]
+ M,
+ #[strum(serialize="MA15+")]
+ #[serde(rename="MA15+")]
+ MA15,
+ #[strum(serialize="Mature 17+")]
+ #[serde(rename="Mature 17+")]
+ Mature,
+ #[strum(serialize="PG")]
+ PG,
+ #[strum(serialize="R18+")]
+ #[serde(rename="R18+")]
+ R18,
+ #[strum(serialize="Rating Pending")]
+ #[serde(rename="Rating Pending")]
+ RatingPending,
+ #[strum(serialize="Teen")]
+ Teen,
+ #[strum(serialize="X18+")]
+ #[serde(rename="X18+")]
+ X18
+}
+
+#[derive(strum_macros::Display, Debug, PartialEq, strum_macros::EnumIter, Serialize, Deserialize, Clone)]
+#[serde(tag = "LanguageISO")]
+pub(crate) enum LanguageISO {
+ #[strum(serialize="en")]
+ #[serde(rename="en")]
+ EN,
+ #[strum(serialize="jp")]
+ #[serde(rename="jp")]
+ JP
+}
\ No newline at end of file
diff --git a/src/parsers/mod.rs b/src/parsers/mod.rs
new file mode 100644
index 0000000..40d6245
--- /dev/null
+++ b/src/parsers/mod.rs
@@ -0,0 +1,8 @@
+#[derive(strum_macros::Display, Debug, PartialEq, strum_macros::EnumIter)]
+pub(crate) enum Parsers {
+ #[strum(serialize="Irodori Comics")]
+ Irodori,
+ Fakku,
+ #[strum(serialize="J-Novel Club")]
+ JNovel
+}
\ No newline at end of file