Commit Graph

66 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 45ab6b17b9 Improve various details of documentation 2024-01-23 00:29:11 +01:00
Martchus 33327390e9 Add Vorbis comment IDs for total number of tracks/disks/parts 2023-12-29 17:12:20 +01:00
Martchus b1bca85ef4 Support publisher webpage in Vorbis comments 2023-12-29 16:50:41 +01:00
Martchus 1df871870b Map the publisher field for Vorbis comments 2023-12-29 15:57:51 +01:00
Martchus 92345027fb Use generic `toInt()` function which relies less on compiler optimizations 2023-05-18 00:52:28 +02:00
Martchus d80736743b Use `pubsetbuf` only with `libstdc++`
This usage of the function seems only to work as intended with that
standard lib. With `libc++` and the MSVC standard lib the call has no
effect.
2023-02-28 21:06:52 +01:00
Martchus 981db492e4 Avoid unqualified calls to `std::move` 2023-02-20 19:54:42 +01:00
Martchus 6da62db035 Add mapping for BPM in Vorbis Comments 2022-08-12 00:37:25 +02:00
Martchus ccf77959b4 Convert text values to a supported encoding if needed on the fly
* This makes it harder to use the library wrongly and does not lead to
  worse performance as character set conversions are only done as needed.
* That's actually already done by serializers for most tag formats. This
  change ensures serializers for Matroska and Vorbis tag fields do this as
  well.
* Update documentation accordingly.
2022-07-21 23:30:45 +02:00
Martchus 2ae83a2301 Remove unused include 2022-07-21 23:24:08 +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 c4d850825a Map `RATING` field for Vorbis comments 2022-06-19 17:51:51 +02:00
Martchus 4da00f8b75 Add more field mappings 2022-04-09 23:36:39 +02:00
Martchus bf1eee45ba Add field mappings for all fields mentioned in Matroska spec 2022-04-06 00:01:19 +02:00
Martchus 41ddccb455 Avoid copying fields when making Vorbis comment 2021-12-31 01:18:45 +01:00
Martchus 932687f93d Improve warnings when parsing Vorbis comments 2021-08-16 18:37:44 +02:00
Martchus f39e8b4d8c Avoid useless cases when assigning tag size (which is now std::uint64_t) 2021-08-08 00:05:11 +02:00
Jonas Kvinge ea23d71e8a Fix spelling and typos 2021-07-02 11:12:39 +02:00
Martchus 0e29c98b9f Use flagenumclass.h to implement operators for VorbisCommentFlags 2021-05-13 15:28:56 +02:00
Martchus 0a041f6ad2 Fix warnings 2021-03-20 21:26:25 +01:00
Martchus 763eb1bd53 Adjust code for turning Vorbis comment field "YEAR" into "DATE"
Maybe this way it will compile with GCC 8.
2021-02-03 14:11:40 +01:00
Martchus f21ac07da0 Get rid of deprecated fields 2021-02-01 17:11:08 +01:00
Martchus 64d98f5530 Use std::string_view where it makes sense 2021-01-30 21:53:06 +01:00
Martchus 65d52b2d57 Improve customization point for clearing tag field
* Allow customizing clearing only the value
* Use same naming scheme as in other places
* Avoid having to add an empty reset() function in subclasses
2021-01-30 19:10:16 +01:00
Martchus 047d739918 Fix Vorbis Comment mapping for encoderSettings()
* The "Encoder settings" field should correspond to `ENCODER_OPTIONS`
  rather than `ENCODING`
* See https://github.com/Martchus/tageditor/issues/62
* See https://exiftool.org/TagNames/Vorbis.html
2021-01-29 21:38:59 +01:00
Martchus 9a5d366ce0 Vorbis comment: Turn "YEAR" into "DATE" (unless "DATE" exists)
"DATE" is an official field and "YEAR" only an inofficial one but present
in some files. In consistency with MediaInfo and VLC player it is treated
like "DATE" here.
2020-11-25 01:39:57 +01: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 a7d359df81 Fix warnings about empty expression statements 2020-04-22 22:49:40 +02:00
Martchus 248a6555f3 Add links to upstream documentation of field IDs for the different formats 2020-04-22 18:43:41 +02:00
Martchus b09e7535bc Support lyrics in Vorbis/FLAC 2019-08-12 00:29:08 +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 7efa7a0d5a Adapt to c++utilities v5 2019-05-04 16:04:21 +02:00
Martchus 6afcd0f8d3 Support album artist and fix/improve grouping 2019-01-01 23:47:18 +01:00
Martchus a2ff0f418f Fix typo occured -> occurred 2018-07-23 14:44:06 +02:00
Martchus 7d709ce9af Add Tag::supportsMultipleValues() 2018-07-13 12:25:00 +02:00
Martchus af4b43ff79 Replace typedef with using 2018-07-12 12:34:38 +02:00
Martchus 9361e0bc13 Use constexpr where possible 2018-07-12 12:34:38 +02: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 221409fdcf Make Vorbis Comments consistently case insensitive 2018-05-13 20:41:26 +02:00
Martchus 01a0c730ba Make operators for VorbisCommentFlags constexpr 2018-04-29 21:14:02 +02:00
Martchus 59024a66a0 Don't clear field before parsing by default 2018-03-11 22:27:12 +01:00
Martchus c0336ed4bb Apply clang-format 2018-03-07 01:17:50 +01:00
Martchus a0986ad4a9 Fix style issues 2018-03-07 01:11:42 +01:00
Martchus 0e15c74103 Move everything into namespace TagParser 2018-03-06 23:09:15 +01:00
Martchus 36511fcc13 Add progress feedback and diagnostics replacing status provider 2018-03-06 22:44:01 +01:00
Martchus 7a02e8a325 Uniform/simplify typedefs in templates
* Begin type names with capital letter
* Remove typedefs for implementation type
* Remove useless/obsolete comments
* Simplify relevant code
2018-03-06 22:44:01 +01:00