Commit Graph

56 Commits

Author SHA1 Message Date
Martchus 03f9698269 Expose tagDataTypeString() 2023-07-29 16:02:14 +02:00
Martchus 8ad28f857b Allow extending important classes without ABI break
This allows to make ABI breaks less often while still
being able to extend many aspects of the library.
2023-05-16 22:20:48 +02:00
Martchus 981db492e4 Avoid unqualified calls to `std::move` 2023-02-20 19:54:42 +01:00
Martchus 4aff37b788 Support `CppUtilities::DateTimeExpression` in `TagValue` 2022-08-13 14:42:51 +02:00
Martchus d6a2903749 Fix namespace in documentation of TagDataType 2022-08-13 12:30:59 +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 dcda6b673b Avoid breaking binary compatibility of TagDataType 2022-06-19 16:46:19 +02:00
Martchus 669b054a48 Implement parsing popularimeter ID3v2 frame 2022-06-19 16:29:29 +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 478b47d114 Improve documentation for `TagValue::isNull()`/`TagValue::isEmpty()` 2021-12-31 01:15:50 +01:00
Jonas Kvinge ea23d71e8a Fix spelling and typos 2021-07-02 11:12:39 +02: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 4cc2dbd9e6 Use flags instead of tons of boolean fields in AbstractTrack 2020-12-16 17:48:08 +01:00
Martchus b5983d40ad Add TagValue::nativeData() to store tag format specific meta-data 2020-12-05 21:03:00 +01:00
Martchus 007251c604 Improve documentation of TagValue 2020-12-05 20:52:19 +01:00
Martchus 9368b7a245 Add flags to TagValue, replacing dedicated field for read-only flag 2020-12-05 20:52:01 +01:00
Martchus aa23750307 Make many constructors explicit to avoid unintended implicit conversions 2020-12-05 20:48:57 +01:00
Martchus 13a87b473d Improve documentation 2020-04-24 23:15:30 +02:00
Martchus d26e594777 Deprecate 'Year' in favor of 'RecordDate' and 'ReleaseDate', fix handling in ID3v2
1. Convert TYER and related fields of old ID3v2 versions to the new TDRC
  field and only expose that via the generic accessors.
2. When writing an old ID3v2 tag, convert TDRC back to the old fields.
3. One can still manually unset the via 1. auto-populated TDRC to disable 2.
   and write the old fields directly. So the automatic handling does not
   reduce the flexibility of the library.
4. Deprecate 'Year'; it is replaced by the already existing 'RecordDate'
   which is now supposed to be used everywhere where 'Year' was used before
5. Introduce 'ReleaseDate' to support this field which is supported in
   ID3v2.4.0 and Matroska via the generic accessors.
6. Use ISO format when converting tag values of the type DateTime to/from
   string. This is closer to what's used in ID3v2 tags internally. (The
   library still allows the old format as fallback when parsing for
   compatibility.)
2020-04-24 23:15:13 +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 a8e20c5ef4 Allow converting the description encoding 2019-06-01 22:57:01 +02:00
Martchus 7885b99f72 Add TagValue::isNull() 2019-06-01 22:55:16 +02:00
Martchus c28ded1bca Allow instantiating TagValue from TimeSpan and DateTime 2019-06-01 22:54:44 +02:00
Martchus 7efa7a0d5a Adapt to c++utilities v5 2019-05-04 16:04:21 +02:00
Martchus e81c6bb169 Implement small TODOs for v8 2018-07-12 12:34:38 +02:00
Martchus f27dbd8934 Update documentation 2018-07-09 12:42:14 +02:00
Martchus d64084ec78 Refactor formatting list of values 2018-07-01 22:11:34 +02:00
Martchus 3265e0bea4 Fix documentation which was still using the old namespace 2018-06-03 20:38:32 +02:00
Martchus 60c757dcf6 Add c'tor overload to TagValue to prevent conversion to string 2018-06-03 19:04:48 +02:00
Martchus 8756c8b267 Use std::size_t in TagValue consistently 2018-06-03 18:58:23 +02:00
Martchus 0a640c9f7f Fix warnings, mostly about implicit int conversions
This should fix all non-erros, leaving only warnings which
are indeed potential problems.

The following warnings should be safe to ignore:

* Conversions of various offsets from uint64 to
  std::streamoff/int64 are safe because such offsets have
  been obtained via tellg() and other functions
  returning std::streamoff in the first place.
* It also works vice-versa since tellg() should not
  return negative offsets with exceptions enabled.
* Conversions from char to unsigned char are also ok.
* Unused diag arguments can be ignored (those might be
  useful later).
* Annotate all intended fallthoughs.
2018-06-02 23:04:53 +02:00
Martchus b47705ff81 Refactor MediaFileInfo::createAppropriateTags() 2018-03-11 18:57:22 +01:00
Martchus b35fc2ff0d Improve some structure layouts 2018-03-11 16:14:42 +01:00
Martchus a26b98dcd7 Improve TagValue
* Make more functions inline
* Fix use of std::size_t
2018-03-11 15:16:09 +01:00
Martchus c0336ed4bb Apply clang-format 2018-03-07 01:17:50 +01:00
Martchus 0e15c74103 Move everything into namespace TagParser 2018-03-06 23:09:15 +01:00
Martchus 6b705d5652 Mind encoding when converting TagValue to pos 2017-06-03 21:00:26 +02:00
Martchus 8b9e800803 TagValue: Strip BOM from assigned text
* So everywhere else can be safely assumed that
  text values never have a BOM
* Only exceptions are move constructor and move
  assignment where the caller must ensure no BOM
  is present
2017-05-18 02:27:08 +02:00
Martchus b97192abd3 Use std::make_unique provided by C++14 2017-02-05 21:02:40 +01:00
Martchus ed5dba0408 Add TagValue::operator!=(), improve doc for TagValue 2016-10-20 23:39:02 +02:00
Martchus 0cf30edbff Fix decoration for static builds 2016-08-29 15:43:05 +02:00
Martchus d5c8086230 Improve misc details 2016-08-05 01:46:31 +02:00
Martchus 817a8e25e6 Improve documentation and consistency 2016-08-04 00:16:19 +02:00
Martchus 8663dedf8c Fix misc issues 2016-07-30 22:35:46 +02:00