Switch to rarfile for rar/cbr support

This commit is contained in:
Timmy Welch 2023-04-22 10:49:47 -07:00
parent e70c47d12a
commit 5b3e9c9026
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View File

@ -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:

View File

@ -1 +1 @@
unrar-cffi>=0.2.2
rarfile>=4.0