Commit Graph

119 Commits

Author SHA1 Message Date
Frédéric Mangano
d88498e4fd Renumber the pages past the OpusTags packet
We will soon be able to process OpusTags packets spanning multiple pages, which would offset the
page number of all the succeeding pages. This change prepares the process loop for that feature.
2023-02-02 15:05:37 +09:00
Frédéric Mangano
953ae490d4 Fix the test suite on macOS 2023-01-27 15:53:15 +09:00
Frédéric Mangano
d453af2563 Migrate the system module to use exceptions 2021-01-17 15:43:16 +01:00
Frédéric Mangano
8a54361b8f Migrate the opus module to use exceptions 2021-01-17 15:07:56 +01:00
Frédéric Mangano
1c03c31e82 Migrate the ogg module to use exceptions 2021-01-17 14:58:50 +01:00
Frédéric Mangano
6758ae23ff Migrate the cli module to use exeptions 2021-01-17 12:55:30 +01:00
Frédéric Mangano
937cdc37a7 Exit with 2 on CLI arguments error 2021-01-17 12:36:22 +01:00
Frédéric Mangano
51c7f29c1a Make the top-level functions deal with exceptions 2021-01-17 12:32:38 +01:00
Frédéric Mangano
3e0b3fa56e Make encoding errors fatal
With --raw there is a workaround.

