summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fr-command-tar.c42
-rw-r--r--src/fr-init.c2
2 files changed, 44 insertions, 0 deletions
diff --git a/src/fr-command-tar.c b/src/fr-command-tar.c
index c6dbd9b..dc12f64 100644
--- a/src/fr-command-tar.c
+++ b/src/fr-command-tar.c
@@ -197,6 +197,9 @@ add_compress_arg (FrCommand *comm)
if (is_mime_type (comm->mime_type, "application/x-compressed-tar"))
fr_process_add_arg (comm->process, "-z");
+ else if (is_mime_type (comm->mime_type, "application/x-brotli-compressed-tar"))
+ fr_process_add_arg (comm->process, "--use-compress-program=brotli");
+
else if (is_mime_type (comm->mime_type, "application/x-bzip-compressed-tar"))
if (is_program_in_path ("lbzip2"))
fr_process_add_arg (comm->process, "--use-compress-program=lbzip2");
@@ -544,6 +547,25 @@ fr_command_tar_recompress (FrCommand *comm)
new_name = g_strconcat (c_tar->uncomp_filename, ".gz", NULL);
}
+ else if (is_mime_type (comm->mime_type, "application/x-brotli-compressed-tar")) {
+ fr_process_begin_command (comm->process, "brotli");
+ fr_process_set_begin_func (comm->process, begin_func__recompress, comm);
+ switch (comm->compression) {
+ case FR_COMPRESSION_VERY_FAST:
+ fr_process_add_arg (comm->process, "-1"); break;
+ case FR_COMPRESSION_FAST:
+ fr_process_add_arg (comm->process, "-3"); break;
+ case FR_COMPRESSION_NORMAL:
+ fr_process_add_arg (comm->process, "-6"); break;
+ case FR_COMPRESSION_MAXIMUM:
+ fr_process_add_arg (comm->process, "--best"); break; // i.e. -q 11
+ }
+ fr_process_add_arg (comm->process, "-f");
+ fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+ fr_process_end_command (comm->process);
+
+ new_name = g_strconcat (c_tar->uncomp_filename, ".br", NULL);
+ }
else if (is_mime_type (comm->mime_type, "application/x-bzip-compressed-tar")) {
fr_process_begin_command (comm->process, "bzip2");
fr_process_set_begin_func (comm->process, begin_func__recompress, comm);
@@ -757,6 +779,11 @@ get_uncompressed_name (FrCommandTar *c_tar,
else if (file_extension_is (e_filename, ".tar.gz"))
new_name[l - 3] = 0;
}
+ else if (is_mime_type (comm->mime_type, "application/x-brotli-compressed-tar")) {
+ /* X.tar.br --> X.tar */
+ if (file_extension_is (e_filename, ".tar.br"))
+ new_name[l - 3] = 0;
+ }
else if (is_mime_type (comm->mime_type, "application/x-bzip-compressed-tar")) {
/* X.tbz2 --> X.tar
* X.tar.bz2 --> X.tar */
@@ -895,6 +922,14 @@ fr_command_tar_uncompress (FrCommand *comm)
fr_process_add_arg (comm->process, tmp_name);
fr_process_end_command (comm->process);
}
+ else if (is_mime_type (comm->mime_type, "application/x-brotli-compressed-tar")) {
+ fr_process_begin_command (comm->process, "brotli");
+ fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
+ fr_process_add_arg (comm->process, "-f");
+ fr_process_add_arg (comm->process, "-d");
+ fr_process_add_arg (comm->process, tmp_name);
+ fr_process_end_command (comm->process);
+ }
else if (is_mime_type (comm->mime_type, "application/x-bzip-compressed-tar")) {
fr_process_begin_command (comm->process, "bzip2");
fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
@@ -992,6 +1027,7 @@ fr_command_tar_handle_error (FrCommand *comm,
const char *tar_mime_types[] = { "application/x-compressed-tar",
+ "application/x-brotli-compressed-tar",
"application/x-bzip-compressed-tar",
"application/x-tar",
"application/x-7z-compressed-tar",
@@ -1031,6 +1067,10 @@ fr_command_tar_get_capabilities (FrCommand *comm,
if (is_program_available ("gzip", check_command))
capabilities |= FR_COMMAND_CAN_READ_WRITE;
}
+ else if (is_mime_type (mime_type, "application/x-brotli-compressed-tar")) {
+ if (is_program_available ("brotli", check_command))
+ capabilities |= FR_COMMAND_CAN_READ_WRITE;
+ }
else if (is_mime_type (mime_type, "application/x-bzip-compressed-tar")) {
if (is_program_available ("bzip2", check_command))
capabilities |= FR_COMMAND_CAN_READ_WRITE;
@@ -1109,6 +1149,8 @@ fr_command_tar_get_packages (FrCommand *comm,
return PACKAGES ("tar,gzip");
else if (is_mime_type (mime_type, "application/x-bzip-compressed-tar"))
return PACKAGES ("tar,bzip2");
+ else if (is_mime_type (mime_type, "application/x-brotli-compressed-tar"))
+ return PACKAGES ("tar,brotli");
else if (is_mime_type (mime_type, "application/x-tarz"))
return PACKAGES ("tar,gzip,ncompress");
else if (is_mime_type (mime_type, "application/x-lrzip-compressed-tar"))
diff --git a/src/fr-init.c b/src/fr-init.c
index 2927458..574bb48 100644
--- a/src/fr-init.c
+++ b/src/fr-init.c
@@ -66,6 +66,7 @@ FrMimeTypeDescription mime_type_desc[] = {
{ "application/x-ar", ".ar", N_("Ar (.ar)"), 0 },
{ "application/x-arj", ".arj", N_("Arj (.arj)"), 0 },
{ "application/x-brotli", ".br", N_("brotli (.br)"), 0 },
+ { "application/x-brotli-compressed-tar", ".tar.br", N_("Tar compressed with brotli (.tar.br)"), 0 },
{ "application/x-bzip", ".bz2", NULL, 0 },
{ "application/x-bzip-compressed-tar", ".tar.bz2", N_("Tar compressed with bzip2 (.tar.bz2)"), 0 },
{ "application/x-bzip1", ".bz", NULL, 0 },
@@ -151,6 +152,7 @@ FrExtensionType file_ext_type[] = {
{ ".sit", "application/x-stuffit" },
{ ".swm", "application/x-ms-wim" },
{ ".tar", "application/x-tar" },
+ { ".tar.br", "application/x-brotli-compressed-tar" },
{ ".tar.bz", "application/x-bzip-compressed-tar" },
{ ".tar.bz2", "application/x-bzip-compressed-tar" },
{ ".tar.gz", "application/x-compressed-tar" },