clara-j / media_cleaner

Python script to delete watched content on Emby
31 stars 17 forks source link

issue when using your latest script #19

Closed elvis0288 closed 3 years ago

elvis0288 commented 3 years ago

Hello @terrelsa13 using the latest config will throw this error image

elvis0288 commented 3 years ago

image this is how it looks on the config

terrelsa13 commented 3 years ago

@elvis0288 On the surface this appears to be the same issue of having a single quote in your path name. I understand Windows and Linux allow the use of single quotes in a path name. But why is it necessary for your media library paths?

Find and replace the two instances of this... libfolders.replace('\'','\\\'')

With This... libfolders.replace("'","\'")

\ If that works, I will update the script.

elvis0288 commented 3 years ago

that did not work but i am actually changing all my folder names so it will not have that ' anymore

Thanks!

elvis0288 commented 3 years ago

so i download you latest script and remove all the ' from my folders but i am getting an error when running the script after the configuration image

terrelsa13 commented 3 years ago

Backslash is the escape character in python.

I do not have a windows. So I am able to set up an emby/jellyfin server to test this. Will you try two possible solutions for me?...

Open your config file...

  1. Find the user_bl_libs and/or user_wl_libs variable
  2. Replace all single backslashes with double backslashes. So from this "\" to this "\\". Try running the script like this.
  3. Make sure remove_files=0

Then re-open your config file...

  1. Again, fnd the user_bl_libs and/or user_wl_libs variable
  2. Replace all double backslashes with single forward slashes. So from "\\" to this "/". Try running the script like this.
  3. Make sure remove_files=0

Which of these works?

terrelsa13 commented 3 years ago

@elvis0288 Will you also send a screenshot of the FULL paths shown when the script is run for the first time and blacklist and/or whitelists are being selected for a user?

elvis0288 commented 3 years ago

this is how it shows image and this is how you have it on the config image

elvis0288 commented 3 years ago

the first option was still giving the error.. the second option went through with the -1 of the media to delete but when i put 180 days it displayed a different error. image

but if the error is not related then the correct way would be: image

terrelsa13 commented 3 years ago

That last error (KeyError: 'Size') means the metadata item ['Size'] does not seem to exist for the episode it is currently making a keep/delete decision on. I added this check because I came across what appeared to be a placeholder media item that was created by the server before it was actually moved from its initial folder into where it will be located in the tv/movie/etc... folder structure. That can probably be fixed by checking if the metadata item exists before trying to use it. Then make to decision to use one, both, or none in this case.

As for the paths issue: I will need a little bit of time to get a Windows emby/jellyfin server up and running so I can try a few things out for handling Windows paths. I have to figure out how to store these Windows paths and then read them back out. What I do not know is if using the forward slash will still match paths when reading the config to deciding if the media item is blacklisted or whitelisted. For now, manually edit the config with forward slashes in the whitelist/blacklist.

This branch should get you past the KeyError: 'Size' issue.

elvis0288 commented 3 years ago

hello after using the new branch and the forward slash this happens image

so it looks like no errors but nothing shows as watched and i do have a lot of items right now that has been watched

Thanks!

terrelsa13 commented 3 years ago

What I do not know is if using the forward slash will still match paths when reading the config to deciding if the media item is blacklisted or whitelisted.

Yeah, I mentioned that. When it is looking for a matching path "/" is not he same as "\". So nothing is seen as needing to be deleted.

I will be able to fix this after I get a Windows emby/jellyfin server up and running.

elvis0288 commented 3 years ago

Hello @terrelsa13 any news on this?

Thanks!

terrelsa13 commented 3 years ago

Try this this branch.

Let me know if this fixes the issue with handling paths in Windows.

I suggest creating a new configuration file.

elvis0288 commented 3 years ago

i am trying blacklist with the same result.. nothing is found image

elvis0288 commented 3 years ago

trying to use whitelist to see if that works but the config file cannot be created image

elvis0288 commented 3 years ago

actually blacklist also have this issue if i do not select another user.. so if i just pick 1 user it will show that error image

elvis0288 commented 3 years ago

actually it is happening in both if i do not select all my users.. so if i select just something other than my 6 users then it will throw that error

elvis0288 commented 3 years ago

ok sorry so many messages, i just tested whitelist and it is scanning and bringing back info image so it looks like there is 2 issues. one is the blacklist not working correctly and two is that if you do not add all users it will display an error and it will not create the config file

but it looks like at least on whitelist the path on windows is working now Thanks!.

terrelsa13 commented 3 years ago

i am trying blacklist with the same result.. nothing is found image

For this, please read the "ATTENTION!!!" message and enable at least one media type to be monitored.

terrelsa13 commented 3 years ago

I will have to look into the user selection issue.

terrelsa13 commented 3 years ago

The user selection bug has been fixed and committed to the same link as above.

elvis0288 commented 3 years ago

it is working perfectly now thank you so much