Files
Kemono-Downloader/src/config/constants.py

130 lines
4.6 KiB
Python
Raw Normal View History

2025-07-01 22:48:58 +05:30
CONFIG_ORGANIZATION_NAME = "KemonoDownloader"
CONFIG_APP_NAME_MAIN = "ApplicationSettings"
CONFIG_APP_NAME_TOUR = "ApplicationTour"
# --- Filename and Folder Naming Styles ---
STYLE_POST_TITLE = "post_title"
STYLE_ORIGINAL_NAME = "original_name"
STYLE_DATE_BASED = "date_based"
STYLE_DATE_POST_TITLE = "date_post_title"
STYLE_POST_TITLE_GLOBAL_NUMBERING = "post_title_global_numbering"
2025-09-07 04:56:08 -07:00
STYLE_POST_ID = "post_id"
2025-07-01 22:48:58 +05:30
MANGA_DATE_PREFIX_DEFAULT = ""
# --- Download Scopes ---
SKIP_SCOPE_FILES = "files"
SKIP_SCOPE_POSTS = "posts"
SKIP_SCOPE_BOTH = "both"
CHAR_SCOPE_TITLE = "title"
CHAR_SCOPE_FILES = "files"
CHAR_SCOPE_BOTH = "both"
CHAR_SCOPE_COMMENTS = "comments"
FAVORITE_SCOPE_SELECTED_LOCATION = "selected_location"
FAVORITE_SCOPE_ARTIST_FOLDERS = "artist_folders"
# --- Download Status Constants ---
FILE_DOWNLOAD_STATUS_SUCCESS = "success"
FILE_DOWNLOAD_STATUS_SKIPPED = "skipped"
FILE_DOWNLOAD_STATUS_FAILED_RETRYABLE_LATER = "failed_retry_later"
FILE_DOWNLOAD_STATUS_FAILED_PERMANENTLY_THIS_SESSION = "failed_permanent_session"
# --- Threading and Performance ---
MAX_THREADS = 200
RECOMMENDED_MAX_THREADS = 50
SOFT_WARNING_THREAD_THRESHOLD = 40
MAX_FILE_THREADS_PER_POST_OR_WORKER = 10
POST_WORKER_BATCH_THRESHOLD = 30
POST_WORKER_NUM_BATCHES = 4
POST_WORKER_BATCH_DELAY_SECONDS = 2.5
MAX_POST_WORKERS_WHEN_COMMENT_FILTERING = 3
# --- Multipart Download Settings ---
MIN_SIZE_FOR_MULTIPART_DOWNLOAD = 10 * 1024 * 1024 # 10 MB
MAX_PARTS_FOR_MULTIPART_DOWNLOAD = 15
# --- UI and Settings Keys (for QSettings) ---
TOUR_SHOWN_KEY = "neverShowTourAgainV19"
MANGA_FILENAME_STYLE_KEY = "mangaFilenameStyleV1"
2025-10-08 17:02:46 +05:30
MANGA_CUSTOM_FORMAT_KEY = "mangaCustomFormatV1"
MANGA_CUSTOM_DATE_FORMAT_KEY = "mangaCustomDateFormatV1"
2025-07-01 22:48:58 +05:30
SKIP_WORDS_SCOPE_KEY = "skipWordsScopeV1"
ALLOW_MULTIPART_DOWNLOAD_KEY = "allowMultipartDownloadV1"
USE_COOKIE_KEY = "useCookieV1"
COOKIE_TEXT_KEY = "cookieTextV1"
CHAR_FILTER_SCOPE_KEY = "charFilterScopeV1"
THEME_KEY = "currentThemeV2"
SCAN_CONTENT_IMAGES_KEY = "scanContentForImagesV1"
LANGUAGE_KEY = "currentLanguageV1"
DOWNLOAD_LOCATION_KEY = "downloadLocationV1"
2025-07-15 21:08:11 -07:00
RESOLUTION_KEY = "window_resolution"
UI_SCALE_KEY = "ui_scale_factor"
2025-07-22 07:00:34 -07:00
SAVE_CREATOR_JSON_KEY = "saveCreatorJsonProfile"
2025-10-08 17:02:46 +05:30
DATE_PREFIX_FORMAT_KEY = "datePrefixFormatV1"
AUTO_RETRY_ON_FINISH_KEY = "auto_retry_on_finish"
2025-09-07 04:56:08 -07:00
FETCH_FIRST_KEY = "fetchAllPostsFirst"
DISCORD_TOKEN_KEY = "discord/token"
POST_DOWNLOAD_ACTION_KEY = "postDownloadAction"
2025-07-01 22:48:58 +05:30
# --- UI Constants and Identifiers ---
HTML_PREFIX = "<!HTML!>"
LOG_DISPLAY_LINKS = "links"
LOG_DISPLAY_DOWNLOAD_PROGRESS = "download_progress"
# --- Dialog Return Codes ---
CONFIRM_ADD_ALL_ACCEPTED = 1
CONFIRM_ADD_ALL_SKIP_ADDING = 2
CONFIRM_ADD_ALL_CANCEL_DOWNLOAD = 3
# --- File Type Extensions ---
IMAGE_EXTENSIONS = {
2025-07-18 07:54:11 -07:00
'.jpg', '.jpeg', '.jpe', '.png', '.gif', '.bmp', '.tiff', '.tif', '.webp',
2025-07-01 22:48:58 +05:30
'.heic', '.heif', '.svg', '.ico', '.jfif', '.pjpeg', '.pjp', '.avif'
}
VIDEO_EXTENSIONS = {
'.mp4', '.mov', '.mkv', '.webm', '.avi', '.wmv', '.flv', '.mpeg',
'.mpg', '.m4v', '.3gp', '.ogv', '.ts', '.vob'
}
ARCHIVE_EXTENSIONS = {
2025-10-08 17:02:46 +05:30
'.zip', '.rar', '.7z', '.tar', '.gz', '.bz2', '.bin'
2025-07-01 22:48:58 +05:30
}
AUDIO_EXTENSIONS = {
'.mp3', '.wav', '.aac', '.flac', '.ogg', '.wma', '.m4a', '.opus',
'.aiff', '.ape', '.mid', '.midi'
}
# --- Text Processing Constants ---
MAX_FILENAME_COMPONENT_LENGTH = 150
# Words to ignore when creating folder names from titles
FOLDER_NAME_STOP_WORDS = {
"a", "alone", "am", "an", "and", "at", "be", "by", "com",
"for", "he", "her", "his", "i", "im", "in", "is", "it", "its",
"me", "my", "net", "not", "of", "on", "or", "org", "our",
"s", "she", "so", "the", "their", "they", "this",
2025-08-06 06:56:49 -07:00
"to", "ve", "was", "we", "were", "with", "www", "you", "your", "nsfw", "sfw",
2025-07-05 06:02:21 +05:30
# add more according to need
2025-07-01 22:48:58 +05:30
}
# Additional words to ignore specifically for creator-level downloads
CREATOR_DOWNLOAD_DEFAULT_FOLDER_IGNORE_WORDS = {
"poll", "cover", "fan-art", "fanart", "requests", "request", "holiday",
"batch", "open", "closed", "winner", "loser", "wip",
"update", "news", "discussion", "question", "stream", "video", "sketchbook",
# Months and days
"jan", "january", "feb", "february", "mar", "march", "apr", "april",
"may", "jun", "june", "jul", "july", "aug", "august", "sep", "september",
"oct", "october", "nov", "november", "dec", "december",
"mon", "monday", "tue", "tuesday", "wed", "wednesday", "thu", "thursday",
2025-08-10 09:16:31 -07:00
"fri", "friday", "sat", "saturday", "sun", "sunday", "Pack", "tier", "spoiler",
2025-07-05 06:02:21 +05:30
# add more according to need
2025-07-01 22:48:58 +05:30
}
2025-07-16 09:02:47 -07:00
# --- Duplicate Handling Modes ---
DUPLICATE_HANDLING_HASH = "hash"
2025-10-08 17:02:46 +05:30
DUPLICATE_HANDLING_KEEP_ALL = "keep_all"
STYLE_CUSTOM = "custom"