1 Commits
Author SHA1 Message Date
1xDed 4bb222af8b Release 1.0.0.11: repair broken virtual folders 2026-12-01 02:48:50 +03:00
6 changed files with 64 additions and 11 deletions

No files matched your search

@@ -1,5 +1,7 @@
using System.Collections.Concurrent;
using Jellyfin.Plugin.YandexMusic.Yandex;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Library;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -16,13 +18,20 @@ public class YandexMusicController : ControllerBase
private static readonly ConcurrentDictionary<string, DateTimeOffset> Sessions = new();
private readonly YandexMusicClient _client;
private readonly IServerApplicationPaths _paths;
private readonly ILibraryManager _libraryManager;
/// <summary>
/// Initializes a new instance of the <see cref="YandexMusicController"/> class.
/// </summary>
public YandexMusicController(YandexMusicClient client)
public YandexMusicController(
YandexMusicClient client,
IServerApplicationPaths paths,
ILibraryManager libraryManager)
{
_client = client;
_paths = paths;
_libraryManager = libraryManager;
}
/// <summary>Starts the device flow.</summary>
@@ -88,6 +97,47 @@ public class YandexMusicController : ControllerBase
connected ? null : "api.music.yandex.net недоступен");
}
/// <summary>
/// Removes broken virtual-folder entries (e.g. a library left without an item id or paths),
/// which Jellyfin cannot delete through its own API.
/// </summary>
[HttpPost("RepairLibraries")]
public ActionResult<RepairLibrariesResult> RepairLibraries()
{
var live = _libraryManager.GetVirtualFolders();
var deleted = new List<string>();
if (Directory.Exists(_paths.DefaultUserViewsPath))
{
foreach (var directory in Directory.EnumerateDirectories(_paths.DefaultUserViewsPath))
{
var name = Path.GetFileName(directory);
var info = live.FirstOrDefault(v => string.Equals(v.Name, name, StringComparison.OrdinalIgnoreCase));
var broken = info is null
|| string.IsNullOrEmpty(info.ItemId)
|| info.Locations.Length == 0;
if (broken)
{
try
{
Directory.Delete(directory, true);
deleted.Add(name);
}
catch (Exception ex)
{
return StatusCode(500, new { error = ex.Message, name });
}
}
}
}
return new RepairLibrariesResult(
deleted,
live.Where(v => !deleted.Contains(v.Name, StringComparer.OrdinalIgnoreCase))
.Select(v => v.Name)
.ToList());
}
/// <summary>Clears the saved token.</summary>
[HttpPost("Logout")]
public ActionResult Logout()
@@ -115,3 +165,6 @@ public record DevicePollResult(string Status, string? Token, string? Error);
/// <summary>Plugin status.</summary>
public record StatusResult(bool Connected, bool HasToken, string? Error);
/// <summary>Result of the broken-library cleanup.</summary>
public record RepairLibrariesResult(List<string> Deleted, List<string> Remaining);
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.0.0.10</Version>
<AssemblyVersion>1.0.0.10</AssemblyVersion>
<FileVersion>1.0.0.10</FileVersion>
<Version>1.0.0.11</Version>
<AssemblyVersion>1.0.0.11</AssemblyVersion>
<FileVersion>1.0.0.11</FileVersion>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>Jellyfin.Plugin.YandexMusic</RootNamespace>
<AssemblyName>Jellyfin.Plugin.YandexMusic</AssemblyName>
+1 -1
View File
@@ -1,7 +1,7 @@
---
name: "Yandex Music"
guid: "f3b9626b-da14-4cbf-8ad1-33b92cfa6656"
version: "1.0.0.10"
version: "1.0.0.11"
targetAbi: "12.4.0.0"
framework: "net10.0"
overview: "Metadata for music from Yandex Music."
+5 -5
View File
@@ -9,12 +9,12 @@
"imageUrl": "",
"versions": [
{
"version": "1.0.0.10",
"changelog": "Tag-based matching, artist/genre normalization, provider id repair, artist/genre pre-creation.",
"version": "1.0.0.11",
"changelog": "Add admin endpoint to remove broken virtual folder entries.",
"targetAbi": "12.4.0.0",
"sourceUrl": "https://git.midns.ru/1xDed/jellyfin-plugin-yandexmusic/raw/branch/main/dist/Jellyfin.Plugin.YandexMusic_1.0.0.10.zip",
"checksum": "596e7fedd63ddc805a763900fd40592c",
"timestamp": "2026-11-30T23:28:17Z"
"sourceUrl": "https://git.midns.ru/1xDed/jellyfin-plugin-yandexmusic/raw/branch/main/dist/Jellyfin.Plugin.YandexMusic_1.0.0.11.zip",
"checksum": "c9ce5fe95bff06823e17b544d65bfe8f",
"timestamp": "2026-11-30T23:48:50Z"
}
]
}
+1 -1
View File
@@ -3,7 +3,7 @@ set -euo pipefail
cd "$(dirname "$0")/.."
VERSION="1.0.0.10"
VERSION="1.0.0.11"
NAME="Jellyfin.Plugin.YandexMusic"
PUBLISH_DIR="publish"
ARTIFACTS_DIR="${ARTIFACTS_DIR:-artifacts}"