Commit Graph

53 Commits

Author SHA1 Message Date
Martchus 2448bcd456 Fix TagValue::convertDescriptionEncoding() 2021-05-09 18:37:31 +02:00
Martchus 0a041f6ad2 Fix warnings 2021-03-20 21:26:25 +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 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 44fea6c8c2 Omit default components when formatting date time
It just looks nicer to have e.g. "2017" instead of "2017-01-01T00:00:00".
The ID3v2.4.0 standard and the Matroska standard explicitely allow this
format as well.
2020-04-26 21:45:20 +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 fe67abcfeb Fix old namespaces being mentioned in the documentation 2019-09-04 18:47:54 +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 5ad00a083c Adapt to changes in c++utilities 2019-06-10 23:11:39 +02:00
Martchus 736b4caeeb Document handling different types and encodings 2019-06-01 23:20:01 +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 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 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 3265e0bea4 Fix documentation which was still using the old namespace 2018-06-03 20:38:32 +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 f1656faa96 Fix TagValue::to{TimeSpan,DateTime}() for UTF-16 2018-06-02 19:23:07 +02:00
Martchus 09c1c6a232 Improve coding style in TagValue 2018-06-02 19:22:26 +02:00
Martchus fd1864c3df Make error messages in TagValue more specific 2018-06-02 19:21:15 +02:00
Martchus ca0b8e4d8c Improve coding style 2018-03-11 22:28:15 +01:00
Martchus 706c410edb Clear description encoding of TagValue 2018-03-11 22:27:55 +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 646fc4d302 Fix TagValue::toInteger() from Latin1/UTF-8 str 2017-06-08 00:48:10 +02:00
Martchus 4e59ed2742 Mind encoding in TagValue::toStandardGenreIndex() 2017-06-03 21:00:36 +02:00
Martchus e1d14ad61b Allow conversion of DateTime in TagValue::toString() 2017-06-03 21:00:36 +02:00
Martchus 6c1a0b9126 Fix TagValue::toDateTime() 2017-06-03 21:00:36 +02:00
Martchus 6b705d5652 Mind encoding when converting TagValue to pos 2017-06-03 21:00:26 +02:00
Martchus b76d35acfd Mind encoding when converting TagValue to int 2017-06-03 21:00:26 +02:00
Martchus 39b63c84cb TagValue equality: Actually ignore encoding if not relevant 2017-06-03 21:00:26 +02:00
Martchus e925e15533 Improve handling of Unicode and BOM in ID3v2
* Convert UTF-8 text fields automatically to UTF-16
  when version is ID3v2.3 or below
  -> so conversion from ID3v2.4 to ID3v2.3 or below
     doesn't require manual conversion of possibly
     UTF-8 encoded fields
* Don't use magic numbers for ID3v2 encoding byte
* Don't warn about UTF-16 Big Endian with BOM
2017-05-20 23:34:45 +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 c272ec315b Fix setting encoding in TagValue::assignText()
* when no conversion should to be done
* also be more tolerant in TagValue::toString() when
  no encoding has been specified
2016-12-28 00:17:26 +01:00
Martchus 369a241131 Fix character set conversion in TagValue::assignText 2016-12-27 23:39:32 +01:00
Martchus ed5dba0408 Add TagValue::operator!=(), improve doc for TagValue 2016-10-20 23:39:02 +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
Martchus 1e9df46691 Provide character set conversion for TagValue 2016-07-27 18:26:56 +02:00
Martchus 2c5d463a9f Improve API doc 2016-06-10 23:08:01 +02:00
Martchus b8e8dcd778 fixed some OGG/Vorbis related issues 2016-03-22 22:52:36 +01:00
Martchus 899e2a97fe small improvements
- fixed some mostly ID3/MP3 related bugs
- added convenience methods/operators
2016-03-18 21:43:09 +01:00
Martchus aa50c2d8b3 fixed includes 2015-09-06 19:57:33 +02:00