Skip to content

Commit

Permalink
Add bathPath helper property on AuthenticatedJellyfinClient
Browse files Browse the repository at this point in the history
  • Loading branch information
l7ssha committed Nov 9, 2024
1 parent 512dad3 commit bb084a9
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/src/modules/jellyfin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ class AuthenticatedJellyfinClient {
final Tentacle jellyfinClient;
final JellyfinConfigUser configUser;

String? get basePath => configUser.config?.basePath;

AuthenticatedJellyfinClient(this.jellyfinClient, this.configUser);

Future<Iterable<SessionInfo>> getCurrentSessions() async {
Expand Down Expand Up @@ -245,12 +247,12 @@ class AuthenticatedJellyfinClient {
}

Future<void> 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 {
Expand Down

0 comments on commit bb084a9

Please sign in to comment.