diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index bb3ac708..7f2bf80a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -396,6 +396,7 @@ jobs:
COMMIT_SHA=$(git rev-parse HEAD)
echo "Version: $VERSION"
+ echo "Flutter SDK Version: $FLUTTER_VERSION"
echo "Date: $DATE"
echo "Commit SHA: $COMMIT_SHA"
@@ -403,8 +404,8 @@ jobs:
sed -i "s/{{VERSION}}/$VERSION/g" linux/com.edde746.plezy.metainfo.xml
sed -i "s/{{DATE}}/$DATE/g" linux/com.edde746.plezy.metainfo.xml
- # Replace commit SHA placeholder in manifest
- sed -i "s/{{COMMIT_SHA}}/$COMMIT_SHA/g" linux/com.edde746.plezy.yml
+ # Replace placeholders in manifest
+ sed -i "s|{{COMMIT_SHA}}|$COMMIT_SHA|g" linux/com.edde746.plezy.yml
- name: Preprocess Flatpak manifest with flatpak-flutter
run: |
@@ -433,7 +434,15 @@ jobs:
path: plezy.flatpak
create-release:
- needs: [build-android, build-ios, build-macos, build-windows, build-linux, build-flatpak]
+ needs:
+ [
+ build-android,
+ build-ios,
+ build-macos,
+ build-windows,
+ build-linux,
+ build-flatpak,
+ ]
runs-on: ubuntu-latest
permissions:
contents: write
diff --git a/README.md b/README.md
index 002d5c5c..e2092494 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ Plezy is a modern Plex media client that provides a seamless streaming experienc
-> Google Play version is in closed testing ([required by Google](https://support.google.com/googleplay/android-developer/answer/14151465#overview)). Join the [Google Group](https://groups.google.com/g/plezy-testers) to get access.
+> Google Play version is in closed testing ([required by Google](https://support.google.com/googleplay/android-developer/answer/14151465#overview)). Join the [Google Group](https://groups.google.com/g/plezy-testers-2) to get access.
### Desktop
- [Windows (x64)](https://github.com/edde746/plezy/releases/latest/download/plezy-windows-installer.exe)
diff --git a/lib/client/plex_client.dart b/lib/client/plex_client.dart
index fdb7bc2d..534e1621 100644
--- a/lib/client/plex_client.dart
+++ b/lib/client/plex_client.dart
@@ -703,21 +703,39 @@ class PlexClient {
/// Get available sort options for a library section
Future> getLibrarySorts(String sectionId) async {
try {
- // Fetch library content with minimal data to get Sort metadata
- final response = await _dio.get(
- '/library/sections/$sectionId/all',
- queryParameters: {'X-Plex-Container-Size': 0},
- );
+ // Use the dedicated sorts endpoint
+ final response = await _dio.get('/library/sections/$sectionId/sorts');
- final container = _getMediaContainer(response);
- if (container != null && container['Sort'] != null) {
- return (container['Sort'] as List)
- .map((json) => PlexSort.fromJson(json as Map))
- .toList();
+ // Parse the Directory array (not Sort array) per the API spec
+ final sorts = _extractDirectoryList(response, PlexSort.fromJson);
+
+ if (sorts.isNotEmpty) {
+ return sorts;
}
// Fallback: return common sort options if API doesn't provide them
- return [
+ return _getFallbackSorts(sectionId);
+ } catch (e) {
+ appLogger.e('Failed to get library sorts: $e');
+ // Return fallback sort options on error
+ return _getFallbackSorts(sectionId);
+ }
+ }
+
+ Future> _getFallbackSorts(String sectionId) async {
+ try {
+ // Get library type to determine which sorts to include
+ final librariesResponse = await _dio.get('/library/sections');
+ final libraries = _extractDirectoryList(
+ librariesResponse,
+ PlexLibrary.fromJson,
+ );
+ final library = libraries.firstWhere(
+ (lib) => lib.key == sectionId,
+ orElse: () => libraries.first,
+ );
+
+ final fallbackSorts = [
PlexSort(key: 'titleSort', title: 'Title', defaultDirection: 'asc'),
PlexSort(
key: 'addedAt',
@@ -725,6 +743,21 @@ class PlexClient {
title: 'Date Added',
defaultDirection: 'desc',
),
+ ];
+
+ // Add "Latest Episode Air Date" only for TV show libraries
+ if (library.type.toLowerCase() == 'show') {
+ fallbackSorts.add(
+ PlexSort(
+ key: 'episode.originallyAvailableAt',
+ descKey: 'episode.originallyAvailableAt:desc',
+ title: 'Latest Episode Air Date',
+ defaultDirection: 'desc',
+ ),
+ );
+ }
+
+ fallbackSorts.addAll([
PlexSort(
key: 'originallyAvailableAt',
descKey: 'originallyAvailableAt:desc',
@@ -737,10 +770,12 @@ class PlexClient {
title: 'Rating',
defaultDirection: 'desc',
),
- ];
+ ]);
+
+ return fallbackSorts;
} catch (e) {
- appLogger.e('Failed to get library sorts: $e');
- // Return fallback sort options on error
+ appLogger.e('Failed to get fallback sorts: $e');
+ // Return minimal fallback options
return [
PlexSort(key: 'titleSort', title: 'Title', defaultDirection: 'asc'),
PlexSort(
diff --git a/linux/com.edde746.plezy.yml b/linux/com.edde746.plezy.yml
index 81ed2026..a9def21e 100644
--- a/linux/com.edde746.plezy.yml
+++ b/linux/com.edde746.plezy.yml
@@ -76,11 +76,10 @@ modules:
sources:
- type: git
- url: https://github.com/edde746/plex-flutter.git
+ url: https://github.com/edde746/plezy.git
commit: {{COMMIT_SHA}}
- type: git
url: https://github.com/flutter/flutter.git
- # NOTE: This will be replaced with SDK modules by flatpak-flutter preprocessing
- tag: stable
+ tag: 3.35.6
dest: flutter