1
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 1m0s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s

This commit is contained in:
孙诚
2025-11-12 14:28:26 +08:00
parent 626a8a2950
commit e7168a2fe6
4 changed files with 39 additions and 6 deletions

View File

@@ -15,6 +15,7 @@
- /etc/localtime:/etc/localtime:ro
- /wd/media/tv:/data/media/tv:rw
- /wd/media/anime:/data/media/anime:rw
- /wd/media/music:/data/media/music:rw
- /wd/media/others/anime:/data/media/anime-other:rw
- /wd/apps/vols/nas_robot:/app/data:rw
- /wd:/host/wd:ro

View File

@@ -88,4 +88,39 @@ public class JobTriggerController : BaseController
return "OK";
}
[HttpGet]
public string MusicTagAsync()
{
var musicPath = "/data/media/music";
List<string> musicType = ["mp3", "flac", "m4a", "wav", "ape", "ogg", "wma", "alac", "aac", "dsd"];
// 递归获取所有音乐文件
var files = Directory.GetFiles(musicPath, "*.*", SearchOption.AllDirectories)
.Where(f => musicType.Contains(Path.GetExtension(f).TrimStart('.').ToLower()))
.ToList();
foreach (var file in files)
{
_logger.LogInformation("Processing music file: {file}", file);
try
{
var fileTag = TagLib.File.Create(file);
var artist = fileTag.Tag.FirstPerformer ?? "未知艺术家";
var album = fileTag.Tag.Album ?? "未知专辑";
var title = fileTag.Tag.Title ?? Path.GetFileNameWithoutExtension(file);
var year = fileTag.Tag.Year > 0 ? fileTag.Tag.Year.ToString() : "未知年份";
var genre = fileTag.Tag.FirstGenre ?? "未知风格";
_logger.LogInformation("Tag info - Artist: {artist}, Album: {album}, Title: {title}, Year: {year}, Genre: {genre}", artist, album, title, year, genre);
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
}
return "OK";
}
}

View File

@@ -7,10 +7,6 @@ namespace WebApi.Controllers;
public class NotifyController : BaseController
{
public NotifyController()
{
}
[HttpPost]
public async Task<string> Radarr()
{

View File

@@ -9,8 +9,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0"/>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0"/>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="taglib-sharp-netstandard2.0" Version="2.1.0" />
</ItemGroup>
<ItemGroup>