Remove legacy rar settings

This commit is contained in:
Timmy Welch 2023-01-31 00:01:50 -08:00
parent 46899255c8
commit 2c5d419ee9
No known key found for this signature in database
7 changed files with 13 additions and 25 deletions

View File

@ -82,7 +82,6 @@ class ComicArchive:
def __init__(
self,
path: pathlib.Path | str,
rar_exe_path: str = "rar",
default_image_path: pathlib.Path | str | None = None,
) -> None:
self.cbi_md: GenericMetadata | None = None
@ -96,7 +95,6 @@ class ComicArchive:
self.page_count: int | None = None
self.page_list: list[str] = []
self.rar_exe_path = shutil.which(rar_exe_path or "rar") or ""
self.ci_xml_filename = "ComicInfo.xml"
self.comet_default_filename = "CoMet.xml"
self.reset_cache()

View File

@ -560,7 +560,7 @@ class CLI:
logger.error("Cannot find %s", filename)
return
ca = ComicArchive(filename, self.options.general_rar_exe_path, str(graphics_path / "nocover.png"))
ca = ComicArchive(filename, str(graphics_path / "nocover.png"))
if not ca.seems_to_be_a_comic_archive():
logger.error("Sorry, but %s is not a comic archive!", filename)

View File

@ -18,7 +18,6 @@ from __future__ import annotations
import argparse
import logging
import os
import pathlib
import platform
import settngs
@ -326,13 +325,6 @@ def validate_commandline_options(options: settngs.Config[settngs.Values], parser
else:
options[0].runtime_file_list = options[0].runtime_files
rar_path = pathlib.Path(options[0].general_rar_exe_path)
if rar_path.is_absolute() and rar_path.exists():
if rar_path.is_dir():
utils.add_to_path(str(rar_path))
else:
utils.add_to_path(str(rar_path.parent))
# take a crack at finding rar exe if it's not in the path
if not utils.which("rar"):
if platform.system() == "Windows":

View File

@ -12,13 +12,6 @@ from comictaggerlib.defaults import DEFAULT_REPLACEMENTS, Replacement, Replaceme
def general(parser: settngs.Manager) -> None:
# General Settings
parser.add_setting("--rar-exe-path", default="rar", help="The path to the rar program")
parser.add_setting(
"--allow-cbi-in-rar",
default=True,
action=argparse.BooleanOptionalAction,
help="Allows ComicBookLover tags in RAR/CBR files",
)
parser.add_setting("check_for_new_version", default=False, cmdline=False)
parser.add_setting("send_usage_stats", default=False, cmdline=False)
@ -59,7 +52,6 @@ def identifier(parser: settngs.Manager) -> None:
def dialog(parser: settngs.Manager) -> None:
# Show/ask dialog flags
parser.add_setting("ask_about_cbi_in_rar", default=True, cmdline=False)
parser.add_setting("show_disclaimer", default=True, cmdline=False)
parser.add_setting("dont_notify_about_this_version", default="", cmdline=False)
parser.add_setting("ask_about_usage_stats", default=True, cmdline=False)

View File

@ -23,6 +23,8 @@ def archiver(manager: settngs.Manager) -> None:
def validate_plugin_settings(options: settngs.Config) -> settngs.Config:
if "archiver" not in options[1]:
return options
cfg = settngs.normalize_config(options, file=True, cmdline=True, defaults=False)
for archiver in comicapi.comicarchive.archivers:
exe_name = archiver.exe.replace(" ", "-").replace("_", "-").strip().strip("-").replace("-", "_")

View File

@ -277,7 +277,7 @@ class FileSelectionList(QtWidgets.QWidget):
if self.is_list_dupe(path):
return self.get_current_list_row(path)
ca = ComicArchive(path, self.options.general_rar_exe_path, str(graphics_path / "nocover.png"))
ca = ComicArchive(path, str(graphics_path / "nocover.png"))
if ca.seems_to_be_a_comic_archive():
row: int = self.twList.rowCount()

View File

@ -269,7 +269,10 @@ class SettingsWindow(QtWidgets.QDialog):
def settings_to_form(self) -> None:
# Copy values from settings to form
self.leRarExePath.setText(self.options[0].general_rar_exe_path)
if "archiver" in self.options[1] and "rar" in self.options[1]["archiver"]:
self.leRarExePath.setText(getattr(self.options[0], self.options[1]["archiver"]["rar"].internal_name))
else:
self.leRarExePath.setEnabled(False)
self.sbNameMatchIdentifyThresh.setValue(self.options[0].identifier_series_match_identify_thresh)
self.sbNameMatchSearchThresh.setValue(self.options[0].comicvine_series_match_search_thresh)
self.tePublisherFilter.setPlainText("\n".join(self.options[0].identifier_publisher_filter))
@ -374,11 +377,12 @@ class SettingsWindow(QtWidgets.QDialog):
)
# Copy values from form to settings and save
self.options[0].general_rar_exe_path = str(self.leRarExePath.text())
if "archiver" in self.options[1] and "rar" in self.options[1]["archiver"]:
setattr(self.options[0], self.options[1]["archiver"]["rar"].internal_name, str(self.leRarExePath.text()))
# make sure rar program is now in the path for the rar class
if self.options[0].general_rar_exe_path:
utils.add_to_path(os.path.dirname(self.options[0].general_rar_exe_path))
# make sure rar program is now in the path for the rar class
if self.options[0].archivers_rar:
utils.add_to_path(os.path.dirname(str(self.leRarExePath.text())))
if not str(self.leIssueNumPadding.text()).isdigit():
self.leIssueNumPadding.setText("0")