Skip to content

Commit 9ee925e

Browse files
Pattern naming (#40)
Use patterns to determine how to name and organize --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 388aff2 commit 9ee925e

18 files changed

Lines changed: 444 additions & 290 deletions

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,25 @@ trim_trailing_whitespace = true
99
insert_final_newline = true
1010
max_line_length = 100
1111

12+
[{*.html,*.jte,*.kte,*.jinja}]
13+
indent_size = 4
14+
insert_final_newline = false
15+
max_line_length = off
16+
17+
[*.json]
18+
insert_final_newline = false
19+
1220
[*.md]
1321
trim_trailing_whitespace = false
1422
max_line_length = off
1523

1624
[*.py]
1725
indent_size = 4
26+
27+
[{*.xml,*.xsd}]
28+
indent_size = 4
29+
insert_final_newline = false
30+
max_line_length = off
31+
32+
[{*.yaml,*.yml}]
33+
indent_style = tab

.gitattributes

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@
3232
*.tgz binary
3333
*.zip binary
3434

35-
# C#
36-
*.cs text diff=csharp
37-
*.cshtml text diff=html
38-
*.csproj text eol=crlf
39-
*.csx text diff=csharp
40-
*.sln text eol=crlf
41-
4235
# Java
4336
*.gradle text diff=java
4437
*.gradle.kts text diff=kotlin

.github/workflows/testing.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Testing
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- docs/**
9+
pull_request:
10+
branches:
11+
- main
12+
paths-ignore:
13+
- docs/**
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
pytest:
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
python-version:
25+
- '3.10'
26+
- '3.11'
27+
- '3.12'
28+
- '3.13'
29+
os:
30+
- ubuntu-latest
31+
- macos-latest
32+
- windows-latest
33+
runs-on: ${{ matrix.os }}
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: astral-sh/setup-uv@v5
37+
- name: Setup Python
38+
run: uv python install ${{ matrix.python-version }}
39+
- name: Install project
40+
run: uv sync --group tests
41+
- name: Run tests
42+
run: uv run pytest
43+
collector:
44+
needs: [pytest]
45+
if: always()
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Check for failures
49+
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
50+
run: echo job failed && exit 1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ logs/
1111
# =====Files=====
1212
*.iml
1313
*.log
14+
.coverage
1415
.envrc
1516
.pdm-python
1617
.python-version

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.9.0
3+
rev: v0.9.3
44
hooks:
55
- id: ruff-format
66
- id: ruff

README.md

Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
[![Ruff](https://img.shields.io/badge/ruff-enabled-informational?logo=ruff&style=flat-square)](https://github.com/astral-sh/ruff)
1010

1111
[![Github - Contributors](https://img.shields.io/github/contributors/Buried-In-Code/Perdoo.svg?logo=Github&label=Contributors&style=flat-square)](https://github.com/Buried-In-Code/Perdoo/graphs/contributors)
12+
[![Github Action - Testing](https://img.shields.io/github/actions/workflow/status/Buried-In-Code/Perdoo/testing.yaml?branch=main&logo=Github&label=Testing&style=flat-square)](https://github.com/Buried-In-Code/Perdoo/actions/workflows/testing.yaml)
13+
[![Github Action - Publishing](https://img.shields.io/github/actions/workflow/status/Buried-In-Code/Perdoo/publishing.yaml?branch=main&logo=Github&label=Publishing&style=flat-square)](https://github.com/Buried-In-Code/Perdoo/actions/workflows/publishing.yaml)
14+
1215

1316
Perdoo is designed to assist in sorting and organizing your comic collection by utilizing metadata files stored within comic archives.\
1417
Perdoo standardizes all your digital comics into a unified format (cb7, cbt, or cbz).\
@@ -93,44 +96,53 @@ Unlike other tagging tools, Perdoo employs a manual approach when metadata files
9396
- [Marvel](https://www.marvel.com/comics) using the [Esak](https://github.com/Metron-Project/Esak) library.
9497
- [Metron](https://metron.cloud) using the [Mokkari](https://github.com/Metron-Project/Mokkari) library.
9598

96-
## File Organization
97-
98-
### Series Naming
99-
100-
Series with a volume greater than 1 will display its volume in the title.
101-
102-
### Comic Naming
103-
104-
The files are named based on the format of the comic:
105-
106-
- **_Default_**: `{Series Title}_#{Issue Number}.cbz`
107-
- Annual: `{Series Title}_Annual_#{Issue Number}.cbz`
108-
- Digital Chapter: `{Series Title}_Chapter_#{Issue Number}.cbz`
109-
- Graphic Novel: `{Series Title}_#{Issue Number}_GN.cbz`
110-
- Hardcover: `{Series Title}_#{Issue Number}_HC.cbz`
111-
- Omnibus: `{Series Title}_#{Issue Number}.cbz`
112-
- Trade Paperback: `{Series Title}_#{Issue Number}_TPB.cbz`
113-
114-
### Folder Structure
115-
116-
```
117-
Collection Root
118-
+-- Publisher
119-
| +-- Series
120-
| | +-- Series_#001.cbz
121-
| | +-- Series_Annual_#01.cbz
122-
| | +-- Series_Chapter_#01.cbz
123-
| | +-- Series_#01_GN.cbz
124-
| | +-- Series_#01_HC.cbz
125-
| | +-- Series_#01_TPB.cbz
126-
| +-- Series-v2
127-
| | +-- Series-v2_#001.cbz
128-
| | +-- Series-v2_Annual_#01.cbz
129-
| | +-- Series-v2_Chapter_#01.cbz
130-
| | +-- Series-v2_#01_GN.cbz
131-
| | +-- Series-v2_#01_HC.cbz
132-
| | +-- Series-v2_#01_TPB.cbz
133-
```
99+
## File Renaming and Organization
100+
101+
File naming and organization uses a pattern-based approach, it tries to name based on the MetronInfo data with a fallback to ComicInfo.
102+
Naming is done based on the Comic Format, set the value to `""` and it will fallback to the default setting.
103+
104+
- **_Default_**: `{publisher-name}/{series-name}-v{volume}/{series-name}-v{volume}_#{number:3}`
105+
- **Annual**: `{publisher-name}/{series-name}-v{volume}/{series-name}-v{volume}_Annual_#{number:2}`
106+
- **Digital Chapter**: `{publisher-name}/{series-name}-v{volume}/{series-name}-v{volume}_Chapter_#{number:3}`
107+
- **Graphic Novel**: `{publisher-name}/{series-name}-v{volume}/{series-name}-v{volume}_GN_#{number:2}`
108+
- **Hardcover**: `{publisher-name}/{series-name}-v{volume}/{series-name}-v{volume}_HC_#{number:2}`
109+
- **Limited Series**: `""` _Falls back to Default_
110+
- **Omnibus**: `{publisher-name}/{series-name}-v{volume}/{series-name}-v{volume}_OB_#{number:2}`
111+
- **One-Shot**: `""` _Falls back to Default_
112+
- **Single Issue**: `""` _Falls back to Default_
113+
- **Trade Paperback**: `{publisher-name}/{series-name}-v{volume}/{series-name}-v{volume}_TPB_#{number:2}`
114+
115+
### Options
116+
117+
- **Padding**: Int and Int-like fields, such as `{number}`, can include optional zero-padding by specifying the length (e.g. `{number:3}` will pad 0's to be atleast 3 digits long, `12` => `012`).
118+
- **Sanitization**: All metadata values are sanitized to remove characters outside the set `0-9a-zA-Z&!-`. Custom characters can still be added directly to patterns.
119+
120+
| Pattern Key | Description |
121+
| -------------------- | ------------------------------------------------------ |
122+
| `{cover-date}` | The issue cover date in `yyyy-mm-dd` format. |
123+
| `{cover-day}` | The day from the issue cover date. |
124+
| `{cover-month}` | The month from the issue cover date. |
125+
| `{cover-year}` | The year from the issue cover date. |
126+
| `{format}` | The full format name of the series. |
127+
| `{id}` | The primary id of the issue. |
128+
| `{imprint}` | The publisher's imprint. |
129+
| `{isbn}` | The issue's ISBN. |
130+
| `{issue-count}` | The total number of issues in the series. |
131+
| `{lang}` | The issue's language. |
132+
| `{number}` | The issue number. |
133+
| `{publisher-id}` | The publisher's unique id. |
134+
| `{publisher-name}` | The full name of the publisher. |
135+
| `{series-id}` | The series' unique id. |
136+
| `{series-name}` | The full name of the series. |
137+
| `{series-sort-name}` | Sort-friendly name (omits leading "The", "A", etc...). |
138+
| `{series-year}` | The year the series started. |
139+
| `{store-date}` | The store date of the issue in `yyyy-mm-dd` format. |
140+
| `{store-day}` | The day from the issue store date. |
141+
| `{store-month}` | The month from the issue store date. |
142+
| `{store-year}` | The year from the issue store date. |
143+
| `{title}` | The issue title. |
144+
| `{upc}` | The issue's UPC. |
145+
| `{volume}` | The volume of the series. |
134146

135147
## Socials
136148

0 commit comments

Comments
 (0)