From 5b3e9c9026fe26c621dc603a9033efee4040c1d4 Mon Sep 17 00:00:00 2001 From: Timmy Welch Date: Sat, 22 Apr 2023 10:49:47 -0700 Subject: [PATCH] Switch to rarfile for rar/cbr support --- comicapi/archivers/rar.py | 6 +++--- requirements-CBR.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/comicapi/archivers/rar.py b/comicapi/archivers/rar.py index 726404a..1dc2df8 100644 --- a/comicapi/archivers/rar.py +++ b/comicapi/archivers/rar.py @@ -12,7 +12,7 @@ import time from comicapi.archivers import Archiver try: - from unrar.cffi import rarfile + import rarfile rar_support = True except ImportError: @@ -22,7 +22,7 @@ except ImportError: logger = logging.getLogger(__name__) if not rar_support: - logger.error("unrar-cffi unavailable") + logger.error("rar unavailable") class RarArchiver(Archiver): @@ -43,7 +43,7 @@ class RarArchiver(Archiver): def get_comment(self) -> str: rarc = self.get_rar_obj() - return rarc.comment.decode("utf-8") if rarc else "" + return (rarc.comment if rarc else "") or "" def set_comment(self, comment: str) -> bool: if rar_support and self.exe: diff --git a/requirements-CBR.txt b/requirements-CBR.txt index 0e3a2cd..f5c5f0a 100644 --- a/requirements-CBR.txt +++ b/requirements-CBR.txt @@ -1 +1 @@ -unrar-cffi>=0.2.2 +rarfile>=4.0