terrelsa13 / MUMC

Multi-User Media Cleaner aka MUMC (pronounced Mew-Mick) will go through movies, tv episodes, audio tracks, and audiobooks in your Emby/Jellyfin libraries deleting media items you no longer want.
GNU General Public License v3.0
93 stars 6 forks source link

Favorited movie is deleted #74

Closed keppo070 closed 11 months ago

keppo070 commented 1 year ago
MUMC Version: 4.1.18-beta
Emby Version: 4.7.11.0
Python Version: 3.9.2
Time Stamp: 20230304090026

FirstUser

Inspecting Media Item: 20565
Media Item Is Monitored: True
Processing Movie Item: 20565

Preparing Movie 20565 For Output
0 exist in [{'Name': 'Les Films Ariane', 'Id': 17386}, {'Name': 'Cerito Films', 'Id': 17385}]
Finished Preparing Movie 20565 For Output
Does Media Item 20565 Meet The played Count Filter?...
1 >= 1 : True
IsPlayed IsCreated Filter Value: 
Does Media Item 20565 Meet The created Count Filter?...
1 >= 0 : True

Movie 20565 is NOT favorited.
ActionBehavior=3
ActionType=favorited
MonitoredUsersAction=any
IsMeetingAction=False
MonitoredUsersMeetPlayedFilter=ignore
IsMeetingPlayedFilter=True
ConfiguredBehavior=keep
ItemId=20565
ActionBehavior=0
ActionType=whitetagged
MonitoredUsersAction=all
IsMeetingAction=False
MonitoredUsersMeetPlayedFilter=ignore
IsMeetingPlayedFilter=True
ConfiguredBehavior=keep
ItemId=20565
ActionBehavior=0
ActionType=blacktagged
MonitoredUsersAction=all
IsMeetingAction=False
MonitoredUsersMeetPlayedFilter=any
IsMeetingPlayedFilter=True
ConfiguredBehavior=delete
ItemId=20565

Comparing the below two items
'f137a2dd21bbc1b99aa5c0f6bf02a805':''
Item is whitelisted/blacklisted for this user: False
Matching whitelisted/blacklisted value for this user is: 
LibraryId is: f137a2dd21bbc1b99aa5c0f6bf02a805
LibraryPath is: /data/movies
LibraryNetPath is: 
Whitelisted/Blacklisted Keys are: 
Whitelisted/Blacklisted Paths are: 
Whitelisted/Blacklisted NetworkPaths are: 
ActionBehavior=3
ActionType=whitelisted
MonitoredUsersAction=any
IsMeetingAction=False
MonitoredUsersMeetPlayedFilter=ignore
IsMeetingPlayedFilter=True
ConfiguredBehavior=keep
ItemId=20565

Comparing the below two items
'f137a2dd21bbc1b99aa5c0f6bf02a805':'f137a2dd21bbc1b99aa5c0f6bf02a805'
Item is whitelisted/blacklisted for this user: True
Matching whitelisted/blacklisted value for this user is: f137a2dd21bbc1b99aa5c0f6bf02a805
LibraryId is: f137a2dd21bbc1b99aa5c0f6bf02a805
LibraryPath is: /data/movies
LibraryNetPath is: 
Whitelisted/Blacklisted Keys are: f137a2dd21bbc1b99aa5c0f6bf02a805,6c2a057148b4d7c20a207c789aba6d07
Whitelisted/Blacklisted Paths are: /data/movies,/data/tvshows
Whitelisted/Blacklisted NetworkPaths are: ,
ActionBehavior=3
ActionType=blacklisted
MonitoredUsersAction=any
IsMeetingAction=True
MonitoredUsersMeetPlayedFilter=all
IsMeetingPlayedFilter=True
ConfiguredBehavior=delete
ItemId=20565
Is Media Item OK To Delete: True
Is Media Item Favorited For This User: False
Is Media Item An Advanced Favorite: False
Is Media Item WhiteTagged: False
Is Media Item BlackTagged: False
Does Media Item Match The Play Count Filter: True
Does Media Item Meet Number Of Days Since Played: True
Does Media Item Match The Created Played Count Filter: True
Does Media Item Meet Number Of Days Since Created-Played: True
Is Media Item WhiteListed For This User: False

Captured UTC time is: 2023-03-04 08:00:26.771096
Date last played or date created is: 2023-02-11T16:21:13.0000000Z
Formatted date last played or date created is: 2023-02-11 16:21:13
Media item was last 'Played 20 days ago'

Captured UTC time is: 2023-03-04 08:00:26.771096
Date last played or date created is: 2022-02-07T02:32:25.0000000Z
Formatted date last played or date created is: 2022-02-07 02:32:25
Media item was last 'Played 390 days ago'

:*[DELETE] - Movie - The Professional - Les Films Ariane - Played 20 days ago - Play Count: 1 - Created 390 days ago - Favorite: False - WhiteTag: False - BlackTag: False - Whitelisted: False - Blacklisted: True - MovieID: 20565

