forked from kookxiang/jellyfin-plugin-bangumi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'kookxiang:master' into feat-collection
- Loading branch information
Showing
41 changed files
with
1,263 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace Jellyfin.Plugin.Bangumi.Archive; | ||
|
||
[ApiController] | ||
[Route("Plugins/Bangumi/Archive")] | ||
public class OAuthController(ArchiveData archive) | ||
: ControllerBase | ||
{ | ||
[HttpGet("Status")] | ||
[Authorize] | ||
public Dictionary<string, object?> Status() | ||
{ | ||
var totalSize = 0L; | ||
DateTime? lastModifyTime = null; | ||
|
||
var directory = new DirectoryInfo(archive.BasePath); | ||
foreach (var info in directory.GetFileSystemInfos("*", SearchOption.AllDirectories)) | ||
{ | ||
if (lastModifyTime == null) | ||
lastModifyTime = info.LastWriteTime; | ||
else if (info.LastWriteTime.CompareTo(lastModifyTime) > 0) | ||
lastModifyTime = info.LastWriteTime; | ||
if (info is FileInfo fileInfo) | ||
totalSize += fileInfo.Length; | ||
} | ||
|
||
return new Dictionary<string, object?> | ||
{ | ||
["path"] = archive.BasePath, | ||
["size"] = totalSize, | ||
["time"] = lastModifyTime | ||
}; | ||
} | ||
|
||
[HttpDelete("Store")] | ||
[Authorize] | ||
public bool Delete() | ||
{ | ||
Directory.Delete(archive.BasePath, true); | ||
Directory.CreateDirectory(archive.BasePath); | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using Jellyfin.Plugin.Bangumi.Archive.Data; | ||
using Jellyfin.Plugin.Bangumi.Archive.Relation; | ||
using MediaBrowser.Common.Configuration; | ||
|
||
namespace Jellyfin.Plugin.Bangumi.Archive; | ||
|
||
public class ArchiveData(IApplicationPaths paths) | ||
{ | ||
public readonly string BasePath = Path.Join(paths.DataPath, "bangumi", "archive"); | ||
|
||
public readonly string TempPath = Path.Join(paths.DataPath, "bangumi", "archive", "temp"); | ||
|
||
public List<IArchiveStore> Stores => | ||
[ | ||
Character, | ||
Subject, | ||
Episode, | ||
Person | ||
]; | ||
|
||
public ArchiveStore<Character> Character => new(BasePath, "character.jsonlines"); | ||
|
||
public ArchiveStore<Subject> Subject => new(BasePath, "subject.jsonlines"); | ||
|
||
public ArchiveStore<Episode> Episode => new(BasePath, "episode.jsonlines"); | ||
|
||
public ArchiveStore<Person> Person => new(BasePath, "person.jsonlines"); | ||
|
||
public SubjectEpisodeRelation SubjectEpisode => new(this); | ||
} |
Oops, something went wrong.