fresh start

This commit is contained in:
2026-01-08 22:07:03 +01:00
commit 715be97289
30 changed files with 2302 additions and 0 deletions

123
Database/x_classes.py Normal file
View File

@@ -0,0 +1,123 @@
from datetime import datetime
from enum import IntEnum, StrEnum
class DownloadMode(IntEnum):
NO_DOWNLOAD = 0
DOWNLOAD = 1
DOWNLOAD_ALL = 2
class ErrorID(IntEnum):
SUCCESS = 0
NO_ART = 1
OTHER_ERROR = 5
DOWNLOAD_FAIL = 6
ACCOUNT_DEAD = 7
ACCOUNT_SKIP = 8
TAGGING_ERROR = 9
FILE_READ_ERROR = 10
HASHING_Unidentified = 11
HASHING_FileNotFound = 12
HASHING_OTHER = 13
FILE_DELETED_OUTSIDE_ARCHIVE = 14
NO_CHANNEL = 15
TWEET_DELETED = 16
class ActionTaken(IntEnum):
Null = 0
Accepted = 1
Rejected = 2
Hidden = 3
class AccountRating(StrEnum):
SFW = "SFW"
NSFW = "NSFW"
NSFL = "NSFL"
class HavoxLabel(StrEnum):
KF = "KF"
NonKF = "NonKF"
Rejected = "Rejected"
class PostRating(StrEnum):
Unrated = "unrated"
General = "general"
Sensitive = "sensitive"
Questionable = "questionable"
Explicit = "explicit"
Filtered = "filtered"
class x_accounts:
id : int
rating : AccountRating
name : str
is_deleted : bool
is_protected : bool
download_mode : int
discord_channel_id : int
discord_thread_id : int
def __init__(self, id = 0, rating = AccountRating.NSFW, name : str = "", is_deleted = False, is_protected = False, download_mode = DownloadMode.NO_DOWNLOAD, discord_thread_id = 0, discord_channel_id = 0, **kwargs):
self.id = id
self.rating = rating
self.name = name
self.is_deleted = is_deleted
self.is_protected = is_protected
self.download_mode = download_mode
self.discord_thread_id = discord_thread_id
self.discord_channel_id = discord_channel_id
class x_posts:
id : int
account_id : int
discord_post_id : int
error_id : int
action_taken : ActionTaken
rating : PostRating
"highest rating from all post images"
tags : list[str]
text : str
date : datetime
def __init__(self, id = -1, account_id = -1, discord_post_id = 0, error_id = ErrorID.SUCCESS, action_taken = ActionTaken.Null, rating = PostRating.Unrated, tags = [], text = "", date = None, **kwargs):
self.id = id
self.account_id = account_id
self.discord_post_id= discord_post_id
self.error_id = error_id
self.action_taken = action_taken
self.rating = rating
self.tags = tags
self.text = text
self.date = date
class x_posts_images:
post_id : int
index : int
phash : int = None
dhash : int = None
error_id : int = 0
rating : PostRating = PostRating.Unrated
tags : list[str] = []
file : str = None
saved_file : str = None
vox_label : HavoxLabel = None
duplicate_id : int = -1
duplicate_index : int = -1
def __init__(self, post_id, index, phash = None, dhash = None, error_id = ErrorID.SUCCESS, rating = PostRating.Unrated, tags = [], file = None, saved_file = None, vox_label : HavoxLabel = None, duplicate_index = -1, duplicate_id = -1, **kwargs):
self.post_id = post_id
self.index = index
self.phash = phash
self.dhash = dhash
self.error_id = error_id
self.rating = rating
self.tags = tags
self.file = file
self.saved_file = saved_file
self.vox_label = vox_label
self.duplicate_id = duplicate_id
self.duplicate_index = duplicate_index
if __name__ == "__main__":
print(ErrorID.ACCOUNT_DEAD)
print(PostRating.Questionable)
print(x_posts_images(0,1).rating)