mirror of
https://github.com/taglib/taglib.git
synced 2025-06-03 17:18:11 -04:00
Add support for Unknown TXXX frames.
This commit is contained in:
parent
37c87e0317
commit
f859fcf82a
@ -431,9 +431,16 @@ PropertyMap Frame::asProperties() const
|
||||
{
|
||||
const ByteVector &id = frameID();
|
||||
// workaround until this function is virtual
|
||||
if(id == "TXXX")
|
||||
return dynamic_cast< const UserTextIdentificationFrame* >(this)->asProperties();
|
||||
else if(id[0] == 'T')
|
||||
if(id == "TXXX") {
|
||||
const UserTextIdentificationFrame *txxxFrame = dynamic_cast< const UserTextIdentificationFrame* >(this);
|
||||
if(txxxFrame != NULL)
|
||||
return txxxFrame->asProperties();
|
||||
else {
|
||||
PropertyMap m;
|
||||
m.unsupportedData().append("UNKNOWN");
|
||||
return m;
|
||||
}
|
||||
} else if(id[0] == 'T')
|
||||
return dynamic_cast< const TextIdentificationFrame* >(this)->asProperties();
|
||||
else if(id == "WXXX")
|
||||
return dynamic_cast< const UserUrlLinkFrame* >(this)->asProperties();
|
||||
@ -443,11 +450,9 @@ PropertyMap Frame::asProperties() const
|
||||
return dynamic_cast< const CommentsFrame* >(this)->asProperties();
|
||||
else if(id == "USLT")
|
||||
return dynamic_cast< const UnsynchronizedLyricsFrame* >(this)->asProperties();
|
||||
else {
|
||||
PropertyMap m;
|
||||
m.unsupportedData().append(id);
|
||||
return m;
|
||||
}
|
||||
PropertyMap m;
|
||||
m.unsupportedData().append(id);
|
||||
return m;
|
||||
}
|
||||
|
||||
void Frame::splitProperties(const PropertyMap &original, PropertyMap &singleFrameProperties,
|
||||
|
@ -350,24 +350,32 @@ void ID3v2::Tag::removeUnsupportedProperties(const StringList &properties)
|
||||
// by the PropertyMap interface. Three special cases exist: TXXX, WXXX, and COMM
|
||||
// frames may also be unsupported if their description() is not a valid key.
|
||||
for(StringList::ConstIterator it = properties.begin(); it != properties.end(); ++it){
|
||||
ByteVector id = it->substr(0,4).data(String::Latin1);
|
||||
if(id == "TXXX") {
|
||||
String description = it->substr(5);
|
||||
Frame *frame = UserTextIdentificationFrame::find(this, description);
|
||||
if(frame)
|
||||
removeFrame(frame);
|
||||
} else if(id == "WXXX") {
|
||||
String description = it->substr(5);
|
||||
Frame *frame = UserUrlLinkFrame::find(this, description);
|
||||
if(frame)
|
||||
removeFrame(frame);
|
||||
} else if(id == "COMM") {
|
||||
String description = it->substr(5);
|
||||
Frame *frame = CommentsFrame::findByDescription(this, description);
|
||||
if(frame)
|
||||
removeFrame(frame);
|
||||
} else
|
||||
removeFrames(id); // there should be only one frame with "id"
|
||||
if(*it == "UNKNOWN") {
|
||||
// delete all unknown frames
|
||||
FrameList l = frameList();
|
||||
for(FrameList::ConstIterator fit = l.begin(); fit != l.end(); fit++)
|
||||
if (dynamic_cast<const UnknownFrame *>(*fit) != NULL)
|
||||
removeFrame(*fit);
|
||||
} else {
|
||||
ByteVector id = it->substr(0,4).data(String::Latin1);
|
||||
if(id == "TXXX") {
|
||||
String description = it->substr(5);
|
||||
Frame *frame = UserTextIdentificationFrame::find(this, description);
|
||||
if(frame)
|
||||
removeFrame(frame);
|
||||
} else if(id == "WXXX") {
|
||||
String description = it->substr(5);
|
||||
Frame *frame = UserUrlLinkFrame::find(this, description);
|
||||
if(frame)
|
||||
removeFrame(frame);
|
||||
} else if(id == "COMM") {
|
||||
String description = it->substr(5);
|
||||
Frame *frame = CommentsFrame::findByDescription(this, description);
|
||||
if(frame)
|
||||
removeFrame(frame);
|
||||
} else
|
||||
removeFrames(id); // there should be only one frame with "id"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user