Merge branch 'develop' into infosources
# Conflicts: # comictaggerlib/cli.py # comictaggerlib/comicvinetalker.py # comictaggerlib/taggerwindow.py # tests/comicvinetalker_test.py # tests/conftest.py
This commit is contained in:
commit
c34902449f
1
.github/workflows/build.yaml
vendored
1
.github/workflows/build.yaml
vendored
@ -74,7 +74,6 @@ jobs:
|
||||
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
pip install --force-reinstall git+https://github.com/pyinstaller/pyinstaller
|
||||
python -m pip install --upgrade --upgrade-strategy eager -r requirements_dev.txt
|
||||
|
||||
- name: Install Windows build dependencies
|
||||
|
1
.github/workflows/package.yaml
vendored
1
.github/workflows/package.yaml
vendored
@ -35,7 +35,6 @@ jobs:
|
||||
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
pip install --force-reinstall git+https://github.com/pyinstaller/pyinstaller
|
||||
python -m pip install --upgrade --upgrade-strategy eager -r requirements_dev.txt
|
||||
|
||||
- name: Install Windows build dependencies
|
||||
|
@ -137,17 +137,11 @@ class ComicInfoXml:
|
||||
|
||||
# second, convert each list to string, and add to XML struct
|
||||
assign("Writer", ", ".join(credit_writer_list))
|
||||
|
||||
assign("Penciller", ", ".join(credit_penciller_list))
|
||||
|
||||
assign("Inker", ", ".join(credit_inker_list))
|
||||
|
||||
assign("Colorist", ", ".join(credit_colorist_list))
|
||||
|
||||
assign("Letterer", ", ".join(credit_letterer_list))
|
||||
|
||||
assign("CoverArtist", ", ".join(credit_cover_list))
|
||||
|
||||
assign("Editor", ", ".join(credit_editor_list))
|
||||
|
||||
assign("Publisher", md.publisher)
|
||||
|
@ -78,6 +78,7 @@ class GenericMetadata:
|
||||
|
||||
is_empty: bool = True
|
||||
tag_origin: str | None = None
|
||||
issue_id: int | None = None
|
||||
|
||||
series: str | None = None
|
||||
issue: str | None = None
|
||||
|
@ -37,6 +37,14 @@ class UtilsVars:
|
||||
already_fixed_encoding = False
|
||||
|
||||
|
||||
def combine_notes(existing_notes: str | None, new_notes: str | None, split: str) -> str:
|
||||
split_notes, _, untouched_notes = (existing_notes or "").rpartition(split)
|
||||
if split_notes:
|
||||
return (split_notes + (new_notes or "")).strip()
|
||||
else:
|
||||
return (untouched_notes + "\n" + (new_notes or "")).strip()
|
||||
|
||||
|
||||
def parse_date_str(date_str: str) -> tuple[int | None, int | None, int | None]:
|
||||
day = None
|
||||
month = None
|
||||
|
@ -93,15 +93,6 @@ if platform.system() not in ["Windows"]:
|
||||
"CFBundleShortVersionString": ctversion.version,
|
||||
"CFBundleVersion": ctversion.version,
|
||||
"CFBundleDocumentTypes": [
|
||||
{
|
||||
"CFBundleTypeRole": "Viewer",
|
||||
"LSItemContentTypes": [
|
||||
"com.rarlab.rar-archive",
|
||||
],
|
||||
"CFBundleTypeName": "RAR Archive",
|
||||
"CFBundleTypeRole": "Editor",
|
||||
"LSHandlerRank": "Default",
|
||||
},
|
||||
{
|
||||
"CFBundleTypeRole": "Editor",
|
||||
"LSHandlerRank": "Default",
|
||||
@ -118,7 +109,6 @@ if platform.system() not in ["Windows"]:
|
||||
"NSPersistentStoreTypeKey": "Binary",
|
||||
"CFBundleTypeIconSystemGenerated": True,
|
||||
"CFBundleTypeName": "ZIP Comic Archive",
|
||||
# 'CFBundleTypeIconFile': 'cbz',
|
||||
"LSItemContentTypes": [
|
||||
"public.zip-comic-archive",
|
||||
"com.simplecomic.cbz-archive",
|
||||
@ -129,6 +119,7 @@ if platform.system() not in ["Windows"]:
|
||||
"com.milke.cbz-archive",
|
||||
"com.bitcartel.comicbooklover.cbz",
|
||||
"public.archive.cbz",
|
||||
"public.zip-archive",
|
||||
],
|
||||
"CFBundleTypeRole": "Editor",
|
||||
"LSHandlerRank": "Default",
|
||||
@ -141,8 +132,8 @@ if platform.system() not in ["Windows"]:
|
||||
"NSPersistentStoreTypeKey": "Binary",
|
||||
"CFBundleTypeIconSystemGenerated": True,
|
||||
"CFBundleTypeName": "7-Zip Comic Archive",
|
||||
# 'CFBundleTypeIconFile': 'cb7',
|
||||
"LSItemContentTypes": [
|
||||
"org.7-zip.7-zip-archive",
|
||||
"com.simplecomic.cb7-archive",
|
||||
"public.cb7-archive",
|
||||
"com.macitbetter.cb7-archive",
|
||||
@ -160,8 +151,8 @@ if platform.system() not in ["Windows"]:
|
||||
"NSPersistentStoreTypeKey": "Binary",
|
||||
"CFBundleTypeIconSystemGenerated": True,
|
||||
"CFBundleTypeName": "RAR Comic Archive",
|
||||
# 'CFBundleTypeIconFile': 'cbr',
|
||||
"LSItemContentTypes": [
|
||||
"com.rarlab.rar-archive",
|
||||
"com.rarlab.rar-comic-archive",
|
||||
"com.simplecomic.cbr-archive",
|
||||
"com.macitbetter.cbr-archive",
|
||||
@ -195,16 +186,11 @@ if platform.system() not in ["Windows"]:
|
||||
},
|
||||
},
|
||||
{
|
||||
# 'UTTypeIcons': {
|
||||
# 'UTTypeIconText': 'cbr',
|
||||
# 'UTTypeIconBackgroundName': comic-fill
|
||||
# }
|
||||
"UTTypeConformsTo": [
|
||||
"public.data",
|
||||
"public.archive",
|
||||
"com.rarlab.rar-archive",
|
||||
],
|
||||
# 'UTTypeIconFile': 'cbr',
|
||||
"UTTypeIdentifier": "com.rarlab.rar-comic-archive",
|
||||
"UTTypeDescription": "RAR Comic Archive",
|
||||
"UTTypeTagSpecification": {
|
||||
@ -218,16 +204,11 @@ if platform.system() not in ["Windows"]:
|
||||
},
|
||||
},
|
||||
{
|
||||
# 'UTTypeIcons': {
|
||||
# 'UTTypeIconText': 'cbz',
|
||||
# 'UTTypeIconBackgroundName': 'comic-fill',
|
||||
# }
|
||||
"UTTypeConformsTo": [
|
||||
"public.data",
|
||||
"public.archive",
|
||||
"public.zip-archive",
|
||||
],
|
||||
# 'UTTypeIconFile': cbz,
|
||||
"UTTypeIdentifier": "public.zip-comic-archive",
|
||||
"UTTypeDescription": "ZIP Comic Archive",
|
||||
"UTTypeTagSpecification": {
|
||||
@ -237,16 +218,11 @@ if platform.system() not in ["Windows"]:
|
||||
},
|
||||
},
|
||||
{
|
||||
# 'UTTypeIcons': {
|
||||
# 'UTTypeIconText': 'cb7',
|
||||
# 'UTTypeIconBackgroundName': comic-fill
|
||||
# }
|
||||
"UTTypeConformsTo": [
|
||||
"public.data",
|
||||
"public.archive",
|
||||
"org.7-zip.7-zip-archive",
|
||||
],
|
||||
# 'UTTypeIconFile': cb7
|
||||
"UTTypeIdentifier": "org.7-zip.7-zip-comic-archive",
|
||||
"UTTypeDescription": "7-Zip Comic Archive",
|
||||
"UTTypeTagSpecification": {
|
||||
|
@ -22,11 +22,13 @@ import logging
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from pprint import pprint
|
||||
|
||||
from comicapi import utils
|
||||
from comicapi.comicarchive import ComicArchive, MetaDataStyle
|
||||
from comicapi.genericmetadata import GenericMetadata
|
||||
from comictaggerlib import ctversion
|
||||
from comictaggerlib.cbltransformer import CBLTransformer
|
||||
from comictaggerlib.filerenamer import FileRenamer, get_rename_dir
|
||||
from comictaggerlib.graphics import graphics_path
|
||||
@ -114,7 +116,11 @@ def display_match_set_for_choice(
|
||||
if opts.overwrite:
|
||||
md = ct_md
|
||||
else:
|
||||
md.overlay(ct_md)
|
||||
notes = (
|
||||
f"Tagged with ComicTagger {ctversion.version} using info from Comic Vine on"
|
||||
f" {datetime.now():%Y-%m-%d %H:%M:%S}. [Issue ID {cv_md.issue_id}]"
|
||||
)
|
||||
md.overlay(ct_md.replace(notes=utils.combine_notes(md.notes, notes, "Tagged with ComicTagger")))
|
||||
|
||||
if opts.auto_imprint:
|
||||
md.fix_publisher()
|
||||
@ -464,7 +470,11 @@ def process_file_cli(
|
||||
if opts.overwrite:
|
||||
md = ct_md
|
||||
else:
|
||||
md.overlay(ct_md)
|
||||
notes = (
|
||||
f"Tagged with ComicTagger {ctversion.version} using info from Comic Vine on"
|
||||
f" {datetime.now():%Y-%m-%d %H:%M:%S}. [Issue ID {cv_md.issue_id}]"
|
||||
)
|
||||
md.overlay(ct_md.replace(notes=utils.combine_notes(md.notes, notes, "Tagged with ComicTagger")))
|
||||
|
||||
if opts.auto_imprint:
|
||||
md.fix_publisher()
|
||||
|
@ -27,6 +27,7 @@ import re
|
||||
import sys
|
||||
import webbrowser
|
||||
from collections.abc import Iterable
|
||||
from datetime import datetime
|
||||
from typing import Any, Callable, cast
|
||||
from urllib.parse import urlparse
|
||||
|
||||
@ -1101,7 +1102,15 @@ Have fun!
|
||||
if self.settings.clear_form_before_populating:
|
||||
self.clear_form()
|
||||
|
||||
self.metadata.overlay(new_metadata)
|
||||
notes = (
|
||||
f"Tagged with ComicTagger {ctversion.version} using info from Comic Vine on"
|
||||
f" {datetime.now():%Y-%m-%d %H:%M:%S}. [Issue ID {new_metadata.issue_id}]"
|
||||
)
|
||||
self.metadata.overlay(
|
||||
new_metadata.replace(
|
||||
notes=utils.combine_notes(self.metadata.notes, notes, "Tagged with ComicTagger")
|
||||
)
|
||||
)
|
||||
# Now push the new combined data into the edit controls
|
||||
self.metadata_to_form()
|
||||
else:
|
||||
@ -1802,7 +1811,11 @@ Have fun!
|
||||
if dlg.cbxRemoveMetadata.isChecked():
|
||||
md = ct_md
|
||||
else:
|
||||
md.overlay(ct_md)
|
||||
notes = (
|
||||
f"Tagged with ComicTagger {ctversion.version} using info from Comic Vine on"
|
||||
f" {datetime.now():%Y-%m-%d %H:%M:%S}. [Issue ID {cv_md.issue_id}]"
|
||||
)
|
||||
md.overlay(ct_md.replace(notes=utils.combine_notes(md.notes, notes, "Tagged with ComicTagger")))
|
||||
|
||||
if self.settings.auto_imprint:
|
||||
md.fix_publisher()
|
||||
|
@ -5,7 +5,7 @@ flake8-black
|
||||
flake8-encodings
|
||||
flake8-isort
|
||||
isort>=5.10
|
||||
pyinstaller>=4.10, != 5.6
|
||||
pyinstaller>=5.6.2
|
||||
pytest==7.*
|
||||
setuptools>=42
|
||||
setuptools_scm[toml]>=3.4
|
||||
|
@ -178,7 +178,8 @@ date = utils.parse_date_str(cv_issue_result["results"]["cover_date"])
|
||||
|
||||
cv_md = comicapi.genericmetadata.GenericMetadata(
|
||||
is_empty=False,
|
||||
tag_origin=None,
|
||||
tag_origin="Comic Vine",
|
||||
issue_id=cv_issue_result["results"]["id"],
|
||||
series=cv_issue_result["results"]["volume"]["name"],
|
||||
issue=cv_issue_result["results"]["issue_number"],
|
||||
title=cv_issue_result["results"]["name"],
|
||||
|
@ -77,6 +77,23 @@ def test_get_language_iso(value, result):
|
||||
assert result == comicapi.utils.get_language_iso(value)
|
||||
|
||||
|
||||
combine_values = [
|
||||
("hello", "english", "en", "hello\nenglish"),
|
||||
("hello en", "english", "en", "hello english"),
|
||||
("hello en goodbye", "english", "en", "hello english"),
|
||||
("hello en en goodbye", "english", "en", "hello en english"),
|
||||
("", "english", "en", "english"),
|
||||
(None, "english", "en", "english"),
|
||||
("hello", "", "en", "hello"),
|
||||
("hello", None, "en", "hello"),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("existing_notes, new_notes, split, result", combine_values)
|
||||
def test_combine_notes(existing_notes, new_notes, split, result):
|
||||
assert result == comicapi.utils.combine_notes(existing_notes, new_notes, split)
|
||||
|
||||
|
||||
def test_unique_file(tmp_path):
|
||||
file = tmp_path / "test.cbz"
|
||||
assert file == comicapi.utils.unique_file(file)
|
||||
|
Loading…
Reference in New Issue
Block a user