Commit Graph

119 Commits

Author SHA1 Message Date
Martchus acfb9ef219 Handle TRACKTOTAL/DISCTOTAL/PARTTOTAL fields in Vorbis Comments
* Move those fields into their corresponding
  TRACKNUMBER/DISCNUMBER/PARTNUMBER fields after parsing so they are
  accessible via just one field as PositionInSet which is in line with
  other tag formats and also how other software like VLC expect the total
  to be specified
* NOT implemented yet: Move those fields optionally back into separate
  fields when serializing
2024-02-28 21:36:06 +01:00
Martchus 351e953b83 Avoid empty documentation entry for `EvpMdCtx` 2024-02-28 21:36:06 +01:00
Martchus d48722f26c Fix unity builds
* Define `CHRONO_UTILITIES_TIMESPAN_INTEGER_SCALE_OVERLOADS` consistently
  with all necassary changes
* Avoid ambiguity between enum members and certain class/struct names
2024-01-30 23:31:15 +01:00
Martchus 92345027fb Use generic `toInt()` function which relies less on compiler optimizations 2023-05-18 00:52:28 +02:00
Martchus 522aa4359e Avoid use of platform-specific `unistd.h` header 2023-02-11 13:55:04 +01:00
Martchus 0347ca73eb Avoid using deprecated OpenSSL functions in testsuite 2023-01-02 01:56:58 +01:00
Martchus 49c6b61e0c Streamline coding style of date time related tests 2022-08-13 16:05:39 +02:00
Martchus 6333aaa84b Adapt DateTime test to latest changes 2022-08-13 16:04:56 +02:00
Martchus 4ac97910e9 Revert "Adapt tests to recent changes" partially
* In accordance with revert of 44fea6c8c2.
* This partially reverts commit 965ee4ab4b.
2022-08-13 15:43:28 +02:00
Martchus 4aff37b788 Support `CppUtilities::DateTimeExpression` in `TagValue` 2022-08-13 14:42:51 +02:00
Martchus c3c525c352 Scale rating automatically when serializing popularity/rating field
* Allow one to get a `Popularity` where `.rating` is always between 1 and 5
  via `TagValue::toScaledPopularity()` (or a "raw" scale by specifying the
  corresponding tag format)
* Allow one to assign a `Popularity` with `.scale = TagType::Unspecified`
  and `.rating` between 1 and 5 (or a "raw" scale by specifying the
  corresponding tag format). It will then be converted internally to
  the required scale (whatever the tag format internally uses)
    * Ensure all tag formats with popularity/rating field use
      `TagValue::toScaledPopularity()` internally when a `Popularity`
      object is assigned
* Ensure all tag formats with popularity/rating field store the rating as
  popularity object to preserve the scaling information
* Keep passing raw strings around working
    * `TagValue::toString()` still does *no* scaling
    * `TagValue::toScaledPopularity()` does *no* scaling for text values
      and instead just assigns the specified scale
* See https://github.com/Martchus/tagparser/issues/23
2022-07-20 23:23:51 +02:00
Martchus 98d28ede9f Add scale info to Popularity for furture extension
This would allow implementing a way to convert between different scales and
which in turn would allow the UI to provide an editor with a generic scale
(e.g. stars) instead of only allowing to edit raw values as string.

