Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error #1

Closed
henrik9999 opened this issue Sep 21, 2019 · 11 comments
Closed

Error #1

henrik9999 opened this issue Sep 21, 2019 · 11 comments

Comments

@henrik9999
Copy link

henrik9999 commented Sep 21, 2019

Traceback (most recent call last):
  File "media_cleaner.py", line 155, in <module>
    deleteItems=get_items(cfg.server_url, cfg.user_key, auth_key)
  File "media_cleaner.py", line 124, in get_items
    item_details=item['Type'] +' - '+ item['Name'] +' - ' + item['UserData']['LastPlayedDate'] + ' - ' + item['UserData']['Key'] + ' - ' + item['Id']
KeyError: 'Key'
@clara-j
Copy link
Owner

clara-j commented Sep 22, 2019

I have a new version coming maybe later today that adds support to ignore items marked as favorite. I will try to get this fixed with that too.

@henrik9999
Copy link
Author

Any updates?

@clara-j
Copy link
Owner

clara-j commented Oct 11, 2019

I have pushed a version that should fix the issue. Sorry for the delay, been busy with family and work so I just did a bug fix and will work on new version with more features later.

@clara-j clara-j closed this as completed Oct 25, 2019
@terrelsa13
Copy link
Contributor

terrelsa13 commented Oct 26, 2019

@henrik9999 Were you able to get this resolved? I am seeing the same error on a fresh install, as of 2 hours ago.

Items to be deleted
Traceback (most recent call last):
  File "./media_cleaner.py", line 159, in <module>
    list_items(deleteItems)
  File "./media_cleaner.py", line 145, in list_items
    item_details=item['Name'] + ' - ' + item['UserData']['LastPlayedDate'] + ' - ' + item['UserData']['Key'] + ' - ' + item['Id']
KeyError: 'Key'

@terrelsa13
Copy link
Contributor

terrelsa13 commented Oct 26, 2019

After some playing around with this script I was able to determine item['UserData']['Key'] either never was, or is no longer available thru the API. Removing it resolved the error.


Option#1
Find this line:

item_details=item['Name'] + ' - ' + item['UserData']['LastPlayedDate'] + ' - ' + item['UserData']['Key'] + ' - ' + item['Id']

Make it look like this:

item_details=item['Name'] + ' - ' + item['UserData']['LastPlayedDate'] + ' - ' + item['Id']

Option#2
Comment out or delete a couple lines. If you chose option#2 your media will still be deleted as expected, but you will not get a summary of the deleted media at the end.

Comment out lines by adding # in front of them like this:

#item_details=item['Name'] + ' - ' + item['UserData']['LastPlayedDate'] + ' - ' + item['UserData']['Key'] + ' - ' + item['Id']
#print('----' + item_details)

@clara-j clara-j reopened this Oct 26, 2019
@clara-j
Copy link
Owner

clara-j commented Oct 26, 2019

Let me look into this, I have re-opened the issue. I thought I had fixed it, but I guess I missed an instance of the Key value.

For some reason on my server I don't have this issue as all items have the Key value.

@clara-j
Copy link
Owner

clara-j commented Oct 26, 2019

I just pushed a new version that removed the other Key value.

I had thought the first fix had removed all references to it, but missed the one on that delete command.

Let me know if it is now working for you.

@terrelsa13
Copy link
Contributor

terrelsa13 commented Oct 27, 2019

Thanks @clara-j that seems to have fixed it.

Now it seems like my emby server side does not like these requests. You ever get this from emby?
https://pastebin.com/raw/X3jNKqCk

@clara-j
Copy link
Owner

clara-j commented Oct 27, 2019

Can you open another issue for this. I want to resolve this one and we can then discuss in the new ticket but looks like a permission issue.

Make sure the user emby is running under has delete permissions on the files/folders for your media. I originally had this when I had docker for emby configured as read only for the folder I was using for media.

@terrelsa13
Copy link
Contributor

Yep. I will open a new issue.

@terrelsa13
Copy link
Contributor

I would also say the original issue posted here is now closed. Unless your update did not solve it for @henrik9999

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants