Commit Graph

138 Commits

Author SHA1 Message Date
Martchus 7f3d4c5751 Add ID3v2 frame definitions for publisher web page and user defined URLs 2023-12-29 17:07:14 +01:00
Martchus ef0ab3d8c3 Avoid GCC's stringop-truncation warning
Not copying the termination character here is wanted. Just use
`std::memcpy` to avoid it as the special behavior of `std::strncpy` is not
needed here anyways.
2023-10-31 19:36:12 +01:00
Martchus 92345027fb Use generic `toInt()` function which relies less on compiler optimizations 2023-05-18 00:52:28 +02:00
Martchus 6fb16d72eb Avoid unqualified call to `std::strncpy()` 2023-05-07 21:45:47 +02:00
Martchus 981db492e4 Avoid unqualified calls to `std::move` 2023-02-20 19:54:42 +01:00
Martchus b50de3cf4f Preserve present parts when converting old record date fields 2022-08-13 15:43:28 +02:00
Martchus f0d8a6efa7 Set only present parts when setting recording time of ID3 <= v2.3
See https://github.com/Martchus/tageditor/issues/86
2022-08-13 14:47:49 +02:00
Martchus 74f6d2b6ac Fix reference to ID3v2 field in error message 2022-08-13 14:43:43 +02:00
Martchus 99bb786eeb Improve comments about `lRecordingTime`-mapping 2022-08-12 19:41:15 +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 0e3ccf8baa Support play counter ID3v2 frame 2022-06-19 17:40:01 +02:00
Martchus 5205d08258 Improve coding style of a few functions in `id3v2frame.cpp`
* Declare functions only used in the compile unit as static
* Use `std` namespace explicitly
* Use `auto` where it makes sense
2022-06-19 16:32:42 +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 1457dec990 Map "popularity meter" of ID3v2 tags to the generic rating field
See https://github.com/Martchus/tageditor/issues/84
2022-06-15 23:50:15 +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 520a913b07 Fix field ID of original year in ID3v2.0 2022-04-09 23:37:13 +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 2fda0a505d Prevent showing warning about encoding wrongly when making ID3v1 fields
Due to the fallthrough the warning would be printed in any case when using
UTF-8 and not only if the BOM is actually written (as there are non-ASCII
characters). This problem became apparent when using the tageditor's CLI
with `--id3-init-on-create` to create an ID3v1 tag from ID3v2. Of course it
doesn't help if there are actually non-ASCII characters present.
2021-08-08 01:20:39 +02:00
Jonas Kvinge ea23d71e8a Fix spelling and typos 2021-07-02 11:12:39 +02:00
Martchus 9da53e6d82 Allow one to disable the automatic handling of ID3v2 record fields 2021-05-13 16:07:06 +02:00
Martchus 87357af974 Fix handling empty ID3v2 record date fields to avoid year "0001" in this case 2021-05-09 12:15:57 +02:00
Martchus a6ca3183b3 Fix reading empty ID3v1 fields 2021-05-09 12:15:00 +02:00
Martchus 0a041f6ad2 Fix warnings 2021-03-20 21:26:25 +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 7692eec9af Make it easier to customize getting internal values 2021-01-30 19:12:04 +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 761e3ee44b Mark all "final" tag, track and container classes as such 2020-12-18 21:13:52 +01:00
Martchus e4a89af3c0 Improve documentation 2020-12-16 17:49:02 +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 aa23750307 Make many constructors explicit to avoid unintended implicit conversions 2020-12-05 20:48:57 +01:00
Martchus 5f39e377dc Use std::size_t consistently 2020-11-25 17:54:30 +01:00
Martchus e7ce9e7ced Improve documentation 2020-11-05 19:52:09 +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 0e66b34d48 Add human readable representation of certain IDs as comments 2020-04-22 22:08:02 +02:00
Martchus 6c8f237087 Show warning when reading/writing ID3v2 frames not matching the tag version 2020-04-22 19:48:27 +02:00
Martchus c9e0f82519 Add missing exports in id3v2frameids.h 2020-04-22 19:15:54 +02:00
Martchus 8f3eae59f1 Add more time-related ID3v2 IDs 2020-04-22 19:14:34 +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 ed816a322d Rename Id2v2 frame ID "grouping" to "albumArtist" 2019-06-16 17:45:49 +02:00
Martchus 0af4044a50 Remove deprecated functions of Id3v2Frame 2019-06-16 17:43:58 +02:00
Martchus df9d869911 Fix const-corretness in Id3Genres::genreNames() 2019-06-16 17:42:14 +02:00
Martchus 9a5c78b725 Don't consider UTF-8 an encoding which can be used in ID3v1
UTF-8 within ID3v1 is still supported relying on the presence of
the BOM. However, the library should not advise that to tag editing
clients.
2019-06-14 18:07:59 +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 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