This also make it assume that a single number is meant to be the rating
(instead of the user). That should make editing the rating a bit more
straight forward (if one doesn't care about the user and play counter).
2022-06-20 21:27:42 +02:00
Martchus 08570aea32 Support unsigned integers in TagValue 2022-06-19 17:38:54 +02:00
Martchus f52b2958df Add implicit conversion of popularity to integer to generalize usage of popularity
* Propose the usage of the popularity type in general for the rating field
  so GUIs can show an appropriate UI element
* Do not just propose the popularity type for ID3v2 tags so a uniform UI
  element can be shown accross tag formats; and API to convert from a
  uniform scale is still TODO
2022-06-19 14:32:45 +02:00
Martchus 46014def51 Add data type for ID3v2's Popularimeter field
See https://github.com/Martchus/tageditor/issues/84
2022-06-18 14:33:30 +02:00
Martchus 7a70a8e098 Apply clang-format 2022-05-23 19:55:50 +02:00
Martchus 5106d94f2a Add Ogg stream serial number to tag target when parsing Vorbis comments
So the stream the Vorbis comment belongs to is shown in the tag editor GUI.
Otherwise it shouldn't change the behavior.
2022-05-03 23:50:20 +02:00
Martchus 87aea59735 Change mapping of publisher for ID3v2
TPUB is likely better be mapped to the recently added publisher field. Note
that MP4 and Matroska have a distinct record label field.
2022-04-10 00:06:20 +02:00
Martchus a3dc63b677 Fix parsing flags of Matroska tracks
The default for the flags "default" and "enabled" is actually 1.
2022-04-05 21:27:58 +02:00
Martchus e277070e9c Use `std::filesystem` in backup helper code
* Fix applying changes to symlinks so that the target is modified in any
  case (and not just if a rewrite isn't necessary)
* Avoid using `std::rename` and `std::remove` because they might not work
  under Windows when the path contains non-ASCII characters
* Simplify code, remove `isRelative()`
2021-09-11 23:54:49 +02:00
Martchus dd787e2f2a Extend Ogg related tests
* Test writing trailing zero lacing value if required
* Test adding cover
2021-08-18 22:48:17 +02:00
Martchus e095c7d87d Fix check for comment of Matroska test file 2021-07-06 17:19:58 +02:00
Martchus cef4dc0bb7 Apply clang-format 2021-07-06 16:38:52 +02:00
Jonas Kvinge ea23d71e8a Fix spelling and typos 2021-07-02 11:12:39 +02:00
Martchus 92e80a9286 Improve passing paths
* Use `std::string_view` instead of `const std::string &`
* Add overloads taking `std::string &&` for re-using existing strings
2021-04-23 22:16:43 +02:00
Martchus 0a041f6ad2 Fix warnings 2021-03-20 21:26:25 +01:00
Martchus 65597fd71e Add API to allow aborting overall/expensive parsing functions
* Not really implemented within the various code paths of the parsers at
  this point; this commit mainly adds the API.
* Adjust example in README
2021-02-04 23:21:50 +01:00
Martchus 8cd115c69d Adapt tests to use KnownField::RecordDate instead of KnownField::Year 2021-02-01 17:22:57 +01:00
Martchus 64d98f5530 Use std::string_view where it makes sense 2021-01-30 21:53:06 +01:00
Martchus 6b469f1c26 Add Locale class to deal with differently specified languages/countries
Different media/tag formats specify languages and countries
differently. This change introduces a Locale class to keep track
of the format being used. So far there are no automatic conversions
implemented so it is entirely up to the user to pass valid values using
a format which matches the one required by the media/tag format.

This change also adds support for Matroska's IETF elements so at least the
raw value can be read, written and is preserved.
2020-12-16 17:48:08 +01:00
Martchus 965ee4ab4b Adapt tests to recent changes 2020-04-26 22:22:29 +02:00
Martchus eabc9c4438 Use 'override' in all TestFixture classes 2019-12-15 19:44:07 +01:00
Martchus 6e9b39726d Add conversion from ISO-639-2/B codes to language names 2019-08-17 20:56:09 +02:00
Martchus 2725bad686 Add options for TagValue comparison
* Support case-insensitive comparision
* Allow ignoring meta-data
2019-08-12 20:24:27 +02:00
Martchus c9e1dde70b Adapt to changes in c++utilities 2019-06-12 20:40:45 +02:00
Martchus 5ad00a083c Adapt to changes in c++utilities 2019-06-10 23:11:39 +02:00
Martchus 5114a3ea08 Treat differently encoded values not necessarily as different
That an automatic conversion happens for different types but not
for different encodings was always a bit odd.

This makes writing tests easier and comparing values within the
tag editor does not rely on choosing a particular encoding.
2019-06-01 23:01:53 +02:00
Martchus c28ded1bca Allow instantiating TagValue from TimeSpan and DateTime 2019-06-01 22:54:44 +02:00
Martchus f042d216fd Do not completely refuse on UTF-8 in ID3v1
since it is apparently used by some software.

But
* Write at least a BOM so it can be interpreted later
  correctly as UTF-8
* Print a warning
* Keep proposing Latin-1

The tag editor should allow to configure which encoding
is used and whether the BOM is used and which encoding is
assumed when parsing a file.
2019-06-01 22:53:59 +02:00
Martchus 8c88298fe8 Fix TagValue::operator== if 0 byte contained 2019-06-01 12:33:24 +02:00
Martchus 73adf26401 Fix conversion from PositionInSet to integer
Even though there was already a test verifying that it is
not possible.
2019-06-01 12:18:05 +02:00
Martchus b9bc756521 Adapt to workingCopyPathMode() removal 2019-05-11 19:01:16 +02:00
Martchus 7efa7a0d5a Adapt to c++utilities v5 2019-05-04 16:04:21 +02:00
Martchus 296e5d11b6 Fix TagValue::toStandardGenreIndex() for empty genre index 2019-02-14 18:18:54 +01:00
Martchus 5140b76f08 Treat 255 as empty ID3v1 genre index 2019-02-13 18:56:03 +01:00
Martchus da64d455d9 Let CMake generate code for test application 2019-01-13 22:28:26 +01:00
Martchus 438efdedbf Use rmdir() rather than remove() to delete dir 2018-11-02 23:07:50 +01:00
Martchus b7a5683211 Fix compiling tests for 32-bit 2018-11-01 23:25:33 +01:00
Martchus 969828e181 Fix compiling tests for Windows 2018-11-01 19:18:00 +01:00
Martchus b955a6b79f Fix compilation of tests under Linux
hopefully works now under Linux and Windows
2018-10-09 20:31:03 +02:00