The tolerant approach was cool and nice until you want to edit something
non-interactively and get the warning telling you you might have lost
data after the file was written. Failing fast is most likely the better
option here.
2020-12-27 10:55:25 +01:00
Frédéric Mangano
3e7b42062a Discard incompatible comments entirely
//IGNORE is not portable either. Now that we have --raw it’s less an
issue though.
2020-12-27 10:55:20 +01:00
Frédéric Mangano
4cae6c44ee Introduce --raw for disabling transcoding 2020-12-26 16:51:36 +01:00
Frédéric Mangano
6db7f07bd5 Factor CLI argument transcoding 2020-12-26 13:00:20 +01:00
Frédéric Mangano
c43704a0a7 Use //IGNORE instead of //TRANSLIT when transcoding
//TRANSLIT is not a well supported, and in most cases there’s not much
transliteration can help with when the encoding is limiting. Besides,
it sounds reasonable to assume most people use UTF-8 nowadays.
2020-12-26 12:30:44 +01:00
Frédéric Mangano
7c8396ca45 run_editor: Pass the editor command through the shell
wordexp doesn’t work on OpenBSD, and escaping the path ourselves then
calling system() is actually easier than using wordexp.
2020-11-01 11:57:48 +01:00
Frédéric Mangano
639d46ed0f Introduce ot::shell_escape 2020-11-01 10:41:24 +01:00
Frédéric Mangano
d071b6cabd Fix error reporting when EDITOR fails 2020-10-31 18:10:33 +01:00
Frédéric Mangano
d8c36a3d3f Forbid mixing --edit with non-interactive edition options 2020-10-31 12:15:01 +01:00
Frédéric Mangano
ba2236facb Cancel --edit when the editor closes without saving 2020-10-31 12:11:26 +01:00
Frédéric Mangano
b3b092d241 Expand EDITOR/VISUAL with wordexp 2020-10-25 11:09:18 +01:00
Frédéric Mangano
8f0f29c056 Support VISUAL with --edit 2020-10-24 12:00:43 +02:00
Frédéric Mangano-Tarumi
e4ca6ca6ef Introduce the --edit option 2020-10-12 07:55:27 +02:00
Frédéric Mangano-Tarumi
8252f94084 --set-all: Ignore comments starting with # 2020-10-11 18:06:39 +02:00
Frédéric Mangano-Tarumi
7206604f85 Make read_comments work on std::list
For consistency with ot::opus_tags.
2020-10-11 17:43:04 +02:00
Frédéric Mangano-Tarumi
b369aea8d4 Fix signedness warnings in t/cli.cc 2020-09-26 13:13:15 +02:00
Reuben Thomas
84e238a4a9
Add support for multiple input files with --in-place
Co-authored-by: Frédéric Mangano-Tarumi <fmang@mg0.fr>
2020-09-26 13:12:15 +02:00
Reuben Thomas
73a54d7ab7 Don't treat empty output filename specially (fix #27)
Instead, make opt.path_out a std::optional<std::string>.
2020-09-20 16:32:27 +02:00
Reuben Thomas
ef15e7ad13
With --set-all, read comments from stdin before processing tags (#29)
With --set-all, read comments from stdin before processing tags
2020-09-19 11:02:43 +02:00
Frédéric Mangano-Tarumi
ea4d74d844 proper permissions setting on output files 2020-08-23 17:51:45 +02:00
Frédéric Mangano-Tarumi
c774c86286 rename liblibopustags to libot
It follows the name of the C++ namespace, and avoids confusion with the
opustags executable.
2019-01-26 17:07:53 -05:00
Frédéric Mangano-Tarumi
8ba3db8bbd t: safer argument casting for getopt 2019-01-12 16:09:18 -05:00
Frédéric Mangano-Tarumi
87bdd6fe22 t: cannot rely on iconv's //TRANSLIT
It's really system-dependant. As long as it doesn't break the regular
conversion it's fine. Managing transliteration is a nice to have but we
cannot expect it would work everywhere.

On systems that don't support it, iconv will trigger an EILSEQ.
2019-01-12 15:46:04 -05:00
Frédéric Mangano-Tarumi
d09d7bd634 t: only run opustags.t in UTF-8 environments 2018-12-19 20:32:55 -05:00
Frédéric Mangano-Tarumi
191796a3d2 t: skip locale test when fr_FR.iso88591 is missing 2018-12-19 19:56:32 -05:00
Frédéric Mangano-Tarumi
cacbd43422 t: modernize system.t 2018-12-18 20:25:28 -05:00
Frédéric Mangano-Tarumi
2dbba5a23e t: extend the tap module 2018-12-18 20:25:26 -05:00
Frédéric Mangano-Tarumi
4036ce1f39 t: print errors on stderr
That way, they're shown by the prove command.
That's what the Perl test suite does too.
2018-12-17 20:58:39 -05:00
Frédéric Mangano-Tarumi
06fff8cbeb support --delete NAME=VALUE 2018-12-17 20:00:27 -05:00
Frédéric Mangano-Tarumi
e2a1c06005 case-insensitive field name for comment deletion 2018-12-16 18:56:18 -05:00
Frédéric Mangano-Tarumi
a9adc11cad t: delete_comments 2018-12-16 18:51:28 -05:00
Frédéric Mangano-Tarumi
7df8c5c426 --set: add only the field name to to_delete 2018-12-16 18:33:08 -05:00
Frédéric Mangano-Tarumi
e26f3f268c error when --set-all's parsing fails 2018-12-16 12:50:18 -05:00
Frédéric Mangano-Tarumi
46cd25f744 warn about newlines and control characters 2018-12-16 12:36:37 -05:00
Frédéric Mangano-Tarumi
102f683869 t: encoding conversion 2018-12-09 12:59:20 -05:00
Frédéric Mangano-Tarumi
ebc8347c9e character encoding converter 2018-12-09 11:45:00 -05:00
Frédéric Mangano-Tarumi
ca06c6fb9d detect muxed streams 2018-12-08 12:55:58 -05:00
Frédéric Mangano-Tarumi
b2826bf0cc raise error on unsynced data 2018-12-08 12:20:00 -05:00
Frédéric Mangano-Tarumi
ccc8417413 rename the methods of ogg_reader
read_page → next_page, because it's more consistent with iterators.

read_header_packet → process_header_packet, because it doesn't actually
*read* anything.
2018-12-08 11:36:10 -05:00
Frédéric Mangano-Tarumi
d9dfc29b7d drop ot::validate_identification_header
No more need to extract the header packet.
2018-12-08 11:28:16 -05:00
Frédéric Mangano-Tarumi
23049a7ff6 introduce ot::is_opus_stream 2018-12-08 11:24:17 -05:00
Frédéric Mangano-Tarumi
7e6d9eae39 reduce read_packet into read_header_packet 2018-12-05 18:42:58 -05:00