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

nice feature that it would be nice to have #27

Open
elvis0288 opened this issue Oct 10, 2021 · 3 comments
Open

nice feature that it would be nice to have #27

elvis0288 opened this issue Oct 10, 2021 · 3 comments

Comments

@elvis0288
Copy link

@terrelsa13 hello how are you?

so i have been using the script for a long time now and everything is working perfectly with it.. i even switch to Linux. now here is my situation..

couple of times per month, i will add new users to jellyfin so the problem is that then i will need to delete the config file for the media cleaner and run it again.. and imagine every time it get bigger and bigger..

do you think there is a way in which i will just run something and instead of having to run everything again, it will just check the config and let you select just the new users to add into the already configured config file?

Thanks!

@terrelsa13
Copy link
Contributor

@elvis0288 I am doing well. Hope you are too.

This is a good idea. If/when I have the time to make such an update to this script I will keep it in mind.
But it sounds like your use-case may fall outside of the normal. I would bet the average home adds and removes users much less often. But I will offer you two solutions and hopefully one is helpful.

1. Create Generic Users Up Front

If I recall you correctly, you are using Ombi to manage your user accounts. If this is still true; create as many extra generic users/passwords as you need in emby/jf. Run the script one last time. Add all of the current and new generic users. Disable access for the unused generic users in Ombi. When you need to add/remove a user; instead enable/disable their access from Ombi.

2. Manually Edit The Config File (Advanced Users Only)

Make a copy of the current config so you can restore it if the manual edit is wrong.

Manually Add User Keys

  1. Log into emby/jf as the admin and go to Dashboard > Users
  2. Select the new user
  3. In the address bar of your browser for emby it will show http://your.server.ip.address/emby/web/index.html#!/users/user?userId=xxxxxx. For jf it will show http://your.server.ip.address/jellyfin/web/index.html#!/useredit.html?userId==xxxxxx
  4. Copy all 32-characters after userId=
  5. Open the media_cleaner_config.py and find the line that starts with user_keys=
  6. Find the last double quote. Right after the last double quote add: a comma, a space, a double quote, and another double quote. The end of your line should look like this now: ", ""]'
  7. Paste the 32-character userId from step#4 between the two double quotes just added. It should look like this now: ", "xxxxxx"]'

Manually Add Libraries

  1. Depending on if the script is running in blacklist mode or whitelist mode; the library paths are saved either as user_bl_libs= or user_wl_libs=
  2. This is similar to adding user keys except go to Dashboard > Library/Libraries and select the first library you want to add to the config for this user.
  3. You will see your config either has "Folder" paths or "Shared Network Folder" paths; copy the one your config is currenlty using.
  4. Make sure to follow the formatting and do not change the order of already existing groups. Paste in the path copied in step#3.
  5. The user_keys and user_bl/wl_libs must be in the correct grouping order. i.e. The first user_key uses the first group of library paths.
  6. Repeat for as many libraries as necessary.

Save the manually update config and re-run the script.

You can also see an example config in the README.md.

@terrelsa13
Copy link
Contributor

terrelsa13 commented Oct 27, 2021

@elvis0288 Give this branch a try. It should allow you to update your existing config with new users and associate libraries to them.

https://github.com/terrelsa13/media_cleaner/tree/terrelsa13-Update-Existing-Config

You will want to make a copy of your original script and config in case you need to revert back. Download the new script. Replace the old script with the new script. Add the following line anywhere in the copy of your existing config:
UPDATE_CONFIG='FALSE'

When it is 'FALSE' the script will run normally.
When it is 'TRUE' the script will allow you to add new users to the existing config.

Let me know how this works for you.

@terrelsa13
Copy link
Contributor

terrelsa13 commented Oct 28, 2021

@elvis0288 I forgot to tell you to also add the following anywhere in the copy of your config:

Only add the one that matches the behavior you are using.

  • If you are whitelisting libraries add script_behavior='whitelist'.
  • If you are blacklisting libraries add script_behavior='blacklist'.

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

2 participants