Bump version to 0.7.0 and add style tag processing for artist tags
All checks were successful
Gitea/kapitanbooru-uploader/pipeline/head This commit looks good

This commit is contained in:
Michał Leśniak 2025-03-16 03:10:20 +01:00
parent 96597a4e2b
commit dcd8e0824f
6 changed files with 36 additions and 6 deletions

View File

@ -142,7 +142,7 @@ class ImageBrowser(tk.Tk):
super().__init__()
self.title("Kapitanbooru Uploader")
self.geometry("900x600")
self.version = "0.6.0"
self.version = "0.7.0"
self.acknowledged_version = parse_version(self.version)
self.settings = Settings()
@ -1417,7 +1417,7 @@ class ImageBrowser(tk.Tk):
self.final_tags_text.config(state=tk.NORMAL)
self.final_tags_text.delete("1.0", tk.END)
for tag in final_list:
_, deprecated = process_tag(tag, self.tags_repo)
tag, deprecated = process_tag(tag, self.tags_repo)
# Ustal kolor i podkreślenie na podstawie wyniku
if deprecated is True:
color = "red"

View File

@ -248,6 +248,36 @@ class TagsRepo:
("label", _("Pobrano {count} tagów...").format(count=len(data_list)))
)
# Add style tags per artist tag if it doesn't exist yet. New style tags should have a post count of 1, category of 0, not be deprecated and words JSON list should have added "style" as the last element.
new_tag_id = (
max([row[0] for row in data_list]) + 1 + 1000000
) # Add 1000000 to avoid conflicts with existing tag IDs
# First, get all style tag names from data_list (tags with category 0 and name ending with "_(style)")
style_tags = set(
[row[1] for row in data_list if row[3] == 0 and row[1].endswith("_(style)")]
)
# Then, get all artist tags from data_list (tags with category 1)
artist_tags = set([row for row in data_list if row[3] == 1])
# For each artist tag, check if there is a style tag with the same name. If not, add a new style tag to data_list.
for artist_tag in artist_tags:
style_tag_name = artist_tag[1] + "_(style)"
if style_tag_name not in style_tags:
data_list.append(
(
new_tag_id,
style_tag_name,
1,
0,
artist_tag[5],
artist_tag[6],
0,
json.dumps(
json.loads(artist_tag[7]) + ["style"]
), # Add "style" to words JSON list
)
)
new_tag_id += 1
data_list = sorted(data_list, key=lambda x: x[0])
data_list = [(idx,) + row for idx, row in enumerate(data_list)]
cursor.executemany(

View File

@ -259,7 +259,7 @@ class TagManager(tk.Frame):
self.tags_display.delete("1.0", tk.END)
for tag in self.manual_tags:
# Process tag to decide its style
_, deprecated = process_tag(tag, self.tags_repo)
tag, deprecated = process_tag(tag, self.tags_repo)
if deprecated is True:
color = "red"
underline = 1

View File

@ -1,6 +1,6 @@
msgid ""
msgstr ""
"Project-Id-Version: Kapitanbooru Uploader 0.6.0\n"
"Project-Id-Version: Kapitanbooru Uploader 0.7.0\n"
"Report-Msgid-Bugs-To: kapitan@mlesniak.pl\n"
"POT-Creation-Date: 2025-03-16 01:22+0100\n"
"Content-Type: text/plain; charset=UTF-8\n"

View File

@ -1,6 +1,6 @@
msgid ""
msgstr ""
"Project-Id-Version: Kapitanbooru Uploader 0.6.0\n"
"Project-Id-Version: Kapitanbooru Uploader 0.7.0\n"
"Report-Msgid-Bugs-To: kapitan@mlesniak.pl\n"
"POT-Creation-Date: 2025-03-16 01:22+0100\n"
"Language: pl\n"

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "kapitanbooru-uploader"
version = "0.6.0"
version = "0.7.0"
description = "A GUI application for uploading images to KapitanBooru"
authors = [{ name = "Michał Leśniak", email = "kapitan@mlesniak.pl" }]
dependencies = [