From bb084a98bca5663bb2ec5a1012a1bdd37e8ee36b Mon Sep 17 00:00:00 2001 From: Szymon Uglis Date: Sat, 9 Nov 2024 15:19:29 +0100 Subject: [PATCH] Add bathPath helper property on AuthenticatedJellyfinClient --- lib/src/modules/jellyfin.dart | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/src/modules/jellyfin.dart b/lib/src/modules/jellyfin.dart index 9b49713..92b7005 100644 --- a/lib/src/modules/jellyfin.dart +++ b/lib/src/modules/jellyfin.dart @@ -160,6 +160,8 @@ class AuthenticatedJellyfinClient { final Tentacle jellyfinClient; final JellyfinConfigUser configUser; + String? get basePath => configUser.config?.basePath; + AuthenticatedJellyfinClient(this.jellyfinClient, this.configUser); Future> getCurrentSessions() async { @@ -245,12 +247,12 @@ class AuthenticatedJellyfinClient { } Future startTask(String taskId) => jellyfinClient.getScheduledTasksApi().startTask(taskId: taskId); - Uri getItemPrimaryImage(String itemId) => Uri.parse("${configUser.config?.basePath}/Items/$itemId/Images/Primary"); - Uri getJellyfinItemUrl(String itemId) => Uri.parse("${configUser.config?.basePath}/#/details?id=$itemId"); - Uri getUserImage(String userId, [String? imageTag]) => Uri.parse( - "${configUser.config?.basePath}/Users/$userId/Images/Primary${imageTag != null ? '?tag=$imageTag' : ''}"); - Uri getUserProfile(String userId) => - Uri.parse('${configUser.config?.basePath}/web/#/userprofile.html?userId=$userId'); + + Uri getItemPrimaryImage(String itemId) => Uri.parse("$basePath/Items/$itemId/Images/Primary"); + Uri getJellyfinItemUrl(String itemId) => Uri.parse("$basePath/#/details?id=$itemId"); + Uri getUserImage(String userId, [String? imageTag]) => + Uri.parse("$basePath/Users/$userId/Images/Primary${imageTag != null ? '?tag=$imageTag' : ''}"); + Uri getUserProfile(String userId) => Uri.parse('$basePath/web/#/userprofile.html?userId=$userId'); } class AnonymousJellyfinClient {