WardPearce / jellyfin-session-kicker

Session kicker after X amount of watch time for Jellyfin
GNU Affero General Public License v3.0
15 stars 1 forks source link

DELETE_DEVICE_IF_NO_MEDIA_CONTROLS not working with 10.9.7 #30

Open vortex91 opened 2 months ago

vortex91 commented 2 months ago

seems like all is working per design except clients which do not have media controls. I'm running on 10.9.7

one suggestion instead of killing the device is to disable the user. In admin GUI each user has disable function.

WardPearce commented 2 months ago

Yea knowm issue that some clients can't be stop annoying

vortex91 commented 2 months ago

So why not just disable user via API and then re-enable? this way no need to kill client. Disable user via API automaticaly kicks users client device offline.

menu-dashboard-users->select user-profile-disable user check box. I'm checking API will post back once I find it there.

I think post in /users should work

"IsDisabled": true,

WardPearce commented 2 months ago

feel free to make a PR, otherwise I'll look into this whenever I'm free

vortex91 commented 2 months ago

I ended up writing a separate script which does a bit more of what I need. However this part might come in handy if you wanted it for your scirpt

    # Fetch user profile
    profile_url = f"{base_url}/Users/{user['user_id']}?api_key={api_key}"
    profile_response = requests.get(profile_url)
    profile_data = profile_response.json()

    # Prepare data for disabling user
    disable_data = profile_data['Policy']
    disable_data["IsDisabled"] = True

    disable_url = f"{base_url}/Users/{user['user_id']}/Policy?api_key={api_key}"
    disable_response = requests.post(disable_url, json=disable_data)

    if disable_response.status_code == 204:
        print(f"Disabled user: {user_name}")
    else:
        print(f"Failed to disable user: {user_name} (Status Code: {disable_response.status_code})")