shemanaev / jellyfin-plugin-webhooks

Webhooks for Jellyfin
MIT License
20 stars 0 forks source link

Incorrect return of "ItemAdded" data #10

Closed zeroquinc closed 1 year ago

zeroquinc commented 1 year ago

Hey,

I try to fetch data from the ItemAdded webhook. But somehow it only returns me with this:

{
    "Event": "ItemAdded",
    "Item": {
        "Name": "Wyatt McClure",
        "ServerId": "af7c5b6e32874f2d87c9e829105c5bd0",
        "Id": "8400f51f207e2593965395fb85070d1d",
        "Etag": "891cdddb048bd1efe33188512db0697d",
        "DateCreated": "2023-09-18T07:59:57.7348443Z",
        "CanDelete": false,
        "CanDownload": false,
        "SortName": "Wyatt McClure",
        "ExternalUrls": [],
        "Path": "/config/metadata/People/W/Wyatt McClure",
        "EnableMediaSourceDisplay": true,
        "ChannelId": null,
        "Taglines": [],
        "Genres": [],
        "RemoteTrailers": [],
        "ProviderIds": {},
        "ParentId": null,
        "Type": "Person",
        "People": [],
        "Studios": [],
        "GenreItems": [],
        "LocalTrailerCount": 0,
        "ChildCount": 1,
        "SpecialFeatureCount": 0,
        "DisplayPreferencesId": "b607178b0ac2f604a458d3d2363fdc83",
        "Tags": [],
        "ImageTags": {},
        "BackdropImageTags": [],
        "ImageBlurHashes": {},
        "LocationType": "FileSystem",
        "LockedFields": [],
        "TrailerCount": 0,
        "MovieCount": 0,
        "SeriesCount": 0,
        "ProgramCount": 0,
        "EpisodeCount": 1,
        "SongCount": 0,
        "AlbumCount": 0,
        "ArtistCount": 0,
        "MusicVideoCount": 0,
        "LockData": false
    },
    "Server": {
        "Id": "af7c5b6e32874f2d87c9e829105c5bd0",
        "Name": "skywalker",
        "Version": "10.8.10.0"
    },
    "AdditionalData": []
}

It's always a random actor and not the actual episode / movie itself. Am I doing something wrong? The value "Play" works correctly for me.

zeroquinc commented 1 year ago

ItemRemoved is working fine as well;

"Event": "ItemRemoved",
    "Item": {
        "Name": "Young Sheldon",
        "OriginalTitle": "Young Sheldon",
        "ServerId": "af7c5b6e32874f2d87c9e829105c5bd0",
        "Id": "0b3521d30f09596069de171bf9dba8e9",
        "Etag": "b64cc0e7d2b2bab113e6143d18892cac",
        "DateCreated": "2023-09-18T07:33:00.298931Z",
        "CanDelete": true,
        "CanDownload": false,
        "SortName": "young sheldon",
        "PremiereDate": "2017-09-25T00:00:00.0000000Z",
        "ExternalUrls": [
            {
                "Name": "IMDb",
                "Url": "https://www.imdb.com/title/tt6226232"
            },
            {
                "Name": "TheMovieDb",
                "Url": "https://www.themoviedb.org/tv/71728"
            },
            {
                "Name": "TheTVDB",
                "Url": "https://www.thetvdb.com/?tab=series&id=328724"
            },
            {
                "Name": "Trakt",
                "Url": "https://trakt.tv/shows/tt6226232"
            }
        ],

Hmm weird, now I get the same behavior on ItemRemoved..

{
    "Event": "ItemRemoved",
    "Item": {
        "Name": "CBS",
        "ServerId": "af7c5b6e32874f2d87c9e829105c5bd0",
        "Id": "0f59424070d17d52775061ff61a822b8",
        "Etag": "9c429e960503e65d8f29ca38c8181efc",
        "DateCreated": "2023-09-18T07:34:21.6400728Z",
        "CanDelete": false,
        "CanDownload": false,
        "SortName": "cbs",
        "ExternalUrls": [],
        "Path": "/config/metadata/Studio/CBS",
        "EnableMediaSourceDisplay": true,
        "ChannelId": null,
        "Taglines": [],
        "Genres": [],
        "RemoteTrailers": [],
        "ProviderIds": {},
        "ParentId": null,
        "Type": "Studio",
        "People": [],
        "Studios": [],
        "GenreItems": [],
        "LocalTrailerCount": 0,
        "ChildCount": 0,
        "SpecialFeatureCount": 0,
        "DisplayPreferencesId": "0e5ff622278219b86a4ebea9119b9e6d",
        "Tags": [],
        "ImageTags": {
            "Thumb": "55cc430fb8167a2c598932496f5cafc0"
        },
        "BackdropImageTags": [],
        "ImageBlurHashes": {
            "Thumb": {
                "55cc430fb8167a2c598932496f5cafc0": "WUL;:H?ct7%gxu%f_Nt7M{WVaxjs?bog9FRiM{Rj~qt7IUofWBWV"
            }
        },
        "LocationType": "FileSystem",
        "LockedFields": [],
        "TrailerCount": 0,
        "MovieCount": 0,
        "SeriesCount": 0,
        "ProgramCount": 0,
        "EpisodeCount": 0,
        "SongCount": 0,
        "AlbumCount": 0,
        "ArtistCount": 0,
        "MusicVideoCount": 0,
        "LockData": false
    },
    "Server": {
        "Id": "af7c5b6e32874f2d87c9e829105c5bd0",
        "Name": "skywalker",
        "Version": "10.8.10.0"
    },
    "AdditionalData": []
}
zeroquinc commented 1 year ago

Sorry for closing. The problem with the plugin is that for ItemAdded it never returns any episode info, only show info.

It only does it on ItemUpdated, but using that is unreliable cause it will also trigger on metadata changes.

shemanaev commented 1 year ago

I can't reproduce that. When episode added, it correctly fires ItemAdded, then ItemUpdated events for Episode and all new Actors (if any). Same for movies.

Also, the trick is you probably want to listen to ItemUpdated anyway, because when ItemAdded fired, Jellyfin don't have any metadata (like movie name, etc...) yet. Best bet is to watch for "MetadataImport" in "AdditionalData".

{
  "Event": "ItemUpdated",
  "Item": {
    ...
  },
  "AdditionalData": [
    "None",
    "MetadataImport",
    "ImageUpdate",
    "MetadataDownload"
  ]
}
zeroquinc commented 1 year ago

Thank you for your comment that works fine!