mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
Don't crash when trying to write AR tags to WMA file
This commit is contained in:
@@ -38,9 +38,20 @@ namespace CUETools.Processor
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (fileInfo is TagLib.Asf.File)
|
||||||
|
{
|
||||||
|
var asf = (TagLib.Asf.Tag)fileInfo.GetTag(TagLib.TagTypes.Asf, true);
|
||||||
|
foreach (string tag in tags.AllKeys)
|
||||||
|
if (!IsKnownXiphTag(tag))
|
||||||
|
asf.SetDescriptorString(tag, tags.GetValues(tag));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
TagLib.Ape.Tag ape = (TagLib.Ape.Tag)fileInfo.GetTag(TagLib.TagTypes.Ape, true);
|
TagLib.Ape.Tag ape = (TagLib.Ape.Tag)fileInfo.GetTag(TagLib.TagTypes.Ape, true);
|
||||||
|
if (ape != null)
|
||||||
|
{
|
||||||
foreach (string tag in tags.AllKeys)
|
foreach (string tag in tags.AllKeys)
|
||||||
ape.SetValue(XiphTagNameToApe(tag), tags.GetValues(tag));
|
ape.SetValue(XiphTagNameToApe(tag), tags.GetValues(tag));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,6 +123,13 @@ namespace CUETools.Processor
|
|||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsKnownXiphTag(string tag)
|
||||||
|
{
|
||||||
|
return tag.ToUpper() == "DATE" ||
|
||||||
|
tag.ToUpper() == "TRACKNUMBER" ||
|
||||||
|
tag.ToUpper() == "DISCNUMBER";
|
||||||
|
}
|
||||||
|
|
||||||
public static string XiphTagNameToApe(string tag)
|
public static string XiphTagNameToApe(string tag)
|
||||||
{
|
{
|
||||||
if (tag.ToUpper() == "DATE")
|
if (tag.ToUpper() == "DATE")
|
||||||
|
|||||||
Reference in New Issue
Block a user