Merge branch 'master' into diag-tags

This commit is contained in:
Tyrrrz 2024-09-27 20:02:27 +03:00
commit e6a9c210ac
4 changed files with 12 additions and 7 deletions

View File

@ -21,15 +21,16 @@ internal partial class MediaFile(TagFile file) : IDisposable
public void SetComment(string comment) => file.Tag.Comment = comment;
public void Dispose()
public void Save()
{
file.Tag.DateTagged = DateTime.Now;
file.Save();
file.Dispose();
}
public void Dispose() => file.Dispose();
}
internal partial class MediaFile
{
public static MediaFile Create(string filePath) => new(TagFile.Create(filePath));
public static MediaFile Open(string filePath) => new(TagFile.Create(filePath));
}

View File

@ -86,10 +86,12 @@ public class MediaTagInjector
CancellationToken cancellationToken = default
)
{
using var mediaFile = MediaFile.Create(filePath);
using var mediaFile = MediaFile.Open(filePath);
InjectMiscMetadata(mediaFile, video);
await InjectMusicMetadataAsync(mediaFile, video, cancellationToken);
await InjectThumbnailAsync(mediaFile, video, cancellationToken);
mediaFile.Save();
}
}

View File

@ -5,8 +5,8 @@
<PackageReference Include="Gress" Version="2.1.1" />
<PackageReference Include="JsonExtensions" Version="1.2.0" />
<PackageReference Include="TagLibSharp" Version="2.3.0" />
<PackageReference Include="YoutubeExplode" Version="6.4.1" />
<PackageReference Include="YoutubeExplode.Converter" Version="6.4.1" />
<PackageReference Include="YoutubeExplode" Version="6.4.2" />
<PackageReference Include="YoutubeExplode.Converter" Version="6.4.2" />
</ItemGroup>
</Project>

View File

@ -4,7 +4,9 @@
<OutputType>WinExe</OutputType>
<ApplicationIcon>..\favicon.ico</ApplicationIcon>
<ApplicationManifest>app.manifest</ApplicationManifest>
<PublishTrimmed>true</PublishTrimmed>
<!-- Trimmed builds break support for Windows 10 for some reason -->
<!-- https://github.com/Tyrrrz/YoutubeDownloader/issues/496 -->
<PublishTrimmed>false</PublishTrimmed>
<CopyOutputSymbolsToPublishDirectory>false</CopyOutputSymbolsToPublishDirectory>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>