-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from insomniachi/dotnet9
Dotnet9
- Loading branch information
Showing
124 changed files
with
2,133 additions
and
20,796 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ jobs: | |
- name: 'Install dotnet' | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: '8.0' | ||
dotnet-version: '9.0' | ||
|
||
- name: 'Add msbuild to PATH' | ||
uses: microsoft/[email protected] | ||
|
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
Binary file not shown.
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
2 changes: 1 addition & 1 deletion
2
Plugins/Anime/Totoro.Plugins.Anime.AllAnime/Totoro.Plugins.Anime.AllAnime.csproj
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
2 changes: 1 addition & 1 deletion
2
Plugins/Anime/Totoro.Plugins.Anime.Anime4Up/Totoro.Plugins.Anime.Anime4Up.csproj
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
2 changes: 1 addition & 1 deletion
2
Plugins/Anime/Totoro.Plugins.Anime.AnimePahe/Totoro.Plugins.Anime.AnimePahe.csproj
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
2 changes: 1 addition & 1 deletion
2
Plugins/Anime/Totoro.Plugins.Anime.AnimeSaturn/Totoro.Plugins.Anime.AnimeSaturn.csproj
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
2 changes: 1 addition & 1 deletion
2
Plugins/Anime/Totoro.Plugins.Anime.Aniwave/Totoro.Plugins.Anime.Aniwave.csproj
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
2 changes: 1 addition & 1 deletion
2
Plugins/Anime/Totoro.Plugins.Anime.GogoAnime/Totoro.Plugins.Anime.GogoAnime.csproj
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
16 changes: 16 additions & 0 deletions
16
Plugins/Anime/Totoro.Plugins.Anime.Jellyfin/AiredEpisodesProvider.cs
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,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Totoro.Plugins.Anime.Contracts; | ||
|
||
namespace Totoro.Plugins.Anime.Jellyfin; | ||
|
||
internal class AiredEpisodesProvider : IAiredAnimeEpisodeProvider | ||
{ | ||
public IAsyncEnumerable<IAiredAnimeEpisode> GetRecentlyAiredEpisodes(int page = 1) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
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,73 @@ | ||
using Flurl; | ||
using Flurl.Http; | ||
using System; | ||
using Totoro.Plugins.Anime.Contracts; | ||
using Totoro.Plugins.Contracts.Optional; | ||
using Totoro.Plugins.Options; | ||
|
||
namespace Totoro.Plugins.Anime.Jellyfin; | ||
|
||
internal class Catalog : IAnimeCatalog | ||
{ | ||
class CatalogItem : ICatalogItem, IHaveImage | ||
{ | ||
required public string Title { get; set; } | ||
required public string Url { get; set; } | ||
required public string Image { get; set; } | ||
} | ||
|
||
public async IAsyncEnumerable<ICatalogItem> Search(string query) | ||
{ | ||
var response = await ConfigManager<Config>.Current.BaseUrl | ||
.AppendPathSegment("/Items") | ||
.SetQueryParams(new | ||
{ | ||
userId = ConfigManager<Config>.Current.UserId, | ||
parentId = ConfigManager<Config>.Current.LibraryId, | ||
searchTerm = query, | ||
recursive = true, | ||
includeItemTypes = @"Series" | ||
}) | ||
.WithHeader("X-Emby-Token", ConfigManager<Config>.Current.ApiKey) | ||
.GetJsonAsync<Root>(); | ||
|
||
foreach (var item in response.Items) | ||
{ | ||
var seasons = await ConfigManager<Config>.Current.BaseUrl | ||
.AppendPathSegment($"/Shows/{item.Id}/Seasons") | ||
.SetQueryParams(new { | ||
userId = ConfigManager<Config>.Current.UserId, | ||
}) | ||
.WithHeader("X-Emby-Token", ConfigManager<Config>.Current.ApiKey) | ||
.GetJsonAsync<Root>(); | ||
|
||
var url = ConfigManager<Config>.Current.BaseUrl | ||
.AppendPathSegment($"/Shows/{item.Id}/Episodes") | ||
.SetQueryParams(new | ||
{ | ||
userId = ConfigManager<Config>.Current.UserId, | ||
}); | ||
|
||
if (seasons.Items is not { Count : > 0 }) | ||
{ | ||
yield return new CatalogItem | ||
{ | ||
Title = item.Name, | ||
Url = url, | ||
Image = ConfigManager<Config>.Current.BaseUrl.AppendPathSegment($"/Items/{item.Id}/Images/Primary") | ||
}; | ||
} | ||
|
||
foreach (var season in seasons.Items) | ||
{ | ||
yield return new CatalogItem | ||
{ | ||
Title = $"{item.Name} {(season.IndexNumber > 1 ? season.Name : "")}".Trim(), | ||
Url = url, | ||
Image = ConfigManager<Config>.Current.BaseUrl.AppendPathSegment($"/Items/{(season.ImageTags.Primary is null ? item.Id : season.Id)}/Images/Primary") | ||
}; | ||
} | ||
|
||
} | ||
} | ||
} |
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,24 @@ | ||
using System.ComponentModel; | ||
using Totoro.Plugins.Options; | ||
|
||
namespace Totoro.Plugins.Anime.Jellyfin; | ||
|
||
public class Config : AnimeProviderConfigObject | ||
{ | ||
[Description("Url to jellyfin instance")] | ||
[Glyph(Glyphs.Url)] | ||
public string BaseUrl { get; set; } = @""; | ||
|
||
[Description("Id of user with access to anime library")] | ||
[Glyph(Glyphs.People)] | ||
public string UserId { get; set; } = @""; | ||
|
||
[Description("Id of Anime library")] | ||
[Glyph(Glyphs.Library)] | ||
public string LibraryId { get; set; } = @""; | ||
|
||
[Description("Jellyfin api key")] | ||
[Glyph(Glyphs.Unlock)] | ||
public string ApiKey { get; set; } = @""; | ||
|
||
} |
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,60 @@ | ||
namespace Totoro.Plugins.Anime.Jellyfin; | ||
|
||
public class Item | ||
{ | ||
public string Name { get; set; } | ||
public string ServerId { get; set; } | ||
public string Id { get; set; } | ||
public DateTime PremiereDate { get; set; } | ||
public string OfficialRating { get; set; } | ||
public string ChannelId { get; set; } | ||
public double CommunityRating { get; set; } | ||
public long RunTimeTicks { get; set; } | ||
public int ProductionYear { get; set; } | ||
public bool IsFolder { get; set; } | ||
public string Type { get; set; } | ||
public UserData UserData { get; set; } | ||
public string Status { get; set; } | ||
public List<string> AirDays { get; set; } = new(); | ||
public ImageTags ImageTags { get; set; } | ||
public List<string> BackdropImageTags { get; set; } = new(); | ||
public ImageBlurHashes ImageBlurHashes { get; set; } | ||
public string LocationType { get; set; } | ||
public string MediaType { get; set; } | ||
public DateTime EndDate { get; set; } | ||
public int IndexNumber { get; set; } | ||
} | ||
|
||
public class UserData | ||
{ | ||
public int UnplayedItemCount { get; set; } | ||
public long PlaybackPositionTicks { get; set; } | ||
public int PlayCount { get; set; } | ||
public bool IsFavorite { get; set; } | ||
public bool Played { get; set; } | ||
public string Key { get; set; } | ||
public string ItemId { get; set; } | ||
} | ||
|
||
public class ImageTags | ||
{ | ||
public string Primary { get; set; } | ||
public string Logo { get; set; } | ||
public string Thumb { get; set; } | ||
} | ||
|
||
public class ImageBlurHashes | ||
{ | ||
public Dictionary<string, string> Backdrop { get; set; } = new(); | ||
public Dictionary<string, string> Primary { get; set; } = new(); | ||
public Dictionary<string, string> Logo { get; set; } = new(); | ||
public Dictionary<string, string> Thumb { get; set; } = new(); | ||
} | ||
|
||
public class Root | ||
{ | ||
public List<Item> Items { get; set; } = new(); | ||
public int TotalRecordCount { get; set; } | ||
public int StartIndex { get; set; } | ||
} | ||
|
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,25 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Reflection; | ||
using Totoro.Plugins.Anime.Contracts; | ||
using Totoro.Plugins.Contracts; | ||
|
||
namespace Totoro.Plugins.Anime.Jellyfin; | ||
|
||
[ExcludeFromCodeCoverage] | ||
public class Plugin : Plugin<AnimeProvider, Config> | ||
{ | ||
public override AnimeProvider Create() => new() | ||
{ | ||
Catalog = new Catalog(), | ||
StreamProvider = new StreamProvider(), | ||
}; | ||
|
||
public override PluginInfo GetInfo() => new() | ||
{ | ||
DisplayName = "Jellyfin", | ||
Name = "jellyfin", | ||
Version = Assembly.GetExecutingAssembly().GetName().Version!, | ||
Icon = typeof(Plugin).Assembly.GetManifestResourceStream("Totoro.Plugins.Anime.Jellyfin.jellyfin-icon.png"), | ||
Description = "Access media from your self hosted instance" | ||
}; | ||
} |
Oops, something went wrong.