Skip to content

Commit

Permalink
Merge pull request #99 from insomniachi/dotnet9
Browse files Browse the repository at this point in the history
Dotnet9
  • Loading branch information
insomniachi authored Dec 2, 2024
2 parents 22c0cec + 6450f26 commit 2982be4
Show file tree
Hide file tree
Showing 124 changed files with 2,133 additions and 20,796 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 3 additions & 0 deletions CreateInstaller.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ param(
[string]$Version = '2.0'
)

# build project
dotnet publish Totoro.WinUI\Totoro.WinUI.csproj --self-contained -c Release -r win-x64 -o Totoro.WinUI\bin\publish\ /property:BuildVersion=$Version

# copy ffmpeg binaries, needed for flyleaf media player
xcopy Totoro.Installer\FFmpeg Totoro.WinUI\bin\publish\FFmpeg /s /e /h

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -11,8 +11,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
Expand All @@ -10,8 +10,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -11,8 +11,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
Expand All @@ -10,8 +10,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
Expand All @@ -10,8 +10,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -11,8 +11,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
Expand Down
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();
}
}
73 changes: 73 additions & 0 deletions Plugins/Anime/Totoro.Plugins.Anime.Jellyfin/Catalog.cs
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")
};
}

}
}
}
24 changes: 24 additions & 0 deletions Plugins/Anime/Totoro.Plugins.Anime.Jellyfin/Config.cs
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; } = @"";

}
60 changes: 60 additions & 0 deletions Plugins/Anime/Totoro.Plugins.Anime.Jellyfin/Models.cs
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; }
}

25 changes: 25 additions & 0 deletions Plugins/Anime/Totoro.Plugins.Anime.Jellyfin/Plugin.cs
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"
};
}
Loading

0 comments on commit 2982be4

Please sign in to comment.