Skip to content

Commit 4373af5

Browse files
authored
Merge pull request #242 from Drazzilb08/dev
Dev
2 parents b998a63 + 182c066 commit 4373af5

File tree

5 files changed

+39
-22
lines changed

5 files changed

+39
-22
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.0
1+
2.0.1

modules/border_replacerr.py

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,36 @@
2121
logging.getLogger("PIL").setLevel(logging.WARNING)
2222

2323

24-
def load_last_run(log_dir: str) -> Optional[datetime]:
24+
def load_last_run(log_dir: str, logger: Logger = None) -> Optional[datetime]:
2525
"""
2626
Load the last run timestamp from the .last_run file in the log directory.
2727
"""
28-
last_run_file = os.path.join(log_dir, ".last_run")
29-
if os.path.exists(last_run_file):
30-
with open(last_run_file, "r") as f:
31-
ts = f.read().strip()
32-
try:
33-
return datetime.fromisoformat(ts)
34-
except Exception:
35-
pass
36-
return None
37-
38-
39-
def save_last_run(log_dir: str, dt: Optional[datetime] = None) -> None:
28+
try:
29+
last_run_file = os.path.join(log_dir, ".last_run")
30+
31+
if os.path.exists(last_run_file):
32+
with open(last_run_file, "r") as f:
33+
ts = f.read().strip()
34+
try:
35+
return datetime.fromisoformat(ts)
36+
except Exception:
37+
pass
38+
except Exception as e:
39+
logger.error(f"Failed to read file: {e}")
40+
return None
41+
42+
43+
def save_last_run(log_dir: str, dt: Optional[datetime] = None, logger: Logger = None) -> None:
4044
"""
4145
Save the current timestamp (or provided datetime) to the .last_run file in the log directory.
4246
"""
43-
last_run_file = os.path.join(log_dir, ".last_run")
44-
now = dt or datetime.now()
45-
with open(last_run_file, "w") as f:
46-
f.write(now.isoformat())
47+
try:
48+
last_run_file = os.path.join(log_dir, ".last_run")
49+
now = dt or datetime.now()
50+
with open(last_run_file, "w") as f:
51+
f.write(now.isoformat())
52+
except Exception as e:
53+
logger.error(f"Failed to write file: {e}")
4754

4855

4956
def check_holiday(
@@ -516,7 +523,7 @@ def no_assets_exit():
516523
return
517524

518525
log_dir = get_log_dir(config.module_name)
519-
last_run = load_last_run(log_dir)
526+
last_run = load_last_run(log_dir, logger=logger)
520527
if config.log_level.lower() == "debug":
521528
print_settings(logger, config)
522529

@@ -611,6 +618,7 @@ def group_assets(assets):
611618
if config.log_level == "debug":
612619
print_json(assets_dict, logger, config.module_name, "assets_dict")
613620
print_json(messages, logger, config.module_name, "messages")
621+
save_last_run(log_dir, logger=logger)
614622

615623

616624
# --- Formatting function for border actions output ---
@@ -669,7 +677,5 @@ def main(config: SimpleNamespace) -> None:
669677
logger.error("\n\nAn error occurred:\n", exc_info=True)
670678
logger.error("\n\n")
671679
finally:
672-
log_dir = get_log_dir(config.module_name)
673-
save_last_run(log_dir)
674680
# Log outro message with run time
675681
logger.log_outro()

modules/renameinatorr.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,17 @@ def process_instance(
108108
media_dict: List[Dict[str, Any]] = app.get_parsed_media()
109109
count: int = get_count_for_instance_type(config, instance_type, logger)
110110
tag_id: Any = None
111+
112+
# Ignore-tag filtering: skip items with the ignore tag, if configured
113+
skipped_count = 0
114+
if getattr(config, "ignore_tag", None):
115+
ignore_tag_id = app.get_tag_id_from_name(config.ignore_tag)
116+
if ignore_tag_id:
117+
before_count = len(media_dict)
118+
media_dict = [item for item in media_dict if ignore_tag_id not in item.get("tags", [])]
119+
skipped_count = before_count - len(media_dict)
120+
if skipped_count > 0:
121+
logger.info(f"Skipped {skipped_count} items due to ignore tag '{config.ignore_tag}'.")
111122
# Tagging logic: filter untagged, clear if all tagged
112123
if getattr(config, "tag_name", None):
113124
tag_id = app.get_tag_id_from_name(config.tag_name)

util/template/config_template.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
"radarr_count": 0,
9191
"sonarr_count": 0,
9292
"tag_name": "",
93+
"ignore_tags": "",
9394
"enable_batching": false,
9495
"instances": []
9596
},

web/static/css/index.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@
173173

174174
/* Update badge in footer (hidden by default) */
175175
.footer-update-badge {
176-
display: none;
177176
background: var(--error);
178177
color: var(--footer-update-badge-color);
179178
border-radius: 12px;

0 commit comments

Comments
 (0)