Skip to content

Commit

Permalink
Version 0.5.0 (#80)
Browse files Browse the repository at this point in the history
### Expected Version Number

v0.5.0
  • Loading branch information
dark-person committed Jun 8, 2024
2 parents b538de4 + 9f61fc2 commit 1c31e33
Show file tree
Hide file tree
Showing 34 changed files with 1,260 additions and 844 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: ""
labels: "bug"
labels: bug
assignees: ""
---

Expand Down
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/code_change_proposal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: "Code change proposal "
about: Suggest improvement to existing source code
title: ""
labels: codes/structure
assignees: ""
---

### Changed Scope

State package name that will changed, or new package name.

### Description

A brief idea of what should be changed, and how it improve later development.

### Related issue (Optional)

Issue number if this proposal can make issue easier to solve.

### Notes

Add any other context about this issue.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Feature request
about: Suggest an idea for this project
title: ""
labels: "new feature"
labels: new feature
assignees: ""
---

Expand Down
10 changes: 10 additions & 0 deletions .vscode/.cspell/package-dictionary.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Dictionary for imported packages
assetserver
Colour
Containsf
Debugf
Equalf
Infof
innerxml
Komga
logrus
Nilf
sirupsen
stretchr
Valuesf
wailsapp
Warnf
10 changes: 10 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"recommendations": [
"mhutchie.git-graph",
"github.vscode-pull-request-github",
"golang.go",
"esbenp.prettier-vscode",
"adpyke.vscode-sql-formatter",
"gruntfuggly.todo-tree"
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[sql]": {
"editor.defaultFormatter": "adpyke.vscode-sql-formatter"
},
"editor.tabSize": 4,
"editor.detectIndentation": true,
"prettier.tabWidth": 4,
Expand Down
27 changes: 27 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ choco install make

## Git related

### Branch Management

The git branch management should be followed below principle:

1. Ensure branch has `rebase` to latest branch. Latest branch will be depend on your development purpose:
Expand All @@ -34,3 +36,28 @@ The git branch management should be followed below principle:
2. Ensure your commit history should be simple as possible, i.e. you should not have multiple commits for typo fixes.
3. File changes in each commit should be as few as possible. This is to prevent `rebase` difficulty.
- i.e. if you change `module1` & `module2`, you should not use one commit ONLY to conclude both changes, instead use >2 commits depend on complexity of these changes.

### Suggestion for commit

**_The below guidelines is for suggestion ONLY_**.

For source code changes, commit message is suggested in below format:

```
`{Changed Module}`: {Commit Message}
```

`Changed Module` usually represent scope of changes, Here is some example:

- `comicinfo`
- `app.go`
- `makefile`
- `vscode`
- `frontend/input`
- `frontend/App`

Developer can ignore above format when **Necessary**, e.g.

- `Update DEVELOPMENT.md`
- `Update dependencies for ...`
- `Move package ... to ...`
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ A simple GUI for create `ComicInfo.xml` and `.cbz` archive at easy way.

After select folder for generate `ComicInfo.xml`, a preview page will appear. User can change content before export real `ComicInfo.xml`.

When there has existing `ComicInfo.xml` file in selected folder, GUI will load existing `ComicInfo.xml` data instead of create a new one.

Currently, this project supports fields:

- `Title`, `Number`, `Summary`, `Year/Month/Day`, `Web`, `GTIN`
Expand Down
62 changes: 10 additions & 52 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
"context"
"encoding/xml"
"fmt"
"gui-comicinfo/internal/archive"
"gui-comicinfo/internal/comicinfo"
Expand Down Expand Up @@ -147,25 +146,10 @@ func (a *App) QuickExportKomga(folder string) string {
return err.Error()
}

output, err := xml.MarshalIndent(c, " ", " ")
if err != nil {
fmt.Printf("error: %v\n", err)
return err.Error()
}

// Open File for reading
f, err := os.Create(filepath.Join(absPath, "ComicInfo.xml"))
if err != nil {
return err.Error()
}
defer f.Close()

// Write XML Content to file
f.Write([]byte("<?xml version=\"1.0\"?>\n"))
f.Write(output)

err = f.Sync()
// Write ComicInfo.xml
err = comicinfo.Save(c, filepath.Join(absPath, "ComicInfo.xml"))
if err != nil {
fmt.Printf("error when saving: %v\n", err)
return err.Error()
}

Expand All @@ -191,25 +175,14 @@ func (a *App) ExportXml(originalDir string, c *comicinfo.ComicInfo) (errorMsg st
return "comicinfo is nil value"
}

output, err := xml.MarshalIndent(c, " ", " ")
if err != nil {
fmt.Printf("error: %v\n", err)
return err.Error()
if originalDir == "" {
return "empty folder path"
}

// Open File for reading
f, err := os.Create(filepath.Join(originalDir, "ComicInfo.xml"))
if err != nil {
return err.Error()
}
defer f.Close()

// Write XML Content to file
f.Write([]byte("<?xml version=\"1.0\"?>\n"))
f.Write(output)

err = f.Sync()
// Save ComicInfo.xml
err := comicinfo.Save(c, filepath.Join(originalDir, "ComicInfo.xml"))
if err != nil {
fmt.Printf("error: %v\n", err)
return err.Error()
}

Expand Down Expand Up @@ -240,28 +213,13 @@ func (a *App) ExportCbz(inputDir string, exportDir string, c *comicinfo.ComicInf
return "empty comic info"
}

// Marshal ComicInfo to XML
output, err := xml.MarshalIndent(c, " ", " ")
// Save ComicInfo.xml
err := comicinfo.Save(c, filepath.Join(inputDir, "ComicInfo.xml"))
if err != nil {
fmt.Printf("error: %v\n", err)
return err.Error()
}

// Open File for reading
f, err := os.Create(filepath.Join(inputDir, "ComicInfo.xml"))
if err != nil {
return err.Error()
}
defer f.Close()

// Write XML Content to file
f.Write([]byte("<?xml version=\"1.0\"?>\n"))
f.Write(output)
err = f.Sync()
if err != nil {
return err.Error()
}

// Start Archive
filename, _ := archive.CreateZipTo(inputDir, exportDir)
err = archive.RenameZip(filename, isWrap)
Expand Down
Loading

0 comments on commit 1c31e33

Please sign in to comment.