Skip to content

Commit b3d1151

Browse files
1.0.3 Bug Fixes
- Fixed issue with importing mp3 metadata without urls not working
1 parent ffe68f2 commit b3d1151

File tree

2 files changed

+47
-9
lines changed

2 files changed

+47
-9
lines changed

MSUScripter/MSUScripter.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
99
<ApplicationIcon>MSUScripterIcon.ico</ApplicationIcon>
1010
<PackageIcon>MSUScripterIcon.ico</PackageIcon>
11-
<Version>1.0.2</Version>
11+
<Version>1.0.3</Version>
1212
</PropertyGroup>
1313

1414

MSUScripter/Services/AudioMetadataService.cs

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,55 @@ public AudioMetadata GetMp3AudioMetadata(string file)
4848

4949
if (tag != null)
5050
{
51-
return new AudioMetadata()
51+
var toReturn = new AudioMetadata()
52+
{
53+
SongName = "",
54+
Artist = "",
55+
Album = "",
56+
Url = ""
57+
};
58+
59+
try
5260
{
53-
SongName = !string.IsNullOrEmpty(tag.Title.Value)
61+
toReturn.SongName = !string.IsNullOrEmpty(tag.Title.Value)
5462
? tag.Title.Value.Replace("\0", "")
55-
: fileInfo.Name.Replace(fileInfo.Extension, "").Replace("\0", ""),
56-
Artist = string.Join(", ", tag.Artists.Value).Replace("\0", ""),
57-
Album = tag.Album.Value.Replace("\0", ""),
58-
Url = tag.ArtistUrls.Any()
63+
: fileInfo.Name.Replace(fileInfo.Extension, "").Replace("\0", "");
64+
}
65+
catch (Exception e)
66+
{
67+
// ignored
68+
}
69+
70+
try
71+
{
72+
toReturn.Artist = string.Join(", ", tag.Artists.Value).Replace("\0", "");
73+
}
74+
catch (Exception e)
75+
{
76+
// ignored
77+
}
78+
79+
try
80+
{
81+
toReturn.Album = tag.Album.Value?.Replace("\0", "") ?? "";
82+
}
83+
catch (Exception e)
84+
{
85+
// ignored
86+
}
87+
88+
try
89+
{
90+
toReturn.Url = tag.ArtistUrls.Any()
5991
? string.Join(", ", tag.ArtistUrls.Select(x => x.Url).ToList()).Replace("\0", "")
60-
: tag.CopyrightUrl.Url.Replace("\0", "")
61-
};
92+
: tag.CopyrightUrl.Url?.Replace("\0", "") ?? "";
93+
}
94+
catch (Exception e)
95+
{
96+
// ignored
97+
}
98+
99+
return toReturn;
62100
}
63101

64102
return new AudioMetadata()

0 commit comments

Comments
 (0)