Bump version to 0.9.5; update localization files and refactor file upload logic in Core
All checks were successful
Gitea/kapitanbooru-uploader/pipeline/head This commit looks good
All checks were successful
Gitea/kapitanbooru-uploader/pipeline/head This commit looks good
This commit is contained in:
@@ -35,7 +35,7 @@ class Core:
|
||||
"""
|
||||
|
||||
def __init__(self, settings: Settings, gui_mode: bool = True):
|
||||
self.version = "0.9.4"
|
||||
self.version = "0.9.5"
|
||||
self.acknowledged_version = parse_version(self.version)
|
||||
self.settings = settings
|
||||
self.tags_repo = TagsRepo(settings)
|
||||
@@ -221,7 +221,9 @@ class Core:
|
||||
final_tags.add("meta:auto_upload")
|
||||
return " ".join(sorted(final_tags)), rating
|
||||
|
||||
def get_tagger_results(self, file_path, callback: Callable|None = None) -> wdt.Result:
|
||||
def get_tagger_results(
|
||||
self, file_path, callback: Callable | None = None
|
||||
) -> wdt.Result:
|
||||
md5 = self.image_files_md5[file_path]
|
||||
cached = self.tagger_cache[md5]
|
||||
if cached:
|
||||
@@ -424,24 +426,29 @@ class Core:
|
||||
"""
|
||||
Autotaguje pliki przy użyciu Taggera i wysyła je na serwer.
|
||||
"""
|
||||
for file_path in file_paths:
|
||||
if not os.path.isfile(file_path):
|
||||
print(_("Plik nie istnieje:"), file_path)
|
||||
continue
|
||||
try:
|
||||
tags, rating = self.compute_final_tags_and_rating_for_file(
|
||||
file_path, lambda: None
|
||||
)
|
||||
print(_("Tagi dla pliku"), file_path, ":", tags, "Rating:", rating)
|
||||
self.upload_file(
|
||||
file_path,
|
||||
final_tags=tags,
|
||||
final_rating=rating,
|
||||
progress_queue=None,
|
||||
cancel_event=None,
|
||||
)
|
||||
except Exception as e:
|
||||
print(_("Błąd podczas autotagowania pliku"), file_path, ":", e)
|
||||
self.image_files = file_paths
|
||||
self.total_files = len(self.image_files)
|
||||
self.image_files_md5 = {
|
||||
file: md5
|
||||
for file, md5 in zip(
|
||||
self.image_files, self.compute_md5_parallel(self.image_files)
|
||||
)
|
||||
}
|
||||
self.tagger_processed.clear()
|
||||
for md5 in self.image_files_md5.values():
|
||||
if self.tagger_cache[md5]:
|
||||
self.tagger_processed.add(md5)
|
||||
self.uploaded.clear()
|
||||
self.upload_verified = 0
|
||||
self.uploaded_count = 0
|
||||
for file in self.image_files:
|
||||
self.uploaded[file] = False
|
||||
if not self.image_files:
|
||||
return
|
||||
self.post_load_processing()
|
||||
self.check_uploaded_files_thread.join()
|
||||
self.process_tagger_queue_thread.join()
|
||||
self.upload_all_files()
|
||||
|
||||
def autotag_dir(self, dir):
|
||||
"""
|
||||
@@ -454,12 +461,8 @@ class Core:
|
||||
self.load_images()
|
||||
self.check_uploaded_files_thread.join()
|
||||
self.process_tagger_queue_thread.join()
|
||||
files_to_upload = [x for x in self.image_files if not self.uploaded[x]]
|
||||
if not files_to_upload:
|
||||
print(_("Brak obrazów do przetworzenia w katalogu:"), dir)
|
||||
return
|
||||
|
||||
self.autotag_files(files_to_upload)
|
||||
self.upload_all_files()
|
||||
|
||||
def upload_file(
|
||||
self,
|
||||
|
@@ -1,8 +1,8 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Kapitanbooru Uploader 0.9.4\n"
|
||||
"Project-Id-Version: Kapitanbooru Uploader 0.9.5\n"
|
||||
"Report-Msgid-Bugs-To: kapitan@mlesniak.pl\n"
|
||||
"POT-Creation-Date: 2025-06-26 18:00+0200\n"
|
||||
"POT-Creation-Date: 2025-06-26 18:09+0200\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
@@ -47,52 +47,36 @@ msgstr "auth_token not found in the HTML page."
|
||||
msgid "Błąd przy otwieraniu pliku"
|
||||
msgstr "Error opening file"
|
||||
|
||||
#: Core.py:237
|
||||
#: Core.py:239
|
||||
msgid "Tagger przetworzył:"
|
||||
msgstr "Tagger processed:"
|
||||
|
||||
#: Core.py:240
|
||||
#: Core.py:242
|
||||
msgid "Błąd Taggera dla"
|
||||
msgstr "Tagger error for"
|
||||
|
||||
#: Core.py:295
|
||||
#: Core.py:297
|
||||
msgid "Error computing MD5:"
|
||||
msgstr "Error computing MD5:"
|
||||
|
||||
#: Core.py:420
|
||||
#: Core.py:422
|
||||
msgid "Błąd podczas sprawdzania paczki uploadu:"
|
||||
msgstr "Error while checking upload package:"
|
||||
|
||||
#: Core.py:429
|
||||
msgid "Plik nie istnieje:"
|
||||
msgstr "File does not exist:"
|
||||
|
||||
#: Core.py:435
|
||||
msgid "Tagi dla pliku"
|
||||
msgstr "Tags for file"
|
||||
|
||||
#: Core.py:444
|
||||
msgid "Błąd podczas autotagowania pliku"
|
||||
msgstr "Error during file autotagowania"
|
||||
|
||||
#: Core.py:451
|
||||
#: Core.py:458
|
||||
msgid "Podana ścieżka nie jest katalogiem:"
|
||||
msgstr "Given path is not a directory:"
|
||||
|
||||
#: Core.py:459
|
||||
msgid "Brak obrazów do przetworzenia w katalogu:"
|
||||
msgstr "No images to process in directory:"
|
||||
|
||||
#: Core.py:482
|
||||
#: Core.py:485
|
||||
#, python-brace-format
|
||||
msgid "Wysyłam plik {base_file_name}..."
|
||||
msgstr "Uploading file {base_file_name}..."
|
||||
|
||||
#: Core.py:517
|
||||
#: Core.py:520
|
||||
msgid "Wysyłanie zakończone powodzeniem!"
|
||||
msgstr "Upload completed successfully!"
|
||||
|
||||
#: Core.py:521 Core.py:530
|
||||
#: Core.py:524 Core.py:533
|
||||
#, python-brace-format
|
||||
msgid ""
|
||||
"Wysyłanie zakończone błędem.\n"
|
||||
@@ -103,52 +87,52 @@ msgstr ""
|
||||
"Status: {status_code}\n"
|
||||
"Content: {text}"
|
||||
|
||||
#: Core.py:539 Core.py:545 ImageBrowser.py:664 ImageBrowser.py:667
|
||||
#: Core.py:542 Core.py:548 ImageBrowser.py:664 ImageBrowser.py:667
|
||||
#: ImageBrowser.py:1187 ImageBrowser.py:1190
|
||||
msgid "Wysyłanie"
|
||||
msgstr "Uploading"
|
||||
|
||||
#: Core.py:557
|
||||
#: Core.py:560
|
||||
msgid "Błąd wysyłania pliku"
|
||||
msgstr "Upload error"
|
||||
|
||||
#: Core.py:587
|
||||
#: Core.py:590
|
||||
msgid "Anulowano operację!"
|
||||
msgstr "Operation cancelled!"
|
||||
|
||||
#: Core.py:597
|
||||
#: Core.py:600
|
||||
#, python-brace-format
|
||||
msgid ""
|
||||
"Wysyłanie {file_path} z tagami: {final_tags} i ratingiem: {final_rating}"
|
||||
msgstr ""
|
||||
"Uploading {file_path} with tags: {final_tags} and rating: {final_rating}"
|
||||
|
||||
#: Core.py:616
|
||||
#: Core.py:619
|
||||
msgid "Przesłano pliki!"
|
||||
msgstr "Files have been uploaded!"
|
||||
|
||||
#: Core.py:637 Core.py:641
|
||||
#: Core.py:640 Core.py:644
|
||||
msgid "Post nie został znaleziony dla tego pliku"
|
||||
msgstr "Post not found for this file"
|
||||
|
||||
#: Core.py:652
|
||||
#: Core.py:655
|
||||
#, python-brace-format
|
||||
msgid "Aktualizuję tagi dla {base_file_name}..."
|
||||
msgstr "Updating tags for {base_file_name}..."
|
||||
|
||||
#: Core.py:662 Core.py:672 Core.py:697
|
||||
#: Core.py:665 Core.py:675 Core.py:700
|
||||
msgid "Operacja anulowana"
|
||||
msgstr "Operation cancelled"
|
||||
|
||||
#: Core.py:707
|
||||
#: Core.py:710
|
||||
msgid "Tagi zostały zaktualizowane!"
|
||||
msgstr "Tags have been updated!"
|
||||
|
||||
#: Core.py:712 ImageBrowser.py:729
|
||||
#: Core.py:715 ImageBrowser.py:729
|
||||
msgid "Sukces edycji"
|
||||
msgstr "Edit successful"
|
||||
|
||||
#: Core.py:719
|
||||
#: Core.py:722
|
||||
#, python-brace-format
|
||||
msgid ""
|
||||
"Błąd podczas aktualizacji tagów\n"
|
||||
@@ -157,15 +141,15 @@ msgstr ""
|
||||
"Error updating tags\n"
|
||||
"Status: {code}"
|
||||
|
||||
#: Core.py:723
|
||||
#: Core.py:726
|
||||
msgid "Treść:"
|
||||
msgstr "Content:"
|
||||
|
||||
#: Core.py:727 ImageBrowser.py:726
|
||||
#: Core.py:730 ImageBrowser.py:726
|
||||
msgid "Błąd edycji"
|
||||
msgstr "Edit error"
|
||||
|
||||
#: Core.py:733
|
||||
#: Core.py:736
|
||||
msgid "Krytyczny błąd edycji"
|
||||
msgstr "Critical edit error"
|
||||
|
||||
@@ -569,5 +553,17 @@ msgstr "Fetched implications for {count} tags..."
|
||||
msgid "Regeneracja bazy zakończona."
|
||||
msgstr "Database regeneration complete."
|
||||
|
||||
#~ msgid "Plik nie istnieje:"
|
||||
#~ msgstr "File does not exist:"
|
||||
|
||||
#~ msgid "Tagi dla pliku"
|
||||
#~ msgstr "Tags for file"
|
||||
|
||||
#~ msgid "Błąd podczas autotagowania pliku"
|
||||
#~ msgstr "Error during file autotagowania"
|
||||
|
||||
#~ msgid "Brak obrazów do przetworzenia w katalogu:"
|
||||
#~ msgstr "No images to process in directory:"
|
||||
|
||||
#~ msgid "Błąd przy obliczaniu MD5:"
|
||||
#~ msgstr "Error calculating MD5:"
|
@@ -1,8 +1,8 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Kapitanbooru Uploader 0.9.4\n"
|
||||
"Project-Id-Version: Kapitanbooru Uploader 0.9.5\n"
|
||||
"Report-Msgid-Bugs-To: kapitan@mlesniak.pl\n"
|
||||
"POT-Creation-Date: 2025-06-26 18:00+0200\n"
|
||||
"POT-Creation-Date: 2025-06-26 18:09+0200\n"
|
||||
"Language: pl\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
@@ -49,52 +49,36 @@ msgstr "Nie znaleziono auth_token w stronie HTML."
|
||||
msgid "Błąd przy otwieraniu pliku"
|
||||
msgstr "Błąd przy otwieraniu pliku"
|
||||
|
||||
#: Core.py:237
|
||||
#: Core.py:239
|
||||
msgid "Tagger przetworzył:"
|
||||
msgstr "Tagger przetworzył:"
|
||||
|
||||
#: Core.py:240
|
||||
#: Core.py:242
|
||||
msgid "Błąd Taggera dla"
|
||||
msgstr "Błąd Taggera dla"
|
||||
|
||||
#: Core.py:295
|
||||
#: Core.py:297
|
||||
msgid "Error computing MD5:"
|
||||
msgstr "Błąd przy obliczaniu MD5:"
|
||||
|
||||
#: Core.py:420
|
||||
#: Core.py:422
|
||||
msgid "Błąd podczas sprawdzania paczki uploadu:"
|
||||
msgstr "Błąd podczas sprawdzania paczki uploadu:"
|
||||
|
||||
#: Core.py:429
|
||||
msgid "Plik nie istnieje:"
|
||||
msgstr ""
|
||||
|
||||
#: Core.py:435
|
||||
msgid "Tagi dla pliku"
|
||||
msgstr ""
|
||||
|
||||
#: Core.py:444
|
||||
msgid "Błąd podczas autotagowania pliku"
|
||||
msgstr "Błąd podczas autotagowania pliku"
|
||||
|
||||
#: Core.py:451
|
||||
#: Core.py:458
|
||||
msgid "Podana ścieżka nie jest katalogiem:"
|
||||
msgstr ""
|
||||
|
||||
#: Core.py:459
|
||||
msgid "Brak obrazów do przetworzenia w katalogu:"
|
||||
msgstr ""
|
||||
|
||||
#: Core.py:482
|
||||
#: Core.py:485
|
||||
#, python-brace-format
|
||||
msgid "Wysyłam plik {base_file_name}..."
|
||||
msgstr "Wysyłam plik {base_file_name}..."
|
||||
|
||||
#: Core.py:517
|
||||
#: Core.py:520
|
||||
msgid "Wysyłanie zakończone powodzeniem!"
|
||||
msgstr "Wysyłanie zakończone powodzeniem!"
|
||||
|
||||
#: Core.py:521 Core.py:530
|
||||
#: Core.py:524 Core.py:533
|
||||
#, python-brace-format
|
||||
msgid ""
|
||||
"Wysyłanie zakończone błędem.\n"
|
||||
@@ -105,52 +89,52 @@ msgstr ""
|
||||
"Status: {status_code}\n"
|
||||
"Treść: {text}"
|
||||
|
||||
#: Core.py:539 Core.py:545 ImageBrowser.py:664 ImageBrowser.py:667
|
||||
#: Core.py:542 Core.py:548 ImageBrowser.py:664 ImageBrowser.py:667
|
||||
#: ImageBrowser.py:1187 ImageBrowser.py:1190
|
||||
msgid "Wysyłanie"
|
||||
msgstr "Wysyłanie"
|
||||
|
||||
#: Core.py:557
|
||||
#: Core.py:560
|
||||
msgid "Błąd wysyłania pliku"
|
||||
msgstr "Błąd wysyłania pliku"
|
||||
|
||||
#: Core.py:587
|
||||
#: Core.py:590
|
||||
msgid "Anulowano operację!"
|
||||
msgstr "Operacja anulowana!"
|
||||
|
||||
#: Core.py:597
|
||||
#: Core.py:600
|
||||
#, python-brace-format
|
||||
msgid ""
|
||||
"Wysyłanie {file_path} z tagami: {final_tags} i ratingiem: {final_rating}"
|
||||
msgstr ""
|
||||
"Wysyłanie {file_path} z tagami: {final_tags} i ratingiem: {final_rating}"
|
||||
|
||||
#: Core.py:616
|
||||
#: Core.py:619
|
||||
msgid "Przesłano pliki!"
|
||||
msgstr "Pliki zostały przesłane!"
|
||||
|
||||
#: Core.py:637 Core.py:641
|
||||
#: Core.py:640 Core.py:644
|
||||
msgid "Post nie został znaleziony dla tego pliku"
|
||||
msgstr "Post nie został znaleziony dla tego pliku"
|
||||
|
||||
#: Core.py:652
|
||||
#: Core.py:655
|
||||
#, python-brace-format
|
||||
msgid "Aktualizuję tagi dla {base_file_name}..."
|
||||
msgstr "Aktualizuję tagi dla {base_file_name}..."
|
||||
|
||||
#: Core.py:662 Core.py:672 Core.py:697
|
||||
#: Core.py:665 Core.py:675 Core.py:700
|
||||
msgid "Operacja anulowana"
|
||||
msgstr "Operacja anulowana"
|
||||
|
||||
#: Core.py:707
|
||||
#: Core.py:710
|
||||
msgid "Tagi zostały zaktualizowane!"
|
||||
msgstr "Tagi zostały zaktualizowane!"
|
||||
|
||||
#: Core.py:712 ImageBrowser.py:729
|
||||
#: Core.py:715 ImageBrowser.py:729
|
||||
msgid "Sukces edycji"
|
||||
msgstr "Sukces edycji"
|
||||
|
||||
#: Core.py:719
|
||||
#: Core.py:722
|
||||
#, python-brace-format
|
||||
msgid ""
|
||||
"Błąd podczas aktualizacji tagów\n"
|
||||
@@ -159,15 +143,15 @@ msgstr ""
|
||||
"Błąd podczas aktualizacji tagów\n"
|
||||
"Status: {code}"
|
||||
|
||||
#: Core.py:723
|
||||
#: Core.py:726
|
||||
msgid "Treść:"
|
||||
msgstr "Treść:"
|
||||
|
||||
#: Core.py:727 ImageBrowser.py:726
|
||||
#: Core.py:730 ImageBrowser.py:726
|
||||
msgid "Błąd edycji"
|
||||
msgstr "Błąd edycji"
|
||||
|
||||
#: Core.py:733
|
||||
#: Core.py:736
|
||||
msgid "Krytyczny błąd edycji"
|
||||
msgstr "Krytyczny błąd edycji"
|
||||
|
||||
@@ -571,5 +555,8 @@ msgstr "Pobrano implikacje dla {count} tagów..."
|
||||
msgid "Regeneracja bazy zakończona."
|
||||
msgstr "Regeneracja bazy zakończona."
|
||||
|
||||
#~ msgid "Błąd podczas autotagowania pliku"
|
||||
#~ msgstr "Błąd podczas autotagowania pliku"
|
||||
|
||||
#~ msgid "Błąd przy obliczaniu MD5:"
|
||||
#~ msgstr "Błąd przy obliczaniu MD5:"
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "kapitanbooru-uploader"
|
||||
version = "0.9.4"
|
||||
version = "0.9.5"
|
||||
description = "A GUI application for uploading images to KapitanBooru"
|
||||
authors = [{ name = "Michał Leśniak", email = "kapitan@mlesniak.pl" }]
|
||||
dependencies = [
|
||||
|
Reference in New Issue
Block a user