Skip to content

Commit be3f593

Browse files
committed
Workaround for mono/taglib-sharp#263 - #22
1 parent ad1c321 commit be3f593

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

AutoTag.Core/Movie/MovieFileMetadata.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public override void WriteToFile(TagLib.File file, AutoTagConfig config, Action<
1313
file.Tag.Year = (uint) Date.Value.Year;
1414
}
1515

16-
if (config.AppleTagging && file.MimeType.EndsWith("/mp4"))
16+
if (config.AppleTagging && (file.TagTypes & TagLib.TagTypes.Apple) == TagLib.TagTypes.Apple)
1717
{
1818
var appleTags = (TagLib.Mpeg4.AppleTag) file.GetTag(TagLib.TagTypes.Apple);
1919

AutoTag.Core/TV/TVFileMetadata.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,30 @@ public override void WriteToFile(TagLib.File file, AutoTagConfig config, Action<
1111
{
1212
base.WriteToFile(file, config, setStatus);
1313

14-
if (config.ExtendedTagging && file.MimeType == "video/x-matroska")
14+
if ((file.TagTypes & TagLib.TagTypes.Matroska) == TagLib.TagTypes.Matroska)
1515
{
16-
var custom = (TagLib.Matroska.Tag) file.GetTag(TagLib.TagTypes.Matroska);
17-
custom.Set("TMDB", "", $"tv/{Id}");
16+
var custom = (TagLib.Matroska.Tag)file.GetTag(TagLib.TagTypes.Matroska);
17+
// workaround for https://github.com/mono/taglib-sharp/issues/263 - Tag.Album property writes to TITLE tag instead of ALBUM
18+
// how has this still not been fixed??
19+
custom.Set("ALBUM", null, SeriesName);
20+
21+
if (config.ExtendedTagging)
22+
{
23+
custom.Set("TMDB", null, $"tv/{Id}");
24+
}
25+
}
26+
else
27+
{
28+
file.Tag.Album = SeriesName;
1829
}
1930

20-
file.Tag.Album = SeriesName;
2131
file.Tag.Disc = (uint) Season;
2232
file.Tag.Track = (uint) Episode;
2333
file.Tag.TrackCount = (uint) SeasonEpisodes;
2434

2535
// set extra tags because Apple is stupid and uses different tags for some reason
2636
// for a list of tags see https://kdenlive.org/en/project/adding-meta-data-to-mp4-video/
27-
if (config.AppleTagging && file.MimeType.EndsWith("/mp4"))
37+
if (config.AppleTagging && (file.TagTypes & TagLib.TagTypes.Apple) == TagLib.TagTypes.Apple)
2838
{
2939
var appleTags = (TagLib.Mpeg4.AppleTag) file.GetTag(TagLib.TagTypes.Apple);
3040

0 commit comments

Comments
 (0)