summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2016-11-01 01:13:24 +0100
committerraveit65 <[email protected]>2016-11-30 19:57:24 +0100
commit77fc877a3985fd9cad49ed0250ab1bdf478e6638 (patch)
treed1c5bccdb66680843506c17ac486ee5cb665d7ac
parent9a311029be8d05fc15b0c310bbc96b0844c9dad0 (diff)
downloadatril-77fc877a3985fd9cad49ed0250ab1bdf478e6638.tar.bz2
atril-77fc877a3985fd9cad49ed0250ab1bdf478e6638.tar.xz
comics backend: add support for unarchiver (unar and lsar)
unar is able to extract all supported comics archive format CBR give unar priority over bsdtar, because it works better CBZ CB7 CBT give bsdtar priority over unar, because it is much faster
-rw-r--r--backend/comics/comics-document.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/backend/comics/comics-document.c b/backend/comics/comics-document.c
index 841524e7..9f945c6f 100644
--- a/backend/comics/comics-document.c
+++ b/backend/comics/comics-document.c
@@ -45,7 +45,8 @@ typedef enum
GNAUNRAR,
UNZIP,
P7ZIP,
- TAR
+ TAR,
+ UNARCHIVER
} ComicBookDecompressType;
typedef struct _ComicsDocumentClass ComicsDocumentClass;
@@ -107,7 +108,10 @@ static const ComicBookDecompressCommand command_usage_def[] = {
{NULL , "%s l -- %s" , "%s x -y %s -o%s", FALSE, OFFSET_7Z},
/* tar */
- {"%s -xOf" , "%s -tf %s" , NULL , FALSE, NO_OFFSET}
+ {"%s -xOf" , "%s -tf %s" , NULL , FALSE, NO_OFFSET},
+
+ /* UNARCHIVER */
+ {"unar -o -" , "%s %s" , NULL , FALSE, NO_OFFSET}
};
static void comics_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface);
@@ -356,6 +360,12 @@ comics_check_decompress_command (gchar *mime_type,
return TRUE;
}
comics_document->selected_command =
+ g_find_program_in_path ("lsar");
+ if (comics_document->selected_command) {
+ comics_document->command_usage = UNARCHIVER;
+ return TRUE;
+ }
+ comics_document->selected_command =
g_find_program_in_path ("bsdtar");
if (comics_document->selected_command) {
comics_document->command_usage = TAR;
@@ -380,6 +390,12 @@ comics_check_decompress_command (gchar *mime_type,
comics_document->command_usage = TAR;
return TRUE;
}
+ comics_document->selected_command =
+ g_find_program_in_path ("lsar");
+ if (comics_document->selected_command) {
+ comics_document->command_usage = UNARCHIVER;
+ return TRUE;
+ }
} else if (g_content_type_is_a (mime_type, "application/x-cb7") ||
g_content_type_is_a (mime_type, "application/x-7z-compressed")) {
@@ -409,6 +425,12 @@ comics_check_decompress_command (gchar *mime_type,
comics_document->command_usage = TAR;
return TRUE;
}
+ comics_document->selected_command =
+ g_find_program_in_path ("lsar");
+ if (comics_document->selected_command) {
+ comics_document->command_usage = UNARCHIVER;
+ return TRUE;
+ }
} else if (g_content_type_is_a (mime_type, "application/x-cbt") ||
g_content_type_is_a (mime_type, "application/x-tar")) {
/* tar utility (Tape ARchive) */
@@ -424,6 +446,12 @@ comics_check_decompress_command (gchar *mime_type,
comics_document->command_usage = TAR;
return TRUE;
}
+ comics_document->selected_command =
+ g_find_program_in_path ("lsar");
+ if (comics_document->selected_command) {
+ comics_document->command_usage = UNARCHIVER;
+ return TRUE;
+ }
} else {
g_set_error (error,
EV_DOCUMENT_ERROR,