mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
fix(music): complete subscription lifecycle
This commit is contained in:
@@ -3,6 +3,7 @@ from typing import Any, Dict, Generator, List, Optional, Tuple, Union
|
||||
from app import schemas
|
||||
from app.core.context import MediaInfo
|
||||
from app.core.event import eventmanager
|
||||
from app.helper.mediaserver import MusicMediaServerHelper
|
||||
from app.log import logger
|
||||
from app.modules import _MediaServerBase, _ModuleBase
|
||||
from app.modules.jellyfin.jellyfin import Jellyfin
|
||||
@@ -153,17 +154,14 @@ class JellyfinModule(_ModuleBase, _MediaServerBase[Jellyfin]):
|
||||
if not s:
|
||||
continue
|
||||
if mediainfo.type == MediaType.MUSIC:
|
||||
matches = s.get_music(
|
||||
title=getattr(mediainfo, "title", None),
|
||||
artist=getattr(mediainfo, "artist", None),
|
||||
album=getattr(mediainfo, "album", None),
|
||||
)
|
||||
if matches:
|
||||
matches = s.get_music(**MusicMediaServerHelper.search_params(mediainfo))
|
||||
match = MusicMediaServerHelper.find_match(mediainfo, matches)
|
||||
if match:
|
||||
return schemas.ExistMediaInfo(
|
||||
type=MediaType.MUSIC,
|
||||
server_type="jellyfin",
|
||||
server=name,
|
||||
itemid=matches[0].item_id,
|
||||
itemid=match.item_id,
|
||||
)
|
||||
continue
|
||||
if mediainfo.type == MediaType.MOVIE:
|
||||
|
||||
@@ -7,6 +7,7 @@ from requests import Response
|
||||
|
||||
from app import schemas
|
||||
from app.core.config import settings
|
||||
from app.helper.mediaserver import MusicMediaServerHelper
|
||||
from app.log import logger
|
||||
from app.schemas import MediaType
|
||||
from app.utils.http import RequestUtils
|
||||
@@ -490,6 +491,8 @@ class Jellyfin:
|
||||
url = f"{self._host}Users/{self.user}/Items"
|
||||
params = {
|
||||
"IncludeItemTypes": "MusicAlbum,Audio",
|
||||
"Fields": "Album,AlbumArtist,AlbumArtists,Artists,ArtistItems,ChildCount,"
|
||||
"ProviderIds,OriginalTitle,ProductionYear,Path,ParentId",
|
||||
"searchTerm": query,
|
||||
"Recursive": "true",
|
||||
"Limit": 20,
|
||||
@@ -904,6 +907,8 @@ class Jellyfin:
|
||||
imdbid=item.get("ProviderIds", {}).get("Imdb"),
|
||||
tvdbid=item.get("ProviderIds", {}).get("Tvdb"),
|
||||
path=item.get("Path"),
|
||||
note=MusicMediaServerHelper.build_note(item)
|
||||
if item.get("Type") in {"MusicAlbum", "Audio"} else None,
|
||||
user_state=user_state
|
||||
|
||||
)
|
||||
@@ -977,7 +982,9 @@ class Jellyfin:
|
||||
params = {
|
||||
"ParentId": parent,
|
||||
"api_key": self._apikey,
|
||||
"Fields": "ProviderIds,OriginalTitle,ProductionYear,Path,UserDataPlayCount,UserDataLastPlayedDate,ParentId",
|
||||
"Fields": "Album,AlbumArtist,AlbumArtists,Artists,ArtistItems,ChildCount,"
|
||||
"ProviderIds,OriginalTitle,ProductionYear,Path,UserDataPlayCount,"
|
||||
"UserDataLastPlayedDate,ParentId",
|
||||
}
|
||||
if limit is not None and limit != -1:
|
||||
params.update({
|
||||
|
||||
Reference in New Issue
Block a user