media_cleaner icon indicating copy to clipboard operation
media_cleaner copied to clipboard

script fails on items that are missing

Open rcmpayne opened this issue 4 years ago • 5 comments

Receiving error on all items that are watched but missing

`Error encounter:

{'Name': 'Episode 15', 'ServerId': '8421c3xxxxxxxxxxxxxxxxxxxxxxxxeb', 'Id': '34906', 'IndexNumber': 15, 'ParentIndexNumber': 9, 'IsFolder': False, 'Type': 'Episode', 'ParentLogoItemId': '13996', 'ParentBackdropItemId': '13996', 'ParentBackdropImageTags': ['d0e490e4253dd7a60747c8637d17e23c', 'bcb049b1a8b979b60f8344b3b823814b'], 'UserData': {'PlaybackPositionTicks': 0, 'PlayCount': 1, 'IsFavorite': False, 'LastPlayedDate': '2019-01-29T02:23:29.0000000+00:00', 'Played': True}, 'SeriesId': '13996', 'SeasonId': '13998', 'SeriesPrimaryImageTag': '70f77846509cf2173ded22611a926c8b', 'ImageTags': {}, 'BackdropImageTags': [], 'ParentLogoImageTag': '8914369c16c715171ac5e198fd89a84d', 'ParentThumbItemId': '13996', 'ParentThumbImageTag': '7478b7ccc10569f42037593562092b23', 'LocationType': 'Virtual', 'MediaType': 'Video'} `

If i go to that show in emby i see its Added 2019-01-20 but Missing

http://app.emby.media/#!/item?id=34906&serverId=8421c3xxxxxxxxxxxxxxxxxxxaeb

rcmpayne avatar Aug 16 '20 20:08 rcmpayne

@rcmpayne Are you saying before this script ran the episode was deleted from the hard drive, but Emby still thinks it is there?

terrelsa13 avatar Sep 05 '20 23:09 terrelsa13

correct

rcmpayne avatar Sep 15 '20 17:09 rcmpayne

From what I see recreating this issue, Emby happily tries to delete files that are no longer there and does not throw an error.

I think this has more to do with what data is returned from emby for a given media item VS what the script is looking for. In the newest script I attempted to take this into account by handling the exception of missing data by only looking for the minimum needed to delete (Type, Name, and ID). But I see now I did not remove the calls to exit() so the script is unable to continue into the exception once it encounters missing data.

For instance this what the emby data of an episode I manually deleted from the hard drive and then ran the script to delete looks like.

{'Name': 'Just the Tips', 'ServerId': '9#############################8', 'Id': '3211302', 'RunTimeTicks': 12912070000, 'IndexNumber': 3, 'ParentIndexNumber': 4, 'IsFolder': False, 'Type': 'Episode', 'ParentLogoItemId': '1528', 'ParentBackdropItemId': '1528', 'ParentBackdropImageTags': ['fca5c82ac103b253c681bc0c50b82a13'], 'UserData': {'PlaybackPositionTicks': 0, 'PlayCount': 1, 'IsFavorite': False, 'LastPlayedDate': '2019-01-02T06:08:41.0000000+00:00', 'Played': True}, 'SeriesName': 'Broad City', 'SeriesId': '1528', 'SeasonId': '1957', 'SeriesPrimaryImageTag': 'f02cfa205599f9cfd1f1ee3892e29d6f', 'SeasonName': 'Season 4', 'ImageTags': {'Primary': '885da7fee00a4c7a61147f1b76f0d30c'}, 'BackdropImageTags': [], 'ParentLogoImageTag': '63d19ae2f9e7c1ecf31fefa69517e107', 'ParentThumbItemId': '1528', 'ParentThumbImageTag': 'bca2732a1e9538c823a74b9d85694d0e', 'MediaType': 'Video'}

You can see emby returns an additional piece data called "SeriesName" which is needed to build the more detailed version of output.

Try these changes. Let me know if they work for you.

terrelsa13 avatar Sep 17 '20 03:09 terrelsa13

@rcmpayne FYI - The patch above no longer exists and has been merged into my trunk until clara-j is able to merge them here.

terrelsa13 avatar Sep 21 '20 23:09 terrelsa13

@rcmpayne This has been resolved for quite some time. Please close this issue.

terrelsa13 avatar Oct 28 '21 15:10 terrelsa13