From 3e6aa54a8c5d5ab927ca2707f0c0088009c29816 Mon Sep 17 00:00:00 2001 From: Wendell Jones Date: Fri, 27 Feb 2026 18:10:36 -0500 Subject: [PATCH] Add Windows startup config and Jellyfin API test script Added startup.json with Windows-specific default paths and documentation for Jellyfin configuration. Introduced test_api.py, a Python script to authenticate with Jellyfin, create a backup, and list backups using the REST API. --- Jellyfin.Server/startup.json | 14 ++++++++++ test_api.py | 53 ++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 Jellyfin.Server/startup.json create mode 100644 test_api.py diff --git a/Jellyfin.Server/startup.json b/Jellyfin.Server/startup.json new file mode 100644 index 00000000..f832195b --- /dev/null +++ b/Jellyfin.Server/startup.json @@ -0,0 +1,14 @@ +{ + "_comment": "Jellyfin Startup Configuration - Windows defaults - using C:/ProgramData/jellyfin", + "_note": "These paths will be used unless overridden by environment variables or command-line arguments", + "_priority": "Command-line args \u003E Environment variables \u003E This file \u003E Built-in defaults", + "_examples": "See startup.linux.json or startup.windows.json in Resources/Configuration for other OS examples", + "Paths": { + "DataDir": "C:/ProgramData/jellyfin", + "ConfigDir": "C:/ProgramData/jellyfin", + "CacheDir": "C:/ProgramData/jellyfin/cache", + "LogDir": "C:/ProgramData/jellyfin/log", + "TempDir": "C:\\Users\\wjones\\AppData\\Local\\Temp\\jellyfin", + "WebDir": "C:/ProgramData/jellyfin/wwwroot" + } +} \ No newline at end of file diff --git a/test_api.py b/test_api.py new file mode 100644 index 00000000..f94c89c4 --- /dev/null +++ b/test_api.py @@ -0,0 +1,53 @@ +import requests + +# Define connection details +server_url = 'http://localhost:8096' +username = 'admin' +password = 'Optimus0329' + +backup_options = { + "Database": True, # Include database + "Config": True, # Include config files + "Data": True, # Include data files + "Root": True, # Include root folder + "MediaFiles": False # Exclude media files +} + +# Build json payload with auth data +auth_data = { + 'username': username, + 'Pw': password +} + +headers = {} + +# Build required connection headers +authorization = 'MediaBrowser Client="other", Device="my-script", DeviceId="some-unique-id", Version="0.0.0"' + +headers['Authorization'] = authorization + +# Authenticate to server +r = requests.post(server_url + '/Users/AuthenticateByName', headers=headers, json=auth_data) + +# Retrieve auth token and user id from returned data +token = r.json().get('AccessToken') +user_id = r.json().get('User').get('Id') + +# Update the headers to include the auth token +headers['Authorization'] = f'{authorization}, Token="{token}"' +headers['Content-Type'] = 'application/json' + +# Requests can be made with +#requests.get(f'{server_url}/api/endpoint', headers=headers) + +# Create a backup (empty body is OK, will use default options) +print("Creating backup...") +response = requests.post(f'{server_url}/Backup/Create', headers=headers, json={}) +print(f"Status: {response.status_code}") +print(response.text) + +# List all backups +print("\nListing backups...") +response = requests.get(f'{server_url}/Backup', headers=headers) +print(f"Status: {response.status_code}") +print(response.text)