From: Juanjo MarĂ­n Date: Fri, 11 Dec 2009 13:40:43 +0000 (+0100) Subject: [comics] Add support for cbt files X-Git-Tag: EVINCE_2_29_4~21 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=d68a91467efab8ef8a8f98589dd4c21b993b6e14;p=evince.git [comics] Add support for cbt files Fixes bgo#588266. --- diff --git a/backend/comics/comics-document.c b/backend/comics/comics-document.c index c871860d..2e867b5c 100644 --- a/backend/comics/comics-document.c +++ b/backend/comics/comics-document.c @@ -40,7 +40,8 @@ typedef enum RARLABS, GNAUNRAR, UNZIP, - P7ZIP + P7ZIP, + TAR } ComicBookDecompressType; typedef struct _ComicsDocumentClass ComicsDocumentClass; @@ -91,16 +92,19 @@ typedef struct { static const ComicBookDecompressCommand command_usage_def[] = { /* RARLABS unrar */ - {"%s p -c- -ierr", "%s vb -c- -- %s", NULL , FALSE, NO_OFFSET}, + {"%s p -c- -ierr --", "%s vb -c- -- %s", NULL , FALSE, NO_OFFSET}, /* GNA! unrar */ - {NULL , "%s t %s" , "%s -xf %s %s" , TRUE , NO_OFFSET}, + {NULL , "%s t %s" , "%s -xf %s %s" , TRUE , NO_OFFSET}, /* unzip */ - {"%s -p -C" , "%s -Z -1 -- %s" , NULL , TRUE , NO_OFFSET}, + {"%s -p -C --" , "%s -Z -1 -- %s" , NULL , TRUE , NO_OFFSET}, /* 7zip */ - {NULL , "%s l -- %s" , "%s x -y %s -o%s", FALSE, OFFSET_7Z} + {NULL , "%s l -- %s" , "%s x -y %s -o%s", FALSE, OFFSET_7Z}, + + /* tar */ + {"%s -xOf" , "%s -tf %s" , NULL , FALSE, NO_OFFSET} }; static void comics_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface); @@ -350,6 +354,15 @@ comics_check_decompress_command (gchar *mime_type, comics_document->command_usage = P7ZIP; return TRUE; } + } else if (!strcmp (mime_type, "application/x-cbt") || + !strcmp (mime_type, "application/x-tar")) { + /* tar utility (Tape ARchive) */ + comics_document->selected_command = + g_find_program_in_path ("tar"); + if (comics_document->selected_command) { + comics_document->command_usage = TAR; + return TRUE; + } } else { g_set_error (error, EV_DOCUMENT_ERROR, @@ -850,11 +863,10 @@ extract_argv (EvDocument *document, gint page) quoted_filename = g_shell_quote (comics_document->page_names->pdata[page]); } - command_line = g_strdup_printf ("%s -- %s %s", + command_line = g_strdup_printf ("%s %s %s", comics_document->extract_command, quoted_archive, quoted_filename); - g_shell_parse_argv (command_line, NULL, &argv, &err); if (err) { diff --git a/backend/comics/comicsdocument.evince-backend.in b/backend/comics/comicsdocument.evince-backend.in index d46161d2..90d4c01b 100644 --- a/backend/comics/comicsdocument.evince-backend.in +++ b/backend/comics/comicsdocument.evince-backend.in @@ -1,4 +1,4 @@ [Evince Backend] Module=comicsdocument _TypeDescription=Comic Books -MimeType=application/x-cbr;application/x-cbz;application/x-cb7; +MimeType=application/x-cbr;application/x-cbz;application/x-cb7;application/x-cbt; diff --git a/configure.ac b/configure.ac index e7daa955..fc05dbca 100644 --- a/configure.ac +++ b/configure.ac @@ -700,7 +700,7 @@ if test "x$enable_tiff" = "xyes"; then EVINCE_MIME_TYPES="${EVINCE_MIME_TYPES}image/tiff;" fi if test "x$enable_comics" = "xyes"; then - EVINCE_MIME_TYPES="${EVINCE_MIME_TYPES}application/x-cbr;application/x-cbz;application/x-cb7;" + EVINCE_MIME_TYPES="${EVINCE_MIME_TYPES}application/x-cbr;application/x-cbz;application/x-cb7;application/x-cbt;" fi if test "x$enable_pixbuf" = "xyes"; then EVINCE_MIME_TYPES="${EVINCE_MIME_TYPES}image/*;"