Added trailers filtering: jellyfin-web can only play youtube trailers, not kinopoisk-hosted

This commit is contained in:
PingWin committed 2021-05-22 23:01:20 +00:00
1 parent d10b6d71f7
commit b8b92cf60b
5 files changed
+18 -5

No files matched your search

Binary file not shown.
+8
View File
@@ -8,6 +8,14 @@
"description": "\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u0438 \u0441\u0430\u0439\u0442\u0430 \u041a\u0438\u043d\u043e\u041f\u043e\u0438\u0441\u043a\n", "description": "\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u0438 \u0441\u0430\u0439\u0442\u0430 \u041a\u0438\u043d\u043e\u041f\u043e\u0438\u0441\u043a\n",
"imageUrl": "https://kinopoisk.userecho.com/s/attachments/28876/0/1/25f8c0315e6ccb2aa6c2642e48f2c9e9.png", "imageUrl": "https://kinopoisk.userecho.com/s/attachments/28876/0/1/25f8c0315e6ccb2aa6c2642e48f2c9e9.png",
"versions": [ "versions": [
{
"version": "10.7.0.5",
"changelog": "Added trailers filtering: jellyfin-web can only play youtube trailers, not kinopoisk-hosted\n",
"targetAbi": "10.7.0",
"sourceUrl": "https://raw.githubusercontent.com/LinFor/jellyfin-plugin-kinopoisk/master/dist/kinopoisk/kinopoisk_10.7.0.5.zip",
"checksum": "6bdb97ee1e862b0b5657f7b510040148",
"timestamp": "2021-05-22T23:01:09Z"
},
{ {
"version": "10.7.0.4", "version": "10.7.0.4",
"changelog": "Added person info, person image, trailers fetching\n", "changelog": "Added person info, person image, trailers fetching\n",
@@ -197,13 +197,14 @@ namespace Jellyfin.Plugin.Kinopoisk
} }
public static MediaUrl ToMediaUrl(this VideoResponse_trailers src) { public static MediaUrl ToMediaUrl(this VideoResponse_trailers src) {
if (src is null) if (src is null || !"YOUTUBE".Equals(src.Site))
return null; return null;
return new MediaUrl return new MediaUrl
{ {
Name = src.Name, Name = src.Name,
Url = src.Url Url = src.Url
.Replace("https://youtu.be/", "https://www.youtube.com/watch?v=") // Jellyfin web currently don't recognize youtu.be links
}; };
} }
+2 -2
View File
@@ -2,7 +2,7 @@
name: "КиноПоиск" name: "КиноПоиск"
guid: "0c136f8a-ff77-4f2b-ade5-13462cae6216" guid: "0c136f8a-ff77-4f2b-ade5-13462cae6216"
imageUrl: "https://kinopoisk.userecho.com/s/attachments/28876/0/1/25f8c0315e6ccb2aa6c2642e48f2c9e9.png" imageUrl: "https://kinopoisk.userecho.com/s/attachments/28876/0/1/25f8c0315e6ccb2aa6c2642e48f2c9e9.png"
version: "10.7.0.4" version: "10.7.0.5"
targetAbi: "10.7.0" targetAbi: "10.7.0"
framework: "net5.0" framework: "net5.0"
owner: "linfor" owner: "linfor"
@@ -15,4 +15,4 @@ artifacts:
- "KinopoiskUnofficialInfo.ApiClient.dll" - "KinopoiskUnofficialInfo.ApiClient.dll"
- "Newtonsoft.Json.dll" - "Newtonsoft.Json.dll"
changelog: > changelog: >
Added person info, person image, trailers fetching Added trailers filtering: jellyfin-web can only play youtube trailers, not kinopoisk-hosted
@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http; using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@@ -30,11 +31,14 @@ namespace KinopoiskUnofficialInfo.ApiClient
_apiClient = new Client(httpClient); _apiClient = new Client(httpClient);
} }
private async Task<T> Invoke<T>(Func<CancellationToken, Task<T>> method, CancellationToken? ct) private async Task<T> Invoke<T>(Func<CancellationToken, Task<T>> method, CancellationToken? ct, [CallerMemberName] string memberName = "")
{ {
try try
{ {
return await method.Invoke(ct ?? CancellationToken.None); _logger.LogDebug($"{memberName} request starting...");
var res = await method.Invoke(ct ?? CancellationToken.None);
_logger.LogDebug($"{memberName} request complete successfully");
return res;
} }
catch (ApiException e) catch (ApiException e)
{ {