SecondUser

Inspecting Media Item: 20565
Media Item Is Monitored: True
Processing Movie Item: 20565

Preparing Movie 20565 For Output
0 exist in [{'Name': 'Les Films Ariane', 'Id': 17386}, {'Name': 'Cerito Films', 'Id': 17385}]
Finished Preparing Movie 20565 For Output
Does Media Item 20565 Meet The played Count Filter?...
2 >= 1 : True
IsPlayed IsCreated Filter Value: 
Does Media Item 20565 Meet The created Count Filter?...
2 >= 0 : True
ActionBehavior=3
ActionType=favorited
MonitoredUsersAction=any
IsMeetingAction=True
MonitoredUsersMeetPlayedFilter=ignore
IsMeetingPlayedFilter=False
ConfiguredBehavior=keep
ItemId=20565
ActionBehavior=0
ActionType=whitetagged
MonitoredUsersAction=all
IsMeetingAction=False
MonitoredUsersMeetPlayedFilter=ignore
IsMeetingPlayedFilter=False
ConfiguredBehavior=keep
ItemId=20565
ActionBehavior=0
ActionType=blacktagged
MonitoredUsersAction=all
IsMeetingAction=False
MonitoredUsersMeetPlayedFilter=any
IsMeetingPlayedFilter=False
ConfiguredBehavior=delete
ItemId=20565

Comparing the below two items
'f137a2dd21bbc1b99aa5c0f6bf02a805':''
Item is whitelisted/blacklisted for this user: False
Matching whitelisted/blacklisted value for this user is: 
LibraryId is: f137a2dd21bbc1b99aa5c0f6bf02a805
LibraryPath is: /data/movies
LibraryNetPath is: 
Whitelisted/Blacklisted Keys are: 
Whitelisted/Blacklisted Paths are: 
Whitelisted/Blacklisted NetworkPaths are: 
ActionBehavior=3
ActionType=whitelisted
MonitoredUsersAction=any
IsMeetingAction=False
MonitoredUsersMeetPlayedFilter=ignore
IsMeetingPlayedFilter=False
ConfiguredBehavior=keep
ItemId=20565

Comparing the below two items
'f137a2dd21bbc1b99aa5c0f6bf02a805':'f137a2dd21bbc1b99aa5c0f6bf02a805'
Item is whitelisted/blacklisted for this user: True
Matching whitelisted/blacklisted value for this user is: f137a2dd21bbc1b99aa5c0f6bf02a805
LibraryId is: f137a2dd21bbc1b99aa5c0f6bf02a805
LibraryPath is: /data/movies
LibraryNetPath is: 
Whitelisted/Blacklisted Keys are: f137a2dd21bbc1b99aa5c0f6bf02a805,6c2a057148b4d7c20a207c789aba6d07
Whitelisted/Blacklisted Paths are: /data/movies,/data/tvshows
Whitelisted/Blacklisted NetworkPaths are: ,
ActionBehavior=3
ActionType=blacklisted
MonitoredUsersAction=any
IsMeetingAction=True
MonitoredUsersMeetPlayedFilter=all
IsMeetingPlayedFilter=False
ConfiguredBehavior=delete
ItemId=20565
Is Media Item OK To Delete: False
Is Media Item Favorited For This User: True
Is Media Item An Advanced Favorite: False
Is Media Item WhiteTagged: False
Is Media Item BlackTagged: False
Does Media Item Match The Play Count Filter: True
Does Media Item Meet Number Of Days Since Played: False
Does Media Item Match The Created Played Count Filter: True
Does Media Item Meet Number Of Days Since Created-Played: True
Is Media Item WhiteListed For This User: False

Captured UTC time is: 2023-03-04 08:00:26.771096
Date last played or date created is: 2023-03-04T07:39:49.0000000Z
Formatted date last played or date created is: 2023-03-04 07:39:49
Media item was last 'Played <1 day ago'

Captured UTC time is: 2023-03-04 08:00:26.771096
Date last played or date created is: 2022-02-07T02:32:25.0000000Z
Formatted date last played or date created is: 2022-02-07 02:32:25
Media item was last 'Played 390 days ago'

:[KEEPING] - Movie - The Professional - Les Films Ariane - Played <1 day ago - Play Count: 2 - Created 390 days ago - Favorite: True - WhiteTag: False - BlackTag: False - Whitelisted: False - Blacklisted: True - MovieID: 20565

Result

Sending Delete Request For: 20565
URL:
http://192.168.178.11:8096/emby/Items/20565?api_key=f8xxxx47
Request:
<urllib.request.Request object at 0x7f5e2ad2e7c0>[DELETED]     Movie - The Professional - 20565
keppo070 commented 1 year ago

favorited_behavior_movie=['keep', 'any', 'ignore', 3]

terrelsa13 commented 1 year ago

Hey, please attach your config. I am not able to reproduce this on my end.

keppo070 commented 1 year ago

mumc_config.py.txt

terrelsa13 commented 1 year ago

