-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Added fix_permissions plugin #1098
Conversation
|
||
# check permissions | ||
if not check_permissions(path, file_perm): | ||
message = 'There was a problem fixing permission on {}'.format(path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use util.bytestring_path(path)
to avoid Unicode errors when logging.
Awesome! Thanks for contributing. This is a great little addition, and I'm sure others will be interested too. If you don't mind my bikeshedding a couple of small details:
|
Oh, one last detail I forgot to mention: we will need to add a documentation page for the plugin under |
im so glad for your feedback. i will work on everything you mentioned :) |
so... i think i put all your suggestions into this plugin. im not sure about the documentary page. what do you think? |
im trying to get my head around writing tests. for my own tests... like changing permissions and importing them... and see what permissions are on the importet files everything works fine. now i try to write a test and it doesnt work at all. maybe anyone with an idea? i read through some beets plugin testing code and i thought this is how it works. but the files just dont get chmod'ed.
i have the feeling that the function which listens on 'after_write' doesnt get executed on the tests. i put a "print('IM GOT EXECUTED')" in it. and it doesnt get printed on the tests. if i run a normal "beet import myfile" it gets printed. i would be so glad for help. |
Hmm... I don't see anything wrong immediately. Would you mind adding the tests to this PR, and I'll do some debugging on my end? |
added. i have the feeling that it has something to do with the listen('after_write'). maybe i will rewrite the plugin to use listen('import'). maybe that could give me a hint. hey and thanks alot for being so kind to people who try to code something for this aweseome piece of software :) |
i changed listen to use "item_copied" instead of "after_write". now everything works even the tests. any thinkable downsides of using item_copied? |
I'm guessing this is because the test importer is configured not to write files by default. This seems like the right thing in any case, though, because it lets you fix the permissions for new files in your library even if you're not writing tags into files. And it also might be more efficient to only do this on import, trusting the permissions to be fixed from that point on on subequent writes. Thanks again! ✨ I'll merge this now. |
i needed a plugin to fix some file permissions while importing files. so i created it :)