Commit Graph

742 Commits

Author SHA1 Message Date
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 1a5dff611c
Merge pull request #24 from Martchus/rating
Scale rating automatically when serializing popularity/rating field
2022-07-20 23:26:52 +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 ed0fcad420 Bump minor version 2022-07-20 16:57:01 +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 d17f04864d Move TagType into separate header
So it can be used in different places without creating a dependency loop.
2022-06-20 21:21:11 +02:00
Martchus c4d850825a Map `RATING` field for Vorbis comments 2022-06-19 17:51:51 +02:00
Martchus 0e3ccf8baa Support play counter ID3v2 frame 2022-06-19 17:40:01 +02:00
Martchus 449ad034de Add string-representation for all types in tagDataTypeString() 2022-06-19 17:39:32 +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 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 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 c41046bd24 Simplify TagValue's comparision code 2022-06-18 14:54:55 +02:00
Martchus aa4b8a8e47 Ensure to handle all conversion errors in TagValue's equality operator
For instance, if a DateTime of wrong size is assigned this would lead to a
conversion error which would otherwise be unhandled.
2022-06-18 14:40:53 +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 9511d61371 Add comment about meaning of iTunes rating values 2022-06-16 01:15:51 +02:00
Martchus d6e1b4b77d Fix mapping of iTunes "advisory" rating to KnownField::LawRating
That likely fits the "advisory" rating better than KnownField::Rating which
is more a personal rating.
2022-06-16 01:15:51 +02:00
Martchus 5d7b7488fa Fix TagValue::toWString() for TagDataType::DateTime 2022-06-16 00:29:05 +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 7a70a8e098 Apply clang-format 2022-05-23 19:55:50 +02:00
Martchus e40c1901e1 Fix crash when parsing FLAC header 2022-05-23 19:55:32 +02:00
Martchus b27c82ef8c Bump patch version 2022-05-23 19:55:12 +02:00
Martchus 72f56f4297 Set the OggIterator filter correctly when parsing tags
I suppose otherwise parsing will fail if there are multiple streams and the
tag spans multiple interleaved pages.
2022-05-03 23:52:18 +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 84b4d06f53 Add stalebot config 2022-04-12 01:04:24 +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 26c88befda Make dummy definition in supportsField() const 2022-04-05 23:30:06 +02:00
Martchus 01813e7879 Add missing official Matroska tag field IDs 2022-04-05 21:54:04 +02:00
Martchus 5c4f94de8e Fix originalMediaType() 2022-04-05 21:48:02 +02:00
Martchus 169760c996 Organize matroskatagid.h with sections in accordance to specification 2022-04-05 21:47:35 +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 8e3055291e Add copyright notice 2022-04-05 20:15:32 +02:00
Martchus a5830319b1 Avoid requiring OpenSSL package in CMake find module
as it is only required for unit tests
2022-04-03 23:20:43 +02:00
Martchus ff86df8e25 Use `makeNativePath()` instead of `u8path()`
On non-Windows platforms the internal representation used for paths is the
configured native (narrow) character set. Most of the time that's UTF-8 but
only on Windows UTF-8 is *always* used for the internal representation.
2022-03-17 22:41:35 +01:00
Martchus b441860cc6 Fix one more occurance of wrong encoding handling with `std::filesystem` 2022-03-16 19:45:59 +01:00
Martchus 1ac689392e Apply clang-format 2022-03-16 19:24:14 +01:00
Martchus 4f221798e9 Fix dealing with non-ASCII characters in backup helper on Windows
See https://github.com/Martchus/tageditor/issues/81
2022-03-16 19:13:09 +01:00
Martchus 526352e016 Increment patch version 2022-03-15 21:51:38 +01:00
Martchus 4140c07512 Clarify that license is "GPL-2-or-later" 2022-03-15 21:49:33 +01:00
Martchus ede94518d0 Add fields to AbstractTrack to support a few more Mkv specs in the future 2022-02-16 00:24:21 +01:00
Martchus 28abe151fd Avoid duplicating MP4 epoch 2022-02-16 00:04:09 +01:00
Martchus 503fb725a2 Improve handling time values of MP4 files
* Cache result of `verifyPresentTrackHeader()` instead of running the code
  unnecassarily multiple times
* Do not tamper with existing/raw values by default to avoid
  inconsistencies through rounding errors and possibly fix
  https://github.com/Martchus/tageditor/issues/80
* Avoid conversions to double (depending on the time scale rounding errors
  might still occur)
2022-02-15 23:22:48 +01:00
Martchus d19a09db5b Make `startDate` static as it isn't used in any other units 2022-02-15 21:35:49 +01:00
Martchus eafe2fa997 Avoid constructor for TrackHeaderInfo 2022-02-15 21:23:29 +01:00