mirror of
https://github.com/taglib/taglib.git
synced 2026-09-09 02:57:02 -04:00
Separate multiple values in basic tag with " / " instead of " "
This commit is contained in:
@@ -66,6 +66,11 @@ String AttachedPictureFrame::toString() const
|
||||
return d->description.isEmpty() ? s : d->description + " " + s;
|
||||
}
|
||||
|
||||
StringList AttachedPictureFrame::toStringList() const
|
||||
{
|
||||
return {d->description, d->mimeType};
|
||||
}
|
||||
|
||||
String::Type AttachedPictureFrame::textEncoding() const
|
||||
{
|
||||
return d->textEncoding;
|
||||
|
||||
@@ -79,6 +79,11 @@ namespace TagLib {
|
||||
*/
|
||||
String toString() const override;
|
||||
|
||||
/*!
|
||||
* Returns a string list containing the description and mime-type.
|
||||
*/
|
||||
StringList toStringList() const override;
|
||||
|
||||
/*!
|
||||
* Returns the text encoding used for the description.
|
||||
*
|
||||
|
||||
@@ -76,6 +76,11 @@ String GeneralEncapsulatedObjectFrame::toString() const
|
||||
return text;
|
||||
}
|
||||
|
||||
StringList GeneralEncapsulatedObjectFrame::toStringList() const
|
||||
{
|
||||
return {d->description, d->fileName, d->mimeType};
|
||||
}
|
||||
|
||||
String::Type GeneralEncapsulatedObjectFrame::textEncoding() const
|
||||
{
|
||||
return d->textEncoding;
|
||||
|
||||
@@ -82,6 +82,11 @@ namespace TagLib {
|
||||
*/
|
||||
String toString() const override;
|
||||
|
||||
/*!
|
||||
* Returns a string list containing the description, file name and mime-type.
|
||||
*/
|
||||
StringList toStringList() const override;
|
||||
|
||||
/*!
|
||||
* Returns the text encoding used for the description and file name.
|
||||
*
|
||||
|
||||
@@ -65,6 +65,11 @@ String OwnershipFrame::toString() const
|
||||
return "pricePaid=" + d->pricePaid + " datePurchased=" + d->datePurchased + " seller=" + d->seller;
|
||||
}
|
||||
|
||||
StringList OwnershipFrame::toStringList() const
|
||||
{
|
||||
return {d->pricePaid, d->datePurchased, d->seller};
|
||||
}
|
||||
|
||||
String OwnershipFrame::pricePaid() const
|
||||
{
|
||||
return d->pricePaid;
|
||||
|
||||
@@ -64,12 +64,17 @@ namespace TagLib {
|
||||
OwnershipFrame &operator=(const OwnershipFrame &) = delete;
|
||||
|
||||
/*!
|
||||
* Returns the text of this popularimeter.
|
||||
* Returns price paid, date purchased and seller.
|
||||
*
|
||||
* \see text()
|
||||
*/
|
||||
String toString() const override;
|
||||
|
||||
/*!
|
||||
* Returns price paid, date purchased and seller.
|
||||
*/
|
||||
StringList toStringList() const override;
|
||||
|
||||
/*!
|
||||
* Returns the date purchased.
|
||||
*
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "popularimeterframe.h"
|
||||
#include "tstringlist.h"
|
||||
|
||||
using namespace TagLib;
|
||||
using namespace ID3v2;
|
||||
@@ -60,6 +61,11 @@ String PopularimeterFrame::toString() const
|
||||
return d->email + " rating=" + String::number(d->rating) + " counter=" + String::number(d->counter);
|
||||
}
|
||||
|
||||
StringList PopularimeterFrame::toStringList() const
|
||||
{
|
||||
return {d->email, String::number(d->rating), String::number(d->counter)};
|
||||
}
|
||||
|
||||
String PopularimeterFrame::email() const
|
||||
{
|
||||
return d->email;
|
||||
|
||||
@@ -71,6 +71,11 @@ namespace TagLib {
|
||||
*/
|
||||
String toString() const override;
|
||||
|
||||
/*!
|
||||
* Returns email, rating and counter.
|
||||
*/
|
||||
StringList toStringList() const override;
|
||||
|
||||
/*!
|
||||
* Returns the email.
|
||||
*
|
||||
|
||||
@@ -110,6 +110,11 @@ String TextIdentificationFrame::toString() const
|
||||
return d->fieldList.toString();
|
||||
}
|
||||
|
||||
StringList TextIdentificationFrame::toStringList() const
|
||||
{
|
||||
return d->fieldList;
|
||||
}
|
||||
|
||||
StringList TextIdentificationFrame::fieldList() const
|
||||
{
|
||||
return d->fieldList;
|
||||
|
||||
@@ -162,6 +162,7 @@ namespace TagLib {
|
||||
|
||||
void setText(const String &s) override;
|
||||
String toString() const override;
|
||||
StringList toStringList() const override;
|
||||
|
||||
/*!
|
||||
* Returns the text encoding that will be used in rendering this frame.
|
||||
|
||||
@@ -122,6 +122,11 @@ void Frame::setText(const String &)
|
||||
{
|
||||
}
|
||||
|
||||
StringList Frame::toStringList() const
|
||||
{
|
||||
return toString();
|
||||
}
|
||||
|
||||
ByteVector Frame::render() const
|
||||
{
|
||||
ByteVector fieldData = renderFields();
|
||||
|
||||
@@ -108,6 +108,14 @@ namespace TagLib {
|
||||
*/
|
||||
virtual String toString() const = 0;
|
||||
|
||||
/*!
|
||||
* This returns the textual representation of the data in the frame.
|
||||
* Subclasses can reimplement this method to provide a string list
|
||||
* representation of the frame's data. The default implementation
|
||||
* returns the single string representation from toString().
|
||||
*/
|
||||
virtual StringList toStringList() const;
|
||||
|
||||
/*!
|
||||
* Render the frame back to its binary format in a ByteVector.
|
||||
*/
|
||||
|
||||
@@ -121,21 +121,21 @@ ID3v2::Tag::~Tag() = default;
|
||||
String ID3v2::Tag::title() const
|
||||
{
|
||||
if(!d->frameListMap["TIT2"].isEmpty())
|
||||
return d->frameListMap["TIT2"].front()->toString();
|
||||
return joinTagValues(d->frameListMap["TIT2"].front()->toStringList());
|
||||
return String();
|
||||
}
|
||||
|
||||
String ID3v2::Tag::artist() const
|
||||
{
|
||||
if(!d->frameListMap["TPE1"].isEmpty())
|
||||
return d->frameListMap["TPE1"].front()->toString();
|
||||
return joinTagValues(d->frameListMap["TPE1"].front()->toStringList());
|
||||
return String();
|
||||
}
|
||||
|
||||
String ID3v2::Tag::album() const
|
||||
{
|
||||
if(!d->frameListMap["TALB"].isEmpty())
|
||||
return d->frameListMap["TALB"].front()->toString();
|
||||
return joinTagValues(d->frameListMap["TALB"].front()->toStringList());
|
||||
return String();
|
||||
}
|
||||
|
||||
@@ -157,10 +157,6 @@ String ID3v2::Tag::comment() const
|
||||
|
||||
String ID3v2::Tag::genre() const
|
||||
{
|
||||
// TODO: In the next major version (TagLib 2.0) a list of multiple genres
|
||||
// should be separated by " / " instead of " ". For the moment to keep
|
||||
// the behavior the same as released versions it is being left with " ".
|
||||
|
||||
const FrameList &tconFrames = d->frameListMap["TCON"];
|
||||
if(tconFrames.isEmpty())
|
||||
{
|
||||
@@ -196,7 +192,7 @@ String ID3v2::Tag::genre() const
|
||||
genres.append(field);
|
||||
}
|
||||
|
||||
return genres.toString();
|
||||
return joinTagValues(genres);
|
||||
}
|
||||
|
||||
unsigned int ID3v2::Tag::year() const
|
||||
|
||||
Reference in New Issue
Block a user