Got it! I wasn't making the correct assumption about your created_filter_movie config option. Once I change it to match yours I was able to reproduce.

Try with latest v4 trunk v4.1.20; issue should be fixed. Let me know if it is not.

keppo070 commented 1 year ago

Thnx for the quick fix.

keppo070 commented 1 year ago

For some reason it seems this issued returned. I removed 1 user from the config file. I'm running single user now.

Again the script is trying te remove "The Professional". Taste differ off course but why does the script hates this movie that it will remove it....

While playing with the options I noticed that Console Outputs is CaseSensitive and I noticed that the debug.log is removed when debug=0 (could be on purpose off course)

MUMC Version: 4.1.20
Emby Version: 4.7.11.0
Python Version: 3.9.2
Time Stamp: 20230513221159
:[KEEPING] - Movie - The Professional - Cerito Films - Unplayed - Play Count: 0 - Created 460 days ago - Favorite: True - WhiteTag: False - BlackTag: False - Whitelisted: False - Blacklisted: True - MovieID: 20565

[DELETED] Movie - The Professional - 20565

terrelsa13 commented 1 year ago

Lol, I am not sure why the script hates this movie. More likely something I did wrong. :D

While playing with the options I noticed that Console Outputs is CaseSensitive

I do not understand what you mean by the console is case-sensitive.

I noticed that the debug.log is removed when debug=0 (could be on purpose off course)

Yep. This is by design. Debug file is deleted every time the script runs. When DEBUG >= 1 it is recreated. When DEBUG=0 it is not recreated. The debug file can be large. No reason to keep it around when debug is disabled.

keppo070 commented 1 year ago

I meant that the True and False are case-sensitive in the section "Enable/Disable console outputs by type" not a real issue. I just got an error when I used true instead of True

terrelsa13 commented 1 year ago

Ahhh yes. That is because Python requires True/False as Boolean values. I'm just passing the True/False directly to Python without manipulation.

Are you able to share the mumc_DEBUG.log? That way I can see what is happening.

terrelsa13 commented 1 year ago

I should clarify. Set DEBUG=4

terrelsa13 commented 1 year ago

If you are not able to share the mumc_DEBUG.log I will at least need to see your mumc_config.py so I can try to reproduce on my end.

keppo070 commented 1 year ago

I'm trying to get my test environment working. I am not so comfortable to share the entire db inside the log.

My config is the same as in https://github.com/terrelsa13/MUMC/issues/74#issuecomment-1455155938 but now only 1 user. Just me.

mumc_config.py.txt

keppo070 commented 1 year ago

mumc_DEBUG.log.txt

terrelsa13 commented 1 year ago

@keppo070 Think I found the issue. Working on the fix.

terrelsa13 commented 1 year ago

@keppo070 I have not forgotten about this. Long story short the Played Conditional portion of the script was only taking into account all, any, and ignore for monitored users meeting the played_filter. Your issue uncovered the script also needs to give options to account for monitored users meeting the played_filter and/or created_played_filter. Below are the new options that will be added for Played_Conditional for all behaviors.

# Played Conditional (Y): Specify how monitored users must meet the played_filter_* and/or created_filter_*.
#   all - Every monitored user(s) must meet the Played Count and Played Count Inequality of both the played_filter_* and created_filter_*
#   any - One or more monitored user(s) must meet the Played Count and Played Count Inequality of either the played_filter_* or created_filter_*
#   all_any - Every monitored user(s) must meet the Played Count and Played Count Inequality of either the played_filter_* or created_filter_*
#   any_all - One or more monitored user(s) must meet the Played Count and Played Count Inequality of both the played_filter_* and created_filter_*
#   all_played - Every monitored user(s) must meet the Played Count and Played Count Inequality of the played_filter_*
#   any_played - One or more monitored user(s) must meet the Played Count and Played Count Inequality of the played_filter_*
#   all_created - Every monitored user(s) must meet the Played Count and Played Count Inequality of the created_filter_*
#   any_created - One or more monitored user(s) must meet the Played Count and Played Count Inequality of the created_filter_*
#   ignore - Ignore if monitored user(s) meet the Played Count and Played Count Inequality of both the played_filter_* and created_filter_*

Because this change has been so extensive I have also taken it as an opportunity to break the single large script into modules. There are also other feature requests and general improvements I am making as well. Apologies for it taking such a long time. I still have a few more feature requests to figure out how to implement; followed by testing. I wish I could give you an ETA, but between life and work I am making changes here and there as fast as I can.

terrelsa13 commented 11 months ago

@keppo070 v5 of this script on the beta branch is ~85% complete. It has the additional played conditional options mentioned above.

The config is moving from the legacy format to a yaml format for v5. There is a legacy to yaml converter that should convert the existing config to the new yaml format. But I have only run it on my config. If you are looking to try v5 I suggest copying your current mumc directory so you can go back to it.

There are also a few other items like the config editor and various documentation that are still WIP.

Long story short; YMMV w/ v5