Closed Floflobel closed 10 months ago
@Floflobel Ahh I see. The feature to account for incomplete UserData
from Trakt imports was setting the item['UserData']['LastPlayedDate']
to 'Unplayed' then trying to parse the string as a date-time. Try MUMC-Latest v4.1.21 and let me know if the issue is fixed.
Thank you for your quick fix!
The error has been resolved but it seems that all my media is at "Play Count: 0". I'll check on my side if I don't see anything and send you the logs if necessary.
It seems that there's a problem with Emby's API, rather than a problem with the code. From what I can see in the logs, you're going to batch retrieve the items and that's when it returns a PlayCount of 0:
https://streaming.domain/emby/Users/4fd64ef2422e40e0ba6e095eb9f74ecd/Items?ParentID=db4c1708cbb5dd1676284a40f2950aba&IncludeItemTypes=Movie&StartIndex=151&Limit=25&IsPlayed=True&Fields=Id,ParentId,Path,Tags,MediaSources,DateCreated,Genres,Studios&Recursive=True&SortBy=ParentIndexNumber,IndexNumber,Name&SortOrder=Ascending&EnableImages=False&CollapseBoxSetItems=False&EnableUserData=True&api_key=XXXXX
{
Name: "Fast & Furious X",
...
UserData: {
PlaybackPositionTicks: 0,
PlayCount: 0,
IsFavorite: true,
Played: true
},
...
},
Whereas when I look in my developer console and retrieve the JSON by going to a movie, this is what I get:
https://streaming.domain/emby/Users/4fd64ef2422e40e0ba6e095eb9f74ecd/Items/1229467?Fields=ShareLevel&X-Emby-Client=Emby%20Web&X-Emby-Device-Name=Chromium%20Linux&X-Emby-Device-Id=ada2d6bb-a1d7-49e4-83a5-d38cb737451e&X-Emby-Client-Version=4.8.0.39&X-Emby-Token=XXXXXX&X-Emby-Language=fr
{
Name: "Fast & Furious X",
...
UserData: {
PlaybackPositionTicks: 0,
PlayCount: 1,
IsFavorite: true,
LastPlayedDate: "2023-07-18T20:51:25.0000000Z",
Played: true
},
...
}
I'll keep looking at the API to see if I can find anything.
According to the Emby team, you just need to add this to the request. I'll test it by modifying the script.
Fields=UserDataPlayCount,UserDataLastPlayedDate
Awesome! Thanks for looking into this. I will test it out on my end this weekend.
I've modified the code and everything seems to be working fine as far as UserDataPlayCount is concerned, I still need to fix UserDataLastPlayedDate as all my media are in "Unplayed" status.
I can try to do a PR but I don't think I've done everything right.
However, I'd need your help with the settings because I'm trying to do a fairly basic setup but I can't manage it. I've turned everything upside down. Don't hesitate to let me know if you'd like another issue.
I'd like to delete only media that have 0 play count and were created more than 365 days ago. But taking into account the fact that if a user has seen this movie it shouldn't delete it.
From what I understand, I'll have to play with this parameter:
blacklisted_behavior_movie=['delete', 'any', 'all', 3]
I've tried setting the Played Conditional
to all
but it always deletes my media when someone doesn't meet the criterion.
Floflobel -
...
:*[DELETE] - Movie - Strange Days - 20th Century Fox - Unplayed - Play Count: 0 - Created 870 days ago - Favorite: False - WhiteTag: False - BlackTag: False - Whitelisted: False - Blacklisted: True - MovieID: 1188601
...
-----------------------------------------------------------
User2 -
...
:[KEEPING] - Movie - Strange Days - 20th Century Fox - Unplayed - Play Count: 2 - Created 870 days ago - Favorite: False - WhiteTag: False - BlackTag: False - Whitelisted: False - Blacklisted: True - MovieID: 1188601
...
-----------------------------------------------------------
...
[DELETED] Movie - Strange Days - 1188601
...
Log: mumc_config.py.txt
Np. I made the changes to add UserDataPlayCount and UserDataLastPlayedDate to the Fields= API calls. Should now see it in the latest with v4.1.24.
If you are looking to delete episodes regardless of them being favorited, whitetagged, blacktagged, blacklisted, or whitelisted. Then change created_filter_movie=[360, '==', 0, True]
to created_filter_movie=[360, '==', 0, False]
. The False
should tell the script to ignore if the episode is favorited, whitetagged, blacktagged, blacklisted, or whitelisted and delete it anyway.
If you are looking for something more specific that involves deleting unwatched episodes after 360 days and if it does or does not meet the favorited, whitetagged, blacktagged, blacklisted, or whitelisted behaviors; you will have to explain to me exactly what you want to do.
It seems to work for "UserDataPlayCount" but not for "UserDataLastPlayedDate". All my media with at least 1 playback are in "Unplayed" status.
I'll have a look when I have time.
What I want to do is quite simple: I'd like to delete media with 0 views that were created more than 360 days ago. But I'd like it to take into account the views of all users.
For example, the movie "Strange Days" was created more than 360 days ago and has been viewed at least once by User2, in which case I don't want to delete it. If, on the other hand, nobody had seen it, then I want to delete it. I don't use whitetags and blacktags.
Floflobel -
...
:*[DELETE] - Movie - Strange Days - 20th Century Fox - Unplayed - Play Count: 0 - Created 870 days ago - Favorite: False - WhiteTag: False - BlackTag: False - Whitelisted: False - Blacklisted: True - MovieID: 1188601
...
-----------------------------------------------------------
User2 -
...
:[KEEPING] - Movie - Strange Days - 20th Century Fox - Unplayed - Play Count: 2 - Created 870 days ago - Favorite: False - WhiteTag: False - BlackTag: False - Whitelisted: False - Blacklisted: True - MovieID: 1188601
...
-----------------------------------------------------------
...
[DELETED] Movie - Strange Days - 1188601
...
I also tried setting the option you gave me to "False" but it wasn't really what I wanted and it doesn't change my logic.
I hope my explanation is a little more clear.
I'm sorry to do this again, but I've tried to figure it out again and I can't see how to do it. Could you please have some time to help me with the settings?
@Floflobel my apologies. Life and work have been busy. Any time I am able to find to work on this script; I spend on v5 of the script. I unfortunately do not have the bandwidth at this time to support both v4 and v5.
In general to delete media based on its creation date you will want to disable the played condition days and instead only use the created condition days. Then if you set the created count inequality and created count to the desired value; the script should only delete media based off of the creation date and the created played inequality + count specified.
No problem for your absence, it's perfectly understandable :). If you wish I can open a new issue rather than discuss this problem in this one?
I've just tested with V5 because I didn't quite understand which was the "main" version.
I only set a "created_filter_movie" and it works fine. However, when I put blacklisted_behavior_movie=['delete', 'all', 'all', 3]
. I expect it to take all my users into account when deleting or not deleting media, but that's not the case.
Floflobel -
...
:*[DELETE] - Movie - Strange Days - 20th Century Fox - Unplayed - Play Count: 0 - Created 870 days ago - Favorite: False - WhiteTag: False - BlackTag: False - Whitelisted: False - Blacklisted: True - MovieID: 1188601
...
-----------------------------------------------------------
User2 -
...
:[KEEPING] - Movie - Strange Days - 20th Century Fox - Unplayed - Play Count: 2 - Created 870 days ago - Favorite: False - WhiteTag: False - BlackTag: False - Whitelisted: False - Blacklisted: True - MovieID: 1188601
...
-----------------------------------------------------------
...
MOVIE POST PROCESSING STARTED...
...
[DELETED] Movie - Strange Days - 1188601
...
DELETE + KEEP = KEEP
For me when I set all
to Played Conditional (Y): Specify how monitored users must meet played_filter_*.
It should keep my media.
v4 is under the MUMC-Latest branch. v5 is under the MUMC-Beta branch.
Looks like you may have grabbed the latest version of v4.
I really need to see your whole config to make sense of this. There could be other options set causing this movie to be kept instead of deleted.
I am not sure v4 can do what you want. But try these settings.
played_filter_movie=[-1, '>=', 1]
created_filter_movie=[300, '>=', 1, True]
favorited_behavior_movie=['keep', 'any', 'ignore', 0]
whitetagged_behavior_movie=['keep', 'all', 'ignore', 0]
blacktagged_behavior_movie=['delete', 'all', 'any', 0]
whitelisted_behavior_movie=['keep', 'any', 'ignore', 0]
blacklisted_behavior_movie=['delete', 'any', 'any', 5]
There is a known gap in played conditional
of v4 where the script was not taking into account all variations of the played count
/equality
and created count
/equality
for behavioral statements
. Below are the options available for v5.
v4 only had all
,any
, and ignore
. And the all
/any
in v4 were the same as the all_played
/any_played
below for v5.
#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_*
Thank you for your detailed feedback. I've just reinstall all my set-up to V5 and I'm trying to set-up MUMC but every time I get an error:
Traceback (most recent call last):
File "/opt/MUMC_v5/mumc_modules/mumc_config_import.py", line 86, in importConfig
import mumc_config as cfg
ModuleNotFoundError: No module named 'mumc_config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/MUMC_v5/mumc.py", line 113, in
```
2. When I try to initialize the script to generate the configuration file, I have a problem with a "Version" key
```
Monitoring multiple users is possible.
When multiple users are selected; the user with the oldest last played time will determine if media can be deleted.
Select one user at a time.
Enter number of the next user to monitor; leave blank when finished:
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/MUMC_v5/mumc_modules/mumc_config_import.py", line 86, in importConfig
import mumc_config as cfg
ModuleNotFoundError: No module named 'mumc_config'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/MUMC_v5/mumc.py", line 113, in <module>
main()
File "/opt/MUMC_v5/mumc.py", line 31, in main
cfg,init_dict=importConfig(init_dict,cmdopt_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/MUMC_v5/mumc_modules/mumc_config_import.py", line 102, in importConfig
importHasException(init_dict,cmdopt_dict)
File "/opt/MUMC_v5/mumc_modules/mumc_config_import.py", line 22, in importHasException
build_configuration_file(init_dict)
File "/opt/MUMC_v5/mumc_modules/mumc_config_builder.py", line 156, in build_configuration_file
yaml_configurationBuilder(the_dict)
File "/opt/MUMC_v5/mumc_modules/mumc_configuration_yaml.py", line 79, in yaml_configurationBuilder
config_data={thekey:the_dict_copy[thekey] for thekey in the_dict_keys}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/MUMC_v5/mumc_modules/mumc_configuration_yaml.py", line 79, in <dictcomp>
config_data={thekey:the_dict_copy[thekey] for thekey in the_dict_keys}
~~~~~~~~~~~~~^^^^^^^^
KeyError: 'version'
```
I tried to figure out where it was coming from but couldn't. So I tried to remove the "version" key by replacing this line:
https://github.com/terrelsa13/MUMC/blob/93b282d6049f597a0fd16631c487df181f133c8f/mumc_modules/mumc_configuration_yaml.py#L78
with this:
```
the_dict_keys=[,'basic_settings','advanced_settings','admin_settings','DEBUG']
```
But I think it's stuck somewhere. The configuration file is created, but every time I run the script again, it throws back the initial set-up to configure the server. I've checked that the parameter is set to False: `UPDATE_CONFIG: false`.
To not confuse anyone reading this in the future. I opened a new issue to keep v4 and v5 issues separate.
Closing. v4 is sun-setting. Do not have the bandwidth to fix v4 and develop v5.
Hello,
I've been trying to get your tool to work for a while but I can't. I'm always confronted with a problem. The most annoying problem is this error message:
DEBUG: