Giter VIP home page Giter VIP logo

Comments (9)

crobibero avatar crobibero commented on June 20, 2024 1

Most of the work would be ensure you update the photo when it changes.

You could likely use the existing controller as a base and modify if needed
https://github.com/jellyfin/jellyfin/blob/release-10.8.z/Jellyfin.Api/Controllers/ImageController.cs#L106-L135

from jellyfin-plugin-ldapauth.

soupglasses avatar soupglasses commented on June 20, 2024

@crobibero Would you be able to guesstimate the complexity/difficulty of implementing this feature? I have been thinking of taking a shot at implementing this myself, but I am unsure of how difficult it would be to connect up the pieces.

from jellyfin-plugin-ldapauth.

soupglasses avatar soupglasses commented on June 20, 2024

Thanks for pointing me in the right direction. I do not think i will get around to it soon, as I have yet to properly learn C#. But when i get around to doing that, this issue is one on my radar id like to help out with.

from jellyfin-plugin-ldapauth.

AlphaJack avatar AlphaJack commented on June 20, 2024

What about adding an option for avar providers such as https://www.libravatar.org/?

for instance, if %(mail_hash)s is a placeholder of the md5 hash of the email attribute, avatars could be found at https://seccdn.libravatar.org/avatar/%(mail_hash)s

from jellyfin-plugin-ldapauth.

timosturm avatar timosturm commented on June 20, 2024

Is there any update on this?

from jellyfin-plugin-ldapauth.

SanseroGames avatar SanseroGames commented on June 20, 2024

I want this feature, so I'd be willing to spend time on this.

I had a look at the code and came up with an idea how to implement this. The easiest way would be to update the image every time, but given that there is already code that only updates the user if a change is needed, I assume for the profile picture it should behave the same.

So to check whether an update is needed I would hash the LDAP-attribute data and compare it against the hash of the current profile picture. LDAP (or at least LLDAP, which I'm using with Jellyfin) does not have a modification timestamp for a single attribute, or the user in general, which is why I would opt for something like a hash.

For the hash of the current profile picture I have three ideas:

  1. Recalculate the hash every time. Would have to read the file directly from the filesystem
    • Pro: Simple implementation. Keeps filesystem the same as without the plugin
    • Con: Unnecessary overhead, hash could be cached, but I expect the overhead to be negligible, as profile pictures usually are not that large.
  2. Store the hash in the filename of the image.
    • Pro: Hash is in the filename which is stored in the user object. No filesystem access needed to get the hash.
    • Con: Potential clean up problem and cluttering of the file system as each hash creates a distinct filename
  3. Store hash in separate file
  • Pro: New profile picture overwrite old ones, so no clean up necessary
  • Con: extra file specifically to the plugin lying around. Need to read file every time.

Any thoughts on this? If the performance impact of hashing a file is not too big, I think I'd go with 1 as it is the simplest solution. If direct filesystem access from the plugin is a problem and there is already a built in cleanup mechanism, I think option 2 would be best.

Edit: 1 could also be done by just comparing the saved file with the LDAP-attribute byte-by-byte directly without hashing, which would be faster.

from jellyfin-plugin-ldapauth.

crobibero avatar crobibero commented on June 20, 2024

Instead of updating the image on every login attempt, why not create a scheduled task that updates it daily by default and allows the admin to change the frequency

Still pull in the image on initial user create

To store the hash I would probably create a standalone file that contains a serialized list of userIds and image hashes

from jellyfin-plugin-ldapauth.

SanseroGames avatar SanseroGames commented on June 20, 2024

Good point with the scheduled task, wasn't aware of them. This is actually better, as this also updates the profile image of users that stay logged in on their devices.

Regarding storing the hash, I could store it in the plugin configuration, as there is already a list of all known users. I iterate over this list anyway, so it would be convenient.
The downside of caching the hash is that we have no way of knowing whether a user changed their profile image in Jellyfin after it has been synchronized.

from jellyfin-plugin-ldapauth.

crobibero avatar crobibero commented on June 20, 2024

The downside of caching the hash is that we have no way of knowing whether a user changed their profile image in Jellyfin after it has been synchronized.

I don't think it's necessary but we could hook into the user info updated event.

Putting a note on the config page to enable this new feature that it's a one-way sync

from jellyfin-plugin-ldapauth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.