Compare commits
44
Commits
v10.7.5.7
...
v10.10.4.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
976062e6ef | ||
|
|
91555d3872 | ||
|
|
6ab8025c05 | ||
|
|
78b0f03e94 | ||
|
|
aa0c6fea60 | ||
|
|
f1b342ab3f | ||
|
|
194b0315fe | ||
|
|
6461003435 | ||
|
|
ed1836703a | ||
|
|
0743f7d2e7 | ||
|
|
048adc1170 | ||
|
|
096e22156c | ||
|
|
217d2efef8 | ||
|
|
c00f8dd712 | ||
|
|
56ee78af00 | ||
|
|
9687d2112e | ||
|
|
a0dead2318 | ||
|
|
9186137142 | ||
|
|
c771a7f306 | ||
|
|
1f237153b7 | ||
|
|
58cb8f9674 | ||
|
|
4dfc5f1032 | ||
|
|
209738b401 | ||
|
|
663e7602f7 | ||
|
|
656e4e95ef | ||
|
|
61603f8927 | ||
|
|
5112a0a856 | ||
|
|
c516f0c287 | ||
|
|
c66cd64ad7 | ||
|
|
5194068352 | ||
|
|
d012d4c898 | ||
|
|
e7c2e2e5f7 | ||
|
|
df39cccb10 | ||
|
|
332c8153f9 | ||
|
|
3a6d176a37 | ||
|
|
13b3e0fe79 | ||
|
|
81511e6bd8 | ||
|
|
29db7e5909 | ||
|
|
7d2f72a314 | ||
|
|
37020283a9 | ||
|
|
c1ff89d694 | ||
|
|
fbf6995dc3 | ||
|
|
db923f5cdf | ||
|
|
f313766ba4 |
No files matched your search
@@ -9,3 +9,11 @@ updates:
|
|||||||
directory: "/src" # Location of package manifests
|
directory: "/src" # Location of package manifests
|
||||||
schedule:
|
schedule:
|
||||||
interval: "weekly"
|
interval: "weekly"
|
||||||
|
ignore:
|
||||||
|
- dependency-name: "Jellyfin.*"
|
||||||
|
update-types:
|
||||||
|
- version-update:semver-major
|
||||||
|
- version-update:semver-minor
|
||||||
|
- dependency-name: "Microsoft.*"
|
||||||
|
update-types:
|
||||||
|
- version-update:semver-major
|
||||||
@@ -11,15 +11,23 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Setup .NET 6.0
|
- name: Setup .NET 9.0
|
||||||
uses: actions/setup-dotnet@v3
|
uses: actions/setup-dotnet@v5
|
||||||
with:
|
with:
|
||||||
dotnet-version: 6.0.x
|
dotnet-version: 9.0.x
|
||||||
|
|
||||||
- name: Build project
|
- name: Build project
|
||||||
run: dotnet build --configuration Release ./src
|
run: dotnet build --configuration Release --property:Version=1.0.0.0 ./src
|
||||||
|
|
||||||
- name: Test project
|
- name: Test project
|
||||||
run: dotnet test --configuration Release ./src
|
run: dotnet test --configuration Release ./src
|
||||||
|
|
||||||
|
- name: Publish artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: my-artifact
|
||||||
|
path: |
|
||||||
|
./src/Jellyfin.Plugin.Kinopoisk/bin/Release/net9.0/Jellyfin.Plugin.Kinopoisk.dll
|
||||||
|
./src/KinopoiskUnofficialInfo.ApiClient/bin/Release/net9.0/KinopoiskUnofficialInfo.ApiClient.dll
|
||||||
@@ -0,0 +1,175 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
DIST_ARCHIVES_PATH: dist/kinopoisk
|
||||||
|
MANIFEST_FILE: dist/manifest.json
|
||||||
|
TARGET_ABI: 10.10.0
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Setup .NET 9.0
|
||||||
|
uses: actions/setup-dotnet@v5
|
||||||
|
with:
|
||||||
|
dotnet-version: 9.0.x
|
||||||
|
|
||||||
|
- name: Determine version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
VERSION=""
|
||||||
|
if [ -n "${{ github.event.inputs.version }}" ]; then
|
||||||
|
VERSION="${{ github.event.inputs.version }}"
|
||||||
|
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
||||||
|
VERSION="${GITHUB_REF#refs/tags/v}"
|
||||||
|
else
|
||||||
|
# Пытаемся получить версию из CHANGELOG.md
|
||||||
|
if [ -f CHANGELOG.md ]; then
|
||||||
|
CHANGELOG_VERSION=$(grep -E '^## \[' CHANGELOG.md | grep -v '## \[Unreleased\]' | head -1 | sed -E 's/^## \[v?([^]]+)\].*/\1/')
|
||||||
|
if [ -n "$CHANGELOG_VERSION" ]; then
|
||||||
|
VERSION=$CHANGELOG_VERSION
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Если не нашли версию в CHANGELOG.md, пробуем git
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
GIT_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
|
||||||
|
if [ -n "$GIT_TAG" ]; then
|
||||||
|
VERSION="${GIT_TAG#v}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
echo "Не удалось определить версию. Укажите версию вручную или создайте тег."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||||
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Extract changelog
|
||||||
|
id: changelog
|
||||||
|
run: |
|
||||||
|
if [ -f CHANGELOG.md ]; then
|
||||||
|
# Ищем номер строки с нашей версией
|
||||||
|
LINE_NUM=$(grep -n "## \\[${{ env.VERSION }}\\]" CHANGELOG.md | cut -d: -f1)
|
||||||
|
|
||||||
|
if [ -n "$LINE_NUM" ]; then
|
||||||
|
# Извлекаем контент от следующей строки до следующего заголовка ## [
|
||||||
|
NEXT_HEADER_LINE=$(tail -n +$((LINE_NUM+1)) CHANGELOG.md | grep -n "## \\[" | head -1 | cut -d: -f1)
|
||||||
|
|
||||||
|
if [ -n "$NEXT_HEADER_LINE" ]; then
|
||||||
|
# Есть следующий заголовок - извлекаем до него
|
||||||
|
CHANGELOG=$(tail -n +$((LINE_NUM+1)) CHANGELOG.md | head -n $((NEXT_HEADER_LINE-1)))
|
||||||
|
else
|
||||||
|
# Нет следующего заголовка - извлекаем до конца файла
|
||||||
|
CHANGELOG=$(tail -n +$((LINE_NUM+1)) CHANGELOG.md)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Удаляем пустые строки в начале и конце
|
||||||
|
CHANGELOG=$(echo "$CHANGELOG" | sed -e '1s/^[[:space:]]*//' -e '/./,$!d' | sed -e :a -e '/^\n*$/{$d;N;ba' -e '}')
|
||||||
|
|
||||||
|
# Если остались только пустые строки
|
||||||
|
if [ -z "$(echo "$CHANGELOG" | tr -d '[:space:]')" ]; then
|
||||||
|
CHANGELOG="New release"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
CHANGELOG="New release"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
CHANGELOG="New release"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "changelog<<EOF" >> $GITHUB_OUTPUT
|
||||||
|
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
||||||
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Build project
|
||||||
|
run: dotnet build --configuration Release --property:Version=${VERSION} ./src
|
||||||
|
|
||||||
|
- name: Package release archive
|
||||||
|
run: |
|
||||||
|
RELEASE_FILENAME=jellyfin-plugin-kinopoisk_${VERSION}.zip
|
||||||
|
RELEASE_FILE=${DIST_ARCHIVES_PATH}/${RELEASE_FILENAME}
|
||||||
|
zip --junk-paths $RELEASE_FILE \
|
||||||
|
./src/Jellyfin.Plugin.Kinopoisk/bin/Release/net9.0/Jellyfin.Plugin.Kinopoisk.dll \
|
||||||
|
./src/KinopoiskUnofficialInfo.ApiClient/bin/Release/net9.0/KinopoiskUnofficialInfo.ApiClient.dll
|
||||||
|
echo "RELEASE_FILENAME=$RELEASE_FILENAME" >> $GITHUB_ENV
|
||||||
|
echo "RELEASE_FILE=$RELEASE_FILE" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
id: create_release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
tag_name: v${{ env.VERSION }}
|
||||||
|
body: ${{ steps.changelog.outputs.changelog }}
|
||||||
|
files: |
|
||||||
|
${{ env.RELEASE_FILE }}
|
||||||
|
|
||||||
|
- name: Hashsum calculation
|
||||||
|
id: hashsum
|
||||||
|
run: |
|
||||||
|
HASH=$(md5sum "${DIST_ARCHIVES_PATH}/jellyfin-plugin-kinopoisk_${VERSION}.zip" | cut -d' ' -f1)
|
||||||
|
echo "HASH=$HASH" >> $GITHUB_ENV
|
||||||
|
echo "hash=$HASH" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Update manifest
|
||||||
|
id: update_manifest
|
||||||
|
run: |
|
||||||
|
CHANGELOG_JSON=$(echo -n "${{ steps.changelog.outputs.changelog }}" | jq -Rs .)
|
||||||
|
# SOURCE_URL="${{ fromJSON(steps.create_release.outputs.assets)[0].browser_download_url }}" # Не работает, отдаёт временный урл
|
||||||
|
SOURCE_URL="${{ github.server_url }}/${{ github.repository }}/releases/download/v${{ env.VERSION }}/${{ env.RELEASE_FILENAME }}"
|
||||||
|
|
||||||
|
jq --arg VERSION "${{ env.VERSION }}" \
|
||||||
|
--arg HASH "${{ env.HASH }}" \
|
||||||
|
--argjson CHANGELOG "$CHANGELOG_JSON" \
|
||||||
|
--arg TARGET_ABI "${{ env.TARGET_ABI }}" \
|
||||||
|
--arg TIMESTAMP "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" \
|
||||||
|
--arg SOURCE_URL "$SOURCE_URL" \
|
||||||
|
'.[0].versions = [
|
||||||
|
{
|
||||||
|
"version": $VERSION,
|
||||||
|
"checksum": $HASH,
|
||||||
|
"changelog": $CHANGELOG,
|
||||||
|
"targetAbi": $TARGET_ABI,
|
||||||
|
"sourceUrl": $SOURCE_URL,
|
||||||
|
"timestamp": $TIMESTAMP
|
||||||
|
}
|
||||||
|
] + .[0].versions' \
|
||||||
|
"${MANIFEST_FILE}" > "${MANIFEST_FILE}.tmp"
|
||||||
|
|
||||||
|
mv "${MANIFEST_FILE}.tmp" "${MANIFEST_FILE}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
run: |
|
||||||
|
# Настраиваем git
|
||||||
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
|
||||||
|
# Получаем имя текущей ветки
|
||||||
|
CURRENT_BRANCH=${GITHUB_REF#refs/heads/}
|
||||||
|
echo "Текущая ветка: $CURRENT_BRANCH"
|
||||||
|
|
||||||
|
# Проверяем, есть ли изменения в манифесте или архиве
|
||||||
|
if git diff --quiet HEAD -- "${MANIFEST_FILE}"; then
|
||||||
|
echo "ℹ️ Нет изменений для коммита"
|
||||||
|
else
|
||||||
|
# Добавляем измененные файлы
|
||||||
|
git add "${MANIFEST_FILE}"
|
||||||
|
|
||||||
|
# Создаем коммит с [skip ci], чтобы не запускать workflow снова
|
||||||
|
git commit -m "Added to manifest version ${{ env.VERSION }} [skip ci]"
|
||||||
|
echo "✅ Изменения закоммичены"
|
||||||
|
|
||||||
|
# Пушим изменения в текущую ветку
|
||||||
|
git push origin HEAD:$CURRENT_BRANCH
|
||||||
|
echo "✅ Изменения запущены в ветку $CURRENT_BRANCH"
|
||||||
|
fi
|
||||||
+105
@@ -0,0 +1,105 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [10.10.3.0]
|
||||||
|
|
||||||
|
Исправлена совместимость с 10.10.*
|
||||||
|
|
||||||
|
## [10.10.2.0]
|
||||||
|
|
||||||
|
Исправлена совместимость с 10.11.(0-4)
|
||||||
|
|
||||||
|
## [10.10.1.0]
|
||||||
|
|
||||||
|
Реализован IExternalUrlProvider (ссылки на кинопоиск)
|
||||||
|
|
||||||
|
## [10.9.8.0]
|
||||||
|
|
||||||
|
Перенесён значимый код из форка уважаемого @VD42
|
||||||
|
|
||||||
|
## [10.9.7.0]
|
||||||
|
|
||||||
|
Fixed pluginId
|
||||||
|
|
||||||
|
## [10.9.6.0]
|
||||||
|
|
||||||
|
Added YANDEX_DISK video source
|
||||||
|
|
||||||
|
## [10.9.5.0]
|
||||||
|
|
||||||
|
Fix staff to person kind matcher (by @bsv798)
|
||||||
|
|
||||||
|
## [10.9.0.0]
|
||||||
|
|
||||||
|
new release
|
||||||
|
|
||||||
|
## [10.8.9.3]
|
||||||
|
|
||||||
|
new release
|
||||||
|
|
||||||
|
## [10.8.9.2]
|
||||||
|
|
||||||
|
new release
|
||||||
|
|
||||||
|
## [10.8.9.1]
|
||||||
|
|
||||||
|
new release
|
||||||
|
|
||||||
|
## [10.7.5.6]
|
||||||
|
|
||||||
|
Update to .NET 7
|
||||||
|
|
||||||
|
## [10.7.5.4]
|
||||||
|
|
||||||
|
Search fixed in case of null premiere date
|
||||||
|
|
||||||
|
## [10.7.5.3]
|
||||||
|
|
||||||
|
Results parsing fixes due to upstream service changes (api 2.2)
|
||||||
|
|
||||||
|
## [10.7.5.2]
|
||||||
|
|
||||||
|
Results parsing fixes due to upstream service changes
|
||||||
|
|
||||||
|
## [10.7.5.1]
|
||||||
|
|
||||||
|
Results parsing fixes
|
||||||
|
|
||||||
|
## [10.7.5.0]
|
||||||
|
|
||||||
|
Short: Huge improvement in auto-identifying of movies. Rus: Значительно улучшено авто-привязка фильмов при добавлении в медиатеку. Пытаюсь найти идентификатор кинопоиска по паттерну kp-12345 или kp12345 в имени файла/папки. Пытаюсь найти единственное совпадение на кинопоиске по имени + году. Пытаюсь перебрать все совпадения по имени + сравнение IMDB ID.
|
||||||
|
|
||||||
|
## [10.7.0.5]
|
||||||
|
|
||||||
|
Added trailers filtering: jellyfin-web can only play youtube trailers, not kinopoisk-hosted
|
||||||
|
|
||||||
|
## [10.7.0.4]
|
||||||
|
|
||||||
|
Added person info, person image, trailers fetching
|
||||||
|
|
||||||
|
## [10.7.0.3]
|
||||||
|
|
||||||
|
Don't provide empty poster Added kinopoisk hyperlink in people info
|
||||||
|
|
||||||
|
## [10.7.0.2]
|
||||||
|
|
||||||
|
Fixed rating parsing
|
||||||
|
|
||||||
|
## [10.7.0.1]
|
||||||
|
|
||||||
|
Fixed some actor professions parsing
|
||||||
|
|
||||||
|
## [10.7.0.0]
|
||||||
|
|
||||||
|
Jellyfin v10.7 compat
|
||||||
|
|
||||||
|
## [10.6.0.2]
|
||||||
|
|
||||||
|
fix NRE in person provider
|
||||||
|
|
||||||
|
## [10.6.0.1]
|
||||||
|
|
||||||
|
new release
|
||||||
|
|
||||||
|
## [10.6.0.0]
|
||||||
|
|
||||||
|
new release
|
||||||
@@ -8,6 +8,8 @@ Fetches metadata from https://www.kinopoisk.ru/. This site is popular in the Rus
|
|||||||
|
|
||||||
После этого на вкладке Каталог найти "КиноПоиск" (раздел Метаданные) и установить.
|
После этого на вкладке Каталог найти "КиноПоиск" (раздел Метаданные) и установить.
|
||||||
|
|
||||||
|
Альтернатива для Emby - [luzmane/emby.kinopoisk.ru](https://github.com/luzmane/emby.kinopoisk.ru)
|
||||||
|
|
||||||
## Настройка
|
## Настройка
|
||||||
|
|
||||||
Параметры плагина искать в: Администрирование - Панель - Расширенное - Плагины - вкладка "Мои плагины" - КиноПоиск - "три точки" - Параметры
|
Параметры плагина искать в: Администрирование - Панель - Расширенное - Плагины - вкладка "Мои плагины" - КиноПоиск - "три точки" - Параметры
|
||||||
|
|||||||
Vendored
+17
@@ -0,0 +1,17 @@
|
|||||||
|
# Форк плагина КиноПоиск: больше изображений
|
||||||
|
|
||||||
|
Оригинал: https://github.com/LinFor/jellyfin-plugin-kinopoisk
|
||||||
|
|
||||||
|
Что изменено:
|
||||||
|
- `coverUrl` из карточки фильма отдаётся как `Backdrop` (широкая обложка);
|
||||||
|
- `logoUrl` отдаётся как `Logo`;
|
||||||
|
- кадры из `GET /api/v2.2/films/{id}/images` отдаются как `Thumb` и `Backdrop` (до 12 штук);
|
||||||
|
- проверка доступности URL дедуплицируется, чтобы не дёргать один и тот же адрес дважды.
|
||||||
|
|
||||||
|
Сборка: `10.10.4.0` (net9.0, targetAbi 10.10.0), файл `jellyfin-plugin-kinopoisk_10.10.4.0.zip`.
|
||||||
|
|
||||||
|
Установка:
|
||||||
|
1. Jellyfin → Dashboard → Plugins → Repositories → добавить
|
||||||
|
`https://git.midns.ru/1xDed/jellyfin-plugin-kinopoisk/raw/branch/master/dist/custom/manifest.json`
|
||||||
|
2. Обновить «КиноПоиск» до 10.10.4.0 и перезапустить Jellyfin.
|
||||||
|
3. Для уже существующих фильмов: «Обновить метаданные» → заменить изображения (или дождаться планового обновления).
|
||||||
Binary file not shown.
Vendored
+21
@@ -0,0 +1,21 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"category": "Metadata",
|
||||||
|
"guid": "33e6d249-648f-44cd-a9ce-497be06c08df",
|
||||||
|
"name": "КиноПоиск",
|
||||||
|
"overview": "Информация о фильмах и сериалах с КиноПоиска + больше изображений",
|
||||||
|
"owner": "1xDed (fork of LinFor & skrashevich)",
|
||||||
|
"description": "Форк плагина КиноПоиск. Дополнительно забирает из API coverUrl, logoUrl и кадры из /films/{id}/images: широкие обложки (Backdrop), landscape-кадры (Thumb) и логотипы (Logo), а не только один постер.",
|
||||||
|
"imageUrl": "https://kinopoisk.userecho.com/s/attachments/28876/0/1/25f8c0315e6ccb2aa6c2642e48f2c9e9.png",
|
||||||
|
"versions": [
|
||||||
|
{
|
||||||
|
"version": "10.10.4.0",
|
||||||
|
"checksum": "e0c9398382c7220e144d842dd31713c5",
|
||||||
|
"changelog": "Больше изображений: coverUrl как Backdrop, logoUrl как Logo, кадры из /films/{id}/images как Thumb и Backdrop (до 12 кадров). Дедупликация проверки URL.",
|
||||||
|
"targetAbi": "10.10.0",
|
||||||
|
"sourceUrl": "https://git.midns.ru/1xDed/jellyfin-plugin-kinopoisk/raw/branch/master/dist/custom/jellyfin-plugin-kinopoisk_10.10.4.0.zip",
|
||||||
|
"timestamp": "2026-11-27T10:05:00Z"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
+92
-13
@@ -1,21 +1,100 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"category": "Metadata",
|
"category": "Metadata",
|
||||||
"guid": "0c136f8a-ff77-4f2b-ade5-13462cae6216",
|
"guid": "33e6d249-648f-44cd-a9ce-497be06c08df",
|
||||||
"name": "КиноПоиск",
|
"name": "КиноПоиск",
|
||||||
"overview": "Информация о фильмах и сериалах с КиноПоиска",
|
"overview": "Информация о фильмах и сериалах с КиноПоиска",
|
||||||
"owner": "skrashevich",
|
"owner": "LinFor & skrashevich",
|
||||||
"description": "Загружает рейтинг, описания, актёров, трейлеры и т.д. с сайта КиноПоиск. Может потребоваться зарегистрировать свой ApiToken, см. информацию в параметрах плагина. Для точного распознавания рекомендуется указывать id фильма с сайта КиноПоиск в имени файла в формате kp-12345 или kp12345. Подробнее см. https://github.com/LinFor/jellyfin-plugin-kinopoisk/blob/master/README.md\n",
|
"description": "Загружает рейтинг, описания, актёров, трейлеры и т.д. с сайта КиноПоиск. Может потребоваться зарегистрировать свой ApiToken, см. информацию в параметрах плагина. Для точного распознавания рекомендуется указывать id фильма с сайта КиноПоиск в имени файла в формате kp-12345 или kp12345. Подробнее см. https://github.com/LinFor/jellyfin-plugin-kinopoisk/blob/master/README.md\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.5.7",
|
"version": "10.10.3.0",
|
||||||
"checksum": "df1c6ea557e12c3d7d29ff96c1257b66",
|
"checksum": "de4cf02e03339d61933a6869bf6be6f4",
|
||||||
|
"changelog": "Исправлена совместимость с 10.10.*",
|
||||||
|
"targetAbi": "10.10.0",
|
||||||
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/releases/download/v10.10.3.0/jellyfin-plugin-kinopoisk_10.10.3.0.zip",
|
||||||
|
"timestamp": "2026-02-18T07:38:15Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "10.10.2.0",
|
||||||
|
"checksum": "4cd0b8b5fe5db078b74eb472146773ac",
|
||||||
|
"changelog": "Исправлена совместимость с 10.11.(0-4)",
|
||||||
|
"targetAbi": "10.10.0",
|
||||||
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/releases/download/v10.10.2.0/jellyfin-plugin-kinopoisk_10.10.2.0.zip",
|
||||||
|
"timestamp": "2026-02-04T09:24:27Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "10.10.1.0",
|
||||||
|
"checksum": "6607f466b207e2e980f142e317ffb989",
|
||||||
|
"changelog": "Реализован IExternalUrlProvider (ссылки на кинопоиск)",
|
||||||
|
"targetAbi": "10.10.0",
|
||||||
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/releases/download/v10.10.1.0/jellyfin-plugin-kinopoisk_10.10.1.0.zip",
|
||||||
|
"timestamp": "2026-01-15T21:37:12Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "10.9.8.0",
|
||||||
|
"checksum": "8ce2e57a7411c393a5ac23d31f50265a",
|
||||||
|
"changelog": "Перенесён значимый код из форка уважаемого @VD42",
|
||||||
|
"targetAbi": "10.9.0",
|
||||||
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/releases/download/v10.9.8.0/jellyfin-plugin-kinopoisk_10.9.8.0.zip",
|
||||||
|
"timestamp": "2026-01-15T17:48:23Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "10.9.7.0",
|
||||||
|
"checksum": "5d3719a7c8a2d6e4af4fca53f736392e",
|
||||||
|
"changelog": "Fixed pluginId",
|
||||||
|
"targetAbi": "10.9.0",
|
||||||
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/releases/download/v10.9.7.0/jellyfin-plugin-kinopoisk_10.9.7.0.zip",
|
||||||
|
"timestamp": "2026-01-15T16:59:09Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "10.9.6.0",
|
||||||
|
"checksum": "d7a156386b76865714eb149a41143b35",
|
||||||
|
"changelog": "Added YANDEX_DISK video source",
|
||||||
|
"targetAbi": "10.9.0",
|
||||||
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/releases/download/v10.9.6.0/jellyfin-plugin-kinopoisk_10.9.6.0.zip",
|
||||||
|
"timestamp": "2026-01-15T16:10:54Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "10.9.5.0",
|
||||||
|
"checksum": "bbc0989e1093054bc7aa12c8e99eca97",
|
||||||
|
"changelog": "Fix staff to person kind matcher (by @bsv798)",
|
||||||
|
"targetAbi": "10.9.0",
|
||||||
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/releases/download/v10.9.5.0/jellyfin-plugin-kinopoisk_10.9.5.0.zip",
|
||||||
|
"timestamp": "2026-01-15T15:54:38Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "10.9.0.0",
|
||||||
|
"checksum": "46f29865d6ddb8e66f577ffd93cb8a55",
|
||||||
|
"changelog": "new release",
|
||||||
|
"targetAbi": "10.9.0",
|
||||||
|
"sourceUrl": "https://raw.githubusercontent.com/LinFor/jellyfin-plugin-kinopoisk/master/dist/kinopoisk/kinopoisk_10.9.0.0.zip",
|
||||||
|
"timestamp": "2024-05-15T15:11:12Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "10.8.9.3",
|
||||||
|
"checksum": "b884a366e1da7e826267e8f13a3c1a09",
|
||||||
"changelog": "new release",
|
"changelog": "new release",
|
||||||
"name": "КиноПоиск",
|
|
||||||
"targetAbi": "10.8.8.0",
|
"targetAbi": "10.8.8.0",
|
||||||
"sourceUrl": "https://raw.githubusercontent.com/skrashevich/jellyfin-plugin-kinopoisk/master/dist/kinopoisk/kinopoisk_10.7.5.7.zip",
|
"sourceUrl": "https://raw.githubusercontent.com/skrashevich/jellyfin-plugin-kinopoisk/master/dist/kinopoisk/kinopoisk_10.8.9.3.zip",
|
||||||
"timestamp": "2023-02-08T13:12:54Z"
|
"timestamp": "2023-06-14T22:56:46Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "10.8.9.2",
|
||||||
|
"checksum": "8cbefa9f1aa03dc054d0d8a83f49eb6b",
|
||||||
|
"changelog": "new release",
|
||||||
|
"targetAbi": "10.8.8.0",
|
||||||
|
"sourceUrl": "https://raw.githubusercontent.com/skrashevich/jellyfin-plugin-kinopoisk/master/dist/kinopoisk/kinopoisk_10.8.9.2.zip",
|
||||||
|
"timestamp": "2023-02-08T16:42:11Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"version": "10.8.9.1",
|
||||||
|
"checksum": "d15934ff981be4d7df861cd35a862971",
|
||||||
|
"changelog": "new release",
|
||||||
|
"targetAbi": "10.8.8.0",
|
||||||
|
"sourceUrl": "https://raw.githubusercontent.com/skrashevich/jellyfin-plugin-kinopoisk/master/dist/kinopoisk/kinopoisk_10.8.9.1.zip",
|
||||||
|
"timestamp": "2023-02-08T16:10:12Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"version": "10.7.5.6",
|
"version": "10.7.5.6",
|
||||||
@@ -97,7 +176,7 @@
|
|||||||
"runtimes": "netframework,netcore",
|
"runtimes": "netframework,netcore",
|
||||||
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.7.0.2.zip",
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.7.0.2.zip",
|
||||||
"filename": "jellyfin-plugin-kinopoisk_10.7.0.2.zip",
|
"filename": "jellyfin-plugin-kinopoisk_10.7.0.2.zip",
|
||||||
"timestamp": "2021-04-06 18:12:00",
|
"timestamp": "2021-04-06T18:12:00",
|
||||||
"version": "10.7.0.2"
|
"version": "10.7.0.2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -108,7 +187,7 @@
|
|||||||
"runtimes": "netframework,netcore",
|
"runtimes": "netframework,netcore",
|
||||||
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.7.0.1.zip",
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.7.0.1.zip",
|
||||||
"filename": "jellyfin-plugin-kinopoisk_10.7.0.1.zip",
|
"filename": "jellyfin-plugin-kinopoisk_10.7.0.1.zip",
|
||||||
"timestamp": "2021-03-18 13:31:00",
|
"timestamp": "2021-03-18T13:31:00",
|
||||||
"version": "10.7.0.1"
|
"version": "10.7.0.1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -119,7 +198,7 @@
|
|||||||
"runtimes": "netframework,netcore",
|
"runtimes": "netframework,netcore",
|
||||||
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.7.0.0.zip",
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.7.0.0.zip",
|
||||||
"filename": "jellyfin-plugin-kinopoisk_10.7.0.0.zip",
|
"filename": "jellyfin-plugin-kinopoisk_10.7.0.0.zip",
|
||||||
"timestamp": "2021-03-16 11:35:00",
|
"timestamp": "2021-03-16T11:35:00",
|
||||||
"version": "10.7.0.0"
|
"version": "10.7.0.0"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -130,7 +209,7 @@
|
|||||||
"runtimes": "netframework,netcore",
|
"runtimes": "netframework,netcore",
|
||||||
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.6.0.2.zip",
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.6.0.2.zip",
|
||||||
"filename": "jellyfin-plugin-kinopoisk_10.6.0.2.zip",
|
"filename": "jellyfin-plugin-kinopoisk_10.6.0.2.zip",
|
||||||
"timestamp": "2020-07-09 13:00:00",
|
"timestamp": "2020-07-09T13:00:00",
|
||||||
"version": "10.6.0.2"
|
"version": "10.6.0.2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -141,7 +220,7 @@
|
|||||||
"runtimes": "netframework,netcore",
|
"runtimes": "netframework,netcore",
|
||||||
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.6.0.1.zip",
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.6.0.1.zip",
|
||||||
"filename": "jellyfin-plugin-kinopoisk_10.6.0.1.zip",
|
"filename": "jellyfin-plugin-kinopoisk_10.6.0.1.zip",
|
||||||
"timestamp": "2020-07-07 19:00:00",
|
"timestamp": "2020-07-07T19:00:00",
|
||||||
"version": "10.6.0.1"
|
"version": "10.6.0.1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -152,7 +231,7 @@
|
|||||||
"runtimes": "netframework,netcore",
|
"runtimes": "netframework,netcore",
|
||||||
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.6.0.0.zip",
|
"sourceUrl": "https://github.com/LinFor/jellyfin-plugin-kinopoisk/raw/master/dist/kinopoisk/jellyfin-plugin-kinopoisk_10.6.0.0.zip",
|
||||||
"filename": "jellyfin-plugin-kinopoisk_10.6.0.0.zip",
|
"filename": "jellyfin-plugin-kinopoisk_10.6.0.0.zip",
|
||||||
"timestamp": "2020-07-07 10:00:00",
|
"timestamp": "2020-07-07T10:00:00",
|
||||||
"version": "10.6.0.0"
|
"version": "10.6.0.0"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
-36
@@ -1,36 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
export VERSION="10.7.5.7"
|
|
||||||
docker run -it --rm -v $(pwd):/src -w /src bitnami/dotnet-sdk:6 dotnet restore ./src
|
|
||||||
|
|
||||||
docker run -it --rm -v $(pwd):/src -w /src bitnami/dotnet-sdk:6 dotnet build --configuration Release ./src
|
|
||||||
|
|
||||||
export RELEASEDIR="$(pwd)/dist/kinopoisk/kinopoisk_$VERSION"
|
|
||||||
mkdir -p "$RELEASEDIR"
|
|
||||||
cp "$(pwd)/src/Jellyfin.Plugin.Kinopoisk/bin/Release/net6.0/Jellyfin.Plugin.Kinopoisk.dll" "$RELEASEDIR/"
|
|
||||||
cp "$(pwd)/src/KinopoiskUnofficialInfo.ApiClient/bin/Release/net6.0/KinopoiskUnofficialInfo.ApiClient.dll" "$RELEASEDIR/"
|
|
||||||
cat << EOF > "dist/kinopoisk/kinopoisk_$VERSION/meta.json"
|
|
||||||
{
|
|
||||||
"category": "Metadata",
|
|
||||||
"changelog": "new versionn",
|
|
||||||
"description": "\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0440\u0435\u0439\u0442\u0438\u043d\u0433, \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f, \u0430\u043a\u0442\u0451\u0440\u043e\u0432, \u0442\u0440\u0435\u0439\u043b\u0435\u0440\u044b \u0438 \u0442.\u0434. \u0441 \u0441\u0430\u0439\u0442\u0430 \u041a\u0438\u043d\u043e\u041f\u043e\u0438\u0441\u043a. \u041c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 ApiToken, \u0441\u043c. \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u043f\u043b\u0430\u0433\u0438\u043d\u0430. \u0414\u043b\u044f \u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c id \u0444\u0438\u043b\u044c\u043c\u0430 \u0441 \u0441\u0430\u0439\u0442\u0430 \u041a\u0438\u043d\u043e\u041f\u043e\u0438\u0441\u043a \u0432 \u0438\u043c\u0435\u043d\u0438 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 kp-12345 \u0438\u043b\u0438 kp12345. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0441\u043c. https://github.com/LinFor/jellyfin-plugin-kinopoisk/blob/master/README.md\n",
|
|
||||||
"guid": "0c136f8a-ff77-4f2b-ade5-13462cae6216",
|
|
||||||
"imageUrl": "https://kinopoisk.userecho.com/s/attachments/28876/0/1/25f8c0315e6ccb2aa6c2642e48f2c9e9.png",
|
|
||||||
"name": "\u041a\u0438\u043d\u043e\u041f\u043e\u0438\u0441\u043a",
|
|
||||||
"overview": "\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0444\u0438\u043b\u044c\u043c\u0430\u0445 \u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0430\u0445 \u0441 \u041a\u0438\u043d\u043e\u041f\u043e\u0438\u0441\u043a\u0430",
|
|
||||||
"owner": "svk",
|
|
||||||
"targetAbi": "10.8.8.0",
|
|
||||||
"timestamp": "$(date -u "+%Y-%m-%dT%H:%M:%SZ")",
|
|
||||||
"version": "$VERSION"
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
zip -r "dist/kinopoisk/kinopoisk_$VERSION.zip" "dist/kinopoisk/kinopoisk_$VERSION"
|
|
||||||
|
|
||||||
export HASH=$(md5sum "dist/kinopoisk/kinopoisk_$VERSION.zip" | cut -d' ' -f1)
|
|
||||||
|
|
||||||
jq --arg HASH "$HASH" --arg URL "https://raw.githubusercontent.com/skrashevich/jellyfin-plugin-kinopoisk/master/dist/kinopoisk/kinopoisk_$VERSION.zip" --arg TIMESTAMP "$(date -u "+%Y-%m-%dT%H:%M:%SZ")" --arg VERSION "$VERSION" '.[0].versions = [[{"version": $VERSION, "checksum": $HASH, "changelog": "new release", "name": "\u041a\u0438\u043d\u043e\u041f\u043e\u0438\u0441\u043a", "targetAbi": "10.8.8.0", "sourceUrl": $URL, "timestamp": $TIMESTAMP}] + (.[0].versions[0:])]' "$(pwd)/dist/manifest.json" > "$(pwd)/dist/manifest.json.tmp" && mv "$(pwd)/dist/manifest.json.tmp" "$(pwd)/dist/manifest.json"
|
|
||||||
#jprm repo add -u https://raw.githubusercontent.com/skrashevich/jellyfin-plugin-kinopoisk/master/dist/ ./dist ./artifacts/*.zip
|
|
||||||
rm ./artifacts/*
|
|
||||||
git add "dist/kinopoisk/kinopoisk_$VERSION.zip" "dist/manifest.json" && \
|
|
||||||
git commit -m "version $VERSION" && \
|
|
||||||
git tag "v$VERSION" && \
|
|
||||||
git push --tags
|
|
||||||
Whitespace-only changes.
@@ -0,0 +1,46 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using KinopoiskUnofficialInfo.ApiClient;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Jellyfin.Plugin.Kinopoisk.Tests
|
||||||
|
{
|
||||||
|
public class ApiModelExtensionsTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void ToPersonInfosShouldSkipPersonsWithoutNames()
|
||||||
|
{
|
||||||
|
var staff = new List<StaffResponse>
|
||||||
|
{
|
||||||
|
CreateStaff(1, "Иван Иванов", string.Empty),
|
||||||
|
CreateStaff(2, string.Empty, string.Empty),
|
||||||
|
CreateStaff(3, " ", " "),
|
||||||
|
CreateStaff(4, string.Empty, "John Smith")
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = staff.ToPersonInfos().ToArray();
|
||||||
|
|
||||||
|
Assert.Equal(2, result.Length);
|
||||||
|
Assert.Equal("Иван Иванов", result[0].Name);
|
||||||
|
Assert.Equal(1, result[0].SortOrder);
|
||||||
|
Assert.Equal("John Smith", result[1].Name);
|
||||||
|
Assert.Equal(2, result[1].SortOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static StaffResponse CreateStaff(
|
||||||
|
int id,
|
||||||
|
string nameRu,
|
||||||
|
string nameEn)
|
||||||
|
{
|
||||||
|
return new StaffResponse
|
||||||
|
{
|
||||||
|
StaffId = id,
|
||||||
|
NameRu = nameRu,
|
||||||
|
NameEn = nameEn,
|
||||||
|
PosterUrl = string.Empty,
|
||||||
|
ProfessionText = "Актёр",
|
||||||
|
ProfessionKey = StaffResponseProfessionKey.ACTOR
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +1,16 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
||||||
<PackageReference Include="xunit" Version="2.4.2" />
|
<PackageReference Include="xunit" Version="2.4.2" />
|
||||||
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
|
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
|
||||||
<PackageReference Include="coverlet.collector" Version="3.2.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Jellyfin.Plugin.Kinopoisk.Tests
|
||||||
|
{
|
||||||
|
public class RemoteImageUrlSanitizerTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public async Task SanitizeRemoteImageUrlDisposesRequestAndResponse()
|
||||||
|
{
|
||||||
|
using var handler = new TrackingHandler();
|
||||||
|
using var httpClient = new HttpClient(handler);
|
||||||
|
|
||||||
|
var sanitizer = new RemoteImageUrlSanitizer(httpClient);
|
||||||
|
|
||||||
|
var result = await sanitizer.SanitizeRemoteImageUrl(
|
||||||
|
"https://example.com/image.jpg");
|
||||||
|
|
||||||
|
Assert.Equal("https://example.com/image.jpg", result);
|
||||||
|
Assert.True(handler.RequestContent.IsDisposed);
|
||||||
|
Assert.True(handler.ResponseContent.IsDisposed);
|
||||||
|
}
|
||||||
|
|
||||||
|
private sealed class TrackingHandler : HttpMessageHandler
|
||||||
|
{
|
||||||
|
public TrackingContent RequestContent { get; } = new TrackingContent();
|
||||||
|
|
||||||
|
public TrackingContent ResponseContent { get; } = new TrackingContent();
|
||||||
|
|
||||||
|
protected override Task<HttpResponseMessage> SendAsync(
|
||||||
|
HttpRequestMessage request,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
request.Content = RequestContent;
|
||||||
|
|
||||||
|
return Task.FromResult(
|
||||||
|
new HttpResponseMessage(HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
Content = ResponseContent
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private sealed class TrackingContent : HttpContent
|
||||||
|
{
|
||||||
|
public bool IsDisposed { get; private set; }
|
||||||
|
|
||||||
|
protected override Task SerializeToStreamAsync(
|
||||||
|
Stream stream,
|
||||||
|
TransportContext context)
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool TryComputeLength(out long length)
|
||||||
|
{
|
||||||
|
length = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing)
|
||||||
|
{
|
||||||
|
IsDisposed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -14,11 +14,7 @@ EndProject
|
|||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Debug|x64 = Debug|x64
|
|
||||||
Debug|x86 = Debug|x86
|
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
Release|x64 = Release|x64
|
|
||||||
Release|x86 = Release|x86
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -26,51 +22,19 @@ Global
|
|||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{92F27832-191C-414F-A50D-5098D5C5C35C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{92F27832-191C-414F-A50D-5098D5C5C35C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{92F27832-191C-414F-A50D-5098D5C5C35C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{92F27832-191C-414F-A50D-5098D5C5C35C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{92F27832-191C-414F-A50D-5098D5C5C35C}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{92F27832-191C-414F-A50D-5098D5C5C35C}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{92F27832-191C-414F-A50D-5098D5C5C35C}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{92F27832-191C-414F-A50D-5098D5C5C35C}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{92F27832-191C-414F-A50D-5098D5C5C35C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{92F27832-191C-414F-A50D-5098D5C5C35C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{92F27832-191C-414F-A50D-5098D5C5C35C}.Release|Any CPU.Build.0 = Release|Any CPU
|
{92F27832-191C-414F-A50D-5098D5C5C35C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{92F27832-191C-414F-A50D-5098D5C5C35C}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{92F27832-191C-414F-A50D-5098D5C5C35C}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{92F27832-191C-414F-A50D-5098D5C5C35C}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{92F27832-191C-414F-A50D-5098D5C5C35C}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{440F7DCA-3815-4B72-8984-8630250801A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{440F7DCA-3815-4B72-8984-8630250801A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{440F7DCA-3815-4B72-8984-8630250801A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{440F7DCA-3815-4B72-8984-8630250801A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{440F7DCA-3815-4B72-8984-8630250801A5}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{440F7DCA-3815-4B72-8984-8630250801A5}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{440F7DCA-3815-4B72-8984-8630250801A5}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{440F7DCA-3815-4B72-8984-8630250801A5}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{440F7DCA-3815-4B72-8984-8630250801A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{440F7DCA-3815-4B72-8984-8630250801A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{440F7DCA-3815-4B72-8984-8630250801A5}.Release|Any CPU.Build.0 = Release|Any CPU
|
{440F7DCA-3815-4B72-8984-8630250801A5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{440F7DCA-3815-4B72-8984-8630250801A5}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{440F7DCA-3815-4B72-8984-8630250801A5}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{440F7DCA-3815-4B72-8984-8630250801A5}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{440F7DCA-3815-4B72-8984-8630250801A5}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{9584F66B-8EAB-4CA8-AC55-E9503EA23CC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{9584F66B-8EAB-4CA8-AC55-E9503EA23CC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{9584F66B-8EAB-4CA8-AC55-E9503EA23CC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{9584F66B-8EAB-4CA8-AC55-E9503EA23CC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{9584F66B-8EAB-4CA8-AC55-E9503EA23CC9}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{9584F66B-8EAB-4CA8-AC55-E9503EA23CC9}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{9584F66B-8EAB-4CA8-AC55-E9503EA23CC9}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{9584F66B-8EAB-4CA8-AC55-E9503EA23CC9}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{9584F66B-8EAB-4CA8-AC55-E9503EA23CC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{9584F66B-8EAB-4CA8-AC55-E9503EA23CC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{9584F66B-8EAB-4CA8-AC55-E9503EA23CC9}.Release|Any CPU.Build.0 = Release|Any CPU
|
{9584F66B-8EAB-4CA8-AC55-E9503EA23CC9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{9584F66B-8EAB-4CA8-AC55-E9503EA23CC9}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{9584F66B-8EAB-4CA8-AC55-E9503EA23CC9}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{9584F66B-8EAB-4CA8-AC55-E9503EA23CC9}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{9584F66B-8EAB-4CA8-AC55-E9503EA23CC9}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{0AB018D0-655E-48DF-B414-22EA61C926C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{0AB018D0-655E-48DF-B414-22EA61C926C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{0AB018D0-655E-48DF-B414-22EA61C926C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{0AB018D0-655E-48DF-B414-22EA61C926C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{0AB018D0-655E-48DF-B414-22EA61C926C9}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{0AB018D0-655E-48DF-B414-22EA61C926C9}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{0AB018D0-655E-48DF-B414-22EA61C926C9}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{0AB018D0-655E-48DF-B414-22EA61C926C9}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{0AB018D0-655E-48DF-B414-22EA61C926C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{0AB018D0-655E-48DF-B414-22EA61C926C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{0AB018D0-655E-48DF-B414-22EA61C926C9}.Release|Any CPU.Build.0 = Release|Any CPU
|
{0AB018D0-655E-48DF-B414-22EA61C926C9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{0AB018D0-655E-48DF-B414-22EA61C926C9}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{0AB018D0-655E-48DF-B414-22EA61C926C9}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{0AB018D0-655E-48DF-B414-22EA61C926C9}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{0AB018D0-655E-48DF-B414-22EA61C926C9}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
@@ -9,6 +9,8 @@ using MediaBrowser.Controller.Entities.TV;
|
|||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Providers;
|
using MediaBrowser.Model.Providers;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Jellyfin.Data.Enums;
|
||||||
|
using Jellyfin.Extensions;
|
||||||
|
|
||||||
namespace Jellyfin.Plugin.Kinopoisk
|
namespace Jellyfin.Plugin.Kinopoisk
|
||||||
{
|
{
|
||||||
@@ -99,6 +101,8 @@ namespace Jellyfin.Plugin.Kinopoisk
|
|||||||
dst.Name = src.GetLocalName();
|
dst.Name = src.GetLocalName();
|
||||||
dst.OriginalTitle = src.GetOriginalNameIfNotSame();
|
dst.OriginalTitle = src.GetOriginalNameIfNotSame();
|
||||||
dst.PremiereDate = src.GetPremiereDate();
|
dst.PremiereDate = src.GetPremiereDate();
|
||||||
|
if (1900 < src.Year)
|
||||||
|
dst.ProductionYear = src.Year;
|
||||||
if (!string.IsNullOrWhiteSpace(src.Slogan))
|
if (!string.IsNullOrWhiteSpace(src.Slogan))
|
||||||
dst.Tagline = src.Slogan;
|
dst.Tagline = src.Slogan;
|
||||||
dst.Overview = src.Description;
|
dst.Overview = src.Description;
|
||||||
@@ -138,29 +142,69 @@ namespace Jellyfin.Plugin.Kinopoisk
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<RemoteImageInfo> ToRemoteImageInfos(this Film src)
|
public static IEnumerable<RemoteImageInfo> ToRemoteImageInfos(this Film src)
|
||||||
|
=> src.ToRemoteImageInfos(null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Poster + cover + logo + stills from /films/{id}/images.
|
||||||
|
/// Jellyfin needs more than one Primary/Backdrop to fill the hero and the
|
||||||
|
/// "choose image" dialog, so expose every artwork the API returns.
|
||||||
|
/// </summary>
|
||||||
|
public static IEnumerable<RemoteImageInfo> ToRemoteImageInfos(this Film src, FilmImagesResponse images)
|
||||||
{
|
{
|
||||||
var res = Enumerable.Empty<RemoteImageInfo>();
|
var res = new List<RemoteImageInfo>();
|
||||||
if (src is null)
|
if (src is null)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
if (src?.PosterUrl != null)
|
if (!string.IsNullOrEmpty(src.PosterUrl))
|
||||||
{
|
{
|
||||||
var mainPoster = new RemoteImageInfo(){
|
res.Add(new RemoteImageInfo(){
|
||||||
Type = ImageType.Primary,
|
Type = ImageType.Primary,
|
||||||
Url = src.PosterUrl,
|
Url = src.PosterUrl,
|
||||||
Language = Constants.ProviderMetadataLanguage,
|
Language = Constants.ProviderMetadataLanguage,
|
||||||
ProviderName = Constants.ProviderName
|
ProviderName = Constants.ProviderName
|
||||||
};
|
});
|
||||||
res = res.Concat(Enumerable.Repeat(mainPoster, 1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (src.Images != null)
|
if (!string.IsNullOrEmpty(src.CoverUrl))
|
||||||
// {
|
{
|
||||||
// if (src.Images.Posters != null)
|
res.Add(new RemoteImageInfo(){
|
||||||
// res = res.Concat(src.Images.Posters.ToRemoteImageInfos(ImageType.Primary));
|
Type = ImageType.Backdrop,
|
||||||
// if (src.Images.Backdrops != null)
|
Url = src.CoverUrl,
|
||||||
// res = res.Concat(src.Images.Backdrops.ToRemoteImageInfos(ImageType.Backdrop));
|
Language = Constants.ProviderMetadataLanguage,
|
||||||
// }
|
ProviderName = Constants.ProviderName
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(src.LogoUrl))
|
||||||
|
{
|
||||||
|
res.Add(new RemoteImageInfo(){
|
||||||
|
Type = ImageType.Logo,
|
||||||
|
Url = src.LogoUrl,
|
||||||
|
Language = Constants.ProviderMetadataLanguage,
|
||||||
|
ProviderName = Constants.ProviderName
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stills are 16:9 frames: useful both as backdrops and landscape thumbs.
|
||||||
|
// Cap the amount to keep remote-image lookups reasonably fast.
|
||||||
|
const int maxStills = 12;
|
||||||
|
var stills = images?.Items?
|
||||||
|
.Where(i => !string.IsNullOrEmpty(i.ImageUrl))
|
||||||
|
.Take(maxStills)
|
||||||
|
?? Enumerable.Empty<FilmImage>();
|
||||||
|
foreach (var still in stills)
|
||||||
|
{
|
||||||
|
foreach (var type in new[] { ImageType.Thumb, ImageType.Backdrop })
|
||||||
|
{
|
||||||
|
res.Add(new RemoteImageInfo(){
|
||||||
|
Type = type,
|
||||||
|
Url = still.ImageUrl,
|
||||||
|
ThumbnailUrl = still.PreviewUrl,
|
||||||
|
Language = Constants.ProviderMetadataLanguage,
|
||||||
|
ProviderName = Constants.ProviderName
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -237,7 +281,7 @@ namespace Jellyfin.Plugin.Kinopoisk
|
|||||||
{
|
{
|
||||||
Name = src.NameRu,
|
Name = src.NameRu,
|
||||||
ImageUrl = src.PosterUrl,
|
ImageUrl = src.PosterUrl,
|
||||||
Role = src.ProfessionText ?? string.Empty,
|
Role = src.ProfessionText ?? null,
|
||||||
Type = src.ProfessionKey.ToPersonType()
|
Type = src.ProfessionKey.ToPersonType()
|
||||||
};
|
};
|
||||||
if (string.IsNullOrWhiteSpace(res.Name))
|
if (string.IsNullOrWhiteSpace(res.Name))
|
||||||
@@ -253,7 +297,7 @@ namespace Jellyfin.Plugin.Kinopoisk
|
|||||||
public static IEnumerable<PersonInfo> ToPersonInfos(this ICollection<StaffResponse> src)
|
public static IEnumerable<PersonInfo> ToPersonInfos(this ICollection<StaffResponse> src)
|
||||||
{
|
{
|
||||||
var res = src.Select(s => s.ToPersonInfo())
|
var res = src.Select(s => s.ToPersonInfo())
|
||||||
.Where(s => s != null)
|
.Where(s => s != null && !string.IsNullOrWhiteSpace(s.Name))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
@@ -263,16 +307,21 @@ namespace Jellyfin.Plugin.Kinopoisk
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ToPersonType(this StaffResponseProfessionKey src)
|
public static PersonKind ToPersonType(this StaffResponseProfessionKey src)
|
||||||
{
|
{
|
||||||
return src switch
|
return src switch
|
||||||
{
|
{
|
||||||
StaffResponseProfessionKey.ACTOR => PersonType.Actor,
|
StaffResponseProfessionKey.ACTOR => PersonKind.Actor,
|
||||||
StaffResponseProfessionKey.DIRECTOR => PersonType.Director,
|
StaffResponseProfessionKey.DIRECTOR
|
||||||
StaffResponseProfessionKey.WRITER => PersonType.Writer,
|
or StaffResponseProfessionKey.VOICE_DIRECTOR
|
||||||
StaffResponseProfessionKey.COMPOSER => PersonType.Composer,
|
or StaffResponseProfessionKey.OPERATOR => PersonKind.Director,
|
||||||
StaffResponseProfessionKey.PRODUCER or StaffResponseProfessionKey.PRODUCER_USSR => PersonType.Producer,
|
StaffResponseProfessionKey.WRITER => PersonKind.Writer,
|
||||||
_ => string.Empty,
|
StaffResponseProfessionKey.COMPOSER => PersonKind.Composer,
|
||||||
|
StaffResponseProfessionKey.PRODUCER
|
||||||
|
or StaffResponseProfessionKey.PRODUCER_USSR => PersonKind.Producer,
|
||||||
|
StaffResponseProfessionKey.EDITOR => PersonKind.Editor,
|
||||||
|
StaffResponseProfessionKey.TRANSLATOR => PersonKind.Translator,
|
||||||
|
_ => PersonKind.Unknown,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ namespace Jellyfin.Plugin.Kinopoisk
|
|||||||
{
|
{
|
||||||
public static class Constants
|
public static class Constants
|
||||||
{
|
{
|
||||||
|
public const string PluginName = "КиноПоиск";
|
||||||
|
public const string PluginDescription = "Информация о фильмах и сериалах с КиноПоиска";
|
||||||
public const string ProviderId = "kinopoisk";
|
public const string ProviderId = "kinopoisk";
|
||||||
public const string ProviderName = "КиноПоиск";
|
public const string ProviderName = "КиноПоиск";
|
||||||
public const string ProviderDescription = "Информация о фильмах и сериалах с КиноПоиска";
|
|
||||||
public const string ProviderMetadataLanguage = "ru";
|
public const string ProviderMetadataLanguage = "ru";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<DebugType>portable</DebugType>
|
<DebugType>portable</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@@ -11,18 +11,11 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Jellyfin.Controller" Version="10.*">
|
<PackageReference Include="Jellyfin.Data" Version="10.10.0.*" />
|
||||||
<IncludeAssets>compile</IncludeAssets>
|
<PackageReference Include="Jellyfin.Controller" Version="10.10.0.*" />
|
||||||
</PackageReference>
|
<PackageReference Include="Jellyfin.Common" Version="10.10.0.*" />
|
||||||
<PackageReference Include="Jellyfin.Model" Version="10.*">
|
<PackageReference Include="Jellyfin.Model" Version="10.10.0.*" />
|
||||||
<IncludeAssets>compile</IncludeAssets>
|
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0">
|
|
||||||
<IncludeAssets>compile</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
<PackageReference Include="System.Text.Json" Version="7.*">
|
|
||||||
<IncludeAssets>compile</IncludeAssets>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using Jellyfin.Plugin.Kinopoisk.ProviderIdResolvers;
|
using Jellyfin.Plugin.Kinopoisk.ProviderIdResolvers;
|
||||||
using KinopoiskUnofficialInfo.ApiClient;
|
using KinopoiskUnofficialInfo.ApiClient;
|
||||||
using MediaBrowser.Common.Plugins;
|
using MediaBrowser.Controller;
|
||||||
|
using MediaBrowser.Controller.Plugins;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using Microsoft.Extensions.Caching.Memory;
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
@@ -15,7 +16,7 @@ namespace Jellyfin.Plugin.Kinopoisk
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class KinopoiskPluginServiceRegistrator : IPluginServiceRegistrator
|
public class KinopoiskPluginServiceRegistrator : IPluginServiceRegistrator
|
||||||
{
|
{
|
||||||
public void RegisterServices(IServiceCollection serviceCollection)
|
public void RegisterServices(IServiceCollection serviceCollection, IServerApplicationHost applicationHost)
|
||||||
{
|
{
|
||||||
serviceCollection.AddSingleton((sp) => new KinopoiskApiClient(
|
serviceCollection.AddSingleton((sp) => new KinopoiskApiClient(
|
||||||
Plugin.Instance.Configuration.ApiToken,
|
Plugin.Instance.Configuration.ApiToken,
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ namespace Jellyfin.Plugin.Kinopoisk.Model
|
|||||||
|
|
||||||
public string Key => Constants.ProviderId;
|
public string Key => Constants.ProviderId;
|
||||||
|
|
||||||
public string UrlFormatString => "https://www.kinopoisk.ru/film/{0}";
|
public string UrlFormatString => null;
|
||||||
|
|
||||||
public ExternalIdMediaType? Type => null;
|
public ExternalIdMediaType? Type => null;
|
||||||
|
|
||||||
public bool Supports(IHasProviderIds item)
|
public bool Supports(IHasProviderIds item)
|
||||||
{
|
{
|
||||||
return item is Movie || item is Series;
|
return item is Movie || item is Series || item is Person;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
|
using MediaBrowser.Controller.Providers;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Model.Providers;
|
||||||
|
|
||||||
|
namespace Jellyfin.Plugin.Kinopoisk.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// External URLs for Kinopoisk.
|
||||||
|
/// </summary>
|
||||||
|
public class KinopoiskExternalUrlProvider : IExternalUrlProvider
|
||||||
|
{
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public string Name => Constants.ProviderName;
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public IEnumerable<string> GetExternalUrls(BaseItem item)
|
||||||
|
{
|
||||||
|
var baseUrl = "https://www.kinopoisk.ru/";
|
||||||
|
if (item.TryGetProviderId(Constants.ProviderId, out var externalId))
|
||||||
|
{
|
||||||
|
if (item is Person)
|
||||||
|
{
|
||||||
|
yield return baseUrl + $"name/{externalId}/";
|
||||||
|
}
|
||||||
|
else if (item is Movie)
|
||||||
|
{
|
||||||
|
yield return baseUrl + $"film/{externalId}/";
|
||||||
|
}
|
||||||
|
else if (item is Series)
|
||||||
|
{
|
||||||
|
yield return baseUrl + $"series/{externalId}/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
using MediaBrowser.Controller.Entities;
|
|
||||||
using MediaBrowser.Controller.Providers;
|
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using MediaBrowser.Model.Providers;
|
|
||||||
|
|
||||||
namespace Jellyfin.Plugin.Kinopoisk.Model
|
|
||||||
{
|
|
||||||
public class KinopoiskPersonExternalId : IExternalId
|
|
||||||
{
|
|
||||||
public string ProviderName => Constants.ProviderName;
|
|
||||||
|
|
||||||
public string Key => Constants.ProviderId;
|
|
||||||
|
|
||||||
public string UrlFormatString => "https://www.kinopoisk.ru/name/{0}";
|
|
||||||
|
|
||||||
public ExternalIdMediaType? Type => null;
|
|
||||||
|
|
||||||
public bool Supports(IHasProviderIds item)
|
|
||||||
{
|
|
||||||
return item is Person;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,9 +12,9 @@ namespace Jellyfin.Plugin.Kinopoisk
|
|||||||
{
|
{
|
||||||
public static Plugin Instance { get; private set; }
|
public static Plugin Instance { get; private set; }
|
||||||
|
|
||||||
public override string Name => Constants.ProviderName;
|
public override string Name => Constants.PluginName;
|
||||||
|
|
||||||
public override string Description => Constants.ProviderDescription;
|
public override string Description => Constants.PluginDescription;
|
||||||
|
|
||||||
public override Guid Id => Guid.Parse("33e6d249-648f-44cd-a9ce-497be06c08df");
|
public override Guid Id => Guid.Parse("33e6d249-648f-44cd-a9ce-497be06c08df");
|
||||||
|
|
||||||
|
|||||||
@@ -44,13 +44,15 @@ namespace Jellyfin.Plugin.Kinopoisk.ProviderIdResolvers
|
|||||||
var candidates = searchResult.Films.ToArray();
|
var candidates = searchResult.Films.ToArray();
|
||||||
_logger.LogDebug($"Received {candidates.Length} results, trying to filter and match...");
|
_logger.LogDebug($"Received {candidates.Length} results, trying to filter and match...");
|
||||||
|
|
||||||
|
var candidates_by_year = FilterByYear(info, candidates);
|
||||||
|
|
||||||
// Check if there are single candidate filtered by year
|
// Check if there are single candidate filtered by year
|
||||||
possibleResult = await TryResolveBySingleCandidateLeft(info, FilterByYear(info, candidates), ct);
|
possibleResult = await TryResolveBySingleCandidateLeft(info, candidates_by_year, ct);
|
||||||
if (possibleResult.IsSuccess)
|
if (possibleResult.IsSuccess)
|
||||||
return possibleResult;
|
return possibleResult;
|
||||||
|
|
||||||
// Try to resolve by ImdbId match filtered by year
|
// Try to resolve by ImdbId match filtered by year
|
||||||
possibleResult = await TryResolveByImdbMatch(info, FilterByYear(info, candidates), ct);
|
possibleResult = await TryResolveByImdbMatch(info, candidates_by_year, ct);
|
||||||
if (possibleResult.IsSuccess)
|
if (possibleResult.IsSuccess)
|
||||||
return possibleResult;
|
return possibleResult;
|
||||||
|
|
||||||
@@ -59,6 +61,22 @@ namespace Jellyfin.Plugin.Kinopoisk.ProviderIdResolvers
|
|||||||
if (possibleResult.IsSuccess)
|
if (possibleResult.IsSuccess)
|
||||||
return possibleResult;
|
return possibleResult;
|
||||||
|
|
||||||
|
// TODO: Maybe check type?
|
||||||
|
|
||||||
|
if (0 < candidates_by_year.Count)
|
||||||
|
{
|
||||||
|
var kinopoiskId = candidates_by_year.First().FilmId;
|
||||||
|
_logger.LogDebug($"All other checks failed, use first result by year, setting KinopoiskProviderId to {kinopoiskId} ({info.Name})");
|
||||||
|
return (true, kinopoiskId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 < candidates.Length)
|
||||||
|
{
|
||||||
|
var kinopoiskId = candidates.First().FilmId;
|
||||||
|
_logger.LogDebug($"All other checks failed, use first result, setting KinopoiskProviderId to {kinopoiskId} ({info.Name})");
|
||||||
|
return (true, kinopoiskId);
|
||||||
|
}
|
||||||
|
|
||||||
_logger.LogDebug($"Suitable result not found");
|
_logger.LogDebug($"Suitable result not found");
|
||||||
return (false, 0);
|
return (false, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,13 @@ namespace Jellyfin.Plugin.Kinopoisk.MetadataProviders
|
|||||||
{
|
{
|
||||||
using var httpClient = new HttpClient(new HttpClientHandler() { AllowAutoRedirect = false }, true);
|
using var httpClient = new HttpClient(new HttpClientHandler() { AllowAutoRedirect = false }, true);
|
||||||
var sanitizer = new RemoteImageUrlSanitizer(httpClient);
|
var sanitizer = new RemoteImageUrlSanitizer(httpClient);
|
||||||
|
var sanitized = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||||
var res = await Task.WhenAll(images.Select(async i => {
|
var res = await Task.WhenAll(images.Select(async i => {
|
||||||
var sanitizedUrl = await sanitizer.SanitizeRemoteImageUrl(i.Url);
|
if (!sanitized.TryGetValue(i.Url, out var sanitizedUrl))
|
||||||
|
{
|
||||||
|
sanitizedUrl = await sanitizer.SanitizeRemoteImageUrl(i.Url);
|
||||||
|
sanitized[i.Url] = sanitizedUrl;
|
||||||
|
}
|
||||||
if (string.IsNullOrEmpty(sanitizedUrl))
|
if (string.IsNullOrEmpty(sanitizedUrl))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ namespace Jellyfin.Plugin.Kinopoisk.MetadataProviders
|
|||||||
=> new ImageType[]
|
=> new ImageType[]
|
||||||
{
|
{
|
||||||
ImageType.Primary,
|
ImageType.Primary,
|
||||||
ImageType.Backdrop
|
ImageType.Backdrop,
|
||||||
|
ImageType.Thumb,
|
||||||
|
ImageType.Logo
|
||||||
};
|
};
|
||||||
|
|
||||||
public override async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
|
public override async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, CancellationToken cancellationToken)
|
||||||
@@ -48,8 +50,15 @@ namespace Jellyfin.Plugin.Kinopoisk.MetadataProviders
|
|||||||
return Enumerable.Empty<RemoteImageInfo>();
|
return Enumerable.Empty<RemoteImageInfo>();
|
||||||
|
|
||||||
var film = await _apiClient.GetSingleFilm(kinopoiskId, cancellationToken);
|
var film = await _apiClient.GetSingleFilm(kinopoiskId, cancellationToken);
|
||||||
|
var images = await _apiClient.GetFilmImages(kinopoiskId, cancellationToken);
|
||||||
|
|
||||||
return await FilterEmptyImages(film.ToRemoteImageInfos());
|
var all = film.ToRemoteImageInfos(images).ToArray();
|
||||||
|
var filtered = await FilterEmptyImages(all);
|
||||||
|
_logger.LogInformation(
|
||||||
|
"Kinopoisk returned {Count} images for {Name}",
|
||||||
|
filtered.Count(),
|
||||||
|
item.Name);
|
||||||
|
return filtered;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,8 +21,10 @@ namespace Jellyfin.Plugin.Kinopoisk
|
|||||||
var currentUrl = url;
|
var currentUrl = url;
|
||||||
while (!currentUrl.Contains("no-poster"))
|
while (!currentUrl.Contains("no-poster"))
|
||||||
{
|
{
|
||||||
var response = await _httpClient.SendAsync(
|
using var request = new HttpRequestMessage(HttpMethod.Get, currentUrl);
|
||||||
new HttpRequestMessage(HttpMethod.Get, currentUrl), HttpCompletionOption.ResponseHeadersRead);
|
using var response = await _httpClient.SendAsync(
|
||||||
|
request,
|
||||||
|
HttpCompletionOption.ResponseHeadersRead);
|
||||||
|
|
||||||
if ((int)response.StatusCode <= 299)
|
if ((int)response.StatusCode <= 299)
|
||||||
return currentUrl;
|
return currentUrl;
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
name: "КиноПоиск"
|
|
||||||
guid: "0c136f8a-ff77-4f2b-ade5-13462cae6216"
|
|
||||||
imageUrl: "https://kinopoisk.userecho.com/s/attachments/28876/0/1/25f8c0315e6ccb2aa6c2642e48f2c9e9.png"
|
|
||||||
version: "10.7.5.6"
|
|
||||||
targetAbi: "10.7.0"
|
|
||||||
framework: "net6.0"
|
|
||||||
owner: "linfor"
|
|
||||||
overview: "Информация о фильмах и сериалах с КиноПоиска"
|
|
||||||
description: >
|
|
||||||
Загружает рейтинг, описания, актёров, трейлеры и т.д. с сайта КиноПоиск.
|
|
||||||
Может потребоваться зарегистрировать свой ApiToken, см. информацию в параметрах плагина.
|
|
||||||
Для точного распознавания рекомендуется указывать id фильма с сайта КиноПоиск в имени файла в формате kp-12345 или kp12345.
|
|
||||||
Подробнее см. https://github.com/LinFor/jellyfin-plugin-kinopoisk/blob/master/README.md
|
|
||||||
category: "Metadata"
|
|
||||||
artifacts:
|
|
||||||
- "Jellyfin.Plugin.Kinopoisk.dll"
|
|
||||||
- "KinopoiskUnofficialInfo.ApiClient.dll"
|
|
||||||
changelog: >
|
|
||||||
Search fixed in case of null premiere date
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace KinopoiskUnofficialInfo.ApiClient.Tests
|
||||||
|
{
|
||||||
|
public class BadSpouseSexConverterTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void ShouldDeserializeUnknownSpouseSex()
|
||||||
|
{
|
||||||
|
const string json =
|
||||||
|
"{\"personId\":1,\"name\":\"Test\",\"divorced\":false," +
|
||||||
|
"\"divorcedReason\":\"\",\"sex\":\"UNKNOWN\",\"children\":0," +
|
||||||
|
"\"webUrl\":\"\",\"relation\":\"\"}";
|
||||||
|
|
||||||
|
var settings = new JsonSerializerSettings
|
||||||
|
{
|
||||||
|
ContractResolver = new DeclarationPatcherContractResolver()
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = JsonConvert.DeserializeObject<PersonResponse_spouses>(
|
||||||
|
json,
|
||||||
|
settings);
|
||||||
|
|
||||||
|
Assert.NotNull(result);
|
||||||
|
Assert.Equal(
|
||||||
|
(PersonResponse_spousesSex)(-1),
|
||||||
|
result.Sex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+3
-3
@@ -1,14 +1,14 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
|
||||||
<PackageReference Include="xunit" Version="2.4.2" />
|
<PackageReference Include="xunit" Version="2.4.2" />
|
||||||
<PackageReference Include="Moq" Version="4.18.4" />
|
<PackageReference Include="Moq" Version="4.18.4" />
|
||||||
<PackageReference Include="VCR.net" Version="0.1.3" />
|
<PackageReference Include="VCR.net" Version="0.1.3" />
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ namespace KinopoiskUnofficialInfo.ApiClient
|
|||||||
public Task<Film> GetSingleFilm(int filmId, CancellationToken? cancellationToken = null)
|
public Task<Film> GetSingleFilm(int filmId, CancellationToken? cancellationToken = null)
|
||||||
=> TryGetValue(GenerateKey(nameof(GetSingleFilm), filmId), c => c.GetSingleFilm(filmId, cancellationToken));
|
=> TryGetValue(GenerateKey(nameof(GetSingleFilm), filmId), c => c.GetSingleFilm(filmId, cancellationToken));
|
||||||
|
|
||||||
|
public Task<FilmImagesResponse> GetFilmImages(int filmId, CancellationToken? cancellationToken = null)
|
||||||
|
=> TryGetValue(GenerateKey(nameof(GetFilmImages), filmId), c => c.GetFilmImages(filmId, cancellationToken));
|
||||||
|
|
||||||
public Task<ICollection<StaffResponse>> GetStaff(int filmId, CancellationToken? cancellationToken = null)
|
public Task<ICollection<StaffResponse>> GetStaff(int filmId, CancellationToken? cancellationToken = null)
|
||||||
=> TryGetValue(GenerateKey(nameof(GetStaff), filmId), c => c.GetStaff(filmId, cancellationToken));
|
=> TryGetValue(GenerateKey(nameof(GetStaff), filmId), c => c.GetStaff(filmId, cancellationToken));
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace KinopoiskUnofficialInfo.ApiClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Extra image fields returned by /api/v2.2/films/{id} which are not part of
|
||||||
|
/// the generated (older) client model.
|
||||||
|
/// </summary>
|
||||||
|
public partial class Film
|
||||||
|
{
|
||||||
|
[JsonProperty("coverUrl")]
|
||||||
|
public string CoverUrl { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("logoUrl")]
|
||||||
|
public string LogoUrl { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace KinopoiskUnofficialInfo.ApiClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Stills/backdrops returned by /api/v2.2/films/{id}/images.
|
||||||
|
/// The endpoint does not report dimensions or the image kind, only URLs.
|
||||||
|
/// </summary>
|
||||||
|
public class FilmImagesResponse
|
||||||
|
{
|
||||||
|
[JsonProperty("total")]
|
||||||
|
public int Total { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("totalPages")]
|
||||||
|
public int TotalPages { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("items")]
|
||||||
|
public List<FilmImage> Items { get; set; } = new List<FilmImage>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FilmImage
|
||||||
|
{
|
||||||
|
[JsonProperty("imageUrl")]
|
||||||
|
public string ImageUrl { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("previewUrl")]
|
||||||
|
public string PreviewUrl { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3948,6 +3948,8 @@ namespace KinopoiskUnofficialInfo.ApiClient
|
|||||||
[System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN")]
|
[System.Runtime.Serialization.EnumMember(Value = @"UNKNOWN")]
|
||||||
UNKNOWN = 2,
|
UNKNOWN = 2,
|
||||||
|
|
||||||
|
[System.Runtime.Serialization.EnumMember(Value = @"YANDEX_DISK")]
|
||||||
|
YANDEX_DISK = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("NSwag", "13.11.1.0 (NJsonSchema v10.4.3.0 (Newtonsoft.Json v12.0.0.0))")]
|
[System.CodeDom.Compiler.GeneratedCode("NSwag", "13.11.1.0 (NJsonSchema v10.4.3.0 (Newtonsoft.Json v12.0.0.0))")]
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ namespace KinopoiskUnofficialInfo.ApiClient
|
|||||||
{
|
{
|
||||||
Task<PersonResponse> GetPerson(int personId, CancellationToken? cancellationToken = null);
|
Task<PersonResponse> GetPerson(int personId, CancellationToken? cancellationToken = null);
|
||||||
Task<Film> GetSingleFilm(int filmId, CancellationToken? cancellationToken = null);
|
Task<Film> GetSingleFilm(int filmId, CancellationToken? cancellationToken = null);
|
||||||
|
Task<FilmImagesResponse> GetFilmImages(int filmId, CancellationToken? cancellationToken = null);
|
||||||
Task<ICollection<StaffResponse>> GetStaff(int filmId, CancellationToken? cancellationToken = null);
|
Task<ICollection<StaffResponse>> GetStaff(int filmId, CancellationToken? cancellationToken = null);
|
||||||
Task<VideoResponse> GetTrailers(int filmId, CancellationToken? cancellationToken = null);
|
Task<VideoResponse> GetTrailers(int filmId, CancellationToken? cancellationToken = null);
|
||||||
Task<FilmSearchResponse> SearchByKeyword(string keyword, int page = 1, CancellationToken? cancellationToken = null);
|
Task<FilmSearchResponse> SearchByKeyword(string keyword, int page = 1, CancellationToken? cancellationToken = null);
|
||||||
|
|||||||
@@ -50,6 +50,40 @@ namespace KinopoiskUnofficialInfo.ApiClient
|
|||||||
public Task<Film> GetSingleFilm(int filmId, CancellationToken? cancellationToken = null)
|
public Task<Film> GetSingleFilm(int filmId, CancellationToken? cancellationToken = null)
|
||||||
=> Invoke((ct) => _apiClient.FilmsAsync(filmId, ct), cancellationToken);
|
=> Invoke((ct) => _apiClient.FilmsAsync(filmId, ct), cancellationToken);
|
||||||
|
|
||||||
|
public async Task<FilmImagesResponse> GetFilmImages(int filmId, CancellationToken? cancellationToken = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var httpClient = _httpClientFactory.CreateClient();
|
||||||
|
using var request = new HttpRequestMessage(
|
||||||
|
HttpMethod.Get,
|
||||||
|
$"https://kinopoiskapiunofficial.tech/api/v2.2/films/{filmId}/images");
|
||||||
|
request.Headers.Add("X-API-KEY", _apiToken);
|
||||||
|
using var response = await httpClient.SendAsync(
|
||||||
|
request,
|
||||||
|
HttpCompletionOption.ResponseContentRead,
|
||||||
|
cancellationToken ?? CancellationToken.None);
|
||||||
|
if (!response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(
|
||||||
|
"Kinopoisk images request for film {FilmId} returned {StatusCode}",
|
||||||
|
filmId,
|
||||||
|
(int)response.StatusCode);
|
||||||
|
return new FilmImagesResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
var json = await response.Content.ReadAsStringAsync();
|
||||||
|
return Newtonsoft.Json.JsonConvert.DeserializeObject<FilmImagesResponse>(json)
|
||||||
|
?? new FilmImagesResponse();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// Extra artwork must never break metadata updates.
|
||||||
|
_logger.LogWarning(ex, "Failed to load images for film {FilmId}", filmId);
|
||||||
|
return new FilmImagesResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Task<ICollection<StaffResponse>> GetStaff(int filmId, CancellationToken? cancellationToken = null)
|
public Task<ICollection<StaffResponse>> GetStaff(int filmId, CancellationToken? cancellationToken = null)
|
||||||
=> Invoke((ct) => _apiClient.StaffAllAsync(filmId, ct), cancellationToken);
|
=> Invoke((ct) => _apiClient.StaffAllAsync(filmId, ct), cancellationToken);
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||||
<PackageReference Include="NSwag.MSBuild" Version="13.18.2">
|
<PackageReference Include="NSwag.MSBuild" Version="13.18.2">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
|
namespace KinopoiskUnofficialInfo.ApiClient
|
||||||
|
{
|
||||||
|
public class BadSpouseSexConverter : StringEnumConverter
|
||||||
|
{
|
||||||
|
public override bool CanConvert(System.Type objectType)
|
||||||
|
=> objectType == typeof(PersonResponse_spousesSex);
|
||||||
|
|
||||||
|
public override object ReadJson(
|
||||||
|
JsonReader reader,
|
||||||
|
System.Type objectType,
|
||||||
|
object existingValue,
|
||||||
|
JsonSerializer serializer)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return base.ReadJson(reader, objectType, existingValue, serializer);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return (PersonResponse_spousesSex)(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ namespace KinopoiskUnofficialInfo.ApiClient
|
|||||||
new BadIntegerConverter(),
|
new BadIntegerConverter(),
|
||||||
new BadDoubleConverter(),
|
new BadDoubleConverter(),
|
||||||
new BadProfessionKeyConverter(),
|
new BadProfessionKeyConverter(),
|
||||||
|
new BadSpouseSexConverter(),
|
||||||
new BadProductionStatusConverter(),
|
new BadProductionStatusConverter(),
|
||||||
new BadFilmSearchResponse_filmsTypeConverter(),
|
new BadFilmSearchResponse_filmsTypeConverter(),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user