diff --git a/src/bigstrings.py b/src/bigstrings.py index 06fd445..f48fc83 100644 --- a/src/bigstrings.py +++ b/src/bigstrings.py @@ -186,6 +186,10 @@ 'oviposition': 'eggs', } +TAG_CONFLICTS = { + 'solo': (['male_on_female', '1boy1girl', '2boys', '2futas', '2girls'], ['solo_female', 'solo_male']), +} + # # ######################################### diff --git a/src/download.py b/src/download.py index 4d2c89f..6c2b75f 100644 --- a/src/download.py +++ b/src/download.py @@ -28,7 +28,7 @@ from logger import Log from path_util import file_already_exists, try_rename, is_file_being_used from rex import re_media_filename, re_time, re_private_video -from tagger import filtered_tags, is_filtered_out_by_extra_tags, unite_separated_tags +from tagger import filtered_tags, is_filtered_out_by_extra_tags, solve_tag_conflicts, unite_separated_tags from util import has_naming_flag, format_time, normalize_path, get_elapsed_time_i, get_time_seconds, extract_ext from vinfo import VideoInfo, export_video_info, get_min_max_ids @@ -128,6 +128,7 @@ async def scan_video(vi: VideoInfo) -> DownloadResult: vi.comments = ('\n' + '\n\n'.join(comments_list) + '\n') if comments_list else '' if Config.check_uploader and vi.uploader and vi.uploader not in tags_raw: tags_raw.append(vi.uploader) + solve_tag_conflicts(vi, tags_raw) if is_filtered_out_by_extra_tags(vi, tags_raw, Config.extra_tags, Config.id_sequence, vi.subfolder, extra_ids): Log.info(f'Info: video {sname} is filtered out by{" outer" if scenario else ""} extra tags, skipping...') return DownloadResult.FAIL_FILTERED_OUTER if scenario else DownloadResult.FAIL_SKIPPED diff --git a/src/tagger.py b/src/tagger.py index e4549be..75d4d3a 100644 --- a/src/tagger.py +++ b/src/tagger.py @@ -8,7 +8,7 @@ from typing import List, Optional, Collection, Iterable, MutableSequence, Union, Dict, Tuple -from bigstrings import TAG_ALIASES +from bigstrings import TAG_ALIASES, TAG_CONFLICTS from config import Config from defs import TAGS_CONCAT_CHAR from logger import Log @@ -20,7 +20,7 @@ from vinfo import VideoInfo __all__ = ( - 'filtered_tags', 'get_matching_tag', 'extract_id_or_group', 'valid_extra_tag', 'is_filtered_out_by_extra_tags', + 'filtered_tags', 'get_matching_tag', 'extract_id_or_group', 'valid_extra_tag', 'is_filtered_out_by_extra_tags', 'solve_tag_conflicts', 'valid_playlist_name', 'unite_separated_tags', ) @@ -169,6 +169,15 @@ def trim_undersores(base_str: str) -> str: return re_uscore_mult.sub('_', base_str).strip('_') +def solve_tag_conflicts(vi: VideoInfo, tags_raw: List[str]) -> None: + for ctag in TAG_CONFLICTS: + if ctag in tags_raw: + cposlist, cneglist = TAG_CONFLICTS[ctag] + if any(cp in tags_raw for cp in cposlist) and all(cn not in tags_raw for cn in cneglist): + Log.info(f'{vi.sname} is tagged with both \'{ctag}\' and \'{"/".join(cposlist)}\'! Removing \'{ctag}\' tag!') + tags_raw.remove(ctag) + + def is_filtered_out_by_extra_tags(vi: VideoInfo, tags_raw: List[str], extra_tags: List[str], id_seq: List[int], subfolder: str, id_seq_ex: List[int] = None) -> bool: suc = True diff --git a/src/version.py b/src/version.py index 9ce80c7..9d22a20 100644 --- a/src/version.py +++ b/src/version.py @@ -9,7 +9,7 @@ APP_NAME = 'NM' APP_VER_MAJOR = '1' APP_VER_SUB = '8' -APP_REVISION = '442' +APP_REVISION = '443' APP_VERSION = f'{APP_VER_MAJOR}.{APP_VER_SUB}.{APP_REVISION}' #