Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3620f89ec8 | ||
|
|
789f1f468d | ||
|
|
b1d2b4f3f1 | ||
|
|
289ca393c7 | ||
|
|
a52b62c1b1 | ||
|
|
90ecfe8ff0 | ||
|
|
ab915d0258 | ||
|
|
0f704230f0 | ||
|
|
63ba2bb3de | ||
|
|
79ac2793e3 | ||
|
|
3c89d0eba8 | ||
|
|
e072960d36 | ||
|
|
fb17600bb0 | ||
|
|
a2a5a5ae55 | ||
|
|
00d6f920f0 | ||
|
|
5f78bbe93a | ||
|
|
b1c44e639c | ||
|
|
81393fea19 | ||
|
|
18c7661c3d | ||
|
|
8a184f6ae6 | ||
|
|
6f6c403437 | ||
|
|
44245b2340 | ||
|
|
da96ca00b4 | ||
|
|
0e62d92287 | ||
|
|
fe7f4fe744 | ||
|
|
95585ad222 | ||
|
|
f4dbaffc23 | ||
|
|
3313239b4b | ||
|
|
661913f7c9 | ||
|
|
867992e96b | ||
|
|
18c322f66a | ||
|
|
f43fbd0951 | ||
|
|
0eb84dc7d2 | ||
|
|
11461eefe5 | ||
|
|
b0ee43d8cd | ||
|
|
263eddbdba | ||
|
|
bf26894231 | ||
|
|
9f4818d5c5 | ||
|
|
dc44354036 | ||
|
|
b7c630f10e |
@@ -63,11 +63,11 @@ body:
|
||||
description: Which platform(s) are affected?
|
||||
multiple: true
|
||||
options:
|
||||
- Android
|
||||
- iOS
|
||||
- Web
|
||||
- macOS
|
||||
- Android
|
||||
- Windows
|
||||
- macOS
|
||||
- Android TV
|
||||
- Linux
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -49,11 +49,11 @@ body:
|
||||
description: Which platform(s) should this feature target?
|
||||
multiple: true
|
||||
options:
|
||||
- Android
|
||||
- iOS
|
||||
- Web
|
||||
- macOS
|
||||
- Android
|
||||
- Windows
|
||||
- macOS
|
||||
- Android TV
|
||||
- Linux
|
||||
- All platforms
|
||||
|
||||
|
||||
@@ -10,3 +10,6 @@ analyzer:
|
||||
dart_code_linter:
|
||||
rules:
|
||||
- avoid-unused-parameters
|
||||
|
||||
formatter:
|
||||
page_width: 120
|
||||
|
||||
@@ -1,10 +1,22 @@
|
||||
package com.edde746.plezy
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
import io.flutter.embedding.engine.FlutterEngine
|
||||
import com.edde746.plezy.mpv.MpvPlayerPlugin
|
||||
|
||||
class MainActivity : FlutterActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
// Disable Android's default focus highlight ring that appears when using
|
||||
// D-pad navigation so the Flutter UI can render its own focus state.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
window.decorView.defaultFocusHighlightEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
|
||||
super.configureFlutterEngine(flutterEngine)
|
||||
flutterEngine.plugins.add(MpvPlayerPlugin())
|
||||
|
||||
@@ -3,7 +3,46 @@ PODS:
|
||||
- Flutter
|
||||
- device_info_plus (0.0.1):
|
||||
- Flutter
|
||||
- DKImagePickerController/Core (4.3.9):
|
||||
- DKImagePickerController/ImageDataManager
|
||||
- DKImagePickerController/Resource
|
||||
- DKImagePickerController/ImageDataManager (4.3.9)
|
||||
- DKImagePickerController/PhotoGallery (4.3.9):
|
||||
- DKImagePickerController/Core
|
||||
- DKPhotoGallery
|
||||
- DKImagePickerController/Resource (4.3.9)
|
||||
- DKPhotoGallery (0.0.19):
|
||||
- DKPhotoGallery/Core (= 0.0.19)
|
||||
- DKPhotoGallery/Model (= 0.0.19)
|
||||
- DKPhotoGallery/Preview (= 0.0.19)
|
||||
- DKPhotoGallery/Resource (= 0.0.19)
|
||||
- SDWebImage
|
||||
- SwiftyGif
|
||||
- DKPhotoGallery/Core (0.0.19):
|
||||
- DKPhotoGallery/Model
|
||||
- DKPhotoGallery/Preview
|
||||
- SDWebImage
|
||||
- SwiftyGif
|
||||
- DKPhotoGallery/Model (0.0.19):
|
||||
- SDWebImage
|
||||
- SwiftyGif
|
||||
- DKPhotoGallery/Preview (0.0.19):
|
||||
- DKPhotoGallery/Model
|
||||
- DKPhotoGallery/Resource
|
||||
- SDWebImage
|
||||
- SwiftyGif
|
||||
- DKPhotoGallery/Resource (0.0.19):
|
||||
- SDWebImage
|
||||
- SwiftyGif
|
||||
- file_picker (0.0.1):
|
||||
- DKImagePickerController/PhotoGallery
|
||||
- Flutter
|
||||
- Flutter (1.0.0)
|
||||
- flutter_webrtc (0.11.3):
|
||||
- Flutter
|
||||
- WebRTC-SDK (= 125.6422.04)
|
||||
- gamepads_ios (0.1.1):
|
||||
- Flutter
|
||||
- os_media_controls (0.0.1):
|
||||
- Flutter
|
||||
- package_info_plus (0.4.5):
|
||||
@@ -11,56 +50,135 @@ PODS:
|
||||
- path_provider_foundation (0.0.1):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- SDWebImage (5.21.3):
|
||||
- SDWebImage/Core (= 5.21.3)
|
||||
- SDWebImage/Core (5.21.3)
|
||||
- share_plus (0.0.1):
|
||||
- Flutter
|
||||
- shared_preferences_foundation (0.0.1):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- sqflite_darwin (0.0.4):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- sqlite3 (3.51.1):
|
||||
- sqlite3/common (= 3.51.1)
|
||||
- sqlite3/common (3.51.1)
|
||||
- sqlite3/dbstatvtab (3.51.1):
|
||||
- sqlite3/common
|
||||
- sqlite3/fts5 (3.51.1):
|
||||
- sqlite3/common
|
||||
- sqlite3/math (3.51.1):
|
||||
- sqlite3/common
|
||||
- sqlite3/perf-threadsafe (3.51.1):
|
||||
- sqlite3/common
|
||||
- sqlite3/rtree (3.51.1):
|
||||
- sqlite3/common
|
||||
- sqlite3/session (3.51.1):
|
||||
- sqlite3/common
|
||||
- sqlite3_flutter_libs (0.0.1):
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- sqlite3 (~> 3.51.1)
|
||||
- sqlite3/dbstatvtab
|
||||
- sqlite3/fts5
|
||||
- sqlite3/math
|
||||
- sqlite3/perf-threadsafe
|
||||
- sqlite3/rtree
|
||||
- sqlite3/session
|
||||
- SwiftyGif (5.4.5)
|
||||
- url_launcher_ios (0.0.1):
|
||||
- Flutter
|
||||
- wakelock_plus (0.0.1):
|
||||
- Flutter
|
||||
- WebRTC-SDK (125.6422.04)
|
||||
- workmanager_apple (0.0.1):
|
||||
- Flutter
|
||||
|
||||
DEPENDENCIES:
|
||||
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
||||
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
||||
- file_picker (from `.symlinks/plugins/file_picker/ios`)
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_webrtc (from `.symlinks/plugins/flutter_webrtc/ios`)
|
||||
- gamepads_ios (from `.symlinks/plugins/gamepads_ios/ios`)
|
||||
- os_media_controls (from `.symlinks/plugins/os_media_controls/ios`)
|
||||
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||
- share_plus (from `.symlinks/plugins/share_plus/ios`)
|
||||
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
|
||||
- sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)
|
||||
- sqlite3_flutter_libs (from `.symlinks/plugins/sqlite3_flutter_libs/darwin`)
|
||||
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)
|
||||
- workmanager_apple (from `.symlinks/plugins/workmanager_apple/ios`)
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- DKImagePickerController
|
||||
- DKPhotoGallery
|
||||
- SDWebImage
|
||||
- sqlite3
|
||||
- SwiftyGif
|
||||
- WebRTC-SDK
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
connectivity_plus:
|
||||
:path: ".symlinks/plugins/connectivity_plus/ios"
|
||||
device_info_plus:
|
||||
:path: ".symlinks/plugins/device_info_plus/ios"
|
||||
file_picker:
|
||||
:path: ".symlinks/plugins/file_picker/ios"
|
||||
Flutter:
|
||||
:path: Flutter
|
||||
flutter_webrtc:
|
||||
:path: ".symlinks/plugins/flutter_webrtc/ios"
|
||||
gamepads_ios:
|
||||
:path: ".symlinks/plugins/gamepads_ios/ios"
|
||||
os_media_controls:
|
||||
:path: ".symlinks/plugins/os_media_controls/ios"
|
||||
package_info_plus:
|
||||
:path: ".symlinks/plugins/package_info_plus/ios"
|
||||
path_provider_foundation:
|
||||
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
||||
share_plus:
|
||||
:path: ".symlinks/plugins/share_plus/ios"
|
||||
shared_preferences_foundation:
|
||||
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
|
||||
sqflite_darwin:
|
||||
:path: ".symlinks/plugins/sqflite_darwin/darwin"
|
||||
sqlite3_flutter_libs:
|
||||
:path: ".symlinks/plugins/sqlite3_flutter_libs/darwin"
|
||||
url_launcher_ios:
|
||||
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||
wakelock_plus:
|
||||
:path: ".symlinks/plugins/wakelock_plus/ios"
|
||||
workmanager_apple:
|
||||
:path: ".symlinks/plugins/workmanager_apple/ios"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
connectivity_plus: cb623214f4e1f6ef8fe7403d580fdad517d2f7dd
|
||||
device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe
|
||||
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
|
||||
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
|
||||
file_picker: a0560bc09d61de87f12d246fc47d2119e6ef37be
|
||||
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
|
||||
flutter_webrtc: 89f078a5050779eaa4a6a4f472954737bb91f39f
|
||||
gamepads_ios: c75c6d31377d275b0effb9174c619e2705678c09
|
||||
os_media_controls: 86dceab6245a5325af90fc0fdebe243c42d789b4
|
||||
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
|
||||
path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880
|
||||
SDWebImage: 16309af6d214ba3f77a7c6f6fdda888cb313a50a
|
||||
share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a
|
||||
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
|
||||
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0
|
||||
sqlite3: 8d708bc63e9f4ce48f0ad9d6269e478c5ced1d9b
|
||||
sqlite3_flutter_libs: d13b8b3003f18f596e542bcb9482d105577eff41
|
||||
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
|
||||
url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b
|
||||
wakelock_plus: e29112ab3ef0b318e58cfa5c32326458be66b556
|
||||
WebRTC-SDK: c3d69a87e7185fad3568f6f3cff7c9ac5890acf3
|
||||
workmanager_apple: 904529ae31e97fc5be632cf628507652294a0778
|
||||
|
||||
PODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7e
|
||||
|
||||
|
||||
@@ -496,6 +496,7 @@
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = Plezy;
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.entertainment";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
@@ -682,6 +683,7 @@
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = Plezy;
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.entertainment";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
@@ -708,6 +710,7 @@
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = Plezy;
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.entertainment";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>LSSupportsOpeningDocumentsInPlace</key>
|
||||
<true/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
@@ -39,6 +41,8 @@
|
||||
<string>This app needs to connect to your Plex Media Server on your local network.</string>
|
||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
<true/>
|
||||
<key>UIFileSharingEnabled</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
import 'dart:io';
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
import 'tables.dart';
|
||||
import '../models/download_models.dart';
|
||||
import '../utils/app_logger.dart';
|
||||
|
||||
part 'app_database.g.dart';
|
||||
|
||||
// Simplified database with API cache for offline support
|
||||
@DriftDatabase(tables: [DownloadedMedia, DownloadQueue, ApiCache, OfflineWatchProgress])
|
||||
class AppDatabase extends _$AppDatabase {
|
||||
AppDatabase() : super(_openConnection());
|
||||
|
||||
@override
|
||||
int get schemaVersion => 7; // Added OfflineWatchProgress table
|
||||
|
||||
@override
|
||||
MigrationStrategy get migration {
|
||||
return MigrationStrategy(
|
||||
onCreate: (Migrator m) async {
|
||||
await m.createAll();
|
||||
},
|
||||
onUpgrade: (Migrator m, int from, int to) async {
|
||||
// Additive migration for schema version 7
|
||||
if (from < 7) {
|
||||
appLogger.i('Adding OfflineWatchProgress table (v7 migration)');
|
||||
await m.createTable(offlineWatchProgress);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Offline Watch Progress Operations
|
||||
// ============================================================
|
||||
|
||||
/// Get all pending offline watch actions for sync
|
||||
Future<List<OfflineWatchProgressItem>> getPendingWatchActions() {
|
||||
return (select(offlineWatchProgress)..orderBy([(t) => OrderingTerm.asc(t.createdAt)])).get();
|
||||
}
|
||||
|
||||
/// Get pending watch actions for a specific server
|
||||
Future<List<OfflineWatchProgressItem>> getPendingWatchActionsForServer(String serverId) {
|
||||
return (select(offlineWatchProgress)
|
||||
..where((t) => t.serverId.equals(serverId))
|
||||
..orderBy([(t) => OrderingTerm.asc(t.createdAt)]))
|
||||
.get();
|
||||
}
|
||||
|
||||
/// Get the latest action for a specific item
|
||||
Future<OfflineWatchProgressItem?> getLatestWatchAction(String globalKey) {
|
||||
return (select(offlineWatchProgress)
|
||||
..where((t) => t.globalKey.equals(globalKey))
|
||||
..orderBy([(t) => OrderingTerm.desc(t.updatedAt)])
|
||||
..limit(1))
|
||||
.getSingleOrNull();
|
||||
}
|
||||
|
||||
/// Get the latest actions for multiple items in a single query
|
||||
///
|
||||
/// Returns a map of globalKey -> latest action for each key.
|
||||
/// Keys with no actions will not be present in the returned map.
|
||||
Future<Map<String, OfflineWatchProgressItem>> getLatestWatchActionsForKeys(Set<String> globalKeys) async {
|
||||
if (globalKeys.isEmpty) return {};
|
||||
|
||||
// Query all actions for the given keys
|
||||
final allActions =
|
||||
await (select(offlineWatchProgress)
|
||||
..where((t) => t.globalKey.isIn(globalKeys))
|
||||
..orderBy([(t) => OrderingTerm.desc(t.updatedAt)]))
|
||||
.get();
|
||||
|
||||
// Group by globalKey and take the latest (first due to ordering)
|
||||
final result = <String, OfflineWatchProgressItem>{};
|
||||
for (final action in allActions) {
|
||||
// Only keep the first (latest) action for each key
|
||||
result.putIfAbsent(action.globalKey, () => action);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Insert or update a progress action (merges with existing)
|
||||
Future<void> upsertProgressAction({
|
||||
required String serverId,
|
||||
required String ratingKey,
|
||||
required int viewOffset,
|
||||
required int duration,
|
||||
required bool shouldMarkWatched,
|
||||
}) async {
|
||||
final globalKey = '$serverId:$ratingKey';
|
||||
final now = DateTime.now().millisecondsSinceEpoch;
|
||||
|
||||
// Check for existing progress entry
|
||||
final existing =
|
||||
await (select(offlineWatchProgress)
|
||||
..where((t) => t.globalKey.equals(globalKey) & t.actionType.equals('progress'))
|
||||
..limit(1))
|
||||
.getSingleOrNull();
|
||||
|
||||
if (existing != null) {
|
||||
// Update existing progress entry
|
||||
await (update(offlineWatchProgress)..where((t) => t.id.equals(existing.id))).write(
|
||||
OfflineWatchProgressCompanion(
|
||||
viewOffset: Value(viewOffset),
|
||||
duration: Value(duration),
|
||||
shouldMarkWatched: Value(shouldMarkWatched),
|
||||
updatedAt: Value(now),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
// Insert new progress entry
|
||||
await into(offlineWatchProgress).insert(
|
||||
OfflineWatchProgressCompanion.insert(
|
||||
serverId: serverId,
|
||||
ratingKey: ratingKey,
|
||||
globalKey: globalKey,
|
||||
actionType: 'progress',
|
||||
viewOffset: Value(viewOffset),
|
||||
duration: Value(duration),
|
||||
shouldMarkWatched: Value(shouldMarkWatched),
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Insert a manual watch action (watched or unwatched)
|
||||
/// Removes conflicting actions for the same item
|
||||
Future<void> insertWatchAction({
|
||||
required String serverId,
|
||||
required String ratingKey,
|
||||
required String actionType, // 'watched' or 'unwatched'
|
||||
}) async {
|
||||
final globalKey = '$serverId:$ratingKey';
|
||||
final now = DateTime.now().millisecondsSinceEpoch;
|
||||
|
||||
// Remove conflicting actions (opposite action type and progress)
|
||||
await (delete(offlineWatchProgress)..where((t) => t.globalKey.equals(globalKey))).go();
|
||||
|
||||
// Insert the new action
|
||||
await into(offlineWatchProgress).insert(
|
||||
OfflineWatchProgressCompanion.insert(
|
||||
serverId: serverId,
|
||||
ratingKey: ratingKey,
|
||||
globalKey: globalKey,
|
||||
actionType: actionType,
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Delete a specific watch action after successful sync
|
||||
Future<void> deleteWatchAction(int id) {
|
||||
return (delete(offlineWatchProgress)..where((t) => t.id.equals(id))).go();
|
||||
}
|
||||
|
||||
/// Update sync attempt count and error message
|
||||
Future<void> updateSyncAttempt(int id, String? errorMessage) async {
|
||||
final existing = await (select(offlineWatchProgress)..where((t) => t.id.equals(id))).getSingleOrNull();
|
||||
|
||||
if (existing != null) {
|
||||
await (update(offlineWatchProgress)..where((t) => t.id.equals(id))).write(
|
||||
OfflineWatchProgressCompanion(syncAttempts: Value(existing.syncAttempts + 1), lastError: Value(errorMessage)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Get count of pending sync items
|
||||
Future<int> getPendingSyncCount() async {
|
||||
final count = await (selectOnly(offlineWatchProgress)..addColumns([offlineWatchProgress.id.count()]))
|
||||
.map((row) => row.read(offlineWatchProgress.id.count()))
|
||||
.getSingle();
|
||||
return count ?? 0;
|
||||
}
|
||||
|
||||
/// Clear all pending watch actions (e.g., after logout)
|
||||
Future<void> clearAllWatchActions() {
|
||||
return delete(offlineWatchProgress).go();
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Downloaded Media Queries for Watch State Sync
|
||||
// ============================================================
|
||||
|
||||
/// Get all downloaded media items (for syncing watch states)
|
||||
Future<List<DownloadedMediaItem>> getAllDownloadedMetadata() {
|
||||
return (select(downloadedMedia)..where((t) => t.status.equals(DownloadStatus.completed.index))).get();
|
||||
}
|
||||
}
|
||||
|
||||
LazyDatabase _openConnection() {
|
||||
return LazyDatabase(() async {
|
||||
final dbFolder = await getApplicationDocumentsDirectory();
|
||||
final file = File(p.join(dbFolder.path, 'plezy_downloads.db'));
|
||||
return NativeDatabase(file);
|
||||
});
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,94 @@
|
||||
import 'package:drift/drift.dart';
|
||||
|
||||
/// Key-value cache table for Plex API responses.
|
||||
/// Used for offline support - stores raw JSON responses.
|
||||
class ApiCache extends Table {
|
||||
/// Composite key: serverId:endpoint (e.g., "abc123:/library/metadata/12345")
|
||||
TextColumn get cacheKey => text()();
|
||||
|
||||
/// JSON response data
|
||||
TextColumn get data => text()();
|
||||
|
||||
/// Whether this item is pinned for offline access
|
||||
BoolColumn get pinned => boolean().withDefault(const Constant(false))();
|
||||
|
||||
/// Timestamp for cache invalidation (optional future use)
|
||||
DateTimeColumn get cachedAt => dateTime().withDefault(currentDateAndTime)();
|
||||
|
||||
@override
|
||||
Set<Column> get primaryKey => {cacheKey};
|
||||
}
|
||||
|
||||
@DataClassName('DownloadQueueItem')
|
||||
class DownloadQueue extends Table {
|
||||
IntColumn get id => integer().autoIncrement()();
|
||||
TextColumn get mediaGlobalKey => text().unique()();
|
||||
IntColumn get priority => integer().withDefault(const Constant(0))();
|
||||
IntColumn get addedAt => integer()();
|
||||
BoolColumn get downloadSubtitles => boolean().withDefault(const Constant(true))();
|
||||
BoolColumn get downloadArtwork => boolean().withDefault(const Constant(true))();
|
||||
}
|
||||
|
||||
@DataClassName('DownloadedMediaItem')
|
||||
class DownloadedMedia extends Table {
|
||||
IntColumn get id => integer().autoIncrement()();
|
||||
TextColumn get serverId => text()();
|
||||
TextColumn get ratingKey => text()();
|
||||
TextColumn get globalKey => text().unique()();
|
||||
TextColumn get type => text()();
|
||||
TextColumn get parentRatingKey => text().nullable()();
|
||||
TextColumn get grandparentRatingKey => text().nullable()();
|
||||
IntColumn get status => integer()();
|
||||
IntColumn get progress => integer().withDefault(const Constant(0))();
|
||||
IntColumn get totalBytes => integer().nullable()();
|
||||
IntColumn get downloadedBytes => integer().withDefault(const Constant(0))();
|
||||
TextColumn get videoFilePath => text().nullable()();
|
||||
TextColumn get thumbPath => text().nullable()();
|
||||
IntColumn get downloadedAt => integer().nullable()();
|
||||
TextColumn get errorMessage => text().nullable()();
|
||||
IntColumn get retryCount => integer().withDefault(const Constant(0))();
|
||||
}
|
||||
|
||||
/// Queue for offline watch progress and manual watch actions.
|
||||
///
|
||||
/// Stores watch progress updates and manual watch/unwatch actions
|
||||
/// that need to be synced to the Plex server when back online.
|
||||
@DataClassName('OfflineWatchProgressItem')
|
||||
class OfflineWatchProgress extends Table {
|
||||
/// Auto-incrementing primary key
|
||||
IntColumn get id => integer().autoIncrement()();
|
||||
|
||||
/// Server ID this media belongs to
|
||||
TextColumn get serverId => text()();
|
||||
|
||||
/// Rating key of the media item
|
||||
TextColumn get ratingKey => text()();
|
||||
|
||||
/// Global key (serverId:ratingKey) for easy lookup
|
||||
TextColumn get globalKey => text()();
|
||||
|
||||
/// Type of action: 'progress', 'watched', 'unwatched'
|
||||
TextColumn get actionType => text()();
|
||||
|
||||
/// Current playback position in milliseconds (for 'progress' actions)
|
||||
IntColumn get viewOffset => integer().nullable()();
|
||||
|
||||
/// Duration of the media in milliseconds (for calculating percentage)
|
||||
IntColumn get duration => integer().nullable()();
|
||||
|
||||
/// Whether this item should be marked as watched (for progress sync)
|
||||
/// Auto-set to true when viewOffset >= 90% of duration
|
||||
BoolColumn get shouldMarkWatched => boolean().withDefault(const Constant(false))();
|
||||
|
||||
/// Timestamp when this action was recorded (milliseconds since epoch)
|
||||
IntColumn get createdAt => integer()();
|
||||
|
||||
/// Timestamp when this action was last updated (for merging progress updates)
|
||||
IntColumn get updatedAt => integer()();
|
||||
|
||||
/// Number of sync attempts (for retry logic)
|
||||
IntColumn get syncAttempts => integer().withDefault(const Constant(0))();
|
||||
|
||||
/// Last sync error message
|
||||
TextColumn get lastError => text().nullable()();
|
||||
}
|
||||
@@ -1,54 +1,59 @@
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
/// Extension on KeyEvent for common event type checks.
|
||||
extension KeyEventActionable on KeyEvent {
|
||||
/// Whether this event should trigger an action (KeyDownEvent or KeyRepeatEvent).
|
||||
/// Use this to filter out KeyUpEvents early in key handlers.
|
||||
bool get isActionable => this is KeyDownEvent || this is KeyRepeatEvent;
|
||||
}
|
||||
|
||||
/// Shared sets for keyboard key categories.
|
||||
final _dpadDirectionKeys = {
|
||||
LogicalKeyboardKey.arrowUp,
|
||||
LogicalKeyboardKey.arrowDown,
|
||||
LogicalKeyboardKey.arrowLeft,
|
||||
LogicalKeyboardKey.arrowRight,
|
||||
};
|
||||
|
||||
final _selectKeys = {
|
||||
LogicalKeyboardKey.select,
|
||||
LogicalKeyboardKey.enter,
|
||||
LogicalKeyboardKey.numpadEnter,
|
||||
LogicalKeyboardKey.gameButtonA,
|
||||
};
|
||||
|
||||
final _backKeys = {
|
||||
LogicalKeyboardKey.escape,
|
||||
LogicalKeyboardKey.goBack,
|
||||
LogicalKeyboardKey.browserBack,
|
||||
LogicalKeyboardKey.gameButtonB,
|
||||
};
|
||||
|
||||
final _contextMenuKeys = {LogicalKeyboardKey.contextMenu, LogicalKeyboardKey.gameButtonX};
|
||||
|
||||
/// Extension methods for checking D-pad related keys.
|
||||
extension DpadKeyExtension on LogicalKeyboardKey {
|
||||
/// Whether this key is a D-pad directional key.
|
||||
bool get isDpadDirection {
|
||||
return this == LogicalKeyboardKey.arrowUp ||
|
||||
this == LogicalKeyboardKey.arrowDown ||
|
||||
this == LogicalKeyboardKey.arrowLeft ||
|
||||
this == LogicalKeyboardKey.arrowRight;
|
||||
}
|
||||
bool get isDpadDirection => _dpadDirectionKeys.contains(this);
|
||||
|
||||
/// Whether this key is a select/activate key.
|
||||
bool get isSelectKey {
|
||||
return this == LogicalKeyboardKey.select ||
|
||||
this == LogicalKeyboardKey.enter ||
|
||||
this == LogicalKeyboardKey.numpadEnter ||
|
||||
this == LogicalKeyboardKey.gameButtonA;
|
||||
}
|
||||
bool get isSelectKey => _selectKeys.contains(this);
|
||||
|
||||
/// Whether this key is a back/cancel key.
|
||||
bool get isBackKey {
|
||||
return this == LogicalKeyboardKey.escape ||
|
||||
this == LogicalKeyboardKey.goBack ||
|
||||
this == LogicalKeyboardKey.browserBack ||
|
||||
this == LogicalKeyboardKey.gameButtonB;
|
||||
}
|
||||
bool get isBackKey => _backKeys.contains(this);
|
||||
|
||||
/// Whether this key is a context menu key.
|
||||
bool get isContextMenuKey {
|
||||
return this == LogicalKeyboardKey.contextMenu ||
|
||||
this == LogicalKeyboardKey.gameButtonX;
|
||||
}
|
||||
bool get isContextMenuKey => _contextMenuKeys.contains(this);
|
||||
|
||||
/// Whether this key moves focus left.
|
||||
bool get isLeftKey {
|
||||
return this == LogicalKeyboardKey.arrowLeft;
|
||||
}
|
||||
bool get isLeftKey => this == LogicalKeyboardKey.arrowLeft;
|
||||
|
||||
/// Whether this key moves focus right.
|
||||
bool get isRightKey {
|
||||
return this == LogicalKeyboardKey.arrowRight;
|
||||
}
|
||||
bool get isRightKey => this == LogicalKeyboardKey.arrowRight;
|
||||
|
||||
/// Whether this key moves focus up.
|
||||
bool get isUpKey {
|
||||
return this == LogicalKeyboardKey.arrowUp;
|
||||
}
|
||||
bool get isUpKey => this == LogicalKeyboardKey.arrowUp;
|
||||
|
||||
/// Whether this key moves focus down.
|
||||
bool get isDownKey {
|
||||
return this == LogicalKeyboardKey.arrowDown;
|
||||
}
|
||||
bool get isDownKey => this == LogicalKeyboardKey.arrowDown;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,7 @@ class FocusTheme {
|
||||
|
||||
/// Get the animation duration from MonoTokens.
|
||||
static Duration getAnimationDuration(BuildContext context) {
|
||||
return Theme.of(context).extension<MonoTokens>()?.fast ??
|
||||
const Duration(milliseconds: 150);
|
||||
return Theme.of(context).extension<MonoTokens>()?.fast ?? const Duration(milliseconds: 150);
|
||||
}
|
||||
|
||||
/// Build the focus border decoration.
|
||||
@@ -35,24 +34,16 @@ class FocusTheme {
|
||||
|
||||
return BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(borderRadius),
|
||||
border: Border.all(
|
||||
color: isFocused ? focusColor : Colors.transparent,
|
||||
width: focusBorderWidth,
|
||||
),
|
||||
border: Border.all(color: isFocused ? focusColor : Colors.transparent, width: focusBorderWidth),
|
||||
);
|
||||
}
|
||||
|
||||
/// Build focus decoration with background color instead of border.
|
||||
/// Useful for video controls where it should match the native hover style.
|
||||
static BoxDecoration focusBackgroundDecoration({
|
||||
required bool isFocused,
|
||||
double borderRadius = defaultBorderRadius,
|
||||
}) {
|
||||
static BoxDecoration focusBackgroundDecoration({required bool isFocused, double borderRadius = defaultBorderRadius}) {
|
||||
return BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(borderRadius),
|
||||
color: isFocused
|
||||
? Colors.white.withValues(alpha: 0.2)
|
||||
: Colors.transparent,
|
||||
color: isFocused ? Colors.white.withValues(alpha: 0.2) : Colors.transparent,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,37 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'dpad_navigator.dart';
|
||||
|
||||
/// Callbacks for chip key event handling.
|
||||
class ChipKeyCallbacks {
|
||||
/// Called when SELECT key is pressed.
|
||||
final VoidCallback? onSelect;
|
||||
|
||||
/// Called when DOWN arrow is pressed.
|
||||
final VoidCallback? onNavigateDown;
|
||||
|
||||
/// Called when UP arrow is pressed.
|
||||
final VoidCallback? onNavigateUp;
|
||||
|
||||
/// Called when LEFT arrow is pressed.
|
||||
final VoidCallback? onNavigateLeft;
|
||||
|
||||
/// Called when RIGHT arrow is pressed.
|
||||
final VoidCallback? onNavigateRight;
|
||||
|
||||
/// Called when BACK key is pressed.
|
||||
final VoidCallback? onBack;
|
||||
|
||||
const ChipKeyCallbacks({
|
||||
this.onSelect,
|
||||
this.onNavigateDown,
|
||||
this.onNavigateUp,
|
||||
this.onNavigateLeft,
|
||||
this.onNavigateRight,
|
||||
this.onBack,
|
||||
});
|
||||
}
|
||||
|
||||
/// A mixin that provides common FocusNode lifecycle management for chip widgets.
|
||||
///
|
||||
/// This mixin handles:
|
||||
@@ -29,8 +61,7 @@ mixin FocusableChipStateMixin<T extends StatefulWidget> on State<T> {
|
||||
|
||||
/// The active focus node (external if provided, otherwise internal).
|
||||
FocusNode get focusNode {
|
||||
return widgetFocusNode ??
|
||||
(_internalFocusNode ??= FocusNode(debugLabel: debugLabel));
|
||||
return widgetFocusNode ?? (_internalFocusNode ??= FocusNode(debugLabel: debugLabel));
|
||||
}
|
||||
|
||||
/// Whether this widget is currently focused.
|
||||
@@ -60,4 +91,59 @@ mixin FocusableChipStateMixin<T extends StatefulWidget> on State<T> {
|
||||
setState(() => _isFocused = focusNode.hasFocus);
|
||||
}
|
||||
}
|
||||
|
||||
/// Shared key event handler for chip widgets.
|
||||
///
|
||||
/// Handles common key patterns:
|
||||
/// - SELECT key -> onSelect
|
||||
/// - Arrow keys -> navigation callbacks
|
||||
/// - BACK key -> onBack
|
||||
///
|
||||
/// Returns [KeyEventResult.handled] if the event was consumed,
|
||||
/// [KeyEventResult.ignored] otherwise.
|
||||
KeyEventResult handleChipKeyEvent(FocusNode node, KeyEvent event, ChipKeyCallbacks callbacks) {
|
||||
if (!event.isActionable) {
|
||||
return KeyEventResult.ignored;
|
||||
}
|
||||
|
||||
final key = event.logicalKey;
|
||||
|
||||
// SELECT key activates the chip
|
||||
if (key.isSelectKey && callbacks.onSelect != null) {
|
||||
callbacks.onSelect!();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
|
||||
// LEFT arrow
|
||||
if (key.isLeftKey && callbacks.onNavigateLeft != null) {
|
||||
callbacks.onNavigateLeft!();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
|
||||
// RIGHT arrow
|
||||
if (key.isRightKey && callbacks.onNavigateRight != null) {
|
||||
callbacks.onNavigateRight!();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
|
||||
// DOWN arrow
|
||||
if (key.isDownKey) {
|
||||
callbacks.onNavigateDown?.call();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
|
||||
// UP arrow
|
||||
if (key.isUpKey && callbacks.onNavigateUp != null) {
|
||||
callbacks.onNavigateUp!();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
|
||||
// BACK key
|
||||
if (key.isBackKey && callbacks.onBack != null) {
|
||||
callbacks.onBack!();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
|
||||
return KeyEventResult.ignored;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'dpad_navigator.dart';
|
||||
import 'focus_theme.dart';
|
||||
import 'input_mode_tracker.dart';
|
||||
|
||||
@@ -106,8 +107,7 @@ class FocusableWrapper extends StatefulWidget {
|
||||
State<FocusableWrapper> createState() => _FocusableWrapperState();
|
||||
}
|
||||
|
||||
class _FocusableWrapperState extends State<FocusableWrapper>
|
||||
with SingleTickerProviderStateMixin {
|
||||
class _FocusableWrapperState extends State<FocusableWrapper> with SingleTickerProviderStateMixin {
|
||||
late FocusNode _focusNode;
|
||||
bool _ownsNode = false;
|
||||
bool _isFocused = false;
|
||||
@@ -140,18 +140,12 @@ class _FocusableWrapperState extends State<FocusableWrapper>
|
||||
}
|
||||
|
||||
void _initAnimations() {
|
||||
_animationController = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 150),
|
||||
);
|
||||
_animationController = AnimationController(vsync: this, duration: const Duration(milliseconds: 150));
|
||||
|
||||
_scaleAnimation = Tween<double>(begin: 1.0, end: FocusTheme.focusScale)
|
||||
.animate(
|
||||
CurvedAnimation(
|
||||
parent: _animationController,
|
||||
curve: Curves.easeOutCubic,
|
||||
),
|
||||
);
|
||||
_scaleAnimation = Tween<double>(
|
||||
begin: 1.0,
|
||||
end: FocusTheme.focusScale,
|
||||
).animate(CurvedAnimation(parent: _animationController, curve: Curves.easeOutCubic));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -222,10 +216,7 @@ class _FocusableWrapperState extends State<FocusableWrapper>
|
||||
|
||||
// Get item's position relative to viewport
|
||||
final itemBox = renderObject as RenderBox;
|
||||
final itemPosition = itemBox.localToGlobal(
|
||||
Offset.zero,
|
||||
ancestor: viewport,
|
||||
);
|
||||
final itemPosition = itemBox.localToGlobal(Offset.zero, ancestor: viewport);
|
||||
|
||||
// Check if item is already in the comfortable zone
|
||||
final viewportHeight = viewport.size.height;
|
||||
@@ -236,8 +227,7 @@ class _FocusableWrapperState extends State<FocusableWrapper>
|
||||
final comfortZoneTop = viewportHeight * 0.2;
|
||||
final comfortZoneBottom = viewportHeight * 0.8;
|
||||
|
||||
if (itemVerticalCenter >= comfortZoneTop &&
|
||||
itemVerticalCenter <= comfortZoneBottom) {
|
||||
if (itemVerticalCenter >= comfortZoneTop && itemVerticalCenter <= comfortZoneBottom) {
|
||||
// Item is in comfortable zone, no need to scroll
|
||||
return;
|
||||
}
|
||||
@@ -265,7 +255,7 @@ class _FocusableWrapperState extends State<FocusableWrapper>
|
||||
}
|
||||
|
||||
// Handle SELECT key with optional long-press detection
|
||||
if (_isSelectKey(key)) {
|
||||
if (key.isSelectKey) {
|
||||
if (widget.enableLongPress) {
|
||||
if (event is KeyDownEvent) {
|
||||
// Only start timer on initial press, not repeats
|
||||
@@ -303,13 +293,13 @@ class _FocusableWrapperState extends State<FocusableWrapper>
|
||||
}
|
||||
}
|
||||
|
||||
// Ignore key repeat events for other keys
|
||||
if (event is! KeyDownEvent && event is! KeyRepeatEvent) {
|
||||
// Ignore key up events for other keys
|
||||
if (!event.isActionable) {
|
||||
return KeyEventResult.ignored;
|
||||
}
|
||||
|
||||
// Context menu key
|
||||
if (_isContextMenuKey(key)) {
|
||||
if (key.isContextMenuKey) {
|
||||
widget.onLongPress?.call();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
@@ -321,7 +311,7 @@ class _FocusableWrapperState extends State<FocusableWrapper>
|
||||
}
|
||||
|
||||
// BACK key
|
||||
if (_isBackKey(key) && widget.onBack != null) {
|
||||
if (key.isBackKey && widget.onBack != null) {
|
||||
widget.onBack!();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
@@ -329,25 +319,6 @@ class _FocusableWrapperState extends State<FocusableWrapper>
|
||||
return KeyEventResult.ignored;
|
||||
}
|
||||
|
||||
bool _isSelectKey(LogicalKeyboardKey key) {
|
||||
return key == LogicalKeyboardKey.select ||
|
||||
key == LogicalKeyboardKey.enter ||
|
||||
key == LogicalKeyboardKey.numpadEnter ||
|
||||
key == LogicalKeyboardKey.gameButtonA;
|
||||
}
|
||||
|
||||
bool _isContextMenuKey(LogicalKeyboardKey key) {
|
||||
return key == LogicalKeyboardKey.contextMenu ||
|
||||
key == LogicalKeyboardKey.gameButtonX;
|
||||
}
|
||||
|
||||
bool _isBackKey(LogicalKeyboardKey key) {
|
||||
return key == LogicalKeyboardKey.escape ||
|
||||
key == LogicalKeyboardKey.goBack ||
|
||||
key == LogicalKeyboardKey.browserBack ||
|
||||
key == LogicalKeyboardKey.gameButtonB;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final duration = FocusTheme.getAnimationDuration(context);
|
||||
@@ -361,15 +332,8 @@ class _FocusableWrapperState extends State<FocusableWrapper>
|
||||
|
||||
// Choose decoration based on useBackgroundFocus
|
||||
final decoration = widget.useBackgroundFocus
|
||||
? FocusTheme.focusBackgroundDecoration(
|
||||
isFocused: showFocus,
|
||||
borderRadius: widget.borderRadius,
|
||||
)
|
||||
: FocusTheme.focusDecoration(
|
||||
context,
|
||||
isFocused: showFocus,
|
||||
borderRadius: widget.borderRadius,
|
||||
);
|
||||
? FocusTheme.focusBackgroundDecoration(isFocused: showFocus, borderRadius: widget.borderRadius)
|
||||
: FocusTheme.focusDecoration(context, isFocused: showFocus, borderRadius: widget.borderRadius);
|
||||
|
||||
Widget result = Focus(
|
||||
focusNode: _focusNode,
|
||||
@@ -395,11 +359,7 @@ class _FocusableWrapperState extends State<FocusableWrapper>
|
||||
|
||||
// Add semantics if label provided
|
||||
if (widget.semanticLabel != null) {
|
||||
result = Semantics(
|
||||
label: widget.semanticLabel,
|
||||
button: widget.onSelect != null,
|
||||
child: result,
|
||||
);
|
||||
result = Semantics(label: widget.semanticLabel, button: widget.onSelect != null, child: result);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../services/tv_detection_service.dart';
|
||||
import '../utils/platform_detector.dart';
|
||||
import '../services/gamepad_service.dart';
|
||||
|
||||
/// Tracks whether the user is navigating via keyboard/d-pad or pointer (mouse/touch).
|
||||
@@ -29,8 +29,7 @@ class InputModeTracker extends StatefulWidget {
|
||||
|
||||
/// Get the current input mode.
|
||||
static InputMode of(BuildContext context) {
|
||||
final provider = context
|
||||
.dependOnInheritedWidgetOfExactType<_InputModeProvider>();
|
||||
final provider = context.dependOnInheritedWidgetOfExactType<_InputModeProvider>();
|
||||
return provider?.mode ?? InputMode.pointer;
|
||||
}
|
||||
|
||||
@@ -45,9 +44,7 @@ class InputModeTracker extends StatefulWidget {
|
||||
|
||||
class _InputModeTrackerState extends State<InputModeTracker> {
|
||||
// Default to keyboard mode on Android TV, pointer mode elsewhere
|
||||
InputMode _mode = TvDetectionService.isTVSync()
|
||||
? InputMode.keyboard
|
||||
: InputMode.pointer;
|
||||
InputMode _mode = TvDetectionService.isTVSync() ? InputMode.keyboard : InputMode.pointer;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -56,7 +53,6 @@ class _InputModeTrackerState extends State<InputModeTracker> {
|
||||
_updateFocusHighlightStrategy(_mode);
|
||||
// Listen to hardware keyboard events globally
|
||||
HardwareKeyboard.instance.addHandler(_handleKeyEvent);
|
||||
RawKeyboard.instance.addListener(_handleRawKeyEvent);
|
||||
|
||||
// Register callback for gamepad input to switch to keyboard mode
|
||||
GamepadService.onGamepadInput = () => _setMode(InputMode.keyboard);
|
||||
@@ -65,7 +61,6 @@ class _InputModeTrackerState extends State<InputModeTracker> {
|
||||
@override
|
||||
void dispose() {
|
||||
HardwareKeyboard.instance.removeHandler(_handleKeyEvent);
|
||||
RawKeyboard.instance.removeListener(_handleRawKeyEvent);
|
||||
GamepadService.onGamepadInput = null;
|
||||
super.dispose();
|
||||
}
|
||||
@@ -79,12 +74,6 @@ class _InputModeTrackerState extends State<InputModeTracker> {
|
||||
return false;
|
||||
}
|
||||
|
||||
void _handleRawKeyEvent(RawKeyEvent event) {
|
||||
if (event is RawKeyDownEvent) {
|
||||
_setMode(InputMode.keyboard);
|
||||
}
|
||||
}
|
||||
|
||||
void _setMode(InputMode mode) {
|
||||
if (_mode != mode) {
|
||||
setState(() => _mode = mode);
|
||||
|
||||
@@ -28,11 +28,7 @@ import 'dpad_navigator.dart';
|
||||
/// child: ...
|
||||
/// )
|
||||
/// ```
|
||||
KeyEventResult handleBackKeyNavigation<T>(
|
||||
BuildContext context,
|
||||
KeyEvent event, {
|
||||
T? result,
|
||||
}) {
|
||||
KeyEventResult handleBackKeyNavigation<T>(BuildContext context, KeyEvent event, {T? result}) {
|
||||
if (event is KeyDownEvent && event.logicalKey.isBackKey) {
|
||||
Navigator.pop(context, result);
|
||||
return KeyEventResult.handled;
|
||||
|
||||
+1052
-704
File diff suppressed because it is too large
Load Diff
+84
-58
@@ -26,18 +26,11 @@
|
||||
"submit": "Submit",
|
||||
"confirm": "Confirm",
|
||||
"retry": "Retry",
|
||||
"playNow": "Play Now",
|
||||
"logout": "Logout",
|
||||
"online": "Online",
|
||||
"offline": "Offline",
|
||||
"owned": "Owned",
|
||||
"shared": "Shared",
|
||||
"current": "CURRENT",
|
||||
"unknown": "Unknown",
|
||||
"refresh": "Refresh",
|
||||
"yes": "Yes",
|
||||
"no": "No",
|
||||
"server": "Server",
|
||||
"delete": "Delete",
|
||||
"shuffle": "Shuffle",
|
||||
"addTo": "Add to..."
|
||||
@@ -64,7 +57,6 @@
|
||||
"theme": "Theme",
|
||||
"appearance": "Appearance",
|
||||
"videoPlayback": "Video Playback",
|
||||
"shufflePlay": "Shuffle Play",
|
||||
"advanced": "Advanced",
|
||||
"useSeasonPostersDescription": "Show season poster instead of series poster for episodes",
|
||||
"showHeroSectionDescription": "Display featured content carousel on home screen",
|
||||
@@ -104,15 +96,11 @@
|
||||
"minutesUnit": "${minutes} minutes",
|
||||
"rememberTrackSelections": "Remember track selections per show/movie",
|
||||
"rememberTrackSelectionsDescription": "Automatically save audio and subtitle language preferences when you change tracks during playback",
|
||||
"unwatchedOnly": "Unwatched Only",
|
||||
"unwatchedOnlyDescription": "Only include unwatched episodes in shuffle queue",
|
||||
"shuffleOrderNavigation": "Shuffle Order Navigation",
|
||||
"shuffleOrderNavigationDescription": "Next/previous buttons follow shuffled order",
|
||||
"loopShuffleQueue": "Loop Shuffle Queue",
|
||||
"loopShuffleQueueDescription": "Restart queue when reaching the end",
|
||||
"videoPlayerControls": "Video Player Controls",
|
||||
"keyboardShortcuts": "Keyboard Shortcuts",
|
||||
"keyboardShortcutsDescription": "Customize keyboard shortcuts",
|
||||
"videoPlayerNavigation": "Video Player Navigation",
|
||||
"videoPlayerNavigationDescription": "Use arrow keys to navigate video player controls",
|
||||
"debugLogging": "Debug Logging",
|
||||
"debugLoggingDescription": "Enable detailed logging for troubleshooting",
|
||||
"viewLogs": "View Logs",
|
||||
@@ -139,7 +127,21 @@
|
||||
"autoSkipCredits": "Auto Skip Credits",
|
||||
"autoSkipCreditsDescription": "Automatically skip credits and play next episode",
|
||||
"autoSkipDelay": "Auto Skip Delay",
|
||||
"autoSkipDelayDescription": "Wait ${seconds} seconds before auto-skipping"
|
||||
"autoSkipDelayDescription": "Wait ${seconds} seconds before auto-skipping",
|
||||
"downloads": "Downloads",
|
||||
"downloadLocationDescription": "Choose where to store downloaded content",
|
||||
"downloadLocationDefault": "Default (App Storage)",
|
||||
"downloadLocationCustom": "Custom Location",
|
||||
"selectFolder": "Select Folder",
|
||||
"resetToDefault": "Reset to Default",
|
||||
"currentPath": "Current: ${path}",
|
||||
"downloadLocationChanged": "Download location changed",
|
||||
"downloadLocationReset": "Download location reset to default",
|
||||
"downloadLocationInvalid": "Selected folder is not writable",
|
||||
"downloadLocationSelectError": "Failed to select folder",
|
||||
"downloadOnWifiOnly": "Download on WiFi only",
|
||||
"downloadOnWifiOnlyDescription": "Prevent downloads when on cellular data",
|
||||
"cellularDownloadBlocked": "Downloads are disabled on cellular data. Connect to WiFi or change the setting."
|
||||
},
|
||||
"search": {
|
||||
"hint": "Search movies, shows, music...",
|
||||
@@ -231,7 +233,6 @@
|
||||
"nextButton": "Next episode",
|
||||
"previousChapterButton": "Previous chapter",
|
||||
"nextChapterButton": "Next chapter",
|
||||
"volumeButton": "Volume",
|
||||
"muteButton": "Mute",
|
||||
"unmuteButton": "Unmute",
|
||||
"settingsButton": "Video settings",
|
||||
@@ -242,6 +243,7 @@
|
||||
"aspectRatioButton": "Aspect ratio",
|
||||
"fullscreenButton": "Enter fullscreen",
|
||||
"exitFullscreenButton": "Exit fullscreen",
|
||||
"alwaysOnTopButton": "Always on top",
|
||||
"rotationLockButton": "Rotation lock",
|
||||
"timelineSlider": "Video timeline",
|
||||
"volumeSlider": "Volume level",
|
||||
@@ -256,6 +258,8 @@
|
||||
"messages": {
|
||||
"markedAsWatched": "Marked as watched",
|
||||
"markedAsUnwatched": "Marked as unwatched",
|
||||
"markedAsWatchedOffline": "Marked as watched (will sync when online)",
|
||||
"markedAsUnwatchedOffline": "Marked as unwatched (will sync when online)",
|
||||
"removedFromContinueWatching": "Removed from Continue Watching",
|
||||
"errorLoading": "Error: ${error}",
|
||||
"fileInfoNotAvailable": "File information not available",
|
||||
@@ -272,22 +276,17 @@
|
||||
"metadataRefreshing": "Refreshing metadata for \"${title}\"...",
|
||||
"metadataRefreshStarted": "Metadata refresh started for \"${title}\"",
|
||||
"metadataRefreshFailed": "Failed to refresh metadata: ${error}",
|
||||
"noPlexToken": "No Plex token found. Please login again.",
|
||||
"logoutConfirm": "Are you sure you want to logout?",
|
||||
"noSeasonsFound": "No seasons found",
|
||||
"noEpisodesFound": "No episodes found in first season",
|
||||
"noEpisodesFoundGeneral": "No episodes found",
|
||||
"noResultsFound": "No results found",
|
||||
"sleepTimerSet": "Sleep timer set for ${label}",
|
||||
"failedToSwitchProfile": "Failed to switch to ${displayName}",
|
||||
"noItemsAvailable": "No items available",
|
||||
"failedToCreatePlayQueue": "Failed to create play queue",
|
||||
"failedToCreatePlayQueueNoItems": "Failed to create play queue - no items",
|
||||
"failedPlayback": "Failed to ${action}: ${error}"
|
||||
},
|
||||
"profile": {
|
||||
"noUsersAvailable": "No users available"
|
||||
},
|
||||
"subtitlingStyling": {
|
||||
"stylingOptions": "Styling Options",
|
||||
"fontSize": "Font Size",
|
||||
@@ -299,7 +298,6 @@
|
||||
},
|
||||
"dialog": {
|
||||
"confirmAction": "Confirm Action",
|
||||
"areYouSure": "Are you sure you want to perform this action?",
|
||||
"cancel": "Cancel",
|
||||
"playNow": "Play Now"
|
||||
},
|
||||
@@ -310,11 +308,8 @@
|
||||
"noContentAvailable": "No content available",
|
||||
"addMediaToLibraries": "Add some media to your libraries",
|
||||
"continueWatching": "Continue Watching",
|
||||
"recentlyAdded": "Recently Added",
|
||||
"play": "Play",
|
||||
"resume": "Resume",
|
||||
"playEpisode": "Play S${season}, E${episode}",
|
||||
"resumeEpisode": "Resume S${season}, E${episode}",
|
||||
"playEpisode": "S${season}E${episode}",
|
||||
"pause": "Pause",
|
||||
"overview": "Overview",
|
||||
"cast": "Cast",
|
||||
@@ -339,8 +334,7 @@
|
||||
"pleaseEnterToken": "Please enter a token",
|
||||
"invalidToken": "Invalid token",
|
||||
"failedToVerifyToken": "Failed to verify token: ${error}",
|
||||
"failedToSwitchProfile": "Failed to switch to ${displayName}",
|
||||
"connectionFailedGeneric": "Connection failed"
|
||||
"failedToSwitchProfile": "Failed to switch to ${displayName}"
|
||||
},
|
||||
"libraries": {
|
||||
"title": "Libraries",
|
||||
@@ -368,7 +362,6 @@
|
||||
"sort": "Sort",
|
||||
"sortBy": "Sort By",
|
||||
"filters": "Filters",
|
||||
"loadingLibraryWithCount": "Loading library... (${count} items loaded)",
|
||||
"confirmActionMessage": "Are you sure you want to perform this action?",
|
||||
"showLibrary": "Show library",
|
||||
"hideLibrary": "Hide library",
|
||||
@@ -403,23 +396,9 @@
|
||||
"viewLicensesDescription": "View licenses of third-party libraries"
|
||||
},
|
||||
"serverSelection": {
|
||||
"connectingToServer": "Connecting to server...",
|
||||
"connectingToAllServers": "Connecting to all servers...",
|
||||
"connectToAllServers": "Connect to All Servers",
|
||||
"allServerConnectionsFailed": "Failed to connect to any servers. Please check your network and try again.",
|
||||
"foundServers": "Found ${count} server(s)",
|
||||
"orSelectIndividually": "Or select a server individually:",
|
||||
"serverDebugCopied": "Server debug data copied to clipboard",
|
||||
"copyDebugData": "Copy Debug Data",
|
||||
"noServersFound": "No servers found",
|
||||
"noServersFoundForAccount": "No servers found for ${username} (${email})",
|
||||
"malformedServerData": "Found ${count} server(s) with malformed data. No valid servers available.",
|
||||
"incompleteServerInfo": "Some servers have incomplete information and were skipped. Please check your Plex.tv account.",
|
||||
"incompleteConnectionInfo": "Server connection information is incomplete. Please try again.",
|
||||
"malformedServerInfo": "Server information is malformed: ${message}",
|
||||
"networkConnectionFailed": "Network connection failed. Please check your internet connection and try again.",
|
||||
"authenticationFailed": "Authentication failed. Please sign in again.",
|
||||
"plexServiceUnavailable": "Plex service unavailable. Please try again later.",
|
||||
"failedToLoadServers": "Failed to load servers: ${error}"
|
||||
},
|
||||
"hubDetail": {
|
||||
@@ -430,11 +409,8 @@
|
||||
"noItemsFound": "No items found"
|
||||
},
|
||||
"logs": {
|
||||
"title": "Logs",
|
||||
"clearLogs": "Clear Logs",
|
||||
"copyLogs": "Copy Logs",
|
||||
"exportLogs": "Export Logs",
|
||||
"noLogsToShow": "No logs to show",
|
||||
"error": "Error:",
|
||||
"stackTrace": "Stack Trace:"
|
||||
},
|
||||
@@ -448,13 +424,13 @@
|
||||
"home": "Home",
|
||||
"search": "Search",
|
||||
"libraries": "Libraries",
|
||||
"settings": "Settings"
|
||||
"settings": "Settings",
|
||||
"downloads": "Downloads"
|
||||
},
|
||||
"collections": {
|
||||
"title": "Collections",
|
||||
"collection": "Collection",
|
||||
"empty": "Collection is empty",
|
||||
"noItems": "No items in this collection",
|
||||
"unknownLibrarySection": "Cannot delete: Unknown library section",
|
||||
"deleteCollection": "Delete Collection",
|
||||
"deleteConfirm": "Are you sure you want to delete \"${title}\"? This action cannot be undone.",
|
||||
@@ -462,7 +438,6 @@
|
||||
"deleteFailed": "Failed to delete collection",
|
||||
"deleteFailedWithError": "Failed to delete collection: ${error}",
|
||||
"failedToLoadItems": "Failed to load collection items: ${error}",
|
||||
"addTo": "Add to collection",
|
||||
"selectCollection": "Select Collection",
|
||||
"createNewCollection": "Create New Collection",
|
||||
"collectionName": "Collection Name",
|
||||
@@ -481,26 +456,17 @@
|
||||
"playlist": "Playlist",
|
||||
"noPlaylists": "No playlists found",
|
||||
"create": "Create Playlist",
|
||||
"newPlaylist": "New Playlist",
|
||||
"playlistName": "Playlist Name",
|
||||
"enterPlaylistName": "Enter playlist name",
|
||||
"edit": "Edit Playlist",
|
||||
"delete": "Delete Playlist",
|
||||
"addTo": "Add to Playlist",
|
||||
"addItems": "Add Items",
|
||||
"removeItem": "Remove from Playlist",
|
||||
"clearPlaylist": "Clear Playlist",
|
||||
"playAll": "Play All",
|
||||
"shuffle": "Shuffle",
|
||||
"smartPlaylist": "Smart Playlist",
|
||||
"regularPlaylist": "Regular Playlist",
|
||||
"itemCount": "${count} items",
|
||||
"oneItem": "1 item",
|
||||
"emptyPlaylist": "This playlist is empty",
|
||||
"deleteConfirm": "Delete Playlist?",
|
||||
"deleteMessage": "Are you sure you want to delete \"${name}\"?",
|
||||
"created": "Playlist created",
|
||||
"updated": "Playlist updated",
|
||||
"deleted": "Playlist deleted",
|
||||
"itemAdded": "Added to playlist",
|
||||
"itemRemoved": "Removed from playlist",
|
||||
@@ -512,5 +478,65 @@
|
||||
"errorAdding": "Failed to add to playlist",
|
||||
"errorReordering": "Failed to reorder playlist item",
|
||||
"errorRemoving": "Failed to remove from playlist"
|
||||
},
|
||||
"watchTogether": {
|
||||
"title": "Watch Together",
|
||||
"description": "Watch content in sync with friends and family",
|
||||
"createSession": "Create Session",
|
||||
"creating": "Creating...",
|
||||
"joinSession": "Join Session",
|
||||
"joining": "Joining...",
|
||||
"controlMode": "Control Mode",
|
||||
"controlModeQuestion": "Who can control playback?",
|
||||
"hostOnly": "Host Only",
|
||||
"anyone": "Anyone",
|
||||
"hostingSession": "Hosting Session",
|
||||
"inSession": "In Session",
|
||||
"sessionCode": "Session Code",
|
||||
"hostControlsPlayback": "Host controls playback",
|
||||
"anyoneCanControl": "Anyone can control playback",
|
||||
"hostControls": "Host controls",
|
||||
"anyoneControls": "Anyone controls",
|
||||
"participants": "Participants",
|
||||
"host": "Host",
|
||||
"hostBadge": "HOST",
|
||||
"youAreHost": "You are the host",
|
||||
"watchingWithOthers": "Watching with others",
|
||||
"endSession": "End Session",
|
||||
"leaveSession": "Leave Session",
|
||||
"endSessionQuestion": "End Session?",
|
||||
"leaveSessionQuestion": "Leave Session?",
|
||||
"endSessionConfirm": "This will end the session for all participants.",
|
||||
"leaveSessionConfirm": "You will be removed from the session.",
|
||||
"endSessionConfirmOverlay": "This will end the watch session for all participants.",
|
||||
"leaveSessionConfirmOverlay": "You will be disconnected from the watch session.",
|
||||
"end": "End",
|
||||
"leave": "Leave",
|
||||
"syncing": "Syncing...",
|
||||
"participant": "participant",
|
||||
"joinWatchSession": "Join Watch Session",
|
||||
"enterCodeHint": "Enter 8-character code",
|
||||
"pasteFromClipboard": "Paste from clipboard",
|
||||
"pleaseEnterCode": "Please enter a session code",
|
||||
"codeMustBe8Chars": "Session code must be 8 characters",
|
||||
"joinInstructions": "Enter the session code shared by the host to join their watch session.",
|
||||
"failedToCreate": "Failed to create session",
|
||||
"failedToJoin": "Failed to join session"
|
||||
},
|
||||
"downloads": {
|
||||
"title": "Downloads",
|
||||
"manage": "Manage",
|
||||
"tvShows": "TV Shows",
|
||||
"movies": "Movies",
|
||||
"noDownloads": "No downloads yet",
|
||||
"noDownloadsDescription": "Downloaded content will appear here for offline viewing",
|
||||
"downloadNow": "Download",
|
||||
"deleteDownload": "Delete download",
|
||||
"retryDownload": "Retry download",
|
||||
"downloadQueued": "Download queued",
|
||||
"episodesQueued": "${count} episodes queued for download",
|
||||
"downloadDeleted": "Download deleted",
|
||||
"deleteConfirm": "Are you sure you want to delete \"${title}\"? This will remove the downloaded file from your device.",
|
||||
"deletingWithProgress": "Deleting ${title}... (${current} of ${total})"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,18 +26,11 @@
|
||||
"submit": "Senden",
|
||||
"confirm": "Bestätigen",
|
||||
"retry": "Erneut versuchen",
|
||||
"playNow": "Jetzt abspielen",
|
||||
"logout": "Abmelden",
|
||||
"online": "Online",
|
||||
"offline": "Offline",
|
||||
"owned": "Besitzer",
|
||||
"shared": "Geteilt",
|
||||
"current": "AKTUELL",
|
||||
"unknown": "Unbekannt",
|
||||
"refresh": "Aktualisieren",
|
||||
"yes": "Ja",
|
||||
"no": "Nein",
|
||||
"server": "Server",
|
||||
"delete": "Löschen",
|
||||
"shuffle": "Zufall",
|
||||
"addTo": "Hinzufügen zu..."
|
||||
@@ -65,7 +58,6 @@
|
||||
"theme": "Design",
|
||||
"appearance": "Darstellung",
|
||||
"videoPlayback": "Videowiedergabe",
|
||||
"shufflePlay": "Zufallswiedergabe",
|
||||
"advanced": "Erweitert",
|
||||
"useSeasonPostersDescription": "Staffelposter statt Serienposter für Episoden anzeigen",
|
||||
"showHeroSectionDescription": "Bereich mit empfohlenen Inhalten auf der Startseite anzeigen",
|
||||
@@ -105,15 +97,11 @@
|
||||
"minutesUnit": "${minutes} Minuten",
|
||||
"rememberTrackSelections": "Spurauswahl pro Serie/Film merken",
|
||||
"rememberTrackSelectionsDescription": "Audio- und Untertitelsprache automatisch speichern, wenn während der Wiedergabe geändert",
|
||||
"unwatchedOnly": "Nur ungesehene",
|
||||
"unwatchedOnlyDescription": "Nur ungesehene Episoden in die Shuffle-Warteschlange aufnehmen",
|
||||
"shuffleOrderNavigation": "Navigation der Shuffle-Reihenfolge",
|
||||
"shuffleOrderNavigationDescription": "Weiter/Zurück folgt der zufälligen Reihenfolge",
|
||||
"loopShuffleQueue": "Shuffle-Warteschlange wiederholen",
|
||||
"loopShuffleQueueDescription": "Warteschlange neu starten, wenn das Ende erreicht ist",
|
||||
"videoPlayerControls": "Videoplayer-Steuerung",
|
||||
"keyboardShortcuts": "Tastenkürzel",
|
||||
"keyboardShortcutsDescription": "Tastenkürzel anpassen",
|
||||
"videoPlayerNavigation": "Videoplayer-Navigation",
|
||||
"videoPlayerNavigationDescription": "Pfeiltasten zur Navigation der Videoplayer-Steuerung verwenden",
|
||||
"debugLogging": "Debug-Protokollierung",
|
||||
"debugLoggingDescription": "Detaillierte Protokolle zur Fehleranalyse aktivieren",
|
||||
"viewLogs": "Protokolle anzeigen",
|
||||
@@ -140,7 +128,21 @@
|
||||
"autoSkipCredits": "Abspann automatisch überspringen",
|
||||
"autoSkipCreditsDescription": "Abspann automatisch überspringen und nächste Episode abspielen",
|
||||
"autoSkipDelay": "Verzögerung für automatisches Überspringen",
|
||||
"autoSkipDelayDescription": "${seconds} Sekunden vor dem automatischen Überspringen warten"
|
||||
"autoSkipDelayDescription": "${seconds} Sekunden vor dem automatischen Überspringen warten",
|
||||
"downloads": "Downloads",
|
||||
"downloadLocationDescription": "Speicherort für heruntergeladene Inhalte wählen",
|
||||
"downloadLocationDefault": "Standard (App-Speicher)",
|
||||
"downloadLocationCustom": "Benutzerdefinierter Speicherort",
|
||||
"selectFolder": "Ordner auswählen",
|
||||
"resetToDefault": "Auf Standard zurücksetzen",
|
||||
"currentPath": "Aktuell: ${path}",
|
||||
"downloadLocationChanged": "Download-Speicherort geändert",
|
||||
"downloadLocationReset": "Download-Speicherort auf Standard zurückgesetzt",
|
||||
"downloadLocationInvalid": "Ausgewählter Ordner ist nicht beschreibbar",
|
||||
"downloadLocationSelectError": "Ordnerauswahl fehlgeschlagen",
|
||||
"downloadOnWifiOnly": "Nur über WLAN herunterladen",
|
||||
"downloadOnWifiOnlyDescription": "Downloads über mobile Daten verhindern",
|
||||
"cellularDownloadBlocked": "Downloads sind über mobile Daten deaktiviert. Verbinde dich mit einem WLAN oder ändere die Einstellung."
|
||||
},
|
||||
"search": {
|
||||
"hint": "Filme, Serien, Musik suchen...",
|
||||
@@ -232,7 +234,6 @@
|
||||
"nextButton": "Nächste Episode",
|
||||
"previousChapterButton": "Vorheriges Kapitel",
|
||||
"nextChapterButton": "Nächstes Kapitel",
|
||||
"volumeButton": "Lautstärke",
|
||||
"muteButton": "Stumm schalten",
|
||||
"unmuteButton": "Stummschaltung aufheben",
|
||||
"settingsButton": "Videoeinstellungen",
|
||||
@@ -243,6 +244,7 @@
|
||||
"aspectRatioButton": "Seitenverhältnis",
|
||||
"fullscreenButton": "Vollbild aktivieren",
|
||||
"exitFullscreenButton": "Vollbild verlassen",
|
||||
"alwaysOnTopButton": "Immer im Vordergrund",
|
||||
"rotationLockButton": "Drehsperre",
|
||||
"timelineSlider": "Video-Zeitleiste",
|
||||
"volumeSlider": "Lautstärkepegel",
|
||||
@@ -257,7 +259,9 @@
|
||||
"messages": {
|
||||
"markedAsWatched": "Als gesehen markiert",
|
||||
"markedAsUnwatched": "Als ungesehen markiert",
|
||||
"removedFromContinueWatching": "Aus ‚Weiterschauen‘ entfernt",
|
||||
"markedAsWatchedOffline": "Als gesehen markiert (wird synchronisiert, wenn online)",
|
||||
"markedAsUnwatchedOffline": "Als ungesehen markiert (wird synchronisiert, wenn online)",
|
||||
"removedFromContinueWatching": "Aus ‚Weiterschauen' entfernt",
|
||||
"errorLoading": "Fehler: ${error}",
|
||||
"fileInfoNotAvailable": "Dateiinfo nicht verfügbar",
|
||||
"errorLoadingFileInfo": "Fehler beim Laden der Dateiinfo: ${error}",
|
||||
@@ -273,22 +277,17 @@
|
||||
"metadataRefreshing": "Metadaten werden aktualisiert für „${title}“...",
|
||||
"metadataRefreshStarted": "Metadaten-Aktualisierung gestartet für „${title}“",
|
||||
"metadataRefreshFailed": "Metadaten konnten nicht aktualisiert werden: ${error}",
|
||||
"noPlexToken": "Kein Plex-Token gefunden. Bitte erneut anmelden.",
|
||||
"logoutConfirm": "Abmeldung wirklich durchführen?",
|
||||
"noSeasonsFound": "Keine Staffeln gefunden",
|
||||
"noEpisodesFound": "Keine Episoden in der ersten Staffel gefunden",
|
||||
"noEpisodesFoundGeneral": "Keine Episoden gefunden",
|
||||
"noResultsFound": "Keine Ergebnisse gefunden",
|
||||
"sleepTimerSet": "Sleep-Timer gesetzt auf ${label}",
|
||||
"failedToSwitchProfile": "Profilwechsel zu ${displayName} fehlgeschlagen",
|
||||
"noItemsAvailable": "Keine Elemente verfügbar",
|
||||
"failedToCreatePlayQueue": "Wiedergabewarteschlange konnte nicht erstellt werden",
|
||||
"failedToCreatePlayQueueNoItems": "Wiedergabewarteschlange konnte nicht erstellt werden – keine Elemente",
|
||||
"failedPlayback": "Wiedergabe für ${action} fehlgeschlagen: ${error}"
|
||||
},
|
||||
"profile": {
|
||||
"noUsersAvailable": "Keine Benutzer verfügbar"
|
||||
},
|
||||
"subtitlingStyling": {
|
||||
"stylingOptions": "Stiloptionen",
|
||||
"fontSize": "Schriftgröße",
|
||||
@@ -300,7 +299,6 @@
|
||||
},
|
||||
"dialog": {
|
||||
"confirmAction": "Aktion bestätigen",
|
||||
"areYouSure": "Aktion wirklich ausführen?",
|
||||
"cancel": "Abbrechen",
|
||||
"playNow": "Jetzt abspielen"
|
||||
},
|
||||
@@ -312,11 +310,8 @@
|
||||
"noContentAvailable": "Kein Inhalt verfügbar",
|
||||
"addMediaToLibraries": "Medien zur Mediathek hinzufügen",
|
||||
"continueWatching": "Weiterschauen",
|
||||
"recentlyAdded": "Kürzlich hinzugefügt",
|
||||
"play": "Abspielen",
|
||||
"resume": "Fortsetzen",
|
||||
"playEpisode": "S${season}, E${episode} - Abspielen",
|
||||
"resumeEpisode": "S${season}, E${episode} - Fortsetzen",
|
||||
"playEpisode": "S${season}E${episode}",
|
||||
"pause": "Pause",
|
||||
"overview": "Übersicht",
|
||||
"cast": "Besetzung",
|
||||
@@ -341,8 +336,7 @@
|
||||
"pleaseEnterToken": "Bitte Token eingeben",
|
||||
"invalidToken": "Ungültiges Token",
|
||||
"failedToVerifyToken": "Token-Verifizierung fehlgeschlagen: ${error}",
|
||||
"failedToSwitchProfile": "Profilwechsel zu ${displayName} fehlgeschlagen",
|
||||
"connectionFailedGeneric": "Verbindung fehlgeschlagen"
|
||||
"failedToSwitchProfile": "Profilwechsel zu ${displayName} fehlgeschlagen"
|
||||
},
|
||||
"libraries": {
|
||||
"title": "Mediatheken",
|
||||
@@ -370,7 +364,6 @@
|
||||
"sort": "Sortieren",
|
||||
"sortBy": "Sortieren nach",
|
||||
"filters": "Filter",
|
||||
"loadingLibraryWithCount": "Lade Mediathek... (${count} Elemente geladen)",
|
||||
"confirmActionMessage": "Aktion wirklich durchführen?",
|
||||
"showLibrary": "Mediathek anzeigen",
|
||||
"hideLibrary": "Mediathek ausblenden",
|
||||
@@ -405,23 +398,9 @@
|
||||
"viewLicensesDescription": "Lizenzen von Drittanbieter-Bibliotheken anzeigen"
|
||||
},
|
||||
"serverSelection": {
|
||||
"connectingToServer": "Verbinde mit Server...",
|
||||
"connectingToAllServers": "Verbinde mit allen Servern...",
|
||||
"connectToAllServers": "Mit allen Servern verbinden",
|
||||
"allServerConnectionsFailed": "Verbindung zu allen Servern fehlgeschlagen. Bitte Netzwerk prüfen und erneut versuchen.",
|
||||
"foundServers": "${count} Server gefunden",
|
||||
"orSelectIndividually": "Oder einzelnen Server auswählen:",
|
||||
"serverDebugCopied": "Server-Debugdaten kopiert",
|
||||
"copyDebugData": "Debugdaten kopieren",
|
||||
"noServersFound": "Keine Server gefunden",
|
||||
"noServersFoundForAccount": "Keine Server gefunden für ${username} (${email})",
|
||||
"malformedServerData": "${count} Server mit fehlerhaften Daten gefunden. Keine gültigen Server verfügbar.",
|
||||
"incompleteServerInfo": "Einige Serverinformationen sind unvollständig und wurden übersprungen. Plex.tv-Konto prüfen.",
|
||||
"incompleteConnectionInfo": "Serververbindungsinformationen unvollständig. Bitte erneut versuchen.",
|
||||
"malformedServerInfo": "Serverinformationen fehlerhaft: ${message}",
|
||||
"networkConnectionFailed": "Netzwerkverbindung fehlgeschlagen. Internetverbindung prüfen und erneut versuchen.",
|
||||
"authenticationFailed": "Authentifizierung fehlgeschlagen. Bitte erneut anmelden.",
|
||||
"plexServiceUnavailable": "Plex-Dienst nicht verfügbar. Bitte später erneut versuchen.",
|
||||
"failedToLoadServers": "Server konnten nicht geladen werden: ${error}"
|
||||
},
|
||||
"hubDetail": {
|
||||
@@ -432,11 +411,8 @@
|
||||
"noItemsFound": "Keine Elemente gefunden"
|
||||
},
|
||||
"logs": {
|
||||
"title": "Protokolle",
|
||||
"clearLogs": "Protokolle löschen",
|
||||
"copyLogs": "Protokolle kopieren",
|
||||
"exportLogs": "Protokolle exportieren",
|
||||
"noLogsToShow": "Keine Protokolle zum Anzeigen",
|
||||
"error": "Fehler:",
|
||||
"stackTrace": "Stacktrace:"
|
||||
},
|
||||
@@ -450,32 +426,40 @@
|
||||
"home": "Start",
|
||||
"search": "Suche",
|
||||
"libraries": "Mediatheken",
|
||||
"settings": "Einstellungen"
|
||||
"settings": "Einstellungen",
|
||||
"downloads": "Downloads"
|
||||
},
|
||||
"downloads": {
|
||||
"title": "Downloads",
|
||||
"manage": "Verwalten",
|
||||
"tvShows": "Serien",
|
||||
"movies": "Filme",
|
||||
"noDownloads": "Noch keine Downloads",
|
||||
"noDownloadsDescription": "Heruntergeladene Inhalte werden hier für die Offline-Wiedergabe angezeigt",
|
||||
"downloadNow": "Herunterladen",
|
||||
"deleteDownload": "Download löschen",
|
||||
"retryDownload": "Download wiederholen",
|
||||
"downloadQueued": "Download in Warteschlange",
|
||||
"episodesQueued": "${count} Episoden zum Download hinzugefügt",
|
||||
"downloadDeleted": "Download gelöscht",
|
||||
"deleteConfirm": "Möchtest du \"${title}\" wirklich löschen? Die heruntergeladene Datei wird von deinem Gerät entfernt.",
|
||||
"deletingWithProgress": "Lösche ${title}... (${current} von ${total})"
|
||||
},
|
||||
"playlists": {
|
||||
"title": "Wiedergabelisten",
|
||||
"noPlaylists": "Keine Wiedergabelisten gefunden",
|
||||
"create": "Wiedergabeliste erstellen",
|
||||
"newPlaylist": "Neue Wiedergabeliste",
|
||||
"playlistName": "Name der Wiedergabeliste",
|
||||
"enterPlaylistName": "Name der Wiedergabeliste eingeben",
|
||||
"edit": "Wiedergabeliste bearbeiten",
|
||||
"delete": "Wiedergabeliste löschen",
|
||||
"addTo": "Zur Wiedergabeliste hinzufügen",
|
||||
"addItems": "Elemente hinzufügen",
|
||||
"removeItem": "Aus Wiedergabeliste entfernen",
|
||||
"clearPlaylist": "Wiedergabeliste leeren",
|
||||
"playAll": "Alle abspielen",
|
||||
"shuffle": "Zufällig",
|
||||
"smartPlaylist": "Intelligente Wiedergabeliste",
|
||||
"regularPlaylist": "Normale Wiedergabeliste",
|
||||
"itemCount": "${count} Elemente",
|
||||
"oneItem": "1 Element",
|
||||
"emptyPlaylist": "Diese Wiedergabeliste ist leer",
|
||||
"deleteConfirm": "Wiedergabeliste löschen?",
|
||||
"deleteMessage": "Soll \"${name}\" wirklich gelöscht werden?",
|
||||
"created": "Wiedergabeliste erstellt",
|
||||
"updated": "Wiedergabeliste aktualisiert",
|
||||
"deleted": "Wiedergabeliste gelöscht",
|
||||
"itemAdded": "Zur Wiedergabeliste hinzugefügt",
|
||||
"itemRemoved": "Aus Wiedergabeliste entfernt",
|
||||
@@ -493,7 +477,6 @@
|
||||
"title": "Sammlungen",
|
||||
"collection": "Sammlung",
|
||||
"empty": "Sammlung ist leer",
|
||||
"noItems": "Keine Elemente in dieser Sammlung",
|
||||
"unknownLibrarySection": "Löschen nicht möglich: Unbekannte Bibliothekssektion",
|
||||
"deleteCollection": "Sammlung löschen",
|
||||
"deleteConfirm": "Sind Sie sicher, dass Sie \"${title}\" löschen möchten? Dies kann nicht rückgängig gemacht werden.",
|
||||
@@ -501,7 +484,6 @@
|
||||
"deleteFailed": "Sammlung konnte nicht gelöscht werden",
|
||||
"deleteFailedWithError": "Sammlung konnte nicht gelöscht werden: ${error}",
|
||||
"failedToLoadItems": "Sammlungselemente konnten nicht geladen werden: ${error}",
|
||||
"addTo": "Zur Sammlung hinzufügen",
|
||||
"selectCollection": "Sammlung auswählen",
|
||||
"createNewCollection": "Neue Sammlung erstellen",
|
||||
"collectionName": "Sammlungsname",
|
||||
@@ -514,5 +496,49 @@
|
||||
"removedFromCollection": "Aus Sammlung entfernt",
|
||||
"removeFromCollectionFailed": "Entfernen aus Sammlung fehlgeschlagen",
|
||||
"removeFromCollectionError": "Fehler beim Entfernen aus der Sammlung: ${error}"
|
||||
},
|
||||
"watchTogether": {
|
||||
"title": "Gemeinsam Schauen",
|
||||
"description": "Inhalte synchron mit Freunden und Familie schauen",
|
||||
"createSession": "Sitzung Erstellen",
|
||||
"creating": "Erstellen...",
|
||||
"joinSession": "Sitzung Beitreten",
|
||||
"joining": "Beitreten...",
|
||||
"controlMode": "Steuerungsmodus",
|
||||
"controlModeQuestion": "Wer kann die Wiedergabe steuern?",
|
||||
"hostOnly": "Nur Host",
|
||||
"anyone": "Alle",
|
||||
"hostingSession": "Sitzung Hosten",
|
||||
"inSession": "In Sitzung",
|
||||
"sessionCode": "Sitzungscode",
|
||||
"hostControlsPlayback": "Host steuert die Wiedergabe",
|
||||
"anyoneCanControl": "Alle können die Wiedergabe steuern",
|
||||
"hostControls": "Host steuert",
|
||||
"anyoneControls": "Alle steuern",
|
||||
"participants": "Teilnehmer",
|
||||
"host": "Host",
|
||||
"hostBadge": "HOST",
|
||||
"youAreHost": "Du bist der Host",
|
||||
"watchingWithOthers": "Mit anderen schauen",
|
||||
"endSession": "Sitzung Beenden",
|
||||
"leaveSession": "Sitzung Verlassen",
|
||||
"endSessionQuestion": "Sitzung Beenden?",
|
||||
"leaveSessionQuestion": "Sitzung Verlassen?",
|
||||
"endSessionConfirm": "Dies beendet die Sitzung für alle Teilnehmer.",
|
||||
"leaveSessionConfirm": "Du wirst aus der Sitzung entfernt.",
|
||||
"endSessionConfirmOverlay": "Dies beendet die Schausitzung für alle Teilnehmer.",
|
||||
"leaveSessionConfirmOverlay": "Du wirst von der Schausitzung getrennt.",
|
||||
"end": "Beenden",
|
||||
"leave": "Verlassen",
|
||||
"syncing": "Synchronisieren...",
|
||||
"participant": "Teilnehmer",
|
||||
"joinWatchSession": "Schausitzung Beitreten",
|
||||
"enterCodeHint": "8-stelligen Code eingeben",
|
||||
"pasteFromClipboard": "Aus Zwischenablage einfügen",
|
||||
"pleaseEnterCode": "Bitte gib einen Sitzungscode ein",
|
||||
"codeMustBe8Chars": "Sitzungscode muss 8 Zeichen haben",
|
||||
"joinInstructions": "Gib den vom Host geteilten Sitzungscode ein, um seiner Schausitzung beizutreten.",
|
||||
"failedToCreate": "Sitzung konnte nicht erstellt werden",
|
||||
"failedToJoin": "Sitzung konnte nicht beigetreten werden"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,18 +26,11 @@
|
||||
"submit": "Invia",
|
||||
"confirm": "Conferma",
|
||||
"retry": "Riprova",
|
||||
"playNow": "Riproduci ora",
|
||||
"logout": "Disconnetti",
|
||||
"online": "Online",
|
||||
"offline": "Offline",
|
||||
"owned": "Di proprietà",
|
||||
"shared": "Condiviso",
|
||||
"current": "CORRENTE",
|
||||
"unknown": "Sconosciuto",
|
||||
"refresh": "Aggiorna",
|
||||
"yes": "Sì",
|
||||
"no": "No",
|
||||
"server": "Server",
|
||||
"delete": "Elimina",
|
||||
"shuffle": "Casuale",
|
||||
"addTo": "Aggiungi a..."
|
||||
@@ -65,7 +58,6 @@
|
||||
"theme": "Tema",
|
||||
"appearance": "Aspetto",
|
||||
"videoPlayback": "Riproduzione video",
|
||||
"shufflePlay": "Riproduzione casuale",
|
||||
"advanced": "Avanzate",
|
||||
"useSeasonPostersDescription": "Mostra il poster della stagione invece del poster della serie per gli episodi",
|
||||
"showHeroSectionDescription": "Visualizza il carosello dei contenuti in primo piano sulla schermata iniziale",
|
||||
@@ -105,15 +97,11 @@
|
||||
"minutesUnit": "${minutes} minuti",
|
||||
"rememberTrackSelections": "Ricorda selezioni tracce per serie/film",
|
||||
"rememberTrackSelectionsDescription": "Salva automaticamente le preferenze delle lingue audio e sottotitoli quando cambi tracce durante la riproduzione",
|
||||
"unwatchedOnly": "Solo non guardati",
|
||||
"unwatchedOnlyDescription": "Includi solo gli episodi non guardati nella coda di riproduzione casuale",
|
||||
"shuffleOrderNavigation": "Navigazione in ordine casuale",
|
||||
"shuffleOrderNavigationDescription": "I pulsanti Avanti/Indietro seguono l'ordine casuale",
|
||||
"loopShuffleQueue": "Coda di riproduzione casuale in loop",
|
||||
"loopShuffleQueueDescription": "Riavvia la coda quando raggiungi la fine",
|
||||
"videoPlayerControls": "Controlli del lettore video",
|
||||
"keyboardShortcuts": "Scorciatoie da tastiera",
|
||||
"keyboardShortcutsDescription": "Personalizza le scorciatoie da tastiera",
|
||||
"videoPlayerNavigation": "Navigazione del lettore video",
|
||||
"videoPlayerNavigationDescription": "Usa i tasti freccia per navigare nei controlli del lettore video",
|
||||
"debugLogging": "Log di debug",
|
||||
"debugLoggingDescription": "Abilita il logging dettagliato per la risoluzione dei problemi",
|
||||
"viewLogs": "Visualizza log",
|
||||
@@ -140,7 +128,21 @@
|
||||
"autoSkipCredits": "Salta Crediti Automaticamente",
|
||||
"autoSkipCreditsDescription": "Salta automaticamente i crediti e riproduci l'episodio successivo",
|
||||
"autoSkipDelay": "Ritardo Salto Automatico",
|
||||
"autoSkipDelayDescription": "Aspetta ${seconds} secondi prima del salto automatico"
|
||||
"autoSkipDelayDescription": "Aspetta ${seconds} secondi prima del salto automatico",
|
||||
"downloads": "Download",
|
||||
"downloadLocationDescription": "Scegli dove salvare i contenuti scaricati",
|
||||
"downloadLocationDefault": "Predefinita (Archiviazione App)",
|
||||
"downloadLocationCustom": "Posizione Personalizzata",
|
||||
"selectFolder": "Seleziona Cartella",
|
||||
"resetToDefault": "Ripristina Predefinita",
|
||||
"currentPath": "Corrente: ${path}",
|
||||
"downloadLocationChanged": "Posizione di download modificata",
|
||||
"downloadLocationReset": "Posizione di download ripristinata a predefinita",
|
||||
"downloadLocationInvalid": "La cartella selezionata non è scrivibile",
|
||||
"downloadLocationSelectError": "Impossibile selezionare la cartella",
|
||||
"downloadOnWifiOnly": "Scarica solo con WiFi",
|
||||
"downloadOnWifiOnlyDescription": "Impedisci i download quando si utilizza la rete dati cellulare",
|
||||
"cellularDownloadBlocked": "I download sono disabilitati sulla rete dati cellulare. Connettiti al WiFi o modifica l'impostazione."
|
||||
},
|
||||
"search": {
|
||||
"hint": "Cerca film. spettacoli, musica...",
|
||||
@@ -232,7 +234,6 @@
|
||||
"nextButton": "Episodio successivo",
|
||||
"previousChapterButton": "Capitolo precedente",
|
||||
"nextChapterButton": "Capitolo successivo",
|
||||
"volumeButton": "Volume",
|
||||
"muteButton": "Silenzia",
|
||||
"unmuteButton": "Riattiva audio",
|
||||
"settingsButton": "Impostazioni video",
|
||||
@@ -243,6 +244,7 @@
|
||||
"aspectRatioButton": "Proporzioni",
|
||||
"fullscreenButton": "Attiva schermo intero",
|
||||
"exitFullscreenButton": "Esci da schermo intero",
|
||||
"alwaysOnTopButton": "Sempre in primo piano",
|
||||
"rotationLockButton": "Blocco rotazione",
|
||||
"timelineSlider": "Timeline video",
|
||||
"volumeSlider": "Livello volume",
|
||||
@@ -257,6 +259,8 @@
|
||||
"messages": {
|
||||
"markedAsWatched": "Segna come visto",
|
||||
"markedAsUnwatched": "Segna come non visto",
|
||||
"markedAsWatchedOffline": "Segnato come visto (sincronizzato online)",
|
||||
"markedAsUnwatchedOffline": "Segnato come non visto (sincronizzato online)",
|
||||
"removedFromContinueWatching": "Rimosso da Continua a guardare",
|
||||
"errorLoading": "Errore: ${error}",
|
||||
"fileInfoNotAvailable": "Informazioni sul file non disponibili",
|
||||
@@ -273,22 +277,17 @@
|
||||
"metadataRefreshing": "Aggiornamento metadati per \"${title}\"...",
|
||||
"metadataRefreshStarted": "Aggiornamento metadati per \"${title}\"",
|
||||
"metadataRefreshFailed": "Errore aggiornamento metadati: ${error}",
|
||||
"noPlexToken": "Nessun token Plex trovato. Riesegui l'accesso.",
|
||||
"logoutConfirm": "Sei sicuro di volerti disconnettere?",
|
||||
"noSeasonsFound": "Nessuna stagione trovata",
|
||||
"noEpisodesFound": "Nessun episodio trovato nella prima stagione",
|
||||
"noEpisodesFoundGeneral": "Nessun episodio trovato",
|
||||
"noResultsFound": "Nessun risultato",
|
||||
"sleepTimerSet": "Imposta timer spegnimento per ${label}",
|
||||
"failedToSwitchProfile": "Impossibile passare a ${displayName}",
|
||||
"noItemsAvailable": "Nessun elemento disponibile",
|
||||
"failedToCreatePlayQueue": "Impossibile creare la coda di riproduzione",
|
||||
"failedToCreatePlayQueueNoItems": "Impossibile creare la coda di riproduzione - nessun elemento",
|
||||
"failedPlayback": "Impossibile ${action}: ${error}"
|
||||
},
|
||||
"profile": {
|
||||
"noUsersAvailable": "Nessun utente disponibile"
|
||||
},
|
||||
"subtitlingStyling": {
|
||||
"stylingOptions": "Opzioni stile",
|
||||
"fontSize": "Dimensione",
|
||||
@@ -300,7 +299,6 @@
|
||||
},
|
||||
"dialog": {
|
||||
"confirmAction": "Conferma azione",
|
||||
"areYouSure": "Sei sicuro di voler eseguire questa azione?",
|
||||
"cancel": "Cancella",
|
||||
"playNow": "Riproduci ora"
|
||||
},
|
||||
@@ -312,11 +310,8 @@
|
||||
"noContentAvailable": "Nessun contenuto disponibile",
|
||||
"addMediaToLibraries": "Aggiungi alcuni file multimediali alle tue librerie",
|
||||
"continueWatching": "Continua a guardare",
|
||||
"recentlyAdded": "Aggiunti di recente",
|
||||
"play": "Riproduci",
|
||||
"resume": "Riprendi",
|
||||
"playEpisode": "Riproduci S${season}, E${episode}",
|
||||
"resumeEpisode": "Riprendi S${season}, E${episode}",
|
||||
"playEpisode": "S${season}E${episode}",
|
||||
"pause": "Pausa",
|
||||
"overview": "Panoramica",
|
||||
"cast": "Attori",
|
||||
@@ -341,8 +336,7 @@
|
||||
"pleaseEnterToken": "Inserisci token",
|
||||
"invalidToken": "Token non valido",
|
||||
"failedToVerifyToken": "Verifica token fallita: ${error}",
|
||||
"failedToSwitchProfile": "Impossibile passare a ${displayName}",
|
||||
"connectionFailedGeneric": "Connessione fallita"
|
||||
"failedToSwitchProfile": "Impossibile passare a ${displayName}"
|
||||
},
|
||||
"libraries": {
|
||||
"title": "Librerie",
|
||||
@@ -370,7 +364,6 @@
|
||||
"sort": "Ordina",
|
||||
"sortBy": "Ordina per",
|
||||
"filters": "Filtri",
|
||||
"loadingLibraryWithCount": "Caricamento librerie... (${count} oggetti caricati)",
|
||||
"confirmActionMessage": "Sei sicuro di voler eseguire questa azione?",
|
||||
"showLibrary": "Mostra libreria",
|
||||
"hideLibrary": "Nascondi libreria",
|
||||
@@ -405,23 +398,9 @@
|
||||
"viewLicensesDescription": "Visualizza le licenze delle librerie di terze parti"
|
||||
},
|
||||
"serverSelection": {
|
||||
"connectingToServer": "Connessione al server...",
|
||||
"connectingToAllServers": "Connessione a tutti i server...",
|
||||
"connectToAllServers": "Connetti a tutti i server",
|
||||
"allServerConnectionsFailed": "Impossibile connettersi a nessun server. Controlla la tua rete e riprova.",
|
||||
"foundServers": "Trovati ${count} server",
|
||||
"orSelectIndividually": "Oppure seleziona un server singolarmente:",
|
||||
"serverDebugCopied": "Dati di debug del server copiati negli appunti",
|
||||
"copyDebugData": "Copia dati di debug",
|
||||
"noServersFound": "Nessun server trovato",
|
||||
"noServersFoundForAccount": "Nessun server trovato per ${username} (${email})",
|
||||
"malformedServerData": "Trovato ${count} server con dati difettosi. Nessun server valido disponibile.",
|
||||
"incompleteServerInfo": "Alcuni server presentano informazioni incomplete e sono stati ignorati. Controlla il tuo account Plex.tv.",
|
||||
"incompleteConnectionInfo": "Le informazioni di connessione al server sono incomplete. Riprova.",
|
||||
"malformedServerInfo": "Le informazioni sul server sono errate: ${message}",
|
||||
"networkConnectionFailed": "Connessione di rete non riuscita. Controlla la tua connessione Internet e riprova.",
|
||||
"authenticationFailed": "Autenticazione fallita. Effettua nuovamente l'accesso.",
|
||||
"plexServiceUnavailable": "Servizio Plex non disponibile. Riprova più tardi.",
|
||||
"failedToLoadServers": "Impossibile caricare i server: ${error}"
|
||||
},
|
||||
"hubDetail": {
|
||||
@@ -432,11 +411,8 @@
|
||||
"noItemsFound": "Nessun elemento trovato"
|
||||
},
|
||||
"logs": {
|
||||
"title": "Registro",
|
||||
"clearLogs": "Cancella log",
|
||||
"copyLogs": "Copia log",
|
||||
"exportLogs": "Esporta log",
|
||||
"noLogsToShow": "Nessun log da mostrare",
|
||||
"error": "Errore:",
|
||||
"stackTrace": "Traccia dello stack:"
|
||||
},
|
||||
@@ -450,32 +426,40 @@
|
||||
"home": "Home",
|
||||
"search": "Cerca",
|
||||
"libraries": "Librerie",
|
||||
"settings": "Impostazioni"
|
||||
"settings": "Impostazioni",
|
||||
"downloads": "Download"
|
||||
},
|
||||
"downloads": {
|
||||
"title": "Download",
|
||||
"manage": "Gestisci",
|
||||
"tvShows": "Serie TV",
|
||||
"movies": "Film",
|
||||
"noDownloads": "Nessun download",
|
||||
"noDownloadsDescription": "I contenuti scaricati appariranno qui per la visualizzazione offline",
|
||||
"downloadNow": "Scarica",
|
||||
"deleteDownload": "Elimina download",
|
||||
"retryDownload": "Riprova download",
|
||||
"downloadQueued": "Download in coda",
|
||||
"episodesQueued": "${count} episodi in coda per il download",
|
||||
"downloadDeleted": "Download eliminato",
|
||||
"deleteConfirm": "Sei sicuro di voler eliminare \"${title}\"? Il file scaricato verrà rimosso dal tuo dispositivo.",
|
||||
"deletingWithProgress": "Eliminazione di ${title}... (${current} di ${total})"
|
||||
},
|
||||
"playlists": {
|
||||
"title": "Playlist",
|
||||
"noPlaylists": "Nessuna playlist trovata",
|
||||
"create": "Crea playlist",
|
||||
"newPlaylist": "Nuova playlist",
|
||||
"playlistName": "Nome playlist",
|
||||
"enterPlaylistName": "Inserisci nome playlist",
|
||||
"edit": "Modifica playlist",
|
||||
"delete": "Elimina playlist",
|
||||
"addTo": "Aggiungi a playlist",
|
||||
"addItems": "Aggiungi elementi",
|
||||
"removeItem": "Rimuovi da playlist",
|
||||
"clearPlaylist": "Svuota playlist",
|
||||
"playAll": "Riproduci tutto",
|
||||
"shuffle": "Casuale",
|
||||
"smartPlaylist": "Playlist intelligente",
|
||||
"regularPlaylist": "Playlist normale",
|
||||
"itemCount": "${count} elementi",
|
||||
"oneItem": "1 elemento",
|
||||
"emptyPlaylist": "Questa playlist è vuota",
|
||||
"deleteConfirm": "Eliminare playlist?",
|
||||
"deleteMessage": "Sei sicuro di voler eliminare \"${name}\"?",
|
||||
"created": "Playlist creata",
|
||||
"updated": "Playlist aggiornata",
|
||||
"deleted": "Playlist eliminata",
|
||||
"itemAdded": "Aggiunto alla playlist",
|
||||
"itemRemoved": "Rimosso dalla playlist",
|
||||
@@ -493,7 +477,6 @@
|
||||
"title": "Raccolte",
|
||||
"collection": "Raccolta",
|
||||
"empty": "La raccolta è vuota",
|
||||
"noItems": "Nessun elemento in questa raccolta",
|
||||
"unknownLibrarySection": "Impossibile eliminare: sezione libreria sconosciuta",
|
||||
"deleteCollection": "Elimina raccolta",
|
||||
"deleteConfirm": "Sei sicuro di voler eliminare \"${title}\"? Questa azione non può essere annullata.",
|
||||
@@ -501,7 +484,6 @@
|
||||
"deleteFailed": "Impossibile eliminare la raccolta",
|
||||
"deleteFailedWithError": "Impossibile eliminare la raccolta: ${error}",
|
||||
"failedToLoadItems": "Impossibile caricare gli elementi della raccolta: ${error}",
|
||||
"addTo": "Aggiungi alla raccolta",
|
||||
"selectCollection": "Seleziona raccolta",
|
||||
"createNewCollection": "Crea nuova raccolta",
|
||||
"collectionName": "Nome raccolta",
|
||||
@@ -514,5 +496,49 @@
|
||||
"removedFromCollection": "Rimosso dalla raccolta",
|
||||
"removeFromCollectionFailed": "Impossibile rimuovere dalla raccolta",
|
||||
"removeFromCollectionError": "Errore durante la rimozione dalla raccolta: ${error}"
|
||||
},
|
||||
"watchTogether": {
|
||||
"title": "Guarda Insieme",
|
||||
"description": "Guarda contenuti in sincronia con amici e familiari",
|
||||
"createSession": "Crea Sessione",
|
||||
"creating": "Creazione...",
|
||||
"joinSession": "Unisciti alla Sessione",
|
||||
"joining": "Connessione...",
|
||||
"controlMode": "Modalità di Controllo",
|
||||
"controlModeQuestion": "Chi può controllare la riproduzione?",
|
||||
"hostOnly": "Solo Host",
|
||||
"anyone": "Tutti",
|
||||
"hostingSession": "Hosting Sessione",
|
||||
"inSession": "In Sessione",
|
||||
"sessionCode": "Codice Sessione",
|
||||
"hostControlsPlayback": "L'host controlla la riproduzione",
|
||||
"anyoneCanControl": "Tutti possono controllare la riproduzione",
|
||||
"hostControls": "Controllo host",
|
||||
"anyoneControls": "Controllo di tutti",
|
||||
"participants": "Partecipanti",
|
||||
"host": "Host",
|
||||
"hostBadge": "HOST",
|
||||
"youAreHost": "Sei l'host",
|
||||
"watchingWithOthers": "Guardando con altri",
|
||||
"endSession": "Termina Sessione",
|
||||
"leaveSession": "Lascia Sessione",
|
||||
"endSessionQuestion": "Terminare la Sessione?",
|
||||
"leaveSessionQuestion": "Lasciare la Sessione?",
|
||||
"endSessionConfirm": "Questo terminerà la sessione per tutti i partecipanti.",
|
||||
"leaveSessionConfirm": "Sarai rimosso dalla sessione.",
|
||||
"endSessionConfirmOverlay": "Questo terminerà la sessione di visione per tutti i partecipanti.",
|
||||
"leaveSessionConfirmOverlay": "Sarai disconnesso dalla sessione di visione.",
|
||||
"end": "Termina",
|
||||
"leave": "Lascia",
|
||||
"syncing": "Sincronizzazione...",
|
||||
"participant": "partecipante",
|
||||
"joinWatchSession": "Unisciti alla Sessione di Visione",
|
||||
"enterCodeHint": "Inserisci codice di 8 caratteri",
|
||||
"pasteFromClipboard": "Incolla dagli appunti",
|
||||
"pleaseEnterCode": "Inserisci un codice sessione",
|
||||
"codeMustBe8Chars": "Il codice sessione deve essere di 8 caratteri",
|
||||
"joinInstructions": "Inserisci il codice sessione condiviso dall'host per unirti alla loro sessione di visione.",
|
||||
"failedToCreate": "Impossibile creare la sessione",
|
||||
"failedToJoin": "Impossibile unirsi alla sessione"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,18 +26,11 @@
|
||||
"submit": "Verzenden",
|
||||
"confirm": "Bevestigen",
|
||||
"retry": "Opnieuw proberen",
|
||||
"playNow": "Nu afspelen",
|
||||
"logout": "Uitloggen",
|
||||
"online": "Online",
|
||||
"offline": "Offline",
|
||||
"owned": "Eigendom",
|
||||
"shared": "Gedeeld",
|
||||
"current": "HUIDIG",
|
||||
"unknown": "Onbekend",
|
||||
"refresh": "Vernieuwen",
|
||||
"yes": "Ja",
|
||||
"no": "Nee",
|
||||
"server": "Server",
|
||||
"delete": "Verwijderen",
|
||||
"shuffle": "Willekeurig",
|
||||
"addTo": "Toevoegen aan..."
|
||||
@@ -65,7 +58,6 @@
|
||||
"theme": "Thema",
|
||||
"appearance": "Uiterlijk",
|
||||
"videoPlayback": "Video afspelen",
|
||||
"shufflePlay": "Willekeurig afspelen",
|
||||
"advanced": "Geavanceerd",
|
||||
"useSeasonPostersDescription": "Toon seizoenposter in plaats van serieposter voor afleveringen",
|
||||
"showHeroSectionDescription": "Toon uitgelichte inhoud carrousel op startscherm",
|
||||
@@ -105,15 +97,11 @@
|
||||
"minutesUnit": "bij ${minutes} minuten",
|
||||
"rememberTrackSelections": "Onthoud track selecties per serie/film",
|
||||
"rememberTrackSelectionsDescription": "Bewaar automatisch audio- en ondertiteltaalvoorkeuren wanneer je tracks wijzigt tijdens afspelen",
|
||||
"unwatchedOnly": "Alleen ongekeken",
|
||||
"unwatchedOnlyDescription": "Alleen ongekeken afleveringen opnemen in willekeurige wachtrij",
|
||||
"shuffleOrderNavigation": "Willekeurige volgorde navigatie",
|
||||
"shuffleOrderNavigationDescription": "Volgende/vorige knoppen volgen willekeurige volgorde",
|
||||
"loopShuffleQueue": "Herhaal willekeurige wachtrij",
|
||||
"loopShuffleQueueDescription": "Start wachtrij opnieuw bij het einde",
|
||||
"videoPlayerControls": "Videospeler bediening",
|
||||
"keyboardShortcuts": "Toetsenbord sneltoetsen",
|
||||
"keyboardShortcutsDescription": "Pas toetsenbord sneltoetsen aan",
|
||||
"videoPlayerNavigation": "Videospeler navigatie",
|
||||
"videoPlayerNavigationDescription": "Gebruik pijltjestoetsen om door de videospeler bediening te navigeren",
|
||||
"debugLogging": "Debug logging",
|
||||
"debugLoggingDescription": "Schakel gedetailleerde logging in voor probleemoplossing",
|
||||
"viewLogs": "Bekijk logs",
|
||||
@@ -140,7 +128,21 @@
|
||||
"autoSkipCredits": "Credits Automatisch Overslaan",
|
||||
"autoSkipCreditsDescription": "Credits automatisch overslaan en volgende aflevering afspelen",
|
||||
"autoSkipDelay": "Vertraging Automatisch Overslaan",
|
||||
"autoSkipDelayDescription": "${seconds} seconden wachten voor automatisch overslaan"
|
||||
"autoSkipDelayDescription": "${seconds} seconden wachten voor automatisch overslaan",
|
||||
"downloads": "Downloads",
|
||||
"downloadLocationDescription": "Kies waar gedownloade content wordt opgeslagen",
|
||||
"downloadLocationDefault": "Standaard (App-opslag)",
|
||||
"downloadLocationCustom": "Aangepaste Locatie",
|
||||
"selectFolder": "Selecteer Map",
|
||||
"resetToDefault": "Herstel naar Standaard",
|
||||
"currentPath": "Huidig: ${path}",
|
||||
"downloadLocationChanged": "Downloadlocatie gewijzigd",
|
||||
"downloadLocationReset": "Downloadlocatie hersteld naar standaard",
|
||||
"downloadLocationInvalid": "Geselecteerde map is niet beschrijfbaar",
|
||||
"downloadLocationSelectError": "Kan map niet selecteren",
|
||||
"downloadOnWifiOnly": "Alleen via WiFi downloaden",
|
||||
"downloadOnWifiOnlyDescription": "Voorkom downloads bij gebruik van mobiele data",
|
||||
"cellularDownloadBlocked": "Downloads zijn uitgeschakeld bij mobiele data. Maak verbinding met WiFi of wijzig de instelling."
|
||||
},
|
||||
"search": {
|
||||
"hint": "Zoek films, series, muziek...",
|
||||
@@ -232,7 +234,6 @@
|
||||
"nextButton": "Volgende aflevering",
|
||||
"previousChapterButton": "Vorig hoofdstuk",
|
||||
"nextChapterButton": "Volgend hoofdstuk",
|
||||
"volumeButton": "Volume",
|
||||
"muteButton": "Dempen",
|
||||
"unmuteButton": "Dempen opheffen",
|
||||
"settingsButton": "Video-instellingen",
|
||||
@@ -243,6 +244,7 @@
|
||||
"aspectRatioButton": "Beeldverhouding",
|
||||
"fullscreenButton": "Volledig scherm activeren",
|
||||
"exitFullscreenButton": "Volledig scherm verlaten",
|
||||
"alwaysOnTopButton": "Altijd bovenop",
|
||||
"rotationLockButton": "Rotatievergrendeling",
|
||||
"timelineSlider": "Videotijdlijn",
|
||||
"volumeSlider": "Volumeniveau",
|
||||
@@ -257,6 +259,8 @@
|
||||
"messages": {
|
||||
"markedAsWatched": "Gemarkeerd als gekeken",
|
||||
"markedAsUnwatched": "Gemarkeerd als ongekeken",
|
||||
"markedAsWatchedOffline": "Gemarkeerd als gekeken (sync wanneer online)",
|
||||
"markedAsUnwatchedOffline": "Gemarkeerd als ongekeken (sync wanneer online)",
|
||||
"removedFromContinueWatching": "Verwijderd uit Doorgaan met kijken",
|
||||
"errorLoading": "Fout: ${error}",
|
||||
"fileInfoNotAvailable": "Bestand informatie niet beschikbaar",
|
||||
@@ -273,22 +277,17 @@
|
||||
"metadataRefreshing": "Metadata vernieuwen voor \"${title}\"...",
|
||||
"metadataRefreshStarted": "Metadata vernieuwen gestart voor \"${title}\"",
|
||||
"metadataRefreshFailed": "Kon metadata niet vernieuwen: ${error}",
|
||||
"noPlexToken": "Geen Plex token gevonden. Log opnieuw in.",
|
||||
"logoutConfirm": "Weet je zeker dat je wilt uitloggen?",
|
||||
"noSeasonsFound": "Geen seizoenen gevonden",
|
||||
"noEpisodesFound": "Geen afleveringen gevonden in eerste seizoen",
|
||||
"noEpisodesFoundGeneral": "Geen afleveringen gevonden",
|
||||
"noResultsFound": "Geen resultaten gevonden",
|
||||
"sleepTimerSet": "Slaap timer ingesteld voor ${label}",
|
||||
"failedToSwitchProfile": "Kon niet wisselen naar ${displayName}",
|
||||
"noItemsAvailable": "Geen items beschikbaar",
|
||||
"failedToCreatePlayQueue": "Kan afspeelwachtrij niet maken",
|
||||
"failedToCreatePlayQueueNoItems": "Kan afspeelwachtrij niet maken - geen items",
|
||||
"failedPlayback": "Afspelen van ${action} mislukt: ${error}"
|
||||
},
|
||||
"profile": {
|
||||
"noUsersAvailable": "Geen gebruikers beschikbaar"
|
||||
},
|
||||
"subtitlingStyling": {
|
||||
"stylingOptions": "Opmaak opties",
|
||||
"fontSize": "Lettergrootte",
|
||||
@@ -300,7 +299,6 @@
|
||||
},
|
||||
"dialog": {
|
||||
"confirmAction": "Bevestig actie",
|
||||
"areYouSure": "Weet je zeker dat je deze actie wilt uitvoeren?",
|
||||
"cancel": "Annuleren",
|
||||
"playNow": "Nu afspelen"
|
||||
},
|
||||
@@ -312,11 +310,8 @@
|
||||
"noContentAvailable": "Geen inhoud beschikbaar",
|
||||
"addMediaToLibraries": "Voeg wat media toe aan je bibliotheken",
|
||||
"continueWatching": "Verder kijken",
|
||||
"recentlyAdded": "Recent toegevoegd",
|
||||
"play": "Afspelen",
|
||||
"resume": "Hervatten",
|
||||
"playEpisode": "Speel S${season}, E${episode}",
|
||||
"resumeEpisode": "Hervat S${season}, E${episode}",
|
||||
"playEpisode": "S${season}E${episode}",
|
||||
"pause": "Pauzeren",
|
||||
"overview": "Overzicht",
|
||||
"cast": "Acteurs",
|
||||
@@ -341,8 +336,7 @@
|
||||
"pleaseEnterToken": "Voer een token in",
|
||||
"invalidToken": "Ongeldig token",
|
||||
"failedToVerifyToken": "Kon token niet verifiëren: ${error}",
|
||||
"failedToSwitchProfile": "Kon niet wisselen naar ${displayName}",
|
||||
"connectionFailedGeneric": "Verbinding mislukt"
|
||||
"failedToSwitchProfile": "Kon niet wisselen naar ${displayName}"
|
||||
},
|
||||
"libraries": {
|
||||
"title": "Bibliotheken",
|
||||
@@ -370,7 +364,6 @@
|
||||
"sort": "Sorteren",
|
||||
"sortBy": "Sorteer op",
|
||||
"filters": "Filters",
|
||||
"loadingLibraryWithCount": "Bibliotheek laden... (${count} items geladen)",
|
||||
"confirmActionMessage": "Weet je zeker dat je deze actie wilt uitvoeren?",
|
||||
"showLibrary": "Toon bibliotheek",
|
||||
"hideLibrary": "Verberg bibliotheek",
|
||||
@@ -405,23 +398,9 @@
|
||||
"viewLicensesDescription": "Bekijk licenties van third-party bibliotheken"
|
||||
},
|
||||
"serverSelection": {
|
||||
"connectingToServer": "Verbinden met server...",
|
||||
"connectingToAllServers": "Verbinden met alle servers...",
|
||||
"connectToAllServers": "Verbind met alle servers",
|
||||
"allServerConnectionsFailed": "Kon niet verbinden met servers. Controleer je netwerk en probeer opnieuw.",
|
||||
"foundServers": "${count} server(s) gevonden",
|
||||
"orSelectIndividually": "Of selecteer een server individueel:",
|
||||
"serverDebugCopied": "Server debug gegevens gekopieerd naar klembord",
|
||||
"copyDebugData": "Kopieer debug gegevens",
|
||||
"noServersFound": "Geen servers gevonden",
|
||||
"noServersFoundForAccount": "Geen servers gevonden voor ${username} (${email})",
|
||||
"malformedServerData": "${count} server(s) gevonden met verkeerde data. Geen geldige servers beschikbaar.",
|
||||
"incompleteServerInfo": "Sommige servers hebben incomplete informatie en zijn overgeslagen. Controleer je Plex.tv account.",
|
||||
"incompleteConnectionInfo": "Server verbinding informatie is incompleet. Probeer opnieuw.",
|
||||
"malformedServerInfo": "Server informatie is verkeerd geformatteerd: ${message}",
|
||||
"networkConnectionFailed": "Netwerkverbinding mislukt. Controleer je internetverbinding en probeer opnieuw.",
|
||||
"authenticationFailed": "Authenticatie mislukt. Log opnieuw in.",
|
||||
"plexServiceUnavailable": "Plex service niet beschikbaar. Probeer later opnieuw.",
|
||||
"failedToLoadServers": "Kon servers niet laden: ${error}"
|
||||
},
|
||||
"hubDetail": {
|
||||
@@ -432,11 +411,8 @@
|
||||
"noItemsFound": "Geen items gevonden"
|
||||
},
|
||||
"logs": {
|
||||
"title": "Logbestanden",
|
||||
"clearLogs": "Wis logs",
|
||||
"copyLogs": "Kopieer logs",
|
||||
"exportLogs": "Exporteer logs",
|
||||
"noLogsToShow": "Geen logs om te tonen",
|
||||
"error": "Fout:",
|
||||
"stackTrace": "Stacktracering:"
|
||||
},
|
||||
@@ -450,32 +426,40 @@
|
||||
"home": "Thuis",
|
||||
"search": "Zoeken",
|
||||
"libraries": "Bibliotheken",
|
||||
"settings": "Instellingen"
|
||||
"settings": "Instellingen",
|
||||
"downloads": "Downloads"
|
||||
},
|
||||
"downloads": {
|
||||
"title": "Downloads",
|
||||
"manage": "Beheren",
|
||||
"tvShows": "Series",
|
||||
"movies": "Films",
|
||||
"noDownloads": "Nog geen downloads",
|
||||
"noDownloadsDescription": "Gedownloade content verschijnt hier voor offline weergave",
|
||||
"downloadNow": "Download",
|
||||
"deleteDownload": "Download verwijderen",
|
||||
"retryDownload": "Download opnieuw proberen",
|
||||
"downloadQueued": "Download in wachtrij",
|
||||
"episodesQueued": "${count} afleveringen in wachtrij voor download",
|
||||
"downloadDeleted": "Download verwijderd",
|
||||
"deleteConfirm": "Weet je zeker dat je \"${title}\" wilt verwijderen? Het gedownloade bestand wordt van je apparaat verwijderd.",
|
||||
"deletingWithProgress": "Verwijderen van ${title}... (${current} van ${total})"
|
||||
},
|
||||
"playlists": {
|
||||
"title": "Afspeellijsten",
|
||||
"noPlaylists": "Geen afspeellijsten gevonden",
|
||||
"create": "Afspeellijst maken",
|
||||
"newPlaylist": "Nieuwe afspeellijst",
|
||||
"playlistName": "Naam afspeellijst",
|
||||
"enterPlaylistName": "Voer naam afspeellijst in",
|
||||
"edit": "Afspeellijst bewerken",
|
||||
"delete": "Afspeellijst verwijderen",
|
||||
"addTo": "Toevoegen aan afspeellijst",
|
||||
"addItems": "Items toevoegen",
|
||||
"removeItem": "Verwijderen uit afspeellijst",
|
||||
"clearPlaylist": "Afspeellijst wissen",
|
||||
"playAll": "Alles afspelen",
|
||||
"shuffle": "Willekeurig",
|
||||
"smartPlaylist": "Slimme afspeellijst",
|
||||
"regularPlaylist": "Normale afspeellijst",
|
||||
"itemCount": "${count} items",
|
||||
"oneItem": "1 item",
|
||||
"emptyPlaylist": "Deze afspeellijst is leeg",
|
||||
"deleteConfirm": "Afspeellijst verwijderen?",
|
||||
"deleteMessage": "Weet je zeker dat je \"${name}\" wilt verwijderen?",
|
||||
"created": "Afspeellijst gemaakt",
|
||||
"updated": "Afspeellijst bijgewerkt",
|
||||
"deleted": "Afspeellijst verwijderd",
|
||||
"itemAdded": "Toegevoegd aan afspeellijst",
|
||||
"itemRemoved": "Verwijderd uit afspeellijst",
|
||||
@@ -493,7 +477,6 @@
|
||||
"title": "Collecties",
|
||||
"collection": "Collectie",
|
||||
"empty": "Collectie is leeg",
|
||||
"noItems": "Geen items in deze collectie",
|
||||
"unknownLibrarySection": "Kan niet verwijderen: onbekende bibliotheeksectie",
|
||||
"deleteCollection": "Collectie verwijderen",
|
||||
"deleteConfirm": "Weet je zeker dat je \"${title}\" wilt verwijderen? Deze actie kan niet ongedaan worden gemaakt.",
|
||||
@@ -501,7 +484,6 @@
|
||||
"deleteFailed": "Collectie verwijderen mislukt",
|
||||
"deleteFailedWithError": "Collectie verwijderen mislukt: ${error}",
|
||||
"failedToLoadItems": "Collectie-items laden mislukt: ${error}",
|
||||
"addTo": "Toevoegen aan collectie",
|
||||
"selectCollection": "Selecteer collectie",
|
||||
"createNewCollection": "Nieuwe collectie maken",
|
||||
"collectionName": "Collectienaam",
|
||||
@@ -514,5 +496,49 @@
|
||||
"removedFromCollection": "Uit collectie verwijderd",
|
||||
"removeFromCollectionFailed": "Verwijderen uit collectie mislukt",
|
||||
"removeFromCollectionError": "Fout bij verwijderen uit collectie: ${error}"
|
||||
},
|
||||
"watchTogether": {
|
||||
"title": "Samen Kijken",
|
||||
"description": "Kijk synchroon met vrienden en familie",
|
||||
"createSession": "Sessie Maken",
|
||||
"creating": "Maken...",
|
||||
"joinSession": "Sessie Deelnemen",
|
||||
"joining": "Deelnemen...",
|
||||
"controlMode": "Controlemodus",
|
||||
"controlModeQuestion": "Wie kan het afspelen bedienen?",
|
||||
"hostOnly": "Alleen Host",
|
||||
"anyone": "Iedereen",
|
||||
"hostingSession": "Sessie Hosten",
|
||||
"inSession": "In Sessie",
|
||||
"sessionCode": "Sessiecode",
|
||||
"hostControlsPlayback": "Host bedient het afspelen",
|
||||
"anyoneCanControl": "Iedereen kan het afspelen bedienen",
|
||||
"hostControls": "Host bedient",
|
||||
"anyoneControls": "Iedereen bedient",
|
||||
"participants": "Deelnemers",
|
||||
"host": "Host",
|
||||
"hostBadge": "HOST",
|
||||
"youAreHost": "Jij bent de host",
|
||||
"watchingWithOthers": "Kijken met anderen",
|
||||
"endSession": "Sessie Beëindigen",
|
||||
"leaveSession": "Sessie Verlaten",
|
||||
"endSessionQuestion": "Sessie Beëindigen?",
|
||||
"leaveSessionQuestion": "Sessie Verlaten?",
|
||||
"endSessionConfirm": "Dit beëindigt de sessie voor alle deelnemers.",
|
||||
"leaveSessionConfirm": "Je wordt uit de sessie verwijderd.",
|
||||
"endSessionConfirmOverlay": "Dit beëindigt de kijksessie voor alle deelnemers.",
|
||||
"leaveSessionConfirmOverlay": "Je wordt losgekoppeld van de kijksessie.",
|
||||
"end": "Beëindigen",
|
||||
"leave": "Verlaten",
|
||||
"syncing": "Synchroniseren...",
|
||||
"participant": "deelnemer",
|
||||
"joinWatchSession": "Kijksessie Deelnemen",
|
||||
"enterCodeHint": "Voer 8-teken code in",
|
||||
"pasteFromClipboard": "Plakken van klembord",
|
||||
"pleaseEnterCode": "Voer een sessiecode in",
|
||||
"codeMustBe8Chars": "Sessiecode moet 8 tekens zijn",
|
||||
"joinInstructions": "Voer de sessiecode in die door de host is gedeeld om deel te nemen aan hun kijksessie.",
|
||||
"failedToCreate": "Sessie maken mislukt",
|
||||
"failedToJoin": "Sessie deelnemen mislukt"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,18 +26,11 @@
|
||||
"submit": "Skicka",
|
||||
"confirm": "Bekräfta",
|
||||
"retry": "Försök igen",
|
||||
"playNow": "Spela nu",
|
||||
"logout": "Logga ut",
|
||||
"online": "Online",
|
||||
"offline": "Offline",
|
||||
"owned": "Egen",
|
||||
"shared": "Delad",
|
||||
"current": "NUVARANDE",
|
||||
"unknown": "Okänd",
|
||||
"refresh": "Uppdatera",
|
||||
"yes": "Ja",
|
||||
"no": "Nej",
|
||||
"server": "Server",
|
||||
"delete": "Ta bort",
|
||||
"shuffle": "Blanda",
|
||||
"addTo": "Lägg till i..."
|
||||
@@ -65,7 +58,6 @@
|
||||
"theme": "Tema",
|
||||
"appearance": "Utseende",
|
||||
"videoPlayback": "Videouppspelning",
|
||||
"shufflePlay": "Blanda uppspelning",
|
||||
"advanced": "Avancerat",
|
||||
"useSeasonPostersDescription": "Visa säsongsaffisch istället för serieaffisch för avsnitt",
|
||||
"showHeroSectionDescription": "Visa utvalda innehållskarusell på startsidan",
|
||||
@@ -105,15 +97,11 @@
|
||||
"minutesUnit": "${minutes} minuter",
|
||||
"rememberTrackSelections": "Kom ihåg spårval per serie/film",
|
||||
"rememberTrackSelectionsDescription": "Spara automatiskt ljud- och undertextspråkpreferenser när du ändrar spår under uppspelning",
|
||||
"unwatchedOnly": "Endast osedda",
|
||||
"unwatchedOnlyDescription": "Inkludera endast osedda avsnitt i blandningskön",
|
||||
"shuffleOrderNavigation": "Blandningsordning-navigation",
|
||||
"shuffleOrderNavigationDescription": "Nästa/föregående knappar följer blandad ordning",
|
||||
"loopShuffleQueue": "Loopa blandningskö",
|
||||
"loopShuffleQueueDescription": "Starta om kö när slutet nås",
|
||||
"videoPlayerControls": "Videospelar-kontroller",
|
||||
"keyboardShortcuts": "Tangentbordsgenvägar",
|
||||
"keyboardShortcutsDescription": "Anpassa tangentbordsgenvägar",
|
||||
"videoPlayerNavigation": "Navigering i videospelaren",
|
||||
"videoPlayerNavigationDescription": "Använd piltangenter för att navigera videospelarens kontroller",
|
||||
"debugLogging": "Felsökningsloggning",
|
||||
"debugLoggingDescription": "Aktivera detaljerad loggning för felsökning",
|
||||
"viewLogs": "Visa loggar",
|
||||
@@ -140,7 +128,21 @@
|
||||
"autoSkipCredits": "Hoppa Över Credits Automatiskt",
|
||||
"autoSkipCreditsDescription": "Hoppa automatiskt över credits och spela nästa avsnitt",
|
||||
"autoSkipDelay": "Fördröjning Auto Hoppa Över",
|
||||
"autoSkipDelayDescription": "Vänta ${seconds} sekunder innan automatisk överhoppning"
|
||||
"autoSkipDelayDescription": "Vänta ${seconds} sekunder innan automatisk överhoppning",
|
||||
"downloads": "Nedladdningar",
|
||||
"downloadLocationDescription": "Välj var nedladdat innehåll ska lagras",
|
||||
"downloadLocationDefault": "Standard (App-lagring)",
|
||||
"downloadLocationCustom": "Anpassad Plats",
|
||||
"selectFolder": "Välj Mapp",
|
||||
"resetToDefault": "Återställ till Standard",
|
||||
"currentPath": "Nuvarande: ${path}",
|
||||
"downloadLocationChanged": "Nedladdningsplats ändrad",
|
||||
"downloadLocationReset": "Nedladdningsplats återställd till standard",
|
||||
"downloadLocationInvalid": "Vald mapp är inte skrivbar",
|
||||
"downloadLocationSelectError": "Kunde inte välja mapp",
|
||||
"downloadOnWifiOnly": "Ladda ner endast på WiFi",
|
||||
"downloadOnWifiOnlyDescription": "Förhindra nedladdningar vid användning av mobildata",
|
||||
"cellularDownloadBlocked": "Nedladdningar är inaktiverade på mobildata. Anslut till WiFi eller ändra inställningen."
|
||||
},
|
||||
"search": {
|
||||
"hint": "Sök filmer, serier, musik...",
|
||||
@@ -232,7 +234,6 @@
|
||||
"nextButton": "Nästa avsnitt",
|
||||
"previousChapterButton": "Föregående kapitel",
|
||||
"nextChapterButton": "Nästa kapitel",
|
||||
"volumeButton": "Volym",
|
||||
"muteButton": "Tysta",
|
||||
"unmuteButton": "Slå på ljud",
|
||||
"settingsButton": "Videoinställningar",
|
||||
@@ -243,6 +244,7 @@
|
||||
"aspectRatioButton": "Bildförhållande",
|
||||
"fullscreenButton": "Aktivera helskärm",
|
||||
"exitFullscreenButton": "Avsluta helskärm",
|
||||
"alwaysOnTopButton": "Alltid överst",
|
||||
"rotationLockButton": "Rotationslås",
|
||||
"timelineSlider": "Videotidslinje",
|
||||
"volumeSlider": "Volymnivå",
|
||||
@@ -257,6 +259,8 @@
|
||||
"messages": {
|
||||
"markedAsWatched": "Markerad som sedd",
|
||||
"markedAsUnwatched": "Markerad som osedd",
|
||||
"markedAsWatchedOffline": "Markerad som sedd (synkroniseras när online)",
|
||||
"markedAsUnwatchedOffline": "Markerad som osedd (synkroniseras när online)",
|
||||
"removedFromContinueWatching": "Borttagen från Fortsätt titta",
|
||||
"errorLoading": "Fel: ${error}",
|
||||
"fileInfoNotAvailable": "Filinformation inte tillgänglig",
|
||||
@@ -273,22 +277,17 @@
|
||||
"metadataRefreshing": "Uppdaterar metadata för \"${title}\"...",
|
||||
"metadataRefreshStarted": "Metadata-uppdatering startad för \"${title}\"",
|
||||
"metadataRefreshFailed": "Misslyckades att uppdatera metadata: ${error}",
|
||||
"noPlexToken": "Ingen Plex-token hittad. Vänligen logga in igen.",
|
||||
"logoutConfirm": "Är du säker på att du vill logga ut?",
|
||||
"noSeasonsFound": "Inga säsonger hittades",
|
||||
"noEpisodesFound": "Inga avsnitt hittades i första säsongen",
|
||||
"noEpisodesFoundGeneral": "Inga avsnitt hittades",
|
||||
"noResultsFound": "Inga resultat hittades",
|
||||
"sleepTimerSet": "Sovtimer inställd för ${label}",
|
||||
"failedToSwitchProfile": "Misslyckades att byta till ${displayName}",
|
||||
"noItemsAvailable": "Inga objekt tillgängliga",
|
||||
"failedToCreatePlayQueue": "Det gick inte att skapa uppspelningskö",
|
||||
"failedToCreatePlayQueueNoItems": "Det gick inte att skapa uppspelningskö – inga objekt",
|
||||
"failedPlayback": "Kunde inte ${action}: ${error}"
|
||||
},
|
||||
"profile": {
|
||||
"noUsersAvailable": "Inga användare tillgängliga"
|
||||
},
|
||||
"subtitlingStyling": {
|
||||
"stylingOptions": "Stilalternativ",
|
||||
"fontSize": "Teckenstorlek",
|
||||
@@ -300,7 +299,6 @@
|
||||
},
|
||||
"dialog": {
|
||||
"confirmAction": "Bekräfta åtgärd",
|
||||
"areYouSure": "Är du säker på att du vill utföra denna åtgärd?",
|
||||
"cancel": "Avbryt",
|
||||
"playNow": "Spela nu"
|
||||
},
|
||||
@@ -312,11 +310,8 @@
|
||||
"noContentAvailable": "Inget innehåll tillgängligt",
|
||||
"addMediaToLibraries": "Lägg till media till dina bibliotek",
|
||||
"continueWatching": "Fortsätt titta",
|
||||
"recentlyAdded": "Nyligen tillagda",
|
||||
"play": "Spela",
|
||||
"resume": "Återuppta",
|
||||
"playEpisode": "Spela S${season}, E${episode}",
|
||||
"resumeEpisode": "Återuppta S${season}, E${episode}",
|
||||
"playEpisode": "S${season}E${episode}",
|
||||
"pause": "Pausa",
|
||||
"overview": "Översikt",
|
||||
"cast": "Rollbesättning",
|
||||
@@ -341,8 +336,7 @@
|
||||
"pleaseEnterToken": "Vänligen ange en token",
|
||||
"invalidToken": "Ogiltig token",
|
||||
"failedToVerifyToken": "Misslyckades att verifiera token: ${error}",
|
||||
"failedToSwitchProfile": "Misslyckades att byta till ${displayName}",
|
||||
"connectionFailedGeneric": "Anslutning misslyckades"
|
||||
"failedToSwitchProfile": "Misslyckades att byta till ${displayName}"
|
||||
},
|
||||
"libraries": {
|
||||
"title": "Bibliotek",
|
||||
@@ -370,7 +364,6 @@
|
||||
"sort": "Sortera",
|
||||
"sortBy": "Sortera efter",
|
||||
"filters": "Filter",
|
||||
"loadingLibraryWithCount": "Laddar bibliotek... (${count} objekt laddade)",
|
||||
"confirmActionMessage": "Är du säker på att du vill utföra denna åtgärd?",
|
||||
"showLibrary": "Visa bibliotek",
|
||||
"hideLibrary": "Dölj bibliotek",
|
||||
@@ -405,23 +398,9 @@
|
||||
"viewLicensesDescription": "Visa licenser för tredjepartsbibliotek"
|
||||
},
|
||||
"serverSelection": {
|
||||
"connectingToServer": "Ansluter till server...",
|
||||
"connectingToAllServers": "Ansluter till alla servrar...",
|
||||
"connectToAllServers": "Anslut till alla servrar",
|
||||
"allServerConnectionsFailed": "Misslyckades att ansluta till servrar. Kontrollera ditt nätverk och försök igen.",
|
||||
"foundServers": "Hittade ${count} server(ar)",
|
||||
"orSelectIndividually": "Eller välj en server individuellt:",
|
||||
"serverDebugCopied": "Server-felsökningsdata kopierad till urklipp",
|
||||
"copyDebugData": "Kopiera felsökningsdata",
|
||||
"noServersFound": "Inga servrar hittades",
|
||||
"noServersFoundForAccount": "Inga servrar hittades för ${username} (${email})",
|
||||
"malformedServerData": "Hittade ${count} server(ar) med felformaterad data. Inga giltiga servrar tillgängliga.",
|
||||
"incompleteServerInfo": "Vissa servrar har ofullständig information och hoppades över. Vänligen kontrollera ditt Plex.tv-konto.",
|
||||
"incompleteConnectionInfo": "Server-anslutningsinformation är ofullständig. Försök igen.",
|
||||
"malformedServerInfo": "Serverinformation är felformaterad: ${message}",
|
||||
"networkConnectionFailed": "Nätverksanslutning misslyckades. Kontrollera din internetanslutning och försök igen.",
|
||||
"authenticationFailed": "Autentisering misslyckades. Logga in igen.",
|
||||
"plexServiceUnavailable": "Plex-tjänst otillgänglig. Försök igen senare.",
|
||||
"failedToLoadServers": "Misslyckades att ladda servrar: ${error}"
|
||||
},
|
||||
"hubDetail": {
|
||||
@@ -432,11 +411,8 @@
|
||||
"noItemsFound": "Inga objekt hittades"
|
||||
},
|
||||
"logs": {
|
||||
"title": "Loggar",
|
||||
"clearLogs": "Rensa loggar",
|
||||
"copyLogs": "Kopiera loggar",
|
||||
"exportLogs": "Exportera loggar",
|
||||
"noLogsToShow": "Inga loggar att visa",
|
||||
"error": "Fel:",
|
||||
"stackTrace": "Stack trace:"
|
||||
},
|
||||
@@ -450,32 +426,40 @@
|
||||
"home": "Hem",
|
||||
"search": "Sök",
|
||||
"libraries": "Bibliotek",
|
||||
"settings": "Inställningar"
|
||||
"settings": "Inställningar",
|
||||
"downloads": "Nedladdningar"
|
||||
},
|
||||
"downloads": {
|
||||
"title": "Nedladdningar",
|
||||
"manage": "Hantera",
|
||||
"tvShows": "TV-serier",
|
||||
"movies": "Filmer",
|
||||
"noDownloads": "Inga nedladdningar ännu",
|
||||
"noDownloadsDescription": "Nedladdat innehåll visas här för offline-visning",
|
||||
"downloadNow": "Ladda ner",
|
||||
"deleteDownload": "Ta bort nedladdning",
|
||||
"retryDownload": "Försök igen",
|
||||
"downloadQueued": "Nedladdning köad",
|
||||
"episodesQueued": "${count} avsnitt köade för nedladdning",
|
||||
"downloadDeleted": "Nedladdning borttagen",
|
||||
"deleteConfirm": "Är du säker på att du vill ta bort \"${title}\"? Den nedladdade filen kommer att tas bort från din enhet.",
|
||||
"deletingWithProgress": "Tar bort ${title}... (${current} av ${total})"
|
||||
},
|
||||
"playlists": {
|
||||
"title": "Spellistor",
|
||||
"noPlaylists": "Inga spellistor hittades",
|
||||
"create": "Skapa spellista",
|
||||
"newPlaylist": "Ny spellista",
|
||||
"playlistName": "Spellistans namn",
|
||||
"enterPlaylistName": "Ange spellistans namn",
|
||||
"edit": "Redigera spellista",
|
||||
"delete": "Ta bort spellista",
|
||||
"addTo": "Lägg till i spellista",
|
||||
"addItems": "Lägg till objekt",
|
||||
"removeItem": "Ta bort från spellista",
|
||||
"clearPlaylist": "Rensa spellista",
|
||||
"playAll": "Spela alla",
|
||||
"shuffle": "Blanda",
|
||||
"smartPlaylist": "Smart spellista",
|
||||
"regularPlaylist": "Vanlig spellista",
|
||||
"itemCount": "${count} objekt",
|
||||
"oneItem": "1 objekt",
|
||||
"emptyPlaylist": "Denna spellista är tom",
|
||||
"deleteConfirm": "Ta bort spellista?",
|
||||
"deleteMessage": "Är du säker på att du vill ta bort \"${name}\"?",
|
||||
"created": "Spellista skapad",
|
||||
"updated": "Spellista uppdaterad",
|
||||
"deleted": "Spellista borttagen",
|
||||
"itemAdded": "Tillagd i spellista",
|
||||
"itemRemoved": "Borttagen från spellista",
|
||||
@@ -493,7 +477,6 @@
|
||||
"title": "Samlingar",
|
||||
"collection": "Samling",
|
||||
"empty": "Samlingen är tom",
|
||||
"noItems": "Inga objekt i den här samlingen",
|
||||
"unknownLibrarySection": "Kan inte ta bort: okänd bibliotekssektion",
|
||||
"deleteCollection": "Ta bort samling",
|
||||
"deleteConfirm": "Är du säker på att du vill ta bort \"${title}\"? Detta går inte att ångra.",
|
||||
@@ -501,7 +484,6 @@
|
||||
"deleteFailed": "Det gick inte att ta bort samlingen",
|
||||
"deleteFailedWithError": "Det gick inte att ta bort samlingen: ${error}",
|
||||
"failedToLoadItems": "Det gick inte att läsa in samlingsobjekt: ${error}",
|
||||
"addTo": "Lägg till i samling",
|
||||
"selectCollection": "Välj samling",
|
||||
"createNewCollection": "Skapa ny samling",
|
||||
"collectionName": "Samlingsnamn",
|
||||
@@ -514,5 +496,49 @@
|
||||
"removedFromCollection": "Borttagen från samling",
|
||||
"removeFromCollectionFailed": "Misslyckades med att ta bort från samling",
|
||||
"removeFromCollectionError": "Fel vid borttagning från samling: ${error}"
|
||||
},
|
||||
"watchTogether": {
|
||||
"title": "Titta Tillsammans",
|
||||
"description": "Titta på innehåll synkroniserat med vänner och familj",
|
||||
"createSession": "Skapa Session",
|
||||
"creating": "Skapar...",
|
||||
"joinSession": "Gå med i Session",
|
||||
"joining": "Ansluter...",
|
||||
"controlMode": "Kontrollläge",
|
||||
"controlModeQuestion": "Vem kan styra uppspelningen?",
|
||||
"hostOnly": "Endast Värd",
|
||||
"anyone": "Alla",
|
||||
"hostingSession": "Värd för Session",
|
||||
"inSession": "I Session",
|
||||
"sessionCode": "Sessionskod",
|
||||
"hostControlsPlayback": "Värden styr uppspelningen",
|
||||
"anyoneCanControl": "Alla kan styra uppspelningen",
|
||||
"hostControls": "Värd styr",
|
||||
"anyoneControls": "Alla styr",
|
||||
"participants": "Deltagare",
|
||||
"host": "Värd",
|
||||
"hostBadge": "VÄRD",
|
||||
"youAreHost": "Du är värden",
|
||||
"watchingWithOthers": "Tittar med andra",
|
||||
"endSession": "Avsluta Session",
|
||||
"leaveSession": "Lämna Session",
|
||||
"endSessionQuestion": "Avsluta Session?",
|
||||
"leaveSessionQuestion": "Lämna Session?",
|
||||
"endSessionConfirm": "Detta avslutar sessionen för alla deltagare.",
|
||||
"leaveSessionConfirm": "Du kommer att tas bort från sessionen.",
|
||||
"endSessionConfirmOverlay": "Detta avslutar tittarsessionen för alla deltagare.",
|
||||
"leaveSessionConfirmOverlay": "Du kommer att kopplas bort från tittarsessionen.",
|
||||
"end": "Avsluta",
|
||||
"leave": "Lämna",
|
||||
"syncing": "Synkroniserar...",
|
||||
"participant": "deltagare",
|
||||
"joinWatchSession": "Gå med i Tittarsession",
|
||||
"enterCodeHint": "Ange 8-teckens kod",
|
||||
"pasteFromClipboard": "Klistra in från urklipp",
|
||||
"pleaseEnterCode": "Vänligen ange en sessionskod",
|
||||
"codeMustBe8Chars": "Sessionskod måste vara 8 tecken",
|
||||
"joinInstructions": "Ange sessionskoden som delats av värden för att gå med i deras tittarsession.",
|
||||
"failedToCreate": "Det gick inte att skapa session",
|
||||
"failedToJoin": "Det gick inte att gå med i session"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,18 +26,11 @@
|
||||
"submit": "提交",
|
||||
"confirm": "确认",
|
||||
"retry": "重试",
|
||||
"playNow": "立即播放",
|
||||
"logout": "登出",
|
||||
"online": "在线",
|
||||
"offline": "离线",
|
||||
"owned": "拥有",
|
||||
"shared": "共享",
|
||||
"current": "当前",
|
||||
"unknown": "未知",
|
||||
"refresh": "刷新",
|
||||
"yes": "是",
|
||||
"no": "否",
|
||||
"server": "服务器",
|
||||
"delete": "删除",
|
||||
"shuffle": "随机播放",
|
||||
"addTo": "添加到..."
|
||||
@@ -45,7 +38,7 @@
|
||||
"screens": {
|
||||
"licenses": "许可证",
|
||||
"selectServer": "选择服务器",
|
||||
"switchProfile": "切换配置文件",
|
||||
"switchProfile": "切换用户",
|
||||
"subtitleStyling": "字幕样式",
|
||||
"search": "搜索",
|
||||
"logs": "日志"
|
||||
@@ -65,7 +58,6 @@
|
||||
"theme": "主题",
|
||||
"appearance": "外观",
|
||||
"videoPlayback": "视频播放",
|
||||
"shufflePlay": "随机播放",
|
||||
"advanced": "高级",
|
||||
"useSeasonPostersDescription": "为剧集显示季海报而非剧集海报",
|
||||
"showHeroSectionDescription": "在主屏幕上显示精选内容轮播区",
|
||||
@@ -105,15 +97,11 @@
|
||||
"minutesUnit": "${minutes} 分钟",
|
||||
"rememberTrackSelections": "记住每个剧集/电影的音轨选择",
|
||||
"rememberTrackSelectionsDescription": "在播放过程中更改音轨时自动保存音频和字幕语言偏好",
|
||||
"unwatchedOnly": "仅未观看",
|
||||
"unwatchedOnlyDescription": "随机队列中仅包含未观看的剧集",
|
||||
"shuffleOrderNavigation": "随机顺序导航",
|
||||
"shuffleOrderNavigationDescription": "下一集/上一集按钮遵循随机播放顺序",
|
||||
"loopShuffleQueue": "循环随机队列",
|
||||
"loopShuffleQueueDescription": "在队列结束时重新开始",
|
||||
"videoPlayerControls": "视频播放器控制",
|
||||
"keyboardShortcuts": "键盘快捷键",
|
||||
"keyboardShortcutsDescription": "自定义键盘快捷键",
|
||||
"videoPlayerNavigation": "视频播放器导航",
|
||||
"videoPlayerNavigationDescription": "使用方向键导航视频播放器控件",
|
||||
"debugLogging": "调试日志",
|
||||
"debugLoggingDescription": "启用详细日志记录以便故障排除",
|
||||
"viewLogs": "查看日志",
|
||||
@@ -140,7 +128,21 @@
|
||||
"autoSkipCredits": "自动跳过片尾",
|
||||
"autoSkipCreditsDescription": "自动跳过片尾并播放下一集",
|
||||
"autoSkipDelay": "自动跳过延迟",
|
||||
"autoSkipDelayDescription": "自动跳过前等待 ${seconds} 秒"
|
||||
"autoSkipDelayDescription": "自动跳过前等待 ${seconds} 秒",
|
||||
"downloads": "下载",
|
||||
"downloadLocationDescription": "选择下载内容的存储位置",
|
||||
"downloadLocationDefault": "默认(应用存储)",
|
||||
"downloadLocationCustom": "自定义位置",
|
||||
"selectFolder": "选择文件夹",
|
||||
"resetToDefault": "重置为默认",
|
||||
"currentPath": "当前: ${path}",
|
||||
"downloadLocationChanged": "下载位置已更改",
|
||||
"downloadLocationReset": "下载位置已重置为默认",
|
||||
"downloadLocationInvalid": "所选文件夹不可写入",
|
||||
"downloadLocationSelectError": "选择文件夹失败",
|
||||
"downloadOnWifiOnly": "仅在 WiFi 时下载",
|
||||
"downloadOnWifiOnlyDescription": "使用蜂窝数据时禁止下载",
|
||||
"cellularDownloadBlocked": "蜂窝数据下已禁用下载。请连接 WiFi 或更改设置。"
|
||||
},
|
||||
"search": {
|
||||
"hint": "搜索电影、系列、音乐...",
|
||||
@@ -232,7 +234,6 @@
|
||||
"nextButton": "下一集",
|
||||
"previousChapterButton": "上一章节",
|
||||
"nextChapterButton": "下一章节",
|
||||
"volumeButton": "音量",
|
||||
"muteButton": "静音",
|
||||
"unmuteButton": "取消静音",
|
||||
"settingsButton": "视频设置",
|
||||
@@ -243,6 +244,7 @@
|
||||
"aspectRatioButton": "宽高比",
|
||||
"fullscreenButton": "进入全屏",
|
||||
"exitFullscreenButton": "退出全屏",
|
||||
"alwaysOnTopButton": "置顶窗口",
|
||||
"rotationLockButton": "旋转锁定",
|
||||
"timelineSlider": "视频时间轴",
|
||||
"volumeSlider": "音量调节",
|
||||
@@ -257,6 +259,8 @@
|
||||
"messages": {
|
||||
"markedAsWatched": "已标记为已观看",
|
||||
"markedAsUnwatched": "已标记为未观看",
|
||||
"markedAsWatchedOffline": "已标记为已观看 (将在联网时同步)",
|
||||
"markedAsUnwatchedOffline": "已标记为未观看 (将在联网时同步)",
|
||||
"removedFromContinueWatching": "已从继续观看中移除",
|
||||
"errorLoading": "错误: ${error}",
|
||||
"fileInfoNotAvailable": "文件信息不可用",
|
||||
@@ -273,22 +277,17 @@
|
||||
"metadataRefreshing": "正在刷新 “${title}” 的元数据...",
|
||||
"metadataRefreshStarted": "已开始刷新 “${title}” 的元数据",
|
||||
"metadataRefreshFailed": "无法刷新元数据: ${error}",
|
||||
"noPlexToken": "未找到 Plex 令牌。请重新登录。",
|
||||
"logoutConfirm": "你确定要登出吗?",
|
||||
"noSeasonsFound": "未找到季",
|
||||
"noEpisodesFound": "在第一季中未找到剧集",
|
||||
"noEpisodesFoundGeneral": "未找到剧集",
|
||||
"noResultsFound": "未找到结果",
|
||||
"sleepTimerSet": "睡眠定时器已设置为 ${label}",
|
||||
"failedToSwitchProfile": "无法切换到 ${displayName}",
|
||||
"noItemsAvailable": "没有可用的项目",
|
||||
"failedToCreatePlayQueue": "创建播放队列失败",
|
||||
"failedToCreatePlayQueueNoItems": "创建播放队列失败 - 没有项目",
|
||||
"failedPlayback": "无法${action}: ${error}"
|
||||
},
|
||||
"profile": {
|
||||
"noUsersAvailable": "没有可用用户"
|
||||
},
|
||||
"subtitlingStyling": {
|
||||
"stylingOptions": "样式选项",
|
||||
"fontSize": "字号",
|
||||
@@ -300,23 +299,19 @@
|
||||
},
|
||||
"dialog": {
|
||||
"confirmAction": "确认操作",
|
||||
"areYouSure": "确定要执行此操作吗?",
|
||||
"cancel": "取消",
|
||||
"playNow": "立即播放"
|
||||
},
|
||||
"discover": {
|
||||
"title": "发现",
|
||||
"switchProfile": "切换配置文件",
|
||||
"switchProfile": "切换用户",
|
||||
"switchServer": "切换服务器",
|
||||
"logout": "登出",
|
||||
"noContentAvailable": "没有可用内容",
|
||||
"addMediaToLibraries": "请向你的媒体库添加一些媒体",
|
||||
"continueWatching": "继续观看",
|
||||
"recentlyAdded": "最近添加",
|
||||
"play": "播放",
|
||||
"resume": "继续",
|
||||
"playEpisode": "播放 S${season}, E${episode}",
|
||||
"resumeEpisode": "继续 S${season}, E${episode}",
|
||||
"playEpisode": "S${season}E${episode}",
|
||||
"pause": "暂停",
|
||||
"overview": "概述",
|
||||
"cast": "演员表",
|
||||
@@ -341,8 +336,7 @@
|
||||
"pleaseEnterToken": "请输入一个令牌",
|
||||
"invalidToken": "令牌无效",
|
||||
"failedToVerifyToken": "无法验证令牌: ${error}",
|
||||
"failedToSwitchProfile": "无法切换到 ${displayName}",
|
||||
"connectionFailedGeneric": "连接失败"
|
||||
"failedToSwitchProfile": "无法切换到 ${displayName}"
|
||||
},
|
||||
"libraries": {
|
||||
"title": "媒体库",
|
||||
@@ -370,7 +364,6 @@
|
||||
"sort": "排序",
|
||||
"sortBy": "排序依据",
|
||||
"filters": "筛选器",
|
||||
"loadingLibraryWithCount": "正在加载媒体库... (已加载 ${count} 个项目)",
|
||||
"confirmActionMessage": "确定要执行此操作吗?",
|
||||
"showLibrary": "显示媒体库",
|
||||
"hideLibrary": "隐藏媒体库",
|
||||
@@ -405,23 +398,9 @@
|
||||
"viewLicensesDescription": "查看第三方库的许可证"
|
||||
},
|
||||
"serverSelection": {
|
||||
"connectingToServer": "正在连接服务器...",
|
||||
"connectingToAllServers": "正在连接所有服务器...",
|
||||
"connectToAllServers": "连接所有服务器",
|
||||
"allServerConnectionsFailed": "无法连接到任何服务器。请检查你的网络并重试。",
|
||||
"foundServers": "找到 ${count} 个服务器",
|
||||
"orSelectIndividually": "或单独选择一个服务器:",
|
||||
"serverDebugCopied": "服务器调试数据已复制到剪贴板",
|
||||
"copyDebugData": "复制调试数据",
|
||||
"noServersFound": "未找到服务器",
|
||||
"noServersFoundForAccount": "未找到 ${username} (${email}) 的服务器",
|
||||
"malformedServerData": "找到 ${count} 个数据格式错误的服务器。没有可用的有效服务器。",
|
||||
"incompleteServerInfo": "某些服务器信息不完整,已被跳过。请检查你的 Plex.tv 账户。",
|
||||
"incompleteConnectionInfo": "服务器连接信息不完整。请重试。",
|
||||
"malformedServerInfo": "服务器信息格式错误: ${message}",
|
||||
"networkConnectionFailed": "网络连接失败。请检查你的网络连接并重试。",
|
||||
"authenticationFailed": "验证失败。请重新登录。",
|
||||
"plexServiceUnavailable": "Plex 服务不可用。请稍后重试。",
|
||||
"failedToLoadServers": "无法加载服务器: ${error}"
|
||||
},
|
||||
"hubDetail": {
|
||||
@@ -432,11 +411,8 @@
|
||||
"noItemsFound": "未找到项目"
|
||||
},
|
||||
"logs": {
|
||||
"title": "日志",
|
||||
"clearLogs": "清除日志",
|
||||
"copyLogs": "复制日志",
|
||||
"exportLogs": "导出日志",
|
||||
"noLogsToShow": "没有可显示的日志",
|
||||
"error": "错误:",
|
||||
"stackTrace": "堆栈跟踪 (Stack Trace):"
|
||||
},
|
||||
@@ -450,32 +426,40 @@
|
||||
"home": "主页",
|
||||
"search": "搜索",
|
||||
"libraries": "媒体库",
|
||||
"settings": "设置"
|
||||
"settings": "设置",
|
||||
"downloads": "下载"
|
||||
},
|
||||
"downloads": {
|
||||
"title": "下载",
|
||||
"manage": "管理",
|
||||
"tvShows": "电视剧",
|
||||
"movies": "电影",
|
||||
"noDownloads": "暂无下载",
|
||||
"noDownloadsDescription": "下载的内容将在此处显示以供离线观看",
|
||||
"downloadNow": "下载",
|
||||
"deleteDownload": "删除下载",
|
||||
"retryDownload": "重试下载",
|
||||
"downloadQueued": "下载已排队",
|
||||
"episodesQueued": "${count} 集已加入下载队列",
|
||||
"downloadDeleted": "下载已删除",
|
||||
"deleteConfirm": "确定要删除 \"${title}\" 吗?下载的文件将从您的设备中删除。",
|
||||
"deletingWithProgress": "正在删除 ${title}... (${current}/${total})"
|
||||
},
|
||||
"playlists": {
|
||||
"title": "播放列表",
|
||||
"noPlaylists": "未找到播放列表",
|
||||
"create": "创建播放列表",
|
||||
"newPlaylist": "新播放列表",
|
||||
"playlistName": "播放列表名称",
|
||||
"enterPlaylistName": "输入播放列表名称",
|
||||
"edit": "编辑播放列表",
|
||||
"delete": "删除播放列表",
|
||||
"addTo": "添加到播放列表",
|
||||
"addItems": "添加项目",
|
||||
"removeItem": "从播放列表中移除",
|
||||
"clearPlaylist": "清空播放列表",
|
||||
"playAll": "全部播放",
|
||||
"shuffle": "随机播放",
|
||||
"smartPlaylist": "智能播放列表",
|
||||
"regularPlaylist": "普通播放列表",
|
||||
"itemCount": "${count} 个项目",
|
||||
"oneItem": "1 个项目",
|
||||
"emptyPlaylist": "此播放列表为空",
|
||||
"deleteConfirm": "删除播放列表?",
|
||||
"deleteMessage": "确定要删除 \"${name}\" 吗?",
|
||||
"created": "播放列表已创建",
|
||||
"updated": "播放列表已更新",
|
||||
"deleted": "播放列表已删除",
|
||||
"itemAdded": "已添加到播放列表",
|
||||
"itemRemoved": "已从播放列表中移除",
|
||||
@@ -493,7 +477,6 @@
|
||||
"title": "合集",
|
||||
"collection": "合集",
|
||||
"empty": "合集为空",
|
||||
"noItems": "此合集没有项目",
|
||||
"unknownLibrarySection": "无法删除:未知的媒体库分区",
|
||||
"deleteCollection": "删除合集",
|
||||
"deleteConfirm": "确定要删除\"${title}\"吗?此操作无法撤销。",
|
||||
@@ -501,7 +484,6 @@
|
||||
"deleteFailed": "删除合集失败",
|
||||
"deleteFailedWithError": "删除合集失败:${error}",
|
||||
"failedToLoadItems": "加载合集项目失败:${error}",
|
||||
"addTo": "添加到合集",
|
||||
"selectCollection": "选择合集",
|
||||
"createNewCollection": "创建新合集",
|
||||
"collectionName": "合集名称",
|
||||
@@ -514,5 +496,49 @@
|
||||
"removedFromCollection": "已从合集移除",
|
||||
"removeFromCollectionFailed": "从合集移除失败",
|
||||
"removeFromCollectionError": "从合集移除时出错:${error}"
|
||||
},
|
||||
"watchTogether": {
|
||||
"title": "一起看",
|
||||
"description": "与朋友和家人同步观看内容",
|
||||
"createSession": "创建会话",
|
||||
"creating": "创建中...",
|
||||
"joinSession": "加入会话",
|
||||
"joining": "加入中...",
|
||||
"controlMode": "控制模式",
|
||||
"controlModeQuestion": "谁可以控制播放?",
|
||||
"hostOnly": "仅主持人",
|
||||
"anyone": "任何人",
|
||||
"hostingSession": "主持会话",
|
||||
"inSession": "在会话中",
|
||||
"sessionCode": "会话代码",
|
||||
"hostControlsPlayback": "主持人控制播放",
|
||||
"anyoneCanControl": "任何人都可以控制播放",
|
||||
"hostControls": "主持人控制",
|
||||
"anyoneControls": "任何人控制",
|
||||
"participants": "参与者",
|
||||
"host": "主持人",
|
||||
"hostBadge": "主持人",
|
||||
"youAreHost": "你是主持人",
|
||||
"watchingWithOthers": "与他人一起观看",
|
||||
"endSession": "结束会话",
|
||||
"leaveSession": "离开会话",
|
||||
"endSessionQuestion": "结束会话?",
|
||||
"leaveSessionQuestion": "离开会话?",
|
||||
"endSessionConfirm": "这将为所有参与者结束会话。",
|
||||
"leaveSessionConfirm": "你将被移出会话。",
|
||||
"endSessionConfirmOverlay": "这将为所有参与者结束观看会话。",
|
||||
"leaveSessionConfirmOverlay": "你将断开与观看会话的连接。",
|
||||
"end": "结束",
|
||||
"leave": "离开",
|
||||
"syncing": "同步中...",
|
||||
"participant": "参与者",
|
||||
"joinWatchSession": "加入观看会话",
|
||||
"enterCodeHint": "输入8位代码",
|
||||
"pasteFromClipboard": "从剪贴板粘贴",
|
||||
"pleaseEnterCode": "请输入会话代码",
|
||||
"codeMustBe8Chars": "会话代码必须是8个字符",
|
||||
"joinInstructions": "输入主持人分享的会话代码以加入他们的观看会话。",
|
||||
"failedToCreate": "创建会话失败",
|
||||
"failedToJoin": "加入会话失败"
|
||||
}
|
||||
}
|
||||
|
||||
+141
-68
@@ -10,7 +10,7 @@ import 'services/macos_titlebar_service.dart';
|
||||
import 'services/fullscreen_state_manager.dart';
|
||||
import 'services/update_service.dart';
|
||||
import 'services/settings_service.dart';
|
||||
import 'services/tv_detection_service.dart';
|
||||
import 'utils/platform_detector.dart';
|
||||
import 'services/gamepad_service.dart';
|
||||
import 'providers/user_profile_provider.dart';
|
||||
import 'providers/plex_client_provider.dart';
|
||||
@@ -20,9 +20,18 @@ import 'providers/theme_provider.dart';
|
||||
import 'providers/settings_provider.dart';
|
||||
import 'providers/hidden_libraries_provider.dart';
|
||||
import 'providers/playback_state_provider.dart';
|
||||
import 'providers/download_provider.dart';
|
||||
import 'providers/offline_mode_provider.dart';
|
||||
import 'providers/offline_watch_provider.dart';
|
||||
import 'watch_together/watch_together.dart';
|
||||
import 'services/multi_server_manager.dart';
|
||||
import 'services/offline_watch_sync_service.dart';
|
||||
import 'services/data_aggregation_service.dart';
|
||||
import 'services/server_registry.dart';
|
||||
import 'services/download_manager_service.dart';
|
||||
import 'services/download_storage_service.dart';
|
||||
import 'services/plex_api_cache.dart';
|
||||
import 'database/app_database.dart';
|
||||
import 'utils/app_logger.dart';
|
||||
import 'utils/orientation_helper.dart';
|
||||
import 'utils/language_codes.dart';
|
||||
@@ -71,6 +80,9 @@ void main() async {
|
||||
final debugEnabled = settings.getEnableDebugLogging();
|
||||
setLoggerLevel(debugEnabled);
|
||||
|
||||
// Initialize download storage service with settings
|
||||
await DownloadStorageService.instance.initialize(settings);
|
||||
|
||||
// Start global fullscreen state monitoring
|
||||
FullscreenStateManager().startMonitoring();
|
||||
|
||||
@@ -87,37 +99,114 @@ void main() async {
|
||||
// Global RouteObserver for tracking navigation
|
||||
final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
|
||||
|
||||
class MainApp extends StatelessWidget {
|
||||
class MainApp extends StatefulWidget {
|
||||
const MainApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Initialize multi-server infrastructure
|
||||
final serverManager = MultiServerManager();
|
||||
final aggregationService = DataAggregationService(serverManager);
|
||||
State<MainApp> createState() => _MainAppState();
|
||||
}
|
||||
|
||||
class _MainAppState extends State<MainApp> with WidgetsBindingObserver {
|
||||
// Initialize multi-server infrastructure
|
||||
late final MultiServerManager _serverManager;
|
||||
late final DataAggregationService _aggregationService;
|
||||
late final AppDatabase _appDatabase;
|
||||
late final DownloadManagerService _downloadManager;
|
||||
late final OfflineWatchSyncService _offlineWatchSyncService;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
|
||||
_serverManager = MultiServerManager();
|
||||
_aggregationService = DataAggregationService(_serverManager);
|
||||
_appDatabase = AppDatabase();
|
||||
|
||||
// Initialize API cache with database
|
||||
PlexApiCache.initialize(_appDatabase);
|
||||
|
||||
_downloadManager = DownloadManagerService(database: _appDatabase, storageService: DownloadStorageService.instance);
|
||||
|
||||
_offlineWatchSyncService = OfflineWatchSyncService(database: _appDatabase, serverManager: _serverManager);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
if (state == AppLifecycleState.resumed) {
|
||||
// App came back to foreground - trigger sync check
|
||||
_offlineWatchSyncService.onAppResumed();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MultiProvider(
|
||||
providers: [
|
||||
// Legacy provider for backward compatibility
|
||||
ChangeNotifierProvider(create: (context) => PlexClientProvider()),
|
||||
// New multi-server providers
|
||||
ChangeNotifierProvider(
|
||||
create: (context) =>
|
||||
MultiServerProvider(serverManager, aggregationService),
|
||||
),
|
||||
ChangeNotifierProvider(create: (context) => MultiServerProvider(_serverManager, _aggregationService)),
|
||||
ChangeNotifierProvider(create: (context) => ServerStateProvider()),
|
||||
// Offline mode provider - depends on MultiServerProvider
|
||||
ChangeNotifierProxyProvider<MultiServerProvider, OfflineModeProvider>(
|
||||
create: (_) {
|
||||
final provider = OfflineModeProvider(_serverManager);
|
||||
provider.initialize(); // Initialize immediately so statusStream listener is ready
|
||||
return provider;
|
||||
},
|
||||
update: (_, multiServerProvider, previous) {
|
||||
final provider = previous ?? OfflineModeProvider(_serverManager);
|
||||
provider.initialize(); // Idempotent - safe to call again
|
||||
return provider;
|
||||
},
|
||||
),
|
||||
// Download provider
|
||||
ChangeNotifierProvider(create: (context) => DownloadProvider(downloadManager: _downloadManager)),
|
||||
// Offline watch sync service
|
||||
ChangeNotifierProvider<OfflineWatchSyncService>(
|
||||
create: (context) {
|
||||
final offlineModeProvider = context.read<OfflineModeProvider>();
|
||||
final downloadProvider = context.read<DownloadProvider>();
|
||||
|
||||
// Wire up callback to refresh download provider after watch state sync
|
||||
_offlineWatchSyncService.onWatchStatesRefreshed = () {
|
||||
downloadProvider.refreshMetadataFromCache();
|
||||
};
|
||||
|
||||
_offlineWatchSyncService.startConnectivityMonitoring(offlineModeProvider);
|
||||
return _offlineWatchSyncService;
|
||||
},
|
||||
),
|
||||
// Offline watch provider - depends on sync service and download provider
|
||||
ChangeNotifierProxyProvider2<OfflineWatchSyncService, DownloadProvider, OfflineWatchProvider>(
|
||||
create: (context) => OfflineWatchProvider(
|
||||
syncService: _offlineWatchSyncService,
|
||||
downloadProvider: context.read<DownloadProvider>(),
|
||||
apiCache: PlexApiCache.instance,
|
||||
),
|
||||
update: (_, syncService, downloadProvider, previous) {
|
||||
return previous ??
|
||||
OfflineWatchProvider(
|
||||
syncService: syncService,
|
||||
downloadProvider: downloadProvider,
|
||||
apiCache: PlexApiCache.instance,
|
||||
);
|
||||
},
|
||||
),
|
||||
// Existing providers
|
||||
ChangeNotifierProvider(create: (context) => UserProfileProvider()),
|
||||
ChangeNotifierProvider(create: (context) => ThemeProvider()),
|
||||
ChangeNotifierProvider(
|
||||
create: (context) => SettingsProvider(),
|
||||
lazy: true,
|
||||
),
|
||||
ChangeNotifierProvider(
|
||||
create: (context) => HiddenLibrariesProvider(),
|
||||
lazy: true,
|
||||
),
|
||||
ChangeNotifierProvider(create: (context) => SettingsProvider(), lazy: true),
|
||||
ChangeNotifierProvider(create: (context) => HiddenLibrariesProvider(), lazy: true),
|
||||
ChangeNotifierProvider(create: (context) => PlaybackStateProvider()),
|
||||
ChangeNotifierProvider(create: (context) => WatchTogetherProvider()),
|
||||
],
|
||||
child: Consumer<ThemeProvider>(
|
||||
builder: (context, themeProvider, child) {
|
||||
@@ -257,94 +346,82 @@ class _SetupScreenState extends State<SetupScreen> {
|
||||
// Migrate from single-server to multi-server if needed
|
||||
await registry.migrateFromSingleServer();
|
||||
|
||||
// Load enabled servers
|
||||
final servers = await registry.getEnabledServers();
|
||||
// Refresh servers from API to get updated connection info (IPs may change)
|
||||
await registry.refreshServersFromApi();
|
||||
|
||||
// Load all configured servers
|
||||
final servers = await registry.getServers();
|
||||
|
||||
if (servers.isEmpty) {
|
||||
// No servers configured - show auth screen
|
||||
if (mounted) {
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const AuthScreen()),
|
||||
);
|
||||
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => const AuthScreen()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Get multi-server provider
|
||||
if (!mounted) return;
|
||||
final multiServerProvider = Provider.of<MultiServerProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
final multiServerProvider = Provider.of<MultiServerProvider>(context, listen: false);
|
||||
|
||||
try {
|
||||
appLogger.i('Connecting to ${servers.length} enabled servers...');
|
||||
appLogger.i('Connecting to ${servers.length} servers...');
|
||||
|
||||
// Get or generate client identifier
|
||||
final clientId = storage.getClientIdentifier();
|
||||
|
||||
// Connect to all servers in parallel
|
||||
final connectedCount = await multiServerProvider.serverManager
|
||||
.connectToAllServers(
|
||||
servers,
|
||||
clientIdentifier: clientId,
|
||||
timeout: const Duration(seconds: 10),
|
||||
onServerConnected: (serverId, client) {
|
||||
// Set first connected client in legacy provider for backward compatibility
|
||||
final legacyProvider = Provider.of<PlexClientProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
if (legacyProvider.client == null) {
|
||||
legacyProvider.setClient(client);
|
||||
}
|
||||
},
|
||||
);
|
||||
final connectedCount = await multiServerProvider.serverManager.connectToAllServers(
|
||||
servers,
|
||||
clientIdentifier: clientId,
|
||||
timeout: const Duration(seconds: 10),
|
||||
onServerConnected: (serverId, client) {
|
||||
// Set first connected client in legacy provider for backward compatibility
|
||||
final legacyProvider = Provider.of<PlexClientProvider>(context, listen: false);
|
||||
if (legacyProvider.client == null) {
|
||||
legacyProvider.setClient(client);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
if (connectedCount > 0) {
|
||||
// At least one server connected successfully
|
||||
appLogger.i('Successfully connected to $connectedCount servers');
|
||||
|
||||
if (mounted) {
|
||||
// Now that Plex clients are available, trigger initial watch sync
|
||||
context.read<OfflineWatchSyncService>().onServersConnected();
|
||||
|
||||
// Navigate to main screen immediately
|
||||
// Get first connected client for backward compatibility
|
||||
final firstClient =
|
||||
multiServerProvider.serverManager.onlineClients.values.first;
|
||||
final firstClient = multiServerProvider.serverManager.onlineClients.values.first;
|
||||
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => MainScreen(client: firstClient),
|
||||
),
|
||||
);
|
||||
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => MainScreen(client: firstClient)));
|
||||
|
||||
// Check for updates in background after navigation
|
||||
_checkForUpdatesOnStartup();
|
||||
}
|
||||
} else {
|
||||
// All connections failed
|
||||
appLogger.w('Failed to connect to any servers');
|
||||
// All connections failed - navigate to offline mode
|
||||
appLogger.w('Failed to connect to any servers, entering offline mode');
|
||||
|
||||
if (mounted) {
|
||||
// Show auth screen to re-authenticate
|
||||
// Navigate to MainScreen in offline mode
|
||||
// User can still access Downloads and Settings
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const AuthScreen()),
|
||||
MaterialPageRoute(builder: (context) => const MainScreen(isOfflineMode: true)),
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (e, stackTrace) {
|
||||
appLogger.e(
|
||||
'Error during multi-server connection',
|
||||
error: e,
|
||||
stackTrace: stackTrace,
|
||||
);
|
||||
appLogger.e('Error during multi-server connection', error: e, stackTrace: stackTrace);
|
||||
|
||||
if (mounted) {
|
||||
// Navigate to MainScreen in offline mode
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const AuthScreen()),
|
||||
MaterialPageRoute(builder: (context) => const MainScreen(isOfflineMode: true)),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -356,11 +433,7 @@ class _SetupScreenState extends State<SetupScreen> {
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(height: 16),
|
||||
Text(t.app.loading),
|
||||
],
|
||||
children: [const CircularProgressIndicator(), const SizedBox(height: 16), Text(t.app.loading)],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
mixin Refreshable {
|
||||
void refresh();
|
||||
}
|
||||
|
||||
/// Mixin for screens that support full refresh (clearing all cached data)
|
||||
mixin FullRefreshable {
|
||||
void fullRefresh();
|
||||
}
|
||||
|
||||
/// Mixin for screens with focusable tab content
|
||||
mixin FocusableTab {
|
||||
void focusActiveTabIfReady();
|
||||
}
|
||||
|
||||
/// Mixin for screens with focusable search input
|
||||
mixin SearchInputFocusable {
|
||||
void focusSearchInput();
|
||||
}
|
||||
|
||||
/// Mixin for screens that can load a specific library by key
|
||||
mixin LibraryLoadable {
|
||||
void loadLibraryByKey(String libraryGlobalKey);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
import '../utils/formatters.dart';
|
||||
|
||||
enum DownloadStatus {
|
||||
queued,
|
||||
downloading,
|
||||
paused,
|
||||
completed,
|
||||
failed,
|
||||
cancelled,
|
||||
partial, // Some episodes downloaded, but not all (for shows/seasons)
|
||||
}
|
||||
|
||||
class DownloadProgress {
|
||||
final String globalKey;
|
||||
final DownloadStatus status;
|
||||
final int progress; // 0-100
|
||||
final int downloadedBytes;
|
||||
final int totalBytes;
|
||||
final double speed; // bytes per second
|
||||
final String? errorMessage;
|
||||
final String? currentFile; // What's being downloaded (video, subtitles, artwork)
|
||||
|
||||
// Thumbnail path (populated after artwork download completes)
|
||||
final String? thumbPath;
|
||||
|
||||
const DownloadProgress({
|
||||
required this.globalKey,
|
||||
required this.status,
|
||||
this.progress = 0,
|
||||
this.downloadedBytes = 0,
|
||||
this.totalBytes = 0,
|
||||
this.speed = 0,
|
||||
this.errorMessage,
|
||||
this.currentFile,
|
||||
this.thumbPath,
|
||||
});
|
||||
|
||||
double get progressPercent => progress / 100.0;
|
||||
|
||||
String get speedFormatted => ByteFormatter.formatSpeed(speed);
|
||||
String get downloadedFormatted => ByteFormatter.formatBytes(downloadedBytes);
|
||||
String get totalFormatted => ByteFormatter.formatBytes(totalBytes);
|
||||
|
||||
Duration? get estimatedTimeRemaining {
|
||||
if (speed <= 0 || totalBytes <= 0) return null;
|
||||
final remainingBytes = totalBytes - downloadedBytes;
|
||||
if (remainingBytes <= 0) return Duration.zero;
|
||||
return Duration(seconds: (remainingBytes / speed).round());
|
||||
}
|
||||
|
||||
/// Check if this progress update includes artwork paths
|
||||
bool get hasArtworkPaths => thumbPath != null;
|
||||
|
||||
DownloadProgress copyWith({
|
||||
String? globalKey,
|
||||
DownloadStatus? status,
|
||||
int? progress,
|
||||
int? downloadedBytes,
|
||||
int? totalBytes,
|
||||
double? speed,
|
||||
String? errorMessage,
|
||||
String? currentFile,
|
||||
String? thumbPath,
|
||||
}) {
|
||||
return DownloadProgress(
|
||||
globalKey: globalKey ?? this.globalKey,
|
||||
status: status ?? this.status,
|
||||
progress: progress ?? this.progress,
|
||||
downloadedBytes: downloadedBytes ?? this.downloadedBytes,
|
||||
totalBytes: totalBytes ?? this.totalBytes,
|
||||
speed: speed ?? this.speed,
|
||||
errorMessage: errorMessage ?? this.errorMessage,
|
||||
currentFile: currentFile ?? this.currentFile,
|
||||
thumbPath: thumbPath ?? this.thumbPath,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class DeletionProgress {
|
||||
final String globalKey;
|
||||
final String itemTitle;
|
||||
final int currentItem;
|
||||
final int totalItems;
|
||||
final String? currentOperation;
|
||||
|
||||
const DeletionProgress({
|
||||
required this.globalKey,
|
||||
required this.itemTitle,
|
||||
required this.currentItem,
|
||||
required this.totalItems,
|
||||
this.currentOperation,
|
||||
});
|
||||
|
||||
double get progressPercent => totalItems > 0 ? (currentItem / totalItems) : 0.0;
|
||||
|
||||
int get progressPercentInt => (progressPercent * 100).round();
|
||||
|
||||
bool get isComplete => currentItem >= totalItems;
|
||||
|
||||
DeletionProgress copyWith({
|
||||
String? globalKey,
|
||||
String? itemTitle,
|
||||
int? currentItem,
|
||||
int? totalItems,
|
||||
String? currentOperation,
|
||||
}) {
|
||||
return DeletionProgress(
|
||||
globalKey: globalKey ?? this.globalKey,
|
||||
itemTitle: itemTitle ?? this.itemTitle,
|
||||
currentItem: currentItem ?? this.currentItem,
|
||||
totalItems: totalItems ?? this.totalItems,
|
||||
currentOperation: currentOperation ?? this.currentOperation,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'DeletionProgress(globalKey: $globalKey, itemTitle: $itemTitle, '
|
||||
'currentItem: $currentItem, totalItems: $totalItems, '
|
||||
'progressPercent: $progressPercentInt%)';
|
||||
}
|
||||
}
|
||||
@@ -49,11 +49,7 @@ class PlayQueueResponse {
|
||||
this.items,
|
||||
});
|
||||
|
||||
factory PlayQueueResponse.fromJson(
|
||||
Map<String, dynamic> json, {
|
||||
String? serverId,
|
||||
String? serverName,
|
||||
}) {
|
||||
factory PlayQueueResponse.fromJson(Map<String, dynamic> json, {String? serverId, String? serverName}) {
|
||||
// The API returns data wrapped in MediaContainer
|
||||
final container = json['MediaContainer'] as Map<String, dynamic>? ?? json;
|
||||
final response = _$PlayQueueResponseFromJson(container);
|
||||
@@ -61,16 +57,13 @@ class PlayQueueResponse {
|
||||
// Tag all items with server info
|
||||
if (response.items != null && (serverId != null || serverName != null)) {
|
||||
final taggedItems = response.items!
|
||||
.map(
|
||||
(item) => item.copyWith(serverId: serverId, serverName: serverName),
|
||||
)
|
||||
.map((item) => item.copyWith(serverId: serverId, serverName: serverName))
|
||||
.toList();
|
||||
return PlayQueueResponse(
|
||||
playQueueID: response.playQueueID,
|
||||
playQueueSelectedItemID: response.playQueueSelectedItemID,
|
||||
playQueueSelectedItemOffset: response.playQueueSelectedItemOffset,
|
||||
playQueueSelectedMetadataItemID:
|
||||
response.playQueueSelectedMetadataItemID,
|
||||
playQueueSelectedMetadataItemID: response.playQueueSelectedMetadataItemID,
|
||||
playQueueShuffled: response.playQueueShuffled,
|
||||
playQueueSourceURI: response.playQueueSourceURI,
|
||||
playQueueTotalCount: response.playQueueTotalCount,
|
||||
@@ -87,9 +80,7 @@ class PlayQueueResponse {
|
||||
PlexMetadata? get selectedItem {
|
||||
if (items == null || playQueueSelectedItemID == null) return null;
|
||||
try {
|
||||
return items!.firstWhere(
|
||||
(item) => item.playQueueItemID == playQueueSelectedItemID,
|
||||
);
|
||||
return items!.firstWhere((item) => item.playQueueItemID == playQueueSelectedItemID);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
@@ -98,8 +89,6 @@ class PlayQueueResponse {
|
||||
/// Get the index of the selected item in the current window
|
||||
int? get selectedItemIndex {
|
||||
if (items == null || playQueueSelectedItemID == null) return null;
|
||||
return items!.indexWhere(
|
||||
(item) => item.playQueueItemID == playQueueSelectedItemID,
|
||||
);
|
||||
return items!.indexWhere((item) => item.playQueueItemID == playQueueSelectedItemID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,23 +6,15 @@ part of 'play_queue_response.dart';
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
PlayQueueResponse _$PlayQueueResponseFromJson(Map<String, dynamic> json) =>
|
||||
PlayQueueResponse(
|
||||
playQueueID: (json['playQueueID'] as num).toInt(),
|
||||
playQueueSelectedItemID: (json['playQueueSelectedItemID'] as num?)
|
||||
?.toInt(),
|
||||
playQueueSelectedItemOffset: (json['playQueueSelectedItemOffset'] as num?)
|
||||
?.toInt(),
|
||||
playQueueSelectedMetadataItemID:
|
||||
json['playQueueSelectedMetadataItemID'] as String?,
|
||||
playQueueShuffled: const BoolOrIntConverter().fromJson(
|
||||
json['playQueueShuffled'] as Object,
|
||||
),
|
||||
playQueueSourceURI: json['playQueueSourceURI'] as String?,
|
||||
playQueueTotalCount: (json['playQueueTotalCount'] as num?)?.toInt(),
|
||||
playQueueVersion: (json['playQueueVersion'] as num).toInt(),
|
||||
size: (json['size'] as num?)?.toInt(),
|
||||
items: (json['Metadata'] as List<dynamic>?)
|
||||
?.map((e) => PlexMetadata.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
PlayQueueResponse _$PlayQueueResponseFromJson(Map<String, dynamic> json) => PlayQueueResponse(
|
||||
playQueueID: (json['playQueueID'] as num).toInt(),
|
||||
playQueueSelectedItemID: (json['playQueueSelectedItemID'] as num?)?.toInt(),
|
||||
playQueueSelectedItemOffset: (json['playQueueSelectedItemOffset'] as num?)?.toInt(),
|
||||
playQueueSelectedMetadataItemID: json['playQueueSelectedMetadataItemID'] as String?,
|
||||
playQueueShuffled: const BoolOrIntConverter().fromJson(json['playQueueShuffled'] as Object),
|
||||
playQueueSourceURI: json['playQueueSourceURI'] as String?,
|
||||
playQueueTotalCount: (json['playQueueTotalCount'] as num?)?.toInt(),
|
||||
playQueueVersion: (json['playQueueVersion'] as num).toInt(),
|
||||
size: (json['size'] as num?)?.toInt(),
|
||||
items: (json['Metadata'] as List<dynamic>?)?.map((e) => PlexMetadata.fromJson(e as Map<String, dynamic>)).toList(),
|
||||
);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import '../utils/formatters.dart';
|
||||
|
||||
class PlexFileInfo {
|
||||
// Media level properties
|
||||
final String? container;
|
||||
@@ -61,20 +63,7 @@ class PlexFileInfo {
|
||||
/// Format file size in human-readable format (GB, MB, KB, bytes)
|
||||
String get fileSizeFormatted {
|
||||
if (fileSize == null) return 'Unknown';
|
||||
|
||||
const kb = 1024;
|
||||
const mb = kb * 1024;
|
||||
const gb = mb * 1024;
|
||||
|
||||
if (fileSize! >= gb) {
|
||||
return '${(fileSize! / gb).toStringAsFixed(2)} GB';
|
||||
} else if (fileSize! >= mb) {
|
||||
return '${(fileSize! / mb).toStringAsFixed(2)} MB';
|
||||
} else if (fileSize! >= kb) {
|
||||
return '${(fileSize! / kb).toStringAsFixed(2)} KB';
|
||||
} else {
|
||||
return '$fileSize bytes';
|
||||
}
|
||||
return ByteFormatter.formatBytes(fileSize!, decimals: 2);
|
||||
}
|
||||
|
||||
/// Format duration in HH:MM:SS or MM:SS format
|
||||
@@ -96,17 +85,7 @@ class PlexFileInfo {
|
||||
/// Format bitrate in Mbps or Kbps
|
||||
String get bitrateFormatted {
|
||||
if (bitrate == null) return 'Unknown';
|
||||
|
||||
const kbps = 1000;
|
||||
const mbps = kbps * 1000;
|
||||
|
||||
if (bitrate! >= mbps) {
|
||||
return '${(bitrate! / mbps).toStringAsFixed(2)} Mbps';
|
||||
} else if (bitrate! >= kbps) {
|
||||
return '${(bitrate! / kbps).toStringAsFixed(2)} Kbps';
|
||||
} else {
|
||||
return '$bitrate bps';
|
||||
}
|
||||
return ByteFormatter.formatBitrateBps(bitrate!);
|
||||
}
|
||||
|
||||
/// Format resolution as widthxheight
|
||||
@@ -140,8 +119,7 @@ class PlexFileInfo {
|
||||
/// Format audio channels (e.g., "2 channels (stereo)")
|
||||
String get audioChannelsFormatted {
|
||||
if (audioChannels != null) {
|
||||
String channelText =
|
||||
'$audioChannels channel${audioChannels! > 1 ? 's' : ''}';
|
||||
String channelText = '$audioChannels channel${audioChannels! > 1 ? 's' : ''}';
|
||||
if (audioChannelLayout != null) {
|
||||
channelText += ' ($audioChannelLayout)';
|
||||
}
|
||||
|
||||
@@ -24,13 +24,7 @@ class PlexFilter {
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'filter': filter,
|
||||
'filterType': filterType,
|
||||
'key': key,
|
||||
'title': title,
|
||||
'type': type,
|
||||
};
|
||||
return {'filter': filter, 'filterType': filterType, 'key': key, 'title': title, 'type': type};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,11 +36,7 @@ class PlexFilterValue {
|
||||
PlexFilterValue({required this.key, required this.title, this.type});
|
||||
|
||||
factory PlexFilterValue.fromJson(Map<String, dynamic> json) {
|
||||
return PlexFilterValue(
|
||||
key: json['key'] ?? '',
|
||||
title: json['title'] ?? '',
|
||||
type: json['type'],
|
||||
);
|
||||
return PlexFilterValue(key: json['key'] ?? '', title: json['title'] ?? '', type: json['type']);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
|
||||
@@ -21,11 +21,7 @@ class PlexHome {
|
||||
|
||||
factory PlexHome.fromJson(Map<String, dynamic> json) {
|
||||
final List<dynamic> usersJson = json['users'] as List<dynamic>;
|
||||
final users = usersJson
|
||||
.map(
|
||||
(userJson) => PlexHomeUser.fromJson(userJson as Map<String, dynamic>),
|
||||
)
|
||||
.toList();
|
||||
final users = usersJson.map((userJson) => PlexHomeUser.fromJson(userJson as Map<String, dynamic>)).toList();
|
||||
|
||||
return PlexHome(
|
||||
id: (json['id'] as num?)?.toInt() ?? 0,
|
||||
@@ -52,11 +48,9 @@ class PlexHome {
|
||||
|
||||
PlexHomeUser? get adminUser => users.where((user) => user.admin).firstOrNull;
|
||||
|
||||
List<PlexHomeUser> get managedUsers =>
|
||||
users.where((user) => !user.admin).toList();
|
||||
List<PlexHomeUser> get managedUsers => users.where((user) => !user.admin).toList();
|
||||
|
||||
List<PlexHomeUser> get restrictedUsers =>
|
||||
users.where((user) => user.restricted).toList();
|
||||
List<PlexHomeUser> get restrictedUsers => users.where((user) => user.restricted).toList();
|
||||
|
||||
PlexHomeUser? getUserByUUID(String uuid) {
|
||||
try {
|
||||
|
||||
@@ -43,8 +43,7 @@ class PlexLibrary with MultiServerFields {
|
||||
this.serverName,
|
||||
});
|
||||
|
||||
factory PlexLibrary.fromJson(Map<String, dynamic> json) =>
|
||||
_$PlexLibraryFromJson(json);
|
||||
factory PlexLibrary.fromJson(Map<String, dynamic> json) => _$PlexLibraryFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$PlexLibraryToJson(this);
|
||||
|
||||
|
||||
@@ -19,16 +19,15 @@ PlexLibrary _$PlexLibraryFromJson(Map<String, dynamic> json) => PlexLibrary(
|
||||
hidden: (json['hidden'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$PlexLibraryToJson(PlexLibrary instance) =>
|
||||
<String, dynamic>{
|
||||
'key': instance.key,
|
||||
'title': instance.title,
|
||||
'type': instance.type,
|
||||
'agent': instance.agent,
|
||||
'scanner': instance.scanner,
|
||||
'language': instance.language,
|
||||
'uuid': instance.uuid,
|
||||
'updatedAt': instance.updatedAt,
|
||||
'createdAt': instance.createdAt,
|
||||
'hidden': instance.hidden,
|
||||
};
|
||||
Map<String, dynamic> _$PlexLibraryToJson(PlexLibrary instance) => <String, dynamic>{
|
||||
'key': instance.key,
|
||||
'title': instance.title,
|
||||
'type': instance.type,
|
||||
'agent': instance.agent,
|
||||
'scanner': instance.scanner,
|
||||
'language': instance.language,
|
||||
'uuid': instance.uuid,
|
||||
'updatedAt': instance.updatedAt,
|
||||
'createdAt': instance.createdAt,
|
||||
'hidden': instance.hidden,
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import '../utils/codec_utils.dart';
|
||||
|
||||
class PlexMediaInfo {
|
||||
final String videoUrl;
|
||||
final List<PlexAudioTrack> audioTracks;
|
||||
@@ -67,7 +69,7 @@ class PlexAudioTrack with TrackLabelBuilder {
|
||||
|
||||
String get label {
|
||||
final additionalParts = <String>[];
|
||||
if (codec != null) additionalParts.add(codec!.toUpperCase());
|
||||
if (codec != null) additionalParts.add(CodecUtils.formatAudioCodec(codec!));
|
||||
if (channels != null) additionalParts.add('${channels!}ch');
|
||||
return buildLabel(additionalParts);
|
||||
}
|
||||
@@ -118,39 +120,11 @@ class PlexSubtitleTrack with TrackLabelBuilder {
|
||||
if (!isExternal) return null;
|
||||
|
||||
// Determine file extension based on codec
|
||||
final ext = _getExtensionFromCodec(codec);
|
||||
final ext = CodecUtils.getSubtitleExtension(codec);
|
||||
|
||||
// Construct URL with authentication token
|
||||
return '$baseUrl$key.$ext?X-Plex-Token=$token';
|
||||
}
|
||||
|
||||
/// Maps Plex subtitle codec names to file extensions
|
||||
String _getExtensionFromCodec(String? codec) {
|
||||
if (codec == null) return 'srt';
|
||||
|
||||
switch (codec.toLowerCase()) {
|
||||
case 'subrip':
|
||||
case 'srt':
|
||||
return 'srt';
|
||||
case 'ass':
|
||||
return 'ass';
|
||||
case 'ssa':
|
||||
return 'ssa';
|
||||
case 'webvtt':
|
||||
case 'vtt':
|
||||
return 'vtt';
|
||||
case 'mov_text':
|
||||
return 'srt';
|
||||
case 'pgs':
|
||||
case 'hdmv_pgs_subtitle':
|
||||
return 'sup';
|
||||
case 'dvd_subtitle':
|
||||
case 'dvdsub':
|
||||
return 'sub';
|
||||
default:
|
||||
return 'srt'; // Default to SRT for unknown codecs
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class PlexChapter {
|
||||
@@ -161,20 +135,12 @@ class PlexChapter {
|
||||
final String? title;
|
||||
final String? thumb;
|
||||
|
||||
PlexChapter({
|
||||
required this.id,
|
||||
this.index,
|
||||
this.startTimeOffset,
|
||||
this.endTimeOffset,
|
||||
this.title,
|
||||
this.thumb,
|
||||
});
|
||||
PlexChapter({required this.id, this.index, this.startTimeOffset, this.endTimeOffset, this.title, this.thumb});
|
||||
|
||||
String get label => title ?? 'Chapter ${(index ?? 0) + 1}';
|
||||
|
||||
Duration get startTime => Duration(milliseconds: startTimeOffset ?? 0);
|
||||
Duration? get endTime =>
|
||||
endTimeOffset != null ? Duration(milliseconds: endTimeOffset!) : null;
|
||||
Duration? get endTime => endTimeOffset != null ? Duration(milliseconds: endTimeOffset!) : null;
|
||||
}
|
||||
|
||||
class PlexMarker {
|
||||
@@ -183,12 +149,7 @@ class PlexMarker {
|
||||
final int startTimeOffset;
|
||||
final int endTimeOffset;
|
||||
|
||||
PlexMarker({
|
||||
required this.id,
|
||||
required this.type,
|
||||
required this.startTimeOffset,
|
||||
required this.endTimeOffset,
|
||||
});
|
||||
PlexMarker({required this.id, required this.type, required this.startTimeOffset, required this.endTimeOffset});
|
||||
|
||||
Duration get startTime => Duration(milliseconds: startTimeOffset);
|
||||
Duration get endTime => Duration(milliseconds: endTimeOffset);
|
||||
@@ -201,3 +162,11 @@ class PlexMarker {
|
||||
return posMs >= startTimeOffset && posMs <= endTimeOffset;
|
||||
}
|
||||
}
|
||||
|
||||
/// Combined chapters and markers fetched in a single API call
|
||||
class PlaybackExtras {
|
||||
final List<PlexChapter> chapters;
|
||||
final List<PlexMarker> markers;
|
||||
|
||||
PlaybackExtras({required this.chapters, required this.markers});
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import '../utils/formatters.dart';
|
||||
import '../utils/codec_utils.dart';
|
||||
|
||||
class PlexMediaVersion {
|
||||
final int id;
|
||||
final String? videoResolution;
|
||||
@@ -23,9 +26,7 @@ class PlexMediaVersion {
|
||||
factory PlexMediaVersion.fromJson(Map<String, dynamic> json) {
|
||||
// Get the first Part key for playback
|
||||
final parts = json['Part'] as List<dynamic>?;
|
||||
final partKey = parts != null && parts.isNotEmpty
|
||||
? parts[0]['key'] as String? ?? ''
|
||||
: '';
|
||||
final partKey = parts != null && parts.isNotEmpty ? parts[0]['key'] as String? ?? '' : '';
|
||||
|
||||
return PlexMediaVersion(
|
||||
id: json['id'] as int? ?? 0,
|
||||
@@ -52,7 +53,7 @@ class PlexMediaVersion {
|
||||
|
||||
// Add codec
|
||||
if (videoCodec != null && videoCodec!.isNotEmpty) {
|
||||
parts.add(videoCodec!.toUpperCase());
|
||||
parts.add(CodecUtils.formatVideoCodec(videoCodec!));
|
||||
}
|
||||
|
||||
// Add container
|
||||
@@ -65,8 +66,7 @@ class PlexMediaVersion {
|
||||
|
||||
// Add bitrate in parentheses
|
||||
if (bitrate != null && bitrate! > 0) {
|
||||
final bitrateInMbps = (bitrate! / 1000).toStringAsFixed(1);
|
||||
label += ' ($bitrateInMbps Mbps)';
|
||||
label += ' (${ByteFormatter.formatBitrate(bitrate!)})';
|
||||
}
|
||||
|
||||
return label;
|
||||
|
||||
@@ -5,6 +5,34 @@ import 'plex_role.dart';
|
||||
|
||||
part 'plex_metadata.g.dart';
|
||||
|
||||
/// Media type enum for type-safe media type handling
|
||||
enum PlexMediaType {
|
||||
movie,
|
||||
show,
|
||||
season,
|
||||
episode,
|
||||
artist,
|
||||
album,
|
||||
track,
|
||||
collection,
|
||||
playlist,
|
||||
clip,
|
||||
photo,
|
||||
unknown;
|
||||
|
||||
/// Whether this type represents video content
|
||||
bool get isVideo => this == movie || this == episode || this == clip;
|
||||
|
||||
/// Whether this type is part of a show hierarchy
|
||||
bool get isShowRelated => this == show || this == season || this == episode;
|
||||
|
||||
/// Whether this type represents music content
|
||||
bool get isMusic => this == artist || this == album || this == track;
|
||||
|
||||
/// Whether this type can be played directly
|
||||
bool get isPlayable => isVideo || this == track;
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class PlexMetadata with MultiServerFields {
|
||||
final String ratingKey;
|
||||
@@ -55,13 +83,30 @@ class PlexMetadata with MultiServerFields {
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
final String? serverName;
|
||||
|
||||
// Transient field for clear logo (extracted from Image array)
|
||||
String? _clearLogo;
|
||||
String? get clearLogo => _clearLogo;
|
||||
// Clear logo URL (extracted from Image array, but serialized for offline storage)
|
||||
final String? clearLogo;
|
||||
|
||||
/// Global unique identifier across all servers (serverId:ratingKey)
|
||||
String get globalKey => serverId != null ? '$serverId:$ratingKey' : ratingKey;
|
||||
|
||||
/// Parsed media type enum for type-safe comparisons
|
||||
PlexMediaType get mediaType {
|
||||
return switch (type.toLowerCase()) {
|
||||
'movie' => PlexMediaType.movie,
|
||||
'show' => PlexMediaType.show,
|
||||
'season' => PlexMediaType.season,
|
||||
'episode' => PlexMediaType.episode,
|
||||
'artist' => PlexMediaType.artist,
|
||||
'album' => PlexMediaType.album,
|
||||
'track' => PlexMediaType.track,
|
||||
'collection' => PlexMediaType.collection,
|
||||
'playlist' => PlexMediaType.playlist,
|
||||
'clip' => PlexMediaType.clip,
|
||||
'photo' => PlexMediaType.photo,
|
||||
_ => PlexMediaType.unknown,
|
||||
};
|
||||
}
|
||||
|
||||
PlexMetadata({
|
||||
required this.ratingKey,
|
||||
required this.key,
|
||||
@@ -103,6 +148,7 @@ class PlexMetadata with MultiServerFields {
|
||||
this.librarySectionID,
|
||||
this.serverId,
|
||||
this.serverName,
|
||||
this.clearLogo,
|
||||
});
|
||||
|
||||
/// Create a copy of this metadata with optional field overrides
|
||||
@@ -147,8 +193,9 @@ class PlexMetadata with MultiServerFields {
|
||||
int? librarySectionID,
|
||||
String? serverId,
|
||||
String? serverName,
|
||||
String? clearLogo,
|
||||
}) {
|
||||
final copy = PlexMetadata(
|
||||
return PlexMetadata(
|
||||
ratingKey: ratingKey ?? this.ratingKey,
|
||||
key: key ?? this.key,
|
||||
guid: guid ?? this.guid,
|
||||
@@ -189,32 +236,34 @@ class PlexMetadata with MultiServerFields {
|
||||
librarySectionID: librarySectionID ?? this.librarySectionID,
|
||||
serverId: serverId ?? this.serverId,
|
||||
serverName: serverName ?? this.serverName,
|
||||
clearLogo: clearLogo ?? this.clearLogo,
|
||||
);
|
||||
// Preserve clearLogo
|
||||
copy._clearLogo = _clearLogo;
|
||||
return copy;
|
||||
}
|
||||
|
||||
// Extract clearLogo from Image array in raw JSON
|
||||
void _extractClearLogo(Map<String, dynamic> json) {
|
||||
if (!json.containsKey('Image')) return;
|
||||
/// Extract clearLogo from Image array in raw JSON
|
||||
static String? _extractClearLogoFromJson(Map<String, dynamic> json) {
|
||||
if (!json.containsKey('Image')) return null;
|
||||
|
||||
final images = json['Image'] as List?;
|
||||
if (images == null) return;
|
||||
if (images == null) return null;
|
||||
|
||||
for (var image in images) {
|
||||
if (image is Map && image['type'] == 'clearLogo') {
|
||||
_clearLogo = image['url'] as String?;
|
||||
return;
|
||||
return image['url'] as String?;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Custom factory that extracts clearLogo
|
||||
/// Create from JSON with clearLogo extracted from Image array
|
||||
factory PlexMetadata.fromJsonWithImages(Map<String, dynamic> json) {
|
||||
final metadata = PlexMetadata.fromJson(json);
|
||||
metadata._extractClearLogo(json);
|
||||
return metadata;
|
||||
// Extract clearLogo before parsing
|
||||
final clearLogoUrl = _extractClearLogoFromJson(json);
|
||||
// Add it to the json so it gets parsed
|
||||
if (clearLogoUrl != null) {
|
||||
json['clearLogo'] = clearLogoUrl;
|
||||
}
|
||||
return PlexMetadata.fromJson(json);
|
||||
}
|
||||
|
||||
// Helper to get the display title (show name for episodes/seasons, title otherwise)
|
||||
@@ -222,8 +271,7 @@ class PlexMetadata with MultiServerFields {
|
||||
final itemType = type.toLowerCase();
|
||||
|
||||
// For episodes and seasons, prefer grandparent title (show name)
|
||||
if ((itemType == 'episode' || itemType == 'season') &&
|
||||
grandparentTitle != null) {
|
||||
if ((itemType == 'episode' || itemType == 'season') && grandparentTitle != null) {
|
||||
return grandparentTitle!;
|
||||
}
|
||||
// For seasons without grandparent, check if this IS the show (parentTitle might have show name)
|
||||
@@ -239,8 +287,7 @@ class PlexMetadata with MultiServerFields {
|
||||
|
||||
if (itemType == 'episode' || itemType == 'season') {
|
||||
// If we showed grandparent/parent as title, show this item's title as subtitle
|
||||
if (grandparentTitle != null ||
|
||||
(itemType == 'season' && parentTitle != null)) {
|
||||
if (grandparentTitle != null || (itemType == 'season' && parentTitle != null)) {
|
||||
return title;
|
||||
}
|
||||
}
|
||||
@@ -279,8 +326,7 @@ class PlexMetadata with MultiServerFields {
|
||||
return viewCount != null && viewCount! > 0;
|
||||
}
|
||||
|
||||
factory PlexMetadata.fromJson(Map<String, dynamic> json) =>
|
||||
_$PlexMetadataFromJson(json);
|
||||
factory PlexMetadata.fromJson(Map<String, dynamic> json) => _$PlexMetadataFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$PlexMetadataToJson(this);
|
||||
}
|
||||
|
||||
@@ -39,54 +39,53 @@ PlexMetadata _$PlexMetadataFromJson(Map<String, dynamic> json) => PlexMetadata(
|
||||
leafCount: (json['leafCount'] as num?)?.toInt(),
|
||||
viewedLeafCount: (json['viewedLeafCount'] as num?)?.toInt(),
|
||||
childCount: (json['childCount'] as num?)?.toInt(),
|
||||
role: (json['Role'] as List<dynamic>?)
|
||||
?.map((e) => PlexRole.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
role: (json['Role'] as List<dynamic>?)?.map((e) => PlexRole.fromJson(e as Map<String, dynamic>)).toList(),
|
||||
audioLanguage: json['audioLanguage'] as String?,
|
||||
subtitleLanguage: json['subtitleLanguage'] as String?,
|
||||
playlistItemID: (json['playlistItemID'] as num?)?.toInt(),
|
||||
playQueueItemID: (json['playQueueItemID'] as num?)?.toInt(),
|
||||
librarySectionID: (json['librarySectionID'] as num?)?.toInt(),
|
||||
clearLogo: json['clearLogo'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$PlexMetadataToJson(PlexMetadata instance) =>
|
||||
<String, dynamic>{
|
||||
'ratingKey': instance.ratingKey,
|
||||
'key': instance.key,
|
||||
'guid': instance.guid,
|
||||
'studio': instance.studio,
|
||||
'type': instance.type,
|
||||
'title': instance.title,
|
||||
'contentRating': instance.contentRating,
|
||||
'summary': instance.summary,
|
||||
'rating': instance.rating,
|
||||
'audienceRating': instance.audienceRating,
|
||||
'year': instance.year,
|
||||
'thumb': instance.thumb,
|
||||
'art': instance.art,
|
||||
'duration': instance.duration,
|
||||
'addedAt': instance.addedAt,
|
||||
'updatedAt': instance.updatedAt,
|
||||
'lastViewedAt': instance.lastViewedAt,
|
||||
'grandparentTitle': instance.grandparentTitle,
|
||||
'grandparentThumb': instance.grandparentThumb,
|
||||
'grandparentArt': instance.grandparentArt,
|
||||
'grandparentRatingKey': instance.grandparentRatingKey,
|
||||
'parentTitle': instance.parentTitle,
|
||||
'parentThumb': instance.parentThumb,
|
||||
'parentRatingKey': instance.parentRatingKey,
|
||||
'parentIndex': instance.parentIndex,
|
||||
'index': instance.index,
|
||||
'grandparentTheme': instance.grandparentTheme,
|
||||
'viewOffset': instance.viewOffset,
|
||||
'viewCount': instance.viewCount,
|
||||
'leafCount': instance.leafCount,
|
||||
'viewedLeafCount': instance.viewedLeafCount,
|
||||
'childCount': instance.childCount,
|
||||
'Role': instance.role,
|
||||
'audioLanguage': instance.audioLanguage,
|
||||
'subtitleLanguage': instance.subtitleLanguage,
|
||||
'playlistItemID': instance.playlistItemID,
|
||||
'playQueueItemID': instance.playQueueItemID,
|
||||
'librarySectionID': instance.librarySectionID,
|
||||
};
|
||||
Map<String, dynamic> _$PlexMetadataToJson(PlexMetadata instance) => <String, dynamic>{
|
||||
'ratingKey': instance.ratingKey,
|
||||
'key': instance.key,
|
||||
'guid': instance.guid,
|
||||
'studio': instance.studio,
|
||||
'type': instance.type,
|
||||
'title': instance.title,
|
||||
'contentRating': instance.contentRating,
|
||||
'summary': instance.summary,
|
||||
'rating': instance.rating,
|
||||
'audienceRating': instance.audienceRating,
|
||||
'year': instance.year,
|
||||
'thumb': instance.thumb,
|
||||
'art': instance.art,
|
||||
'duration': instance.duration,
|
||||
'addedAt': instance.addedAt,
|
||||
'updatedAt': instance.updatedAt,
|
||||
'lastViewedAt': instance.lastViewedAt,
|
||||
'grandparentTitle': instance.grandparentTitle,
|
||||
'grandparentThumb': instance.grandparentThumb,
|
||||
'grandparentArt': instance.grandparentArt,
|
||||
'grandparentRatingKey': instance.grandparentRatingKey,
|
||||
'parentTitle': instance.parentTitle,
|
||||
'parentThumb': instance.parentThumb,
|
||||
'parentRatingKey': instance.parentRatingKey,
|
||||
'parentIndex': instance.parentIndex,
|
||||
'index': instance.index,
|
||||
'grandparentTheme': instance.grandparentTheme,
|
||||
'viewOffset': instance.viewOffset,
|
||||
'viewCount': instance.viewCount,
|
||||
'leafCount': instance.leafCount,
|
||||
'viewedLeafCount': instance.viewedLeafCount,
|
||||
'childCount': instance.childCount,
|
||||
'Role': instance.role,
|
||||
'audioLanguage': instance.audioLanguage,
|
||||
'subtitleLanguage': instance.subtitleLanguage,
|
||||
'playlistItemID': instance.playlistItemID,
|
||||
'playQueueItemID': instance.playQueueItemID,
|
||||
'librarySectionID': instance.librarySectionID,
|
||||
'clearLogo': instance.clearLogo,
|
||||
};
|
||||
|
||||
@@ -94,8 +94,7 @@ class PlexPlaylist with MultiServerFields {
|
||||
/// Playlists don't track viewed leaf count
|
||||
int? get viewedLeafCount => null;
|
||||
|
||||
factory PlexPlaylist.fromJson(Map<String, dynamic> json) =>
|
||||
_$PlexPlaylistFromJson(json);
|
||||
factory PlexPlaylist.fromJson(Map<String, dynamic> json) => _$PlexPlaylistFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$PlexPlaylistToJson(this);
|
||||
|
||||
|
||||
@@ -26,23 +26,22 @@ PlexPlaylist _$PlexPlaylistFromJson(Map<String, dynamic> json) => PlexPlaylist(
|
||||
thumb: json['thumb'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$PlexPlaylistToJson(PlexPlaylist instance) =>
|
||||
<String, dynamic>{
|
||||
'ratingKey': instance.ratingKey,
|
||||
'key': instance.key,
|
||||
'type': instance.type,
|
||||
'title': instance.title,
|
||||
'summary': instance.summary,
|
||||
'smart': instance.smart,
|
||||
'playlistType': instance.playlistType,
|
||||
'duration': instance.duration,
|
||||
'leafCount': instance.leafCount,
|
||||
'composite': instance.composite,
|
||||
'addedAt': instance.addedAt,
|
||||
'updatedAt': instance.updatedAt,
|
||||
'lastViewedAt': instance.lastViewedAt,
|
||||
'viewCount': instance.viewCount,
|
||||
'content': instance.content,
|
||||
'guid': instance.guid,
|
||||
'thumb': instance.thumb,
|
||||
};
|
||||
Map<String, dynamic> _$PlexPlaylistToJson(PlexPlaylist instance) => <String, dynamic>{
|
||||
'ratingKey': instance.ratingKey,
|
||||
'key': instance.key,
|
||||
'type': instance.type,
|
||||
'title': instance.title,
|
||||
'summary': instance.summary,
|
||||
'smart': instance.smart,
|
||||
'playlistType': instance.playlistType,
|
||||
'duration': instance.duration,
|
||||
'leafCount': instance.leafCount,
|
||||
'composite': instance.composite,
|
||||
'addedAt': instance.addedAt,
|
||||
'updatedAt': instance.updatedAt,
|
||||
'lastViewedAt': instance.lastViewedAt,
|
||||
'viewCount': instance.viewCount,
|
||||
'content': instance.content,
|
||||
'guid': instance.guid,
|
||||
'thumb': instance.thumb,
|
||||
};
|
||||
|
||||
@@ -12,18 +12,9 @@ class PlexRole {
|
||||
final String? thumb;
|
||||
final int? count;
|
||||
|
||||
PlexRole({
|
||||
this.id,
|
||||
this.filter,
|
||||
required this.tag,
|
||||
this.tagKey,
|
||||
this.role,
|
||||
this.thumb,
|
||||
this.count,
|
||||
});
|
||||
PlexRole({this.id, this.filter, required this.tag, this.tagKey, this.role, this.thumb, this.count});
|
||||
|
||||
factory PlexRole.fromJson(Map<String, dynamic> json) =>
|
||||
_$PlexRoleFromJson(json);
|
||||
factory PlexRole.fromJson(Map<String, dynamic> json) => _$PlexRoleFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$PlexRoleToJson(this);
|
||||
}
|
||||
|
||||
@@ -4,12 +4,7 @@ class PlexSort {
|
||||
final String title;
|
||||
final String? defaultDirection;
|
||||
|
||||
PlexSort({
|
||||
required this.key,
|
||||
this.descKey,
|
||||
required this.title,
|
||||
this.defaultDirection,
|
||||
});
|
||||
PlexSort({required this.key, this.descKey, required this.title, this.defaultDirection});
|
||||
|
||||
factory PlexSort.fromJson(Map<String, dynamic> json) {
|
||||
return PlexSort(
|
||||
|
||||
@@ -34,8 +34,7 @@ class PlexUserProfile {
|
||||
|
||||
return PlexUserProfile(
|
||||
autoSelectAudio: profile['autoSelectAudio'] as bool? ?? true,
|
||||
defaultAudioAccessibility:
|
||||
profile['defaultAudioAccessibility'] as int? ?? 0,
|
||||
defaultAudioAccessibility: profile['defaultAudioAccessibility'] as int? ?? 0,
|
||||
defaultAudioLanguage: profile['defaultAudioLanguage'] as String?,
|
||||
defaultAudioLanguages: profile['defaultAudioLanguages'] != null
|
||||
? List<String>.from(profile['defaultAudioLanguages'] as List)
|
||||
@@ -45,8 +44,7 @@ class PlexUserProfile {
|
||||
? List<String>.from(profile['defaultSubtitleLanguages'] as List)
|
||||
: null,
|
||||
autoSelectSubtitle: profile['autoSelectSubtitle'] as int? ?? 0,
|
||||
defaultSubtitleAccessibility:
|
||||
profile['defaultSubtitleAccessibility'] as int? ?? 0,
|
||||
defaultSubtitleAccessibility: profile['defaultSubtitleAccessibility'] as int? ?? 0,
|
||||
defaultSubtitleForced: profile['defaultSubtitleForced'] as int? ?? 1,
|
||||
watchedIndicator: profile['watchedIndicator'] as int? ?? 1,
|
||||
mediaReviewsVisibility: profile['mediaReviewsVisibility'] as int? ?? 0,
|
||||
|
||||
@@ -13,11 +13,7 @@ class PlexVideoPlaybackData {
|
||||
/// Available media versions/qualities for this content
|
||||
final List<PlexMediaVersion> availableVersions;
|
||||
|
||||
PlexVideoPlaybackData({
|
||||
required this.videoUrl,
|
||||
required this.mediaInfo,
|
||||
required this.availableVersions,
|
||||
});
|
||||
PlexVideoPlaybackData({required this.videoUrl, required this.mediaInfo, required this.availableVersions});
|
||||
|
||||
/// Returns true if this playback data has a valid video URL
|
||||
bool get hasValidVideoUrl => videoUrl != null && videoUrl!.isNotEmpty;
|
||||
|
||||
@@ -25,9 +25,7 @@ class AndroidFontLoader {
|
||||
await fontDir.create(recursive: true);
|
||||
}
|
||||
|
||||
final fontFile = File(
|
||||
path.join(fontDir.path, 'go-noto-current-regular.ttf'),
|
||||
);
|
||||
final fontFile = File(path.join(fontDir.path, 'go-noto-current-regular.ttf'));
|
||||
|
||||
// Load font from assets and write to cache if it doesn't exist
|
||||
if (!await fontFile.exists()) {
|
||||
@@ -0,0 +1,265 @@
|
||||
/// Log level for player messages.
|
||||
enum PlayerLogLevel {
|
||||
/// No logging.
|
||||
none,
|
||||
|
||||
/// Fatal errors only.
|
||||
fatal,
|
||||
|
||||
/// Errors.
|
||||
error,
|
||||
|
||||
/// Warnings.
|
||||
warn,
|
||||
|
||||
/// Informational messages.
|
||||
info,
|
||||
|
||||
/// Verbose output.
|
||||
verbose,
|
||||
|
||||
/// Debug messages.
|
||||
debug,
|
||||
|
||||
/// Trace-level output (very verbose).
|
||||
trace,
|
||||
}
|
||||
|
||||
/// Represents an audio track in the media.
|
||||
class AudioTrack {
|
||||
/// Unique identifier for the track.
|
||||
final String id;
|
||||
|
||||
/// Human-readable title of the track.
|
||||
final String? title;
|
||||
|
||||
/// Language code (e.g., 'eng', 'jpn').
|
||||
final String? language;
|
||||
|
||||
/// Audio codec (e.g., 'aac', 'ac3', 'dts').
|
||||
final String? codec;
|
||||
|
||||
/// Number of audio channels.
|
||||
final int? channels;
|
||||
|
||||
/// Alias for channels (media_kit compatibility).
|
||||
int? get channelsCount => channels;
|
||||
|
||||
/// Sample rate in Hz.
|
||||
final int? sampleRate;
|
||||
|
||||
/// Bitrate in bits per second.
|
||||
final int? bitrate;
|
||||
|
||||
/// Whether this is the default track.
|
||||
final bool isDefault;
|
||||
|
||||
/// Whether this track is forced.
|
||||
final bool isForced;
|
||||
|
||||
const AudioTrack({
|
||||
required this.id,
|
||||
this.title,
|
||||
this.language,
|
||||
this.codec,
|
||||
this.channels,
|
||||
this.sampleRate,
|
||||
this.bitrate,
|
||||
this.isDefault = false,
|
||||
this.isForced = false,
|
||||
});
|
||||
|
||||
/// Auto-select track.
|
||||
static const auto = AudioTrack(id: 'auto', title: 'Auto');
|
||||
|
||||
/// Disable audio.
|
||||
static const off = AudioTrack(id: 'no', title: 'Off');
|
||||
|
||||
/// Returns a display name for the track.
|
||||
String get displayName {
|
||||
if (title != null && title!.isNotEmpty) return title!;
|
||||
if (language != null && language!.isNotEmpty) return language!;
|
||||
return 'Track $id';
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => 'AudioTrack($id, $displayName)';
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) || other is AudioTrack && runtimeType == other.runtimeType && id == other.id;
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode;
|
||||
}
|
||||
|
||||
/// Represents a subtitle track in the media.
|
||||
class SubtitleTrack {
|
||||
/// Unique identifier for the track.
|
||||
final String id;
|
||||
|
||||
/// Human-readable title of the track.
|
||||
final String? title;
|
||||
|
||||
/// Language code (e.g., 'eng', 'jpn').
|
||||
final String? language;
|
||||
|
||||
/// Subtitle codec/format (e.g., 'subrip', 'ass', 'pgs').
|
||||
final String? codec;
|
||||
|
||||
/// Whether this is the default track.
|
||||
final bool isDefault;
|
||||
|
||||
/// Whether this track is forced (e.g., for foreign language segments).
|
||||
final bool isForced;
|
||||
|
||||
/// Whether this is an external subtitle file.
|
||||
final bool isExternal;
|
||||
|
||||
/// URI of external subtitle file (if isExternal is true).
|
||||
final String? uri;
|
||||
|
||||
const SubtitleTrack({
|
||||
required this.id,
|
||||
this.title,
|
||||
this.language,
|
||||
this.codec,
|
||||
this.isDefault = false,
|
||||
this.isForced = false,
|
||||
this.isExternal = false,
|
||||
this.uri,
|
||||
});
|
||||
|
||||
/// Create a subtitle track from an external URI.
|
||||
factory SubtitleTrack.uri(String uri, {String? title, String? language}) {
|
||||
return SubtitleTrack(id: 'external:$uri', title: title, language: language, isExternal: true, uri: uri);
|
||||
}
|
||||
|
||||
/// Auto-select track.
|
||||
static const auto = SubtitleTrack(id: 'auto', title: 'Auto');
|
||||
|
||||
/// Disable subtitles.
|
||||
static const off = SubtitleTrack(id: 'no', title: 'Off');
|
||||
|
||||
/// Returns a display name for the track.
|
||||
String get displayName {
|
||||
if (title != null && title!.isNotEmpty) return title!;
|
||||
if (language != null && language!.isNotEmpty) return language!;
|
||||
if (isExternal) return 'External';
|
||||
return 'Track $id';
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => 'SubtitleTrack($id, $displayName)';
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) || other is SubtitleTrack && runtimeType == other.runtimeType && id == other.id;
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode;
|
||||
}
|
||||
|
||||
/// Container for all available tracks in the media.
|
||||
class Tracks {
|
||||
/// Available audio tracks.
|
||||
final List<AudioTrack> audio;
|
||||
|
||||
/// Available subtitle tracks.
|
||||
final List<SubtitleTrack> subtitle;
|
||||
|
||||
const Tracks({this.audio = const [], this.subtitle = const []});
|
||||
|
||||
/// Creates a copy with the given fields replaced.
|
||||
Tracks copyWith({List<AudioTrack>? audio, List<SubtitleTrack>? subtitle}) {
|
||||
return Tracks(audio: audio ?? this.audio, subtitle: subtitle ?? this.subtitle);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => 'Tracks(audio: ${audio.length}, subtitle: ${subtitle.length})';
|
||||
}
|
||||
|
||||
/// Represents the currently selected tracks.
|
||||
class TrackSelection {
|
||||
/// Currently selected audio track.
|
||||
final AudioTrack? audio;
|
||||
|
||||
/// Currently selected subtitle track.
|
||||
final SubtitleTrack? subtitle;
|
||||
|
||||
const TrackSelection({this.audio, this.subtitle});
|
||||
|
||||
/// Creates a copy with the given fields replaced.
|
||||
TrackSelection copyWith({AudioTrack? audio, SubtitleTrack? subtitle}) {
|
||||
return TrackSelection(audio: audio ?? this.audio, subtitle: subtitle ?? this.subtitle);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => 'TrackSelection(audio: $audio, subtitle: $subtitle)';
|
||||
}
|
||||
|
||||
/// Represents an audio output device.
|
||||
class AudioDevice {
|
||||
/// Unique identifier for the device.
|
||||
final String name;
|
||||
|
||||
/// Human-readable description of the device.
|
||||
final String description;
|
||||
|
||||
const AudioDevice({required this.name, this.description = ''});
|
||||
|
||||
/// Default/auto audio device.
|
||||
static const auto = AudioDevice(name: 'auto', description: 'Auto');
|
||||
|
||||
@override
|
||||
String toString() => 'AudioDevice($name, $description)';
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) || other is AudioDevice && runtimeType == other.runtimeType && name == other.name;
|
||||
|
||||
@override
|
||||
int get hashCode => name.hashCode;
|
||||
}
|
||||
|
||||
/// A log entry from the player.
|
||||
class PlayerLog {
|
||||
/// The log level of this message.
|
||||
final PlayerLogLevel level;
|
||||
|
||||
/// The prefix/category of the log message (e.g., 'cplayer', 'ffmpeg').
|
||||
final String prefix;
|
||||
|
||||
/// The log message text.
|
||||
final String text;
|
||||
|
||||
const PlayerLog({required this.level, required this.prefix, required this.text});
|
||||
|
||||
@override
|
||||
String toString() => '[$prefix] ${level.name}: $text';
|
||||
}
|
||||
|
||||
/// Represents a media source for the player.
|
||||
class Media {
|
||||
/// The URI of the media (file path, HTTP URL, etc.).
|
||||
final String uri;
|
||||
|
||||
/// Optional HTTP headers for network requests.
|
||||
final Map<String, String>? headers;
|
||||
|
||||
/// Optional start position for playback.
|
||||
final Duration? start;
|
||||
|
||||
const Media(this.uri, {this.headers, this.start});
|
||||
|
||||
@override
|
||||
String toString() => 'Media($uri)';
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is Media && runtimeType == other.runtimeType && uri == other.uri && start == other.start;
|
||||
|
||||
@override
|
||||
int get hashCode => uri.hashCode ^ start.hashCode;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/// Represents an audio output device.
|
||||
class AudioDevice {
|
||||
/// Unique identifier for the device.
|
||||
final String name;
|
||||
|
||||
/// Human-readable description of the device.
|
||||
final String description;
|
||||
|
||||
const AudioDevice({required this.name, this.description = ''});
|
||||
|
||||
/// Default/auto audio device.
|
||||
static const auto = AudioDevice(name: 'auto', description: 'Auto');
|
||||
|
||||
@override
|
||||
String toString() => 'AudioDevice($name, $description)';
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is AudioDevice &&
|
||||
runtimeType == other.runtimeType &&
|
||||
name == other.name;
|
||||
|
||||
@override
|
||||
int get hashCode => name.hashCode;
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/// Represents an audio track in the media.
|
||||
class AudioTrack {
|
||||
/// Unique identifier for the track.
|
||||
final String id;
|
||||
|
||||
/// Human-readable title of the track.
|
||||
final String? title;
|
||||
|
||||
/// Language code (e.g., 'eng', 'jpn').
|
||||
final String? language;
|
||||
|
||||
/// Audio codec (e.g., 'aac', 'ac3', 'dts').
|
||||
final String? codec;
|
||||
|
||||
/// Number of audio channels.
|
||||
final int? channels;
|
||||
|
||||
/// Alias for channels (media_kit compatibility).
|
||||
int? get channelsCount => channels;
|
||||
|
||||
/// Sample rate in Hz.
|
||||
final int? sampleRate;
|
||||
|
||||
/// Bitrate in bits per second.
|
||||
final int? bitrate;
|
||||
|
||||
/// Whether this is the default track.
|
||||
final bool isDefault;
|
||||
|
||||
/// Whether this track is forced.
|
||||
final bool isForced;
|
||||
|
||||
const AudioTrack({
|
||||
required this.id,
|
||||
this.title,
|
||||
this.language,
|
||||
this.codec,
|
||||
this.channels,
|
||||
this.sampleRate,
|
||||
this.bitrate,
|
||||
this.isDefault = false,
|
||||
this.isForced = false,
|
||||
});
|
||||
|
||||
/// Auto-select track.
|
||||
static const auto = AudioTrack(id: 'auto', title: 'Auto');
|
||||
|
||||
/// Disable audio.
|
||||
static const off = AudioTrack(id: 'no', title: 'Off');
|
||||
|
||||
/// Returns a display name for the track.
|
||||
String get displayName {
|
||||
if (title != null && title!.isNotEmpty) return title!;
|
||||
if (language != null && language!.isNotEmpty) return language!;
|
||||
return 'Track $id';
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => 'AudioTrack($id, $displayName)';
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is AudioTrack && runtimeType == other.runtimeType && id == other.id;
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/// Represents a media source for the player.
|
||||
class Media {
|
||||
/// The URI of the media (file path, HTTP URL, etc.).
|
||||
final String uri;
|
||||
|
||||
/// Optional HTTP headers for network requests.
|
||||
final Map<String, String>? headers;
|
||||
|
||||
/// Optional start position for playback.
|
||||
final Duration? start;
|
||||
|
||||
const Media(this.uri, {this.headers, this.start});
|
||||
|
||||
@override
|
||||
String toString() => 'Media($uri)';
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is Media &&
|
||||
runtimeType == other.runtimeType &&
|
||||
uri == other.uri &&
|
||||
start == other.start;
|
||||
|
||||
@override
|
||||
int get hashCode => uri.hashCode ^ start.hashCode;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import 'player_log_level.dart';
|
||||
|
||||
/// A log entry from the player.
|
||||
class PlayerLog {
|
||||
/// The log level of this message.
|
||||
final PlayerLogLevel level;
|
||||
|
||||
/// The prefix/category of the log message (e.g., 'cplayer', 'ffmpeg').
|
||||
final String prefix;
|
||||
|
||||
/// The log message text.
|
||||
final String text;
|
||||
|
||||
const PlayerLog({
|
||||
required this.level,
|
||||
required this.prefix,
|
||||
required this.text,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() => '[$prefix] ${level.name}: $text';
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/// Log level for player messages.
|
||||
enum PlayerLogLevel {
|
||||
/// No logging.
|
||||
none,
|
||||
|
||||
/// Fatal errors only.
|
||||
fatal,
|
||||
|
||||
/// Errors.
|
||||
error,
|
||||
|
||||
/// Warnings.
|
||||
warn,
|
||||
|
||||
/// Informational messages.
|
||||
info,
|
||||
|
||||
/// Verbose output.
|
||||
verbose,
|
||||
|
||||
/// Debug messages.
|
||||
debug,
|
||||
|
||||
/// Trace-level output (very verbose).
|
||||
trace,
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/// Represents a subtitle track in the media.
|
||||
class SubtitleTrack {
|
||||
/// Unique identifier for the track.
|
||||
final String id;
|
||||
|
||||
/// Human-readable title of the track.
|
||||
final String? title;
|
||||
|
||||
/// Language code (e.g., 'eng', 'jpn').
|
||||
final String? language;
|
||||
|
||||
/// Subtitle codec/format (e.g., 'subrip', 'ass', 'pgs').
|
||||
final String? codec;
|
||||
|
||||
/// Whether this is the default track.
|
||||
final bool isDefault;
|
||||
|
||||
/// Whether this track is forced (e.g., for foreign language segments).
|
||||
final bool isForced;
|
||||
|
||||
/// Whether this is an external subtitle file.
|
||||
final bool isExternal;
|
||||
|
||||
/// URI of external subtitle file (if isExternal is true).
|
||||
final String? uri;
|
||||
|
||||
const SubtitleTrack({
|
||||
required this.id,
|
||||
this.title,
|
||||
this.language,
|
||||
this.codec,
|
||||
this.isDefault = false,
|
||||
this.isForced = false,
|
||||
this.isExternal = false,
|
||||
this.uri,
|
||||
});
|
||||
|
||||
/// Create a subtitle track from an external URI.
|
||||
factory SubtitleTrack.uri(String uri, {String? title, String? language}) {
|
||||
return SubtitleTrack(
|
||||
id: 'external:$uri',
|
||||
title: title,
|
||||
language: language,
|
||||
isExternal: true,
|
||||
uri: uri,
|
||||
);
|
||||
}
|
||||
|
||||
/// Auto-select track.
|
||||
static const auto = SubtitleTrack(id: 'auto', title: 'Auto');
|
||||
|
||||
/// Disable subtitles.
|
||||
static const off = SubtitleTrack(id: 'no', title: 'Off');
|
||||
|
||||
/// Returns a display name for the track.
|
||||
String get displayName {
|
||||
if (title != null && title!.isNotEmpty) return title!;
|
||||
if (language != null && language!.isNotEmpty) return language!;
|
||||
if (isExternal) return 'External';
|
||||
return 'Track $id';
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => 'SubtitleTrack($id, $displayName)';
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is SubtitleTrack &&
|
||||
runtimeType == other.runtimeType &&
|
||||
id == other.id;
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
import 'audio_track.dart';
|
||||
import 'subtitle_track.dart';
|
||||
|
||||
/// Represents the currently selected tracks.
|
||||
class TrackSelection {
|
||||
/// Currently selected audio track.
|
||||
final AudioTrack? audio;
|
||||
|
||||
/// Currently selected subtitle track.
|
||||
final SubtitleTrack? subtitle;
|
||||
|
||||
const TrackSelection({this.audio, this.subtitle});
|
||||
|
||||
/// Creates a copy with the given fields replaced.
|
||||
TrackSelection copyWith({AudioTrack? audio, SubtitleTrack? subtitle}) {
|
||||
return TrackSelection(
|
||||
audio: audio ?? this.audio,
|
||||
subtitle: subtitle ?? this.subtitle,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => 'TrackSelection(audio: $audio, subtitle: $subtitle)';
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import 'audio_track.dart';
|
||||
import 'subtitle_track.dart';
|
||||
|
||||
/// Container for all available tracks in the media.
|
||||
class Tracks {
|
||||
/// Available audio tracks.
|
||||
final List<AudioTrack> audio;
|
||||
|
||||
/// Available subtitle tracks.
|
||||
final List<SubtitleTrack> subtitle;
|
||||
|
||||
const Tracks({this.audio = const [], this.subtitle = const []});
|
||||
|
||||
/// Creates a copy with the given fields replaced.
|
||||
Tracks copyWith({List<AudioTrack>? audio, List<SubtitleTrack>? subtitle}) {
|
||||
return Tracks(
|
||||
audio: audio ?? this.audio,
|
||||
subtitle: subtitle ?? this.subtitle,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() =>
|
||||
'Tracks(audio: ${audio.length}, subtitle: ${subtitle.length})';
|
||||
}
|
||||
+2
-9
@@ -49,14 +49,7 @@ export 'player/player_state.dart';
|
||||
export 'player/player_streams.dart';
|
||||
|
||||
// Models
|
||||
export 'models/media.dart';
|
||||
export 'models/audio_device.dart';
|
||||
export 'models/audio_track.dart';
|
||||
export 'models/subtitle_track.dart';
|
||||
export 'models/tracks.dart';
|
||||
export 'models/track_selection.dart';
|
||||
export 'models/player_log.dart';
|
||||
export 'models/player_log_level.dart';
|
||||
export 'models.dart';
|
||||
|
||||
// Video
|
||||
export 'video/video.dart';
|
||||
export 'video.dart';
|
||||
|
||||
@@ -22,8 +22,6 @@ class PlayerLinux extends PlayerNative {
|
||||
/// limitation.
|
||||
@override
|
||||
Future<void> setControlsVisible(bool visible) async {
|
||||
await _methodChannel.invokeMethod('setControlsVisible', {
|
||||
'visible': visible,
|
||||
});
|
||||
await _methodChannel.invokeMethod('setControlsVisible', {'visible': visible});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
import '../models/audio_device.dart';
|
||||
import '../models/media.dart';
|
||||
import '../models/audio_track.dart';
|
||||
import '../models/subtitle_track.dart';
|
||||
import '../models.dart';
|
||||
import 'player_native.dart';
|
||||
import 'player_state.dart';
|
||||
import 'player_streams.dart';
|
||||
@@ -93,12 +90,7 @@ abstract class Player {
|
||||
/// [title] - Optional display title.
|
||||
/// [language] - Optional language code.
|
||||
/// [select] - Whether to select this track immediately.
|
||||
Future<void> addSubtitleTrack({
|
||||
required String uri,
|
||||
String? title,
|
||||
String? language,
|
||||
bool select = false,
|
||||
});
|
||||
Future<void> addSubtitleTrack({required String uri, String? title, String? language, bool select = false});
|
||||
|
||||
// ============================================
|
||||
// Volume and Rate
|
||||
|
||||
@@ -4,15 +4,8 @@ import 'dart:io' show Platform;
|
||||
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../utils/android_font_loader.dart';
|
||||
|
||||
import '../models/audio_device.dart';
|
||||
import '../models/audio_track.dart';
|
||||
import '../models/player_log.dart';
|
||||
import '../models/media.dart';
|
||||
import '../models/subtitle_track.dart';
|
||||
import '../models/track_selection.dart';
|
||||
import '../models/tracks.dart';
|
||||
import '../android_font_loader.dart';
|
||||
import '../models.dart';
|
||||
import 'player.dart';
|
||||
import 'player_state.dart';
|
||||
import 'player_streams.dart';
|
||||
@@ -50,8 +43,7 @@ class PlayerNative implements Player {
|
||||
final _logController = StreamController<PlayerLog>.broadcast();
|
||||
final _errorController = StreamController<String>.broadcast();
|
||||
final _audioDeviceController = StreamController<AudioDevice>.broadcast();
|
||||
final _audioDevicesController =
|
||||
StreamController<List<AudioDevice>>.broadcast();
|
||||
final _audioDevicesController = StreamController<List<AudioDevice>>.broadcast();
|
||||
|
||||
StreamSubscription? _eventSubscription;
|
||||
bool _disposed = false;
|
||||
@@ -278,15 +270,10 @@ class PlayerNative implements Player {
|
||||
T? selectedTrack;
|
||||
|
||||
if (id != null && id != 'no') {
|
||||
selectedTrack = tracks.firstWhere(
|
||||
(track) => _getTrackId(track) == id,
|
||||
orElse: () => null,
|
||||
);
|
||||
selectedTrack = tracks.firstWhere((track) => _getTrackId(track) == id, orElse: () => null);
|
||||
}
|
||||
|
||||
_state = _state.copyWith(
|
||||
track: selectionSetter(_state.track, selectedTrack),
|
||||
);
|
||||
_state = _state.copyWith(track: selectionSetter(_state.track, selectedTrack));
|
||||
_trackController.add(_state.track);
|
||||
}
|
||||
|
||||
@@ -315,10 +302,7 @@ class PlayerNative implements Player {
|
||||
await _observeProperty('duration', 'double');
|
||||
await _observeProperty('pause', 'flag');
|
||||
await _observeProperty('paused-for-cache', 'flag');
|
||||
await _observeProperty(
|
||||
'track-list',
|
||||
(Platform.isAndroid || Platform.isWindows) ? 'string' : 'node',
|
||||
);
|
||||
await _observeProperty('track-list', (Platform.isAndroid || Platform.isWindows) ? 'string' : 'node');
|
||||
await _observeProperty('eof-reached', 'flag');
|
||||
await _observeProperty('volume', 'double');
|
||||
await _observeProperty('aid', 'string');
|
||||
@@ -330,10 +314,7 @@ class PlayerNative implements Player {
|
||||
}
|
||||
|
||||
Future<void> _observeProperty(String name, String format) async {
|
||||
await _methodChannel.invokeMethod('observeProperty', {
|
||||
'name': name,
|
||||
'format': format,
|
||||
});
|
||||
await _methodChannel.invokeMethod('observeProperty', {'name': name, 'format': format});
|
||||
}
|
||||
|
||||
/// Configures subtitle fonts for Android libass support.
|
||||
@@ -418,11 +399,7 @@ class PlayerNative implements Player {
|
||||
@override
|
||||
Future<void> seek(Duration position) async {
|
||||
_checkDisposed();
|
||||
await command([
|
||||
'seek',
|
||||
(position.inMilliseconds / 1000.0).toString(),
|
||||
'absolute',
|
||||
]);
|
||||
await command(['seek', (position.inMilliseconds / 1000.0).toString(), 'absolute']);
|
||||
}
|
||||
|
||||
// ============================================
|
||||
@@ -442,12 +419,7 @@ class PlayerNative implements Player {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> addSubtitleTrack({
|
||||
required String uri,
|
||||
String? title,
|
||||
String? language,
|
||||
bool select = false,
|
||||
}) async {
|
||||
Future<void> addSubtitleTrack({required String uri, String? title, String? language, bool select = false}) async {
|
||||
_checkDisposed();
|
||||
final args = ['sub-add', uri, select ? 'select' : 'auto'];
|
||||
if (title != null) args.add('title=$title');
|
||||
@@ -485,19 +457,14 @@ class PlayerNative implements Player {
|
||||
Future<void> setProperty(String name, String value) async {
|
||||
_checkDisposed();
|
||||
await _ensureInitialized();
|
||||
await _methodChannel.invokeMethod('setProperty', {
|
||||
'name': name,
|
||||
'value': value,
|
||||
});
|
||||
await _methodChannel.invokeMethod('setProperty', {'name': name, 'value': value});
|
||||
}
|
||||
|
||||
@override
|
||||
Future<String?> getProperty(String name) async {
|
||||
_checkDisposed();
|
||||
await _ensureInitialized();
|
||||
return await _methodChannel.invokeMethod<String>('getProperty', {
|
||||
'name': name,
|
||||
});
|
||||
return await _methodChannel.invokeMethod<String>('getProperty', {'name': name});
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import '../models/audio_device.dart';
|
||||
import '../models/tracks.dart';
|
||||
import '../models/track_selection.dart';
|
||||
import '../models.dart';
|
||||
|
||||
/// Immutable snapshot of the current player state.
|
||||
///
|
||||
@@ -108,6 +106,5 @@ class PlayerState {
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() =>
|
||||
'PlayerState(playing: $playing, position: $position, duration: $duration)';
|
||||
String toString() => 'PlayerState(playing: $playing, position: $position, duration: $duration)';
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import '../models/audio_device.dart';
|
||||
import '../models/player_log.dart';
|
||||
import '../models/tracks.dart';
|
||||
import '../models/track_selection.dart';
|
||||
import '../models.dart';
|
||||
|
||||
/// Reactive streams for player state changes.
|
||||
///
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../player/player.dart';
|
||||
import '../player/video_rect_support.dart';
|
||||
import 'player/player.dart';
|
||||
import 'player/video_rect_support.dart';
|
||||
|
||||
/// Video widget for displaying player output.
|
||||
///
|
||||
@@ -27,12 +27,7 @@ class Video extends StatefulWidget {
|
||||
/// Background color shown behind the video.
|
||||
final Color backgroundColor;
|
||||
|
||||
const Video({
|
||||
super.key,
|
||||
required this.player,
|
||||
this.controls,
|
||||
this.backgroundColor = Colors.black,
|
||||
});
|
||||
const Video({super.key, required this.player, this.controls, this.backgroundColor = Colors.black});
|
||||
|
||||
@override
|
||||
State<Video> createState() => _VideoState();
|
||||
@@ -82,12 +77,7 @@ class _VideoState extends State<Video> {
|
||||
final size = renderBox.size;
|
||||
final dpr = MediaQuery.of(context).devicePixelRatio;
|
||||
|
||||
final newRect = Rect.fromLTWH(
|
||||
position.dx,
|
||||
position.dy,
|
||||
size.width,
|
||||
size.height,
|
||||
);
|
||||
final newRect = Rect.fromLTWH(position.dx, position.dy, size.width, size.height);
|
||||
|
||||
// Only update if the rect has changed significantly
|
||||
if (_lastRect != null &&
|
||||
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plezy/widgets/app_icon.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
|
||||
import '../i18n/strings.g.dart';
|
||||
|
||||
/// Navigation tab identifiers
|
||||
enum NavigationTabId { discover, libraries, search, downloads, settings }
|
||||
|
||||
/// Represents a navigation tab with its configuration
|
||||
class NavigationTab {
|
||||
final NavigationTabId id;
|
||||
final bool onlineOnly;
|
||||
final IconData icon;
|
||||
final String Function() getLabel;
|
||||
|
||||
const NavigationTab({required this.id, required this.onlineOnly, required this.icon, required this.getLabel});
|
||||
|
||||
NavigationDestination toDestination() {
|
||||
return NavigationDestination(icon: AppIcon(icon, fill: 1), selectedIcon: AppIcon(icon, fill: 1), label: getLabel());
|
||||
}
|
||||
|
||||
/// Get the index for a tab ID in the visible tabs list
|
||||
static int indexFor(NavigationTabId id, {required bool isOffline}) {
|
||||
final tabs = getVisibleTabs(isOffline: isOffline);
|
||||
return tabs.indexWhere((tab) => tab.id == id);
|
||||
}
|
||||
|
||||
/// Get tabs filtered by offline mode
|
||||
static List<NavigationTab> getVisibleTabs({required bool isOffline}) {
|
||||
return allNavigationTabs.where((tab) => !isOffline || !tab.onlineOnly).toList();
|
||||
}
|
||||
|
||||
/// Check if a visual index corresponds to a specific tab ID
|
||||
static bool isTabAtIndex(NavigationTabId id, int index, {required bool isOffline}) {
|
||||
return indexFor(id, isOffline: isOffline) == index;
|
||||
}
|
||||
}
|
||||
|
||||
// Label getters (must be top-level for const constructor)
|
||||
String _getHomeLabel() => t.navigation.home;
|
||||
String _getLibrariesLabel() => t.navigation.libraries;
|
||||
String _getSearchLabel() => t.navigation.search;
|
||||
String _getDownloadsLabel() => t.navigation.downloads;
|
||||
String _getSettingsLabel() => t.navigation.settings;
|
||||
|
||||
/// All navigation tabs in display order
|
||||
const allNavigationTabs = [
|
||||
NavigationTab(id: NavigationTabId.discover, onlineOnly: true, icon: Symbols.home_rounded, getLabel: _getHomeLabel),
|
||||
NavigationTab(
|
||||
id: NavigationTabId.libraries,
|
||||
onlineOnly: true,
|
||||
icon: Symbols.video_library_rounded,
|
||||
getLabel: _getLibrariesLabel,
|
||||
),
|
||||
NavigationTab(id: NavigationTabId.search, onlineOnly: true, icon: Symbols.search_rounded, getLabel: _getSearchLabel),
|
||||
NavigationTab(
|
||||
id: NavigationTabId.downloads,
|
||||
onlineOnly: false,
|
||||
icon: Symbols.download_rounded,
|
||||
getLabel: _getDownloadsLabel,
|
||||
),
|
||||
NavigationTab(
|
||||
id: NavigationTabId.settings,
|
||||
onlineOnly: false,
|
||||
icon: Symbols.settings_rounded,
|
||||
getLabel: _getSettingsLabel,
|
||||
),
|
||||
];
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,23 +8,26 @@ class HiddenLibrariesProvider extends ChangeNotifier {
|
||||
late StorageService _storageService;
|
||||
Set<String> _hiddenLibraryKeys = {};
|
||||
bool _isInitialized = false;
|
||||
Future<void>? _initFuture;
|
||||
|
||||
/// Get an unmodifiable copy of hidden library keys
|
||||
Set<String> get hiddenLibraryKeys {
|
||||
if (!_isInitialized) _initialize();
|
||||
return Set.unmodifiable(_hiddenLibraryKeys);
|
||||
HiddenLibrariesProvider() {
|
||||
// Start initialization eagerly to reduce race conditions
|
||||
_initFuture = _initialize();
|
||||
}
|
||||
|
||||
/// Ensures the provider is initialized. Call this before accessing hidden
|
||||
/// libraries in contexts where you need the actual persisted values.
|
||||
Future<void> ensureInitialized() => _initFuture ?? _initialize();
|
||||
|
||||
/// Check if the provider has completed initialization
|
||||
bool get isInitialized => _isInitialized;
|
||||
|
||||
HiddenLibrariesProvider() {
|
||||
// Don't initialize immediately if lazy-loaded
|
||||
// _initialize() will be called when first accessed
|
||||
}
|
||||
/// Get an unmodifiable copy of hidden library keys
|
||||
Set<String> get hiddenLibraryKeys => Set.unmodifiable(_hiddenLibraryKeys);
|
||||
|
||||
/// Initialize the provider by loading hidden libraries from storage
|
||||
Future<void> _initialize() async {
|
||||
if (_isInitialized) return;
|
||||
_storageService = await StorageService.getInstance();
|
||||
_hiddenLibraryKeys = _storageService.getHiddenLibraries();
|
||||
_isInitialized = true;
|
||||
@@ -54,10 +57,7 @@ class HiddenLibrariesProvider extends ChangeNotifier {
|
||||
}
|
||||
|
||||
/// Check if a specific library is hidden
|
||||
bool isLibraryHidden(String libraryKey) {
|
||||
if (!_isInitialized) _initialize();
|
||||
return _hiddenLibraryKeys.contains(libraryKey);
|
||||
}
|
||||
bool isLibraryHidden(String libraryKey) => _hiddenLibraryKeys.contains(libraryKey);
|
||||
|
||||
/// Refresh hidden libraries from storage
|
||||
/// Useful if storage was modified outside the provider
|
||||
|
||||
@@ -58,9 +58,7 @@ class MultiServerProvider extends ChangeNotifier {
|
||||
appLogger.d('MultiServerProvider: Token updated for server $serverId');
|
||||
notifyListeners();
|
||||
} else {
|
||||
appLogger.w(
|
||||
'MultiServerProvider: Cannot update token - server $serverId not found',
|
||||
);
|
||||
appLogger.w('MultiServerProvider: Cannot update token - server $serverId not found');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,26 +72,16 @@ class MultiServerProvider extends ChangeNotifier {
|
||||
|
||||
/// Reconnect all servers after a profile switch
|
||||
/// Clears existing connections and connects to all provided servers
|
||||
Future<int> reconnectWithServers(
|
||||
List<PlexServer> servers, {
|
||||
String? clientIdentifier,
|
||||
}) async {
|
||||
Future<int> reconnectWithServers(List<PlexServer> servers, {String? clientIdentifier}) async {
|
||||
// Clear existing connections first
|
||||
_serverManager.disconnectAll();
|
||||
_aggregationService.clearCache(); // Clear cached data when servers change
|
||||
appLogger.d(
|
||||
'MultiServerProvider: Cleared connections, reconnecting to ${servers.length} servers',
|
||||
);
|
||||
appLogger.d('MultiServerProvider: Cleared connections, reconnecting to ${servers.length} servers');
|
||||
|
||||
// Connect with new server tokens
|
||||
final connectedCount = await _serverManager.connectToAllServers(
|
||||
servers,
|
||||
clientIdentifier: clientIdentifier,
|
||||
);
|
||||
final connectedCount = await _serverManager.connectToAllServers(servers, clientIdentifier: clientIdentifier);
|
||||
|
||||
appLogger.i(
|
||||
'MultiServerProvider: Reconnected to $connectedCount/${servers.length} servers after profile switch',
|
||||
);
|
||||
appLogger.i('MultiServerProvider: Reconnected to $connectedCount/${servers.length} servers after profile switch');
|
||||
notifyListeners();
|
||||
return connectedCount;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import '../services/multi_server_manager.dart';
|
||||
|
||||
/// Tracks offline mode status based on network connectivity and server reachability.
|
||||
class OfflineModeProvider extends ChangeNotifier {
|
||||
final MultiServerManager _serverManager;
|
||||
|
||||
StreamSubscription<List<ConnectivityResult>>? _connectivitySubscription;
|
||||
StreamSubscription<Map<String, bool>>? _serverStatusSubscription;
|
||||
|
||||
bool _hasNetworkConnection = true;
|
||||
late bool _hasServerConnection;
|
||||
bool _isInitialized = false;
|
||||
|
||||
OfflineModeProvider(this._serverManager) : _hasServerConnection = _serverManager.onlineServerIds.isNotEmpty;
|
||||
|
||||
/// Whether the app is currently in offline mode
|
||||
/// Offline = no network OR no servers reachable
|
||||
bool get isOffline => !_hasNetworkConnection || !_hasServerConnection;
|
||||
|
||||
/// Whether there is network connectivity (WiFi, mobile data, etc.)
|
||||
bool get hasNetworkConnection => _hasNetworkConnection;
|
||||
|
||||
/// Whether at least one Plex server is reachable
|
||||
bool get hasServerConnection => _hasServerConnection;
|
||||
|
||||
/// Updates network and server connection flags
|
||||
Future<void> _updateConnectionFlags() async {
|
||||
final connectivityResult = await Connectivity().checkConnectivity();
|
||||
_hasNetworkConnection = !connectivityResult.contains(ConnectivityResult.none);
|
||||
_hasServerConnection = _serverManager.onlineServerIds.isNotEmpty;
|
||||
}
|
||||
|
||||
/// Initialize the provider and start monitoring
|
||||
Future<void> initialize() async {
|
||||
if (_isInitialized) return;
|
||||
_isInitialized = true;
|
||||
|
||||
// Check initial connectivity
|
||||
await _updateConnectionFlags();
|
||||
|
||||
// Monitor connectivity changes
|
||||
_connectivitySubscription = Connectivity().onConnectivityChanged.listen((results) {
|
||||
final wasOffline = isOffline;
|
||||
_hasNetworkConnection = !results.contains(ConnectivityResult.none);
|
||||
|
||||
if (wasOffline != isOffline) {
|
||||
notifyListeners();
|
||||
}
|
||||
});
|
||||
|
||||
// Monitor server status from MultiServerManager
|
||||
_serverStatusSubscription = _serverManager.statusStream.listen((statusMap) {
|
||||
final wasOffline = isOffline;
|
||||
_hasServerConnection = statusMap.values.any((isOnline) => isOnline);
|
||||
|
||||
if (wasOffline != isOffline) {
|
||||
notifyListeners();
|
||||
}
|
||||
});
|
||||
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// Force a refresh of connectivity status
|
||||
Future<void> refresh() async {
|
||||
await _updateConnectionFlags();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_connectivitySubscription?.cancel();
|
||||
_serverStatusSubscription?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import '../models/plex_metadata.dart';
|
||||
import '../services/offline_watch_sync_service.dart';
|
||||
import '../services/plex_api_cache.dart';
|
||||
import 'download_provider.dart';
|
||||
|
||||
/// Provider for offline watch status UI state.
|
||||
///
|
||||
/// Provides:
|
||||
/// - Effective watch status (local changes + cached server data)
|
||||
/// - Offline "OnDeck" calculation for shows
|
||||
/// - Manual mark watched/unwatched while offline
|
||||
class OfflineWatchProvider extends ChangeNotifier {
|
||||
final OfflineWatchSyncService _syncService;
|
||||
final DownloadProvider _downloadProvider;
|
||||
// ignore: unused_field - reserved for future cached metadata lookup
|
||||
final PlexApiCache _apiCache;
|
||||
|
||||
OfflineWatchProvider({
|
||||
required OfflineWatchSyncService syncService,
|
||||
required DownloadProvider downloadProvider,
|
||||
required PlexApiCache apiCache,
|
||||
}) : _syncService = syncService,
|
||||
_downloadProvider = downloadProvider,
|
||||
_apiCache = apiCache {
|
||||
// Listen to sync service changes to update UI
|
||||
_syncService.addListener(_onSyncServiceChanged);
|
||||
}
|
||||
|
||||
void _onSyncServiceChanged() {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// Whether a sync is in progress
|
||||
bool get isSyncing => _syncService.isSyncing;
|
||||
|
||||
/// Get count of pending sync items
|
||||
Future<int> getPendingSyncCount() => _syncService.getPendingSyncCount();
|
||||
|
||||
/// Get the effective watch status for a media item.
|
||||
///
|
||||
/// Priority:
|
||||
/// 1. Local offline action (if exists)
|
||||
/// 2. Cached server data from API cache
|
||||
/// 3. Metadata from download provider
|
||||
///
|
||||
/// Returns true if watched, false otherwise.
|
||||
Future<bool> isWatched(String globalKey) async {
|
||||
// First check local offline action
|
||||
final localStatus = await _syncService.getLocalWatchStatus(globalKey);
|
||||
if (localStatus != null) {
|
||||
return localStatus;
|
||||
}
|
||||
|
||||
// Fall back to cached metadata
|
||||
final metadata = _downloadProvider.getMetadata(globalKey);
|
||||
if (metadata != null) {
|
||||
return metadata.isWatched;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Check watch status synchronously using cached metadata.
|
||||
///
|
||||
/// This is useful for UI that can't await, but may not reflect
|
||||
/// the most recent local actions.
|
||||
bool isWatchedSync(PlexMetadata metadata) {
|
||||
// Note: This doesn't check local actions synchronously
|
||||
// because that would require async database access.
|
||||
// For real-time accuracy, use isWatched() instead.
|
||||
return metadata.isWatched;
|
||||
}
|
||||
|
||||
/// Get the effective view offset (resume position) for a media item.
|
||||
///
|
||||
/// Priority:
|
||||
/// 1. Local offline progress (if exists)
|
||||
/// 2. Metadata from download provider
|
||||
///
|
||||
/// Returns null if no position is available.
|
||||
Future<int?> getViewOffset(String globalKey) async {
|
||||
// First check local offline progress
|
||||
final localOffset = await _syncService.getLocalViewOffset(globalKey);
|
||||
if (localOffset != null) {
|
||||
return localOffset;
|
||||
}
|
||||
|
||||
// Fall back to cached metadata
|
||||
final metadata = _downloadProvider.getMetadata(globalKey);
|
||||
return metadata?.viewOffset;
|
||||
}
|
||||
|
||||
/// Get sorted episodes for a show (by season, then episode number).
|
||||
List<PlexMetadata> _getSortedEpisodes(String showRatingKey) {
|
||||
final episodes = _downloadProvider.getDownloadedEpisodesForShow(showRatingKey);
|
||||
if (episodes.isEmpty) return episodes;
|
||||
|
||||
episodes.sort((a, b) {
|
||||
final seasonCompare = (a.parentIndex ?? 0).compareTo(b.parentIndex ?? 0);
|
||||
if (seasonCompare != 0) return seasonCompare;
|
||||
return (a.index ?? 0).compareTo(b.index ?? 0);
|
||||
});
|
||||
|
||||
return episodes;
|
||||
}
|
||||
|
||||
/// Find the next unwatched downloaded episode for a show.
|
||||
///
|
||||
/// This is the "offline OnDeck" calculation - finds the first
|
||||
/// episode that hasn't been watched (or is in progress).
|
||||
///
|
||||
/// Episodes are sorted by season number, then episode number.
|
||||
///
|
||||
/// Returns the next unwatched episode, or the first episode if all watched.
|
||||
Future<PlexMetadata?> getNextUnwatchedEpisode(String showRatingKey) async {
|
||||
final episodes = _getSortedEpisodes(showRatingKey);
|
||||
if (episodes.isEmpty) return null;
|
||||
|
||||
// Batch fetch all watch statuses in a single query
|
||||
final globalKeys = episodes.map((e) => e.globalKey).toSet();
|
||||
final localStatuses = await _syncService.getLocalWatchStatusesBatched(globalKeys);
|
||||
|
||||
// Find first unwatched episode
|
||||
for (final episode in episodes) {
|
||||
final localStatus = localStatuses[episode.globalKey];
|
||||
final watched = localStatus ?? _downloadProvider.getMetadata(episode.globalKey)?.isWatched ?? false;
|
||||
if (!watched) {
|
||||
return episode;
|
||||
}
|
||||
}
|
||||
|
||||
// All episodes watched - return first episode for replay
|
||||
return episodes.first;
|
||||
}
|
||||
|
||||
/// Find the next unwatched downloaded episode synchronously.
|
||||
///
|
||||
/// This uses cached metadata without checking local offline actions.
|
||||
/// For real-time accuracy, use getNextUnwatchedEpisode() instead.
|
||||
PlexMetadata? getNextUnwatchedEpisodeSync(String showRatingKey) {
|
||||
final episodes = _getSortedEpisodes(showRatingKey);
|
||||
if (episodes.isEmpty) return null;
|
||||
|
||||
// Find first unwatched episode (using metadata's isWatched)
|
||||
for (final episode in episodes) {
|
||||
if (!episode.isWatched) {
|
||||
return episode;
|
||||
}
|
||||
}
|
||||
|
||||
// All episodes watched - return first episode for replay
|
||||
return episodes.first;
|
||||
}
|
||||
|
||||
/// Mark an item as watched while offline.
|
||||
///
|
||||
/// This queues the action for sync when online.
|
||||
Future<void> markAsWatched({required String serverId, required String ratingKey}) async {
|
||||
await _syncService.queueMarkWatched(serverId: serverId, ratingKey: ratingKey);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// Mark an item as unwatched while offline.
|
||||
///
|
||||
/// This queues the action for sync when online.
|
||||
Future<void> markAsUnwatched({required String serverId, required String ratingKey}) async {
|
||||
await _syncService.queueMarkUnwatched(serverId: serverId, ratingKey: ratingKey);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// Get downloaded episodes for a show with their watch status.
|
||||
///
|
||||
/// Returns a list of (episode, isWatched) pairs.
|
||||
/// Uses batched database query for efficiency.
|
||||
Future<List<(PlexMetadata episode, bool isWatched)>> getEpisodesWithWatchStatus(String showRatingKey) async {
|
||||
final episodes = _downloadProvider.getDownloadedEpisodesForShow(showRatingKey);
|
||||
|
||||
if (episodes.isEmpty) return [];
|
||||
|
||||
// Batch fetch all watch statuses in a single query
|
||||
final globalKeys = episodes.map((e) => e.globalKey).toSet();
|
||||
final localStatuses = await _syncService.getLocalWatchStatusesBatched(globalKeys);
|
||||
|
||||
final results = <(PlexMetadata, bool)>[];
|
||||
for (final episode in episodes) {
|
||||
final localStatus = localStatuses[episode.globalKey];
|
||||
final watched = localStatus ?? _downloadProvider.getMetadata(episode.globalKey)?.isWatched ?? false;
|
||||
results.add((episode, watched));
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/// Trigger a manual sync of pending items.
|
||||
Future<void> syncNow() async {
|
||||
await _syncService.syncPendingItems();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_syncService.removeListener(_onSyncServiceChanged);
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,7 @@ class _IndexLookupResult {
|
||||
final bool attemptedLoad;
|
||||
final bool loadFailed;
|
||||
|
||||
const _IndexLookupResult({
|
||||
this.index,
|
||||
this.attemptedLoad = false,
|
||||
this.loadFailed = false,
|
||||
});
|
||||
const _IndexLookupResult({this.index, this.attemptedLoad = false, this.loadFailed = false});
|
||||
}
|
||||
|
||||
/// Manages playback state using Plex's play queue API.
|
||||
@@ -53,8 +49,7 @@ class PlaybackStateProvider with ChangeNotifier {
|
||||
bool get isPlaylistActive => _playbackMode == PlaybackMode.playQueue;
|
||||
|
||||
/// Whether any queue-based playback is active
|
||||
bool get isQueueActive =>
|
||||
_playQueueId != null && _playbackMode == PlaybackMode.playQueue;
|
||||
bool get isQueueActive => _playQueueId != null && _playbackMode == PlaybackMode.playQueue;
|
||||
|
||||
/// The context key (show/season/playlist ratingKey) for the current session
|
||||
String? get shuffleContextKey => _contextKey;
|
||||
@@ -68,9 +63,7 @@ class PlaybackStateProvider with ChangeNotifier {
|
||||
/// Gets the current position in the queue (1-indexed)
|
||||
int get currentPosition {
|
||||
if (_currentPlayQueueItemID == null || _loadedItems.isEmpty) return 0;
|
||||
final index = _loadedItems.indexWhere(
|
||||
(item) => item.playQueueItemID == _currentPlayQueueItemID,
|
||||
);
|
||||
final index = _loadedItems.indexWhere((item) => item.playQueueItemID == _currentPlayQueueItemID);
|
||||
return index != -1 ? index + 1 : 0;
|
||||
}
|
||||
|
||||
@@ -81,8 +74,7 @@ class PlaybackStateProvider with ChangeNotifier {
|
||||
|
||||
/// Update the current play queue item when playing a new item
|
||||
void setCurrentItem(PlexMetadata metadata) {
|
||||
if (_playbackMode == PlaybackMode.playQueue &&
|
||||
metadata.playQueueItemID != null) {
|
||||
if (_playbackMode == PlaybackMode.playQueue && metadata.playQueueItemID != null) {
|
||||
_currentPlayQueueItemID = metadata.playQueueItemID;
|
||||
notifyListeners();
|
||||
}
|
||||
@@ -98,10 +90,7 @@ class PlaybackStateProvider with ChangeNotifier {
|
||||
}) async {
|
||||
_playQueueId = playQueue.playQueueID;
|
||||
// Use size or items length as fallback if totalCount is null
|
||||
_playQueueTotalCount =
|
||||
playQueue.playQueueTotalCount ??
|
||||
playQueue.size ??
|
||||
(playQueue.items?.length ?? 0);
|
||||
_playQueueTotalCount = playQueue.playQueueTotalCount ?? playQueue.size ?? (playQueue.items?.length ?? 0);
|
||||
_playQueueShuffled = playQueue.playQueueShuffled;
|
||||
_currentPlayQueueItemID = playQueue.playQueueSelectedItemID;
|
||||
|
||||
@@ -119,9 +108,7 @@ class PlaybackStateProvider with ChangeNotifier {
|
||||
if (_client == null || _playQueueId == null) return false;
|
||||
|
||||
// Check if the target item is already loaded
|
||||
final hasItem = _loadedItems.any(
|
||||
(item) => item.playQueueItemID == targetPlayQueueItemID,
|
||||
);
|
||||
final hasItem = _loadedItems.any((item) => item.playQueueItemID == targetPlayQueueItemID);
|
||||
|
||||
if (hasItem) return true;
|
||||
|
||||
@@ -137,10 +124,7 @@ class PlaybackStateProvider with ChangeNotifier {
|
||||
// Items are already tagged with server info by PlexClient
|
||||
_loadedItems = response.items!;
|
||||
// Use size or items length as fallback if totalCount is null
|
||||
_playQueueTotalCount =
|
||||
response.playQueueTotalCount ??
|
||||
response.size ??
|
||||
response.items!.length;
|
||||
_playQueueTotalCount = response.playQueueTotalCount ?? response.size ?? response.items!.length;
|
||||
_playQueueShuffled = response.playQueueShuffled;
|
||||
notifyListeners();
|
||||
return true;
|
||||
@@ -153,18 +137,12 @@ class PlaybackStateProvider with ChangeNotifier {
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<_IndexLookupResult> _getCurrentIndex({
|
||||
bool loadIfMissing = false,
|
||||
}) async {
|
||||
if (_playbackMode != PlaybackMode.playQueue ||
|
||||
_loadedItems.isEmpty ||
|
||||
_currentPlayQueueItemID == null) {
|
||||
Future<_IndexLookupResult> _getCurrentIndex({bool loadIfMissing = false}) async {
|
||||
if (_playbackMode != PlaybackMode.playQueue || _loadedItems.isEmpty || _currentPlayQueueItemID == null) {
|
||||
return const _IndexLookupResult();
|
||||
}
|
||||
|
||||
var currentIndex = _loadedItems.indexWhere(
|
||||
(item) => item.playQueueItemID == _currentPlayQueueItemID,
|
||||
);
|
||||
var currentIndex = _loadedItems.indexWhere((item) => item.playQueueItemID == _currentPlayQueueItemID);
|
||||
|
||||
if (currentIndex != -1) {
|
||||
return _IndexLookupResult(index: currentIndex);
|
||||
@@ -179,9 +157,7 @@ class PlaybackStateProvider with ChangeNotifier {
|
||||
return const _IndexLookupResult(attemptedLoad: true, loadFailed: true);
|
||||
}
|
||||
|
||||
currentIndex = _loadedItems.indexWhere(
|
||||
(item) => item.playQueueItemID == _currentPlayQueueItemID,
|
||||
);
|
||||
currentIndex = _loadedItems.indexWhere((item) => item.playQueueItemID == _currentPlayQueueItemID);
|
||||
|
||||
if (currentIndex == -1) {
|
||||
return const _IndexLookupResult(attemptedLoad: true, loadFailed: true);
|
||||
@@ -193,10 +169,7 @@ class PlaybackStateProvider with ChangeNotifier {
|
||||
/// Gets the next item in the playback queue.
|
||||
/// Returns null if queue is exhausted or current item is not in queue.
|
||||
/// [loopQueue] - If true, restart from beginning when queue is exhausted
|
||||
Future<PlexMetadata?> getNextEpisode(
|
||||
String currentItemKey, {
|
||||
bool loopQueue = false,
|
||||
}) async {
|
||||
Future<PlexMetadata?> getNextEpisode(String currentItemKey, {bool loopQueue = false}) async {
|
||||
if (_playbackMode != PlaybackMode.playQueue) {
|
||||
// For sequential mode, let the video player handle next episode
|
||||
return null;
|
||||
@@ -224,9 +197,7 @@ class PlaybackStateProvider with ChangeNotifier {
|
||||
// Loop back to beginning - load first item
|
||||
if (_client != null && _playQueueId != null) {
|
||||
final response = await _client!.getPlayQueue(_playQueueId!);
|
||||
if (response != null &&
|
||||
response.items != null &&
|
||||
response.items!.isNotEmpty) {
|
||||
if (response != null && response.items != null && response.items!.isNotEmpty) {
|
||||
// Items are already tagged with server info by PlexClient
|
||||
_loadedItems = response.items!;
|
||||
final firstItem = _loadedItems.first;
|
||||
|
||||
@@ -8,12 +8,17 @@ class SettingsProvider extends ChangeNotifier {
|
||||
bool _useSeasonPoster = false;
|
||||
bool _showHeroSection = true;
|
||||
bool _isInitialized = false;
|
||||
Future<void>? _initFuture;
|
||||
|
||||
SettingsProvider() {
|
||||
// Don't initialize immediately if lazy-loaded
|
||||
// _initializeSettings() will be called when first accessed
|
||||
// Start initialization eagerly to reduce race conditions
|
||||
_initFuture = _initializeSettings();
|
||||
}
|
||||
|
||||
/// Ensures the provider is initialized. Call this before accessing settings
|
||||
/// in contexts where you need the actual persisted values.
|
||||
Future<void> ensureInitialized() => _initFuture ?? _initializeSettings();
|
||||
|
||||
Future<void> _initializeSettings() async {
|
||||
if (_isInitialized) return;
|
||||
|
||||
@@ -26,25 +31,16 @@ class SettingsProvider extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
LibraryDensity get libraryDensity {
|
||||
if (!_isInitialized) _initializeSettings();
|
||||
return _libraryDensity;
|
||||
}
|
||||
/// Whether the provider has completed initialization
|
||||
bool get isInitialized => _isInitialized;
|
||||
|
||||
ViewMode get viewMode {
|
||||
if (!_isInitialized) _initializeSettings();
|
||||
return _viewMode;
|
||||
}
|
||||
LibraryDensity get libraryDensity => _libraryDensity;
|
||||
|
||||
bool get useSeasonPoster {
|
||||
if (!_isInitialized) _initializeSettings();
|
||||
return _useSeasonPoster;
|
||||
}
|
||||
ViewMode get viewMode => _viewMode;
|
||||
|
||||
bool get showHeroSection {
|
||||
if (!_isInitialized) _initializeSettings();
|
||||
return _showHeroSection;
|
||||
}
|
||||
bool get useSeasonPoster => _useSeasonPoster;
|
||||
|
||||
bool get showHeroSection => _showHeroSection;
|
||||
|
||||
Future<void> setLibraryDensity(LibraryDensity density) async {
|
||||
if (!_isInitialized) await _initializeSettings();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import '../services/settings_service.dart' as settings;
|
||||
import '../theme/mono_theme.dart';
|
||||
|
||||
@@ -8,19 +9,16 @@ class ThemeProvider extends ChangeNotifier {
|
||||
late Brightness _systemBrightness;
|
||||
|
||||
ThemeProvider() {
|
||||
_systemBrightness =
|
||||
WidgetsBinding.instance.platformDispatcher.platformBrightness;
|
||||
_systemBrightness = WidgetsBinding.instance.platformDispatcher.platformBrightness;
|
||||
_initializeSettings();
|
||||
|
||||
// Listen to system theme changes
|
||||
WidgetsBinding.instance.platformDispatcher.onPlatformBrightnessChanged =
|
||||
() {
|
||||
_systemBrightness =
|
||||
WidgetsBinding.instance.platformDispatcher.platformBrightness;
|
||||
if (_themeMode == settings.ThemeMode.system) {
|
||||
notifyListeners();
|
||||
}
|
||||
};
|
||||
WidgetsBinding.instance.platformDispatcher.onPlatformBrightnessChanged = () {
|
||||
_systemBrightness = WidgetsBinding.instance.platformDispatcher.platformBrightness;
|
||||
if (_themeMode == settings.ThemeMode.system) {
|
||||
notifyListeners();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Future<void> _initializeSettings() async {
|
||||
@@ -78,11 +76,11 @@ class ThemeProvider extends ChangeNotifier {
|
||||
IconData get themeModeIcon {
|
||||
switch (_themeMode) {
|
||||
case settings.ThemeMode.light:
|
||||
return Icons.light_mode;
|
||||
return Symbols.light_mode_rounded;
|
||||
case settings.ThemeMode.dark:
|
||||
return Icons.dark_mode;
|
||||
return Symbols.dark_mode_rounded;
|
||||
case settings.ThemeMode.system:
|
||||
return Icons.brightness_auto;
|
||||
return Symbols.brightness_auto_rounded;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,7 @@ class UserProfileProvider extends ChangeNotifier {
|
||||
String? get error => _error;
|
||||
bool get hasMultipleUsers {
|
||||
final result = _home?.hasMultipleUsers ?? false;
|
||||
appLogger.d(
|
||||
'hasMultipleUsers: _home=${_home != null}, users count=${_home?.users.length ?? 0}, result=$result',
|
||||
);
|
||||
appLogger.d('hasMultipleUsers: _home=${_home != null}, users count=${_home?.users.length ?? 0}, result=$result');
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -40,9 +38,7 @@ class UserProfileProvider extends ChangeNotifier {
|
||||
|
||||
/// Set a callback to be called when profile switching requires data invalidation
|
||||
/// The callback receives the list of servers with the new profile's access tokens
|
||||
void setDataInvalidationCallback(
|
||||
Future<void> Function(List<PlexServer>)? callback,
|
||||
) {
|
||||
void setDataInvalidationCallback(Future<void> Function(List<PlexServer>)? callback) {
|
||||
_onDataInvalidationRequested = callback;
|
||||
}
|
||||
|
||||
@@ -50,9 +46,7 @@ class UserProfileProvider extends ChangeNotifier {
|
||||
Future<void> _invalidateAllData(List<PlexServer> servers) async {
|
||||
if (_onDataInvalidationRequested != null) {
|
||||
await _onDataInvalidationRequested!(servers);
|
||||
appLogger.d(
|
||||
'Data invalidation triggered for profile switch with ${servers.length} servers',
|
||||
);
|
||||
appLogger.d('Data invalidation triggered for profile switch with ${servers.length} servers');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,16 +65,11 @@ class UserProfileProvider extends ChangeNotifier {
|
||||
|
||||
// If no cached home data or it's expired, try to load from API
|
||||
if (_home == null) {
|
||||
appLogger.d(
|
||||
'UserProfileProvider: No cached home data, attempting to load from API',
|
||||
);
|
||||
appLogger.d('UserProfileProvider: No cached home data, attempting to load from API');
|
||||
try {
|
||||
await loadHomeUsers();
|
||||
} catch (e) {
|
||||
appLogger.w(
|
||||
'UserProfileProvider: Failed to load home users during initialization',
|
||||
error: e,
|
||||
);
|
||||
appLogger.w('UserProfileProvider: Failed to load home users during initialization', error: e);
|
||||
// Don't set error here as it's not critical for app startup
|
||||
}
|
||||
}
|
||||
@@ -90,20 +79,14 @@ class UserProfileProvider extends ChangeNotifier {
|
||||
try {
|
||||
await refreshProfileSettings();
|
||||
} catch (e) {
|
||||
appLogger.w(
|
||||
'UserProfileProvider: Failed to fetch profile settings during initialization',
|
||||
error: e,
|
||||
);
|
||||
appLogger.w('UserProfileProvider: Failed to fetch profile settings during initialization', error: e);
|
||||
// Don't set error here, cached profile (if any) was already loaded
|
||||
}
|
||||
|
||||
_isInitialized = true;
|
||||
appLogger.d('UserProfileProvider: Initialization complete');
|
||||
} catch (e) {
|
||||
appLogger.e(
|
||||
'UserProfileProvider: Critical initialization failure',
|
||||
error: e,
|
||||
);
|
||||
appLogger.e('UserProfileProvider: Critical initialization failure', error: e);
|
||||
_setError('Failed to initialize profile services');
|
||||
// Ensure services are null on failure
|
||||
_authService = null;
|
||||
@@ -148,9 +131,7 @@ class UserProfileProvider extends ChangeNotifier {
|
||||
try {
|
||||
final currentToken = _storageService!.getPlexToken();
|
||||
if (currentToken == null) {
|
||||
appLogger.w(
|
||||
'refreshProfileSettings: No Plex token available, cannot fetch profile',
|
||||
);
|
||||
appLogger.w('refreshProfileSettings: No Plex token available, cannot fetch profile');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -171,9 +152,7 @@ class UserProfileProvider extends ChangeNotifier {
|
||||
|
||||
// Auto-initialize services if not ready
|
||||
if (_authService == null || _storageService == null) {
|
||||
appLogger.d(
|
||||
'loadHomeUsers: Services not initialized, initializing services...',
|
||||
);
|
||||
appLogger.d('loadHomeUsers: Services not initialized, initializing services...');
|
||||
_authService = await PlexAuthService.create();
|
||||
_storageService = await StorageService.getInstance();
|
||||
await _loadCachedData();
|
||||
@@ -188,9 +167,7 @@ class UserProfileProvider extends ChangeNotifier {
|
||||
|
||||
// Use cached data if available and not forcing refresh
|
||||
if (!forceRefresh && _home != null) {
|
||||
appLogger.d(
|
||||
'loadHomeUsers: Using cached data, users count: ${_home!.users.length}',
|
||||
);
|
||||
appLogger.d('loadHomeUsers: Using cached data, users count: ${_home!.users.length}');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -208,12 +185,8 @@ class UserProfileProvider extends ChangeNotifier {
|
||||
final home = await _authService!.getHomeUsers(currentToken);
|
||||
_home = home;
|
||||
|
||||
appLogger.i(
|
||||
'loadHomeUsers: Success! Home users count: ${home.users.length}',
|
||||
);
|
||||
appLogger.d(
|
||||
'loadHomeUsers: Users: ${home.users.map((u) => u.displayName).join(', ')}',
|
||||
);
|
||||
appLogger.i('loadHomeUsers: Success! Home users count: ${home.users.length}');
|
||||
appLogger.d('loadHomeUsers: Users: ${home.users.map((u) => u.displayName).join(', ')}');
|
||||
|
||||
// Cache the home data
|
||||
await _storageService!.saveHomeUsersCache(home.toJson());
|
||||
@@ -223,17 +196,13 @@ class UserProfileProvider extends ChangeNotifier {
|
||||
final currentUserUUID = _storageService!.getCurrentUserUUID();
|
||||
if (currentUserUUID != null) {
|
||||
_currentUser = home.getUserByUUID(currentUserUUID);
|
||||
appLogger.d(
|
||||
'loadHomeUsers: Set current user from UUID: ${_currentUser?.displayName}',
|
||||
);
|
||||
appLogger.d('loadHomeUsers: Set current user from UUID: ${_currentUser?.displayName}');
|
||||
} else {
|
||||
// Default to admin user if no current user set
|
||||
_currentUser = home.adminUser;
|
||||
if (_currentUser != null) {
|
||||
await _storageService!.saveCurrentUserUUID(_currentUser!.uuid);
|
||||
appLogger.d(
|
||||
'loadHomeUsers: Set current user to admin: ${_currentUser?.displayName}',
|
||||
);
|
||||
appLogger.d('loadHomeUsers: Set current user to admin: ${_currentUser?.displayName}');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -289,11 +258,7 @@ class UserProfileProvider extends ChangeNotifier {
|
||||
// Check if user requires PIN
|
||||
String? pin;
|
||||
if (user.requiresPassword && context != null && context.mounted) {
|
||||
pin = await showPinEntryDialog(
|
||||
context,
|
||||
user.displayName,
|
||||
errorMessage: errorMessage,
|
||||
);
|
||||
pin = await showPinEntryDialog(context, user.displayName, errorMessage: errorMessage);
|
||||
|
||||
// User cancelled the PIN dialog
|
||||
if (pin == null) {
|
||||
@@ -302,19 +267,13 @@ class UserProfileProvider extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
final switchResponse = await _authService!.switchToUser(
|
||||
user.uuid,
|
||||
currentToken,
|
||||
pin: pin,
|
||||
);
|
||||
final switchResponse = await _authService!.switchToUser(user.uuid, currentToken, pin: pin);
|
||||
|
||||
// switchResponse.authToken is the new user's Plex.tv token
|
||||
// Fetch servers with this token to get the proper server access tokens
|
||||
appLogger.d('Got new user Plex.tv token, fetching servers...');
|
||||
|
||||
final servers = await _authService!.fetchServers(
|
||||
switchResponse.authToken,
|
||||
);
|
||||
final servers = await _authService!.fetchServers(switchResponse.authToken);
|
||||
if (servers.isEmpty) {
|
||||
throw Exception('No servers available for this user');
|
||||
}
|
||||
@@ -335,10 +294,8 @@ class UserProfileProvider extends ChangeNotifier {
|
||||
appLogger.d(
|
||||
'Updated profile settings for user: ${user.displayName}',
|
||||
error: {
|
||||
'defaultAudioLanguage':
|
||||
_profileSettings?.defaultAudioLanguage ?? 'not set',
|
||||
'defaultSubtitleLanguage':
|
||||
_profileSettings?.defaultSubtitleLanguage ?? 'not set',
|
||||
'defaultAudioLanguage': _profileSettings?.defaultAudioLanguage ?? 'not set',
|
||||
'defaultSubtitleLanguage': _profileSettings?.defaultSubtitleLanguage ?? 'not set',
|
||||
},
|
||||
);
|
||||
|
||||
@@ -348,9 +305,7 @@ class UserProfileProvider extends ChangeNotifier {
|
||||
// The callback will handle server reconnection using the servers list
|
||||
await _invalidateAllData(servers);
|
||||
|
||||
appLogger.d(
|
||||
'Profile switch complete, all servers reconnected with new tokens',
|
||||
);
|
||||
appLogger.d('Profile switch complete, all servers reconnected with new tokens');
|
||||
|
||||
appLogger.i('Successfully switched to user: ${user.displayName}');
|
||||
return true;
|
||||
@@ -462,9 +417,7 @@ class UserProfileProvider extends ChangeNotifier {
|
||||
await _loadCachedData();
|
||||
|
||||
// Load from API since we cleared the cache
|
||||
appLogger.d(
|
||||
'UserProfileProvider: Loading fresh home users for new server',
|
||||
);
|
||||
appLogger.d('UserProfileProvider: Loading fresh home users for new server');
|
||||
|
||||
// Store context reference before async operations to avoid build context warnings
|
||||
final contextForSwitch = context;
|
||||
@@ -485,42 +438,27 @@ class UserProfileProvider extends ChangeNotifier {
|
||||
final success = await switchToUser(userToSwitchTo, contextForSwitch);
|
||||
|
||||
if (success) {
|
||||
appLogger.d(
|
||||
'UserProfileProvider: Successfully switched to admin user for new server',
|
||||
);
|
||||
appLogger.d('UserProfileProvider: Successfully switched to admin user for new server');
|
||||
} else {
|
||||
appLogger.w(
|
||||
'UserProfileProvider: Failed to complete profile switch for new server',
|
||||
);
|
||||
appLogger.w('UserProfileProvider: Failed to complete profile switch for new server');
|
||||
}
|
||||
} else if (_currentUser != null && contextForSwitch == null) {
|
||||
appLogger.w(
|
||||
'UserProfileProvider: Cannot perform complete profile switch - no context provided',
|
||||
);
|
||||
appLogger.w('UserProfileProvider: Cannot perform complete profile switch - no context provided');
|
||||
// Still try to fetch profile settings even without full switch
|
||||
try {
|
||||
await refreshProfileSettings();
|
||||
} catch (e) {
|
||||
appLogger.w(
|
||||
'UserProfileProvider: Failed to refresh profile settings for new server',
|
||||
error: e,
|
||||
);
|
||||
appLogger.w('UserProfileProvider: Failed to refresh profile settings for new server', error: e);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
appLogger.w(
|
||||
'UserProfileProvider: Failed to load home users for new server',
|
||||
error: e,
|
||||
);
|
||||
appLogger.w('UserProfileProvider: Failed to load home users for new server', error: e);
|
||||
// Don't set error as it's not critical
|
||||
}
|
||||
|
||||
appLogger.d('UserProfileProvider: Refresh for new server complete');
|
||||
} catch (e) {
|
||||
appLogger.e(
|
||||
'UserProfileProvider: Failed to refresh for new server',
|
||||
error: e,
|
||||
);
|
||||
appLogger.e('UserProfileProvider: Failed to refresh for new server', error: e);
|
||||
_setError('Failed to refresh for new server');
|
||||
} finally {
|
||||
_setLoading(false);
|
||||
|
||||
@@ -10,6 +10,7 @@ import '../services/server_registry.dart';
|
||||
import '../providers/multi_server_provider.dart';
|
||||
import '../providers/plex_client_provider.dart';
|
||||
import '../i18n/strings.g.dart';
|
||||
import '../theme/mono_tokens.dart';
|
||||
import '../utils/app_logger.dart';
|
||||
import 'main_screen.dart';
|
||||
|
||||
@@ -60,27 +61,19 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
await storage.clearCredentials();
|
||||
setState(() {
|
||||
_isAuthenticating = false;
|
||||
_errorMessage = t.serverSelection.noServersFoundForAccount(
|
||||
username: username,
|
||||
email: email,
|
||||
);
|
||||
_errorMessage = t.serverSelection.noServersFoundForAccount(username: username, email: email);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Save all servers to registry and enable them
|
||||
// Save all servers to registry (all servers are considered enabled)
|
||||
final registry = ServerRegistry(storage);
|
||||
await registry.saveServers(servers);
|
||||
|
||||
// Enable all servers
|
||||
final serverIds = servers.map((s) => s.clientIdentifier).toSet();
|
||||
await registry.saveEnabledServerIds(serverIds);
|
||||
|
||||
// Connect to all servers
|
||||
if (!mounted) return;
|
||||
final multiServerProvider = context.read<MultiServerProvider>();
|
||||
final connectedCount = await multiServerProvider.serverManager
|
||||
.connectToAllServers(servers);
|
||||
final connectedCount = await multiServerProvider.serverManager.connectToAllServers(servers);
|
||||
|
||||
if (connectedCount == 0) {
|
||||
setState(() {
|
||||
@@ -92,8 +85,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
|
||||
// Get the first connected client for backward compatibility
|
||||
if (!mounted) return;
|
||||
final firstClient =
|
||||
multiServerProvider.serverManager.onlineClients.values.first;
|
||||
final firstClient = multiServerProvider.serverManager.onlineClients.values.first;
|
||||
|
||||
// Set it as the legacy client
|
||||
final plexClientProvider = context.read<PlexClientProvider>();
|
||||
@@ -101,12 +93,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
|
||||
// Navigate to main screen
|
||||
if (!mounted) return;
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => MainScreen(client: firstClient),
|
||||
),
|
||||
);
|
||||
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => MainScreen(client: firstClient)));
|
||||
} catch (e) {
|
||||
appLogger.e('Failed to connect to servers', error: e);
|
||||
setState(() {
|
||||
@@ -152,10 +139,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
}
|
||||
|
||||
// Poll for authentication with cancellation support
|
||||
final token = await _authService.pollPinUntilClaimed(
|
||||
pinId,
|
||||
shouldCancel: () => _shouldCancelPolling,
|
||||
);
|
||||
final token = await _authService.pollPinUntilClaimed(pinId, shouldCancel: () => _shouldCancelPolling);
|
||||
|
||||
// If polling was cancelled, don't show error
|
||||
if (_shouldCancelPolling) {
|
||||
@@ -244,10 +228,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text(t.auth.cancel),
|
||||
),
|
||||
TextButton(onPressed: () => Navigator.of(context).pop(), child: Text(t.auth.cancel)),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
final token = tokenController.text.trim();
|
||||
@@ -314,16 +295,11 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/plezy.png',
|
||||
width: 120,
|
||||
height: 120,
|
||||
),
|
||||
Image.asset('assets/plezy.png', width: 120, height: 120),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
t.app.title,
|
||||
style: Theme.of(context).textTheme.headlineMedium
|
||||
?.copyWith(fontWeight: FontWeight.bold),
|
||||
style: Theme.of(context).textTheme.headlineMedium?.copyWith(fontWeight: FontWeight.bold),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
@@ -345,11 +321,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
// Initial state buttons
|
||||
ElevatedButton(
|
||||
onPressed: _startAuthentication,
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 16,
|
||||
),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(padding: const EdgeInsets.symmetric(vertical: 16)),
|
||||
child: Text(t.auth.signInWithPlex),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
@@ -360,11 +332,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
});
|
||||
_startAuthentication();
|
||||
},
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 16,
|
||||
),
|
||||
),
|
||||
style: OutlinedButton.styleFrom(padding: const EdgeInsets.symmetric(vertical: 16)),
|
||||
child: Text(t.auth.showQRCode),
|
||||
),
|
||||
if (kDebugMode) ...[
|
||||
@@ -372,27 +340,17 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
OutlinedButton(
|
||||
onPressed: _handleDebugTap,
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 12,
|
||||
),
|
||||
side: BorderSide(
|
||||
color: Theme.of(context).colorScheme.outline
|
||||
.withValues(alpha: 0.5),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
t.auth.debugEnterToken,
|
||||
style: TextStyle(fontSize: 12),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
side: BorderSide(color: Theme.of(context).colorScheme.outline.withValues(alpha: 0.5)),
|
||||
),
|
||||
child: Text(t.auth.debugEnterToken, style: TextStyle(fontSize: 12)),
|
||||
),
|
||||
],
|
||||
if (_errorMessage != null) ...[
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
_errorMessage!,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
@@ -410,8 +368,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
t.app.title,
|
||||
style: Theme.of(context).textTheme.headlineMedium
|
||||
?.copyWith(fontWeight: FontWeight.bold),
|
||||
style: Theme.of(context).textTheme.headlineMedium?.copyWith(fontWeight: FontWeight.bold),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 48),
|
||||
@@ -424,9 +381,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
// add QR button here
|
||||
ElevatedButton(
|
||||
onPressed: _startAuthentication,
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(padding: const EdgeInsets.symmetric(vertical: 16)),
|
||||
child: Text(t.auth.signInWithPlex),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
@@ -437,9 +392,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
});
|
||||
_startAuthentication();
|
||||
},
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
),
|
||||
style: OutlinedButton.styleFrom(padding: const EdgeInsets.symmetric(vertical: 16)),
|
||||
child: Text(t.auth.showQRCode),
|
||||
),
|
||||
if (kDebugMode) ...[
|
||||
@@ -448,25 +401,16 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
onPressed: _handleDebugTap,
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
side: BorderSide(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.outline.withValues(alpha: 0.5),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
t.auth.debugEnterToken,
|
||||
style: TextStyle(fontSize: 12),
|
||||
side: BorderSide(color: Theme.of(context).colorScheme.outline.withValues(alpha: 0.5)),
|
||||
),
|
||||
child: Text(t.auth.debugEnterToken, style: TextStyle(fontSize: 12)),
|
||||
),
|
||||
],
|
||||
if (_errorMessage != null) ...[
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
_errorMessage!,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
@@ -485,9 +429,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
const SizedBox(height: 24),
|
||||
OutlinedButton(
|
||||
onPressed: _retryAuthentication,
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 24),
|
||||
),
|
||||
style: OutlinedButton.styleFrom(padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 24)),
|
||||
child: Text(t.auth.retry),
|
||||
),
|
||||
],
|
||||
@@ -507,7 +449,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
const SizedBox(height: 24),
|
||||
Center(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(tokens(context).radiusMd),
|
||||
child: QrImageView(
|
||||
data: _qrAuthUrl!,
|
||||
size: qrSize,
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plezy/widgets/app_icon.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../services/plex_client.dart';
|
||||
import '../models/plex_metadata.dart';
|
||||
import '../providers/multi_server_provider.dart';
|
||||
import '../utils/provider_extensions.dart';
|
||||
import '../utils/collection_playlist_play_helper.dart';
|
||||
import '../services/play_queue_launcher.dart';
|
||||
import '../models/plex_playlist.dart';
|
||||
import '../utils/app_logger.dart';
|
||||
import '../mixins/refreshable.dart';
|
||||
import '../mixins/item_updatable.dart';
|
||||
import '../i18n/strings.g.dart';
|
||||
import 'libraries/state_messages.dart';
|
||||
|
||||
/// Abstract base class for screens displaying media lists (collections/playlists)
|
||||
/// Provides common state management and playback functionality
|
||||
abstract class BaseMediaListDetailScreen<T extends StatefulWidget>
|
||||
extends State<T>
|
||||
with Refreshable, ItemUpdatable {
|
||||
abstract class BaseMediaListDetailScreen<T extends StatefulWidget> extends State<T> with Refreshable, ItemUpdatable {
|
||||
// State properties - concrete implementations to avoid duplication
|
||||
List<PlexMetadata> items = [];
|
||||
bool isLoading = false;
|
||||
@@ -55,10 +57,7 @@ abstract class BaseMediaListDetailScreen<T extends StatefulWidget>
|
||||
|
||||
// If serverId is null, fall back to first available server
|
||||
if (serverId == null) {
|
||||
final multiServerProvider = Provider.of<MultiServerProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
final multiServerProvider = Provider.of<MultiServerProvider>(context, listen: false);
|
||||
if (!multiServerProvider.hasConnectedServers) {
|
||||
throw Exception(t.errors.noClientAvailable);
|
||||
}
|
||||
@@ -87,21 +86,22 @@ abstract class BaseMediaListDetailScreen<T extends StatefulWidget>
|
||||
Future<void> _playWithShuffle(bool shuffle) async {
|
||||
if (items.isEmpty) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(emptyMessage)));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(emptyMessage)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final client = _getClientForMediaItem();
|
||||
final item = mediaItem;
|
||||
|
||||
await playCollectionOrPlaylist(
|
||||
final launcher = PlayQueueLauncher(
|
||||
context: context,
|
||||
client: client,
|
||||
item: mediaItem,
|
||||
shuffle: shuffle,
|
||||
serverId: item is PlexMetadata ? item.serverId : (item as PlexPlaylist).serverId,
|
||||
serverName: item is PlexMetadata ? item.serverName : (item as PlexPlaylist).serverName,
|
||||
);
|
||||
|
||||
await launcher.launchFromCollectionOrPlaylist(item: item, shuffle: shuffle, showLoadingIndicator: false);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -127,55 +127,19 @@ abstract class BaseMediaListDetailScreen<T extends StatefulWidget>
|
||||
if (errorMessage != null) {
|
||||
return [
|
||||
SliverFillRemaining(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.error_outline, size: 48, color: Colors.red),
|
||||
const SizedBox(height: 16),
|
||||
Text(errorMessage!),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: loadItems,
|
||||
child: Text(t.common.retry),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: ErrorStateWidget(message: errorMessage!, icon: Symbols.error_outline_rounded, onRetry: loadItems),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
if (items.isEmpty && isLoading) {
|
||||
return [
|
||||
const SliverFillRemaining(
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
];
|
||||
return [const SliverFillRemaining(child: Center(child: CircularProgressIndicator()))];
|
||||
}
|
||||
|
||||
if (items.isEmpty) {
|
||||
final icon = emptyIcon;
|
||||
return [
|
||||
SliverFillRemaining(
|
||||
child: Center(
|
||||
child: icon != null
|
||||
? Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(icon, size: 64, color: Colors.grey),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
emptyMessage,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Text(emptyMessage),
|
||||
),
|
||||
child: EmptyStateWidget(message: emptyMessage, icon: emptyIcon),
|
||||
),
|
||||
];
|
||||
}
|
||||
@@ -195,21 +159,21 @@ abstract class BaseMediaListDetailScreen<T extends StatefulWidget>
|
||||
// Play button
|
||||
if (items.isNotEmpty)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.play_arrow),
|
||||
icon: const AppIcon(Symbols.play_arrow_rounded, fill: 1),
|
||||
tooltip: t.discover.play,
|
||||
onPressed: playItems,
|
||||
),
|
||||
// Shuffle button
|
||||
if (items.isNotEmpty)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.shuffle),
|
||||
icon: const AppIcon(Symbols.shuffle_rounded, fill: 1),
|
||||
tooltip: t.common.shuffle,
|
||||
onPressed: shufflePlayItems,
|
||||
),
|
||||
// Delete button
|
||||
if (showDelete && onDelete != null)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.delete),
|
||||
icon: const AppIcon(Symbols.delete_rounded, fill: 1),
|
||||
tooltip: deleteTooltip ?? t.common.delete,
|
||||
onPressed: onDelete,
|
||||
color: deleteColor ?? Colors.red,
|
||||
@@ -220,8 +184,7 @@ abstract class BaseMediaListDetailScreen<T extends StatefulWidget>
|
||||
|
||||
/// Mixin that provides standard loadItems implementation for media lists
|
||||
/// Handles the common pattern of fetching, tagging, and setting items
|
||||
mixin StandardItemLoader<T extends StatefulWidget>
|
||||
on BaseMediaListDetailScreen<T> {
|
||||
mixin StandardItemLoader<T extends StatefulWidget> on BaseMediaListDetailScreen<T> {
|
||||
/// Fetch items from the API (must be implemented by subclass)
|
||||
Future<List<PlexMetadata>> fetchItems();
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import '../widgets/focused_scroll_scaffold.dart';
|
||||
import '../i18n/strings.g.dart';
|
||||
import '../utils/dialogs.dart';
|
||||
import '../utils/app_logger.dart';
|
||||
import '../utils/snackbar_helper.dart';
|
||||
import 'base_media_list_detail_screen.dart';
|
||||
|
||||
/// Screen to display the contents of a collection
|
||||
@@ -17,8 +18,7 @@ class CollectionDetailScreen extends StatefulWidget {
|
||||
State<CollectionDetailScreen> createState() => _CollectionDetailScreenState();
|
||||
}
|
||||
|
||||
class _CollectionDetailScreenState
|
||||
extends BaseMediaListDetailScreen<CollectionDetailScreen>
|
||||
class _CollectionDetailScreenState extends BaseMediaListDetailScreen<CollectionDetailScreen>
|
||||
with StandardItemLoader<CollectionDetailScreen> {
|
||||
@override
|
||||
PlexMetadata get mediaItem => widget.collection;
|
||||
@@ -55,9 +55,7 @@ class _CollectionDetailScreenState
|
||||
|
||||
if (sectionId == null) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(t.collections.unknownLibrarySection)),
|
||||
);
|
||||
showErrorSnackBar(context, t.collections.unknownLibrarySection);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -73,38 +71,22 @@ class _CollectionDetailScreenState
|
||||
if (!mounted) return;
|
||||
|
||||
try {
|
||||
final success = await client.deleteCollection(
|
||||
sectionId.toString(),
|
||||
widget.collection.ratingKey,
|
||||
);
|
||||
final success = await client.deleteCollection(sectionId.toString(), widget.collection.ratingKey);
|
||||
|
||||
if (!mounted) return;
|
||||
|
||||
if (mounted) {
|
||||
if (success) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(t.collections.deleted)));
|
||||
Navigator.pop(
|
||||
context,
|
||||
true,
|
||||
); // Return true to indicate refresh needed
|
||||
showSuccessSnackBar(context, t.collections.deleted);
|
||||
Navigator.pop(context, true); // Return true to indicate refresh needed
|
||||
} else {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(t.collections.deleteFailed)));
|
||||
showErrorSnackBar(context, t.collections.deleteFailed);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
appLogger.e('Failed to delete collection', error: e);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
t.collections.deleteFailedWithError(error: e.toString()),
|
||||
),
|
||||
),
|
||||
);
|
||||
showErrorSnackBar(context, t.collections.deleteFailedWithError(error: e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+290
-434
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,332 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../models/plex_metadata.dart';
|
||||
import '../../providers/download_provider.dart';
|
||||
import '../../providers/multi_server_provider.dart';
|
||||
import '../../providers/settings_provider.dart';
|
||||
import '../../services/gamepad_service.dart';
|
||||
import '../../utils/platform_detector.dart';
|
||||
import '../../widgets/desktop_app_bar.dart';
|
||||
import '../../widgets/focusable_tab_chip.dart';
|
||||
import '../../widgets/focusable_media_card.dart';
|
||||
import '../../widgets/media_grid_delegate.dart';
|
||||
import '../../widgets/download_tree_view.dart';
|
||||
import '../main_screen.dart';
|
||||
import '../libraries/state_messages.dart';
|
||||
import '../../i18n/strings.g.dart';
|
||||
|
||||
class DownloadsScreen extends StatefulWidget {
|
||||
const DownloadsScreen({super.key});
|
||||
|
||||
@override
|
||||
State<DownloadsScreen> createState() => DownloadsScreenState();
|
||||
}
|
||||
|
||||
class DownloadsScreenState extends State<DownloadsScreen> with SingleTickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
|
||||
// Focus nodes for tab chips
|
||||
final _queueTabChipFocusNode = FocusNode(debugLabel: 'tab_chip_queue');
|
||||
final _tvShowsTabChipFocusNode = FocusNode(debugLabel: 'tab_chip_tv_shows');
|
||||
final _moviesTabChipFocusNode = FocusNode(debugLabel: 'tab_chip_movies');
|
||||
|
||||
/// When true, suppress auto-focus in tabs (used when navigating via tab bar)
|
||||
bool _suppressAutoFocus = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tabController = TabController(length: 3, vsync: this);
|
||||
_tabController.addListener(_onTabChanged);
|
||||
|
||||
// Register L1/R1 callbacks for tab navigation
|
||||
GamepadService.onL1Pressed = _goToPreviousTab;
|
||||
GamepadService.onR1Pressed = _goToNextTab;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_tabController.removeListener(_onTabChanged);
|
||||
_tabController.dispose();
|
||||
_queueTabChipFocusNode.dispose();
|
||||
_tvShowsTabChipFocusNode.dispose();
|
||||
_moviesTabChipFocusNode.dispose();
|
||||
// Clear L1/R1 callbacks
|
||||
GamepadService.onL1Pressed = null;
|
||||
GamepadService.onR1Pressed = null;
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _goToPreviousTab() {
|
||||
if (_tabController.index > 0) {
|
||||
setState(() {
|
||||
_suppressAutoFocus = true;
|
||||
_tabController.index = _tabController.index - 1;
|
||||
});
|
||||
_getTabChipFocusNode(_tabController.index).requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void _goToNextTab() {
|
||||
if (_tabController.index < _tabController.length - 1) {
|
||||
setState(() {
|
||||
_suppressAutoFocus = true;
|
||||
_tabController.index = _tabController.index + 1;
|
||||
});
|
||||
_getTabChipFocusNode(_tabController.index).requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void _onTabChanged() {
|
||||
if (!_tabController.indexIsChanging) {
|
||||
// Rebuild to update chip selection state
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the focus node for a tab chip by index
|
||||
FocusNode _getTabChipFocusNode(int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return _queueTabChipFocusNode;
|
||||
case 1:
|
||||
return _tvShowsTabChipFocusNode;
|
||||
case 2:
|
||||
return _moviesTabChipFocusNode;
|
||||
default:
|
||||
return _queueTabChipFocusNode;
|
||||
}
|
||||
}
|
||||
|
||||
/// Focus the currently selected tab chip in the tab bar.
|
||||
/// Called when BACK is pressed in tab content.
|
||||
void focusTabBar() {
|
||||
setState(() {
|
||||
_suppressAutoFocus = true;
|
||||
});
|
||||
final focusNode = _getTabChipFocusNode(_tabController.index);
|
||||
focusNode.requestFocus();
|
||||
}
|
||||
|
||||
/// Handle BACK from tab bar - navigate to sidenav
|
||||
void _onTabBarBack() {
|
||||
final focusScope = MainScreenFocusScope.of(context);
|
||||
focusScope?.focusSidebar();
|
||||
}
|
||||
|
||||
/// Focus the first item in the currently active tab
|
||||
void _focusCurrentTab() {
|
||||
// Re-enable auto-focus since user is navigating into tab content
|
||||
setState(() {
|
||||
_suppressAutoFocus = false;
|
||||
});
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (!mounted) return;
|
||||
// Focus will be handled by the tab content
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildTabChip(String label, int index) {
|
||||
final isSelected = _tabController.index == index;
|
||||
const tabCount = 3; // Queue, TV Shows, Movies
|
||||
|
||||
return FocusableTabChip(
|
||||
label: label,
|
||||
isSelected: isSelected,
|
||||
focusNode: _getTabChipFocusNode(index),
|
||||
onSelect: () {
|
||||
if (isSelected) {
|
||||
// Already selected - navigate to tab content
|
||||
_focusCurrentTab();
|
||||
} else {
|
||||
// Switch to this tab
|
||||
setState(() {
|
||||
_tabController.index = index;
|
||||
});
|
||||
}
|
||||
},
|
||||
onNavigateLeft: index > 0
|
||||
? () {
|
||||
final newIndex = index - 1;
|
||||
setState(() {
|
||||
_suppressAutoFocus = true;
|
||||
_tabController.index = newIndex;
|
||||
});
|
||||
_getTabChipFocusNode(newIndex).requestFocus();
|
||||
}
|
||||
: null,
|
||||
onNavigateRight: index < tabCount - 1
|
||||
? () {
|
||||
final newIndex = index + 1;
|
||||
setState(() {
|
||||
_suppressAutoFocus = true;
|
||||
_tabController.index = newIndex;
|
||||
});
|
||||
_getTabChipFocusNode(newIndex).requestFocus();
|
||||
}
|
||||
: null,
|
||||
onNavigateDown: _focusCurrentTab,
|
||||
onBack: _onTabBarBack,
|
||||
);
|
||||
}
|
||||
|
||||
/// Build the app bar title - either tabs on desktop or simple title on mobile
|
||||
Widget _buildAppBarTitle() {
|
||||
// On desktop/TV with side nav, show tabs in app bar
|
||||
if (PlatformDetector.shouldUseSideNavigation(context)) {
|
||||
return Row(
|
||||
children: [
|
||||
_buildTabChip(t.downloads.manage, 0),
|
||||
const SizedBox(width: 8),
|
||||
_buildTabChip(t.downloads.tvShows, 1),
|
||||
const SizedBox(width: 8),
|
||||
_buildTabChip(t.downloads.movies, 2),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// On mobile, show simple title
|
||||
return Text(t.downloads.title);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
DesktopSliverAppBar(
|
||||
title: _buildAppBarTitle(),
|
||||
floating: true,
|
||||
pinned: true,
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
shadowColor: Colors.transparent,
|
||||
scrolledUnderElevation: 0,
|
||||
),
|
||||
SliverFillRemaining(
|
||||
child: Column(
|
||||
children: [
|
||||
// Tab selector chips (only on mobile - desktop has them in app bar)
|
||||
if (!PlatformDetector.shouldUseSideNavigation(context))
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: [
|
||||
_buildTabChip(t.downloads.manage, 0),
|
||||
const SizedBox(width: 8),
|
||||
_buildTabChip(t.downloads.tvShows, 1),
|
||||
const SizedBox(width: 8),
|
||||
_buildTabChip(t.downloads.movies, 2),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// Tab content
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: [
|
||||
Consumer2<DownloadProvider, MultiServerProvider>(
|
||||
builder: (context, downloadProvider, serverProvider, _) {
|
||||
// Helper to get client from globalKey (serverId:ratingKey)
|
||||
getClient(String globalKey) {
|
||||
final serverId = globalKey.split(':').first;
|
||||
return serverProvider.serverManager.getClient(serverId);
|
||||
}
|
||||
|
||||
return DownloadTreeView(
|
||||
downloads: downloadProvider.downloads,
|
||||
metadata: downloadProvider.metadata,
|
||||
onPause: downloadProvider.pauseDownload,
|
||||
onResume: (globalKey) {
|
||||
final client = getClient(globalKey);
|
||||
if (client != null) {
|
||||
downloadProvider.resumeDownload(globalKey, client);
|
||||
}
|
||||
},
|
||||
onRetry: (globalKey) {
|
||||
final client = getClient(globalKey);
|
||||
if (client != null) {
|
||||
downloadProvider.retryDownload(globalKey, client);
|
||||
}
|
||||
},
|
||||
onCancel: downloadProvider.cancelDownload,
|
||||
onDelete: downloadProvider.deleteDownload,
|
||||
);
|
||||
},
|
||||
),
|
||||
_DownloadsGridContent(
|
||||
type: DownloadType.tvShows,
|
||||
suppressAutoFocus: _suppressAutoFocus,
|
||||
onBack: focusTabBar,
|
||||
),
|
||||
_DownloadsGridContent(
|
||||
type: DownloadType.movies,
|
||||
suppressAutoFocus: _suppressAutoFocus,
|
||||
onBack: focusTabBar,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
enum DownloadType { manage, tvShows, movies }
|
||||
|
||||
/// Grid content for TV Shows and Movies tabs
|
||||
class _DownloadsGridContent extends StatelessWidget {
|
||||
final DownloadType type;
|
||||
final bool suppressAutoFocus;
|
||||
final VoidCallback? onBack;
|
||||
|
||||
const _DownloadsGridContent({required this.type, required this.suppressAutoFocus, this.onBack});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer2<DownloadProvider, SettingsProvider>(
|
||||
builder: (context, downloadProvider, settingsProvider, _) {
|
||||
final List<PlexMetadata> items = type == DownloadType.tvShows
|
||||
? downloadProvider.downloadedShows
|
||||
: downloadProvider.downloadedMovies;
|
||||
|
||||
if (items.isEmpty) {
|
||||
return _buildEmptyState(context);
|
||||
}
|
||||
|
||||
return GridView.builder(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
gridDelegate: MediaGridDelegate.createDelegate(context: context, density: settingsProvider.libraryDensity),
|
||||
itemCount: items.length,
|
||||
itemBuilder: (context, index) {
|
||||
final item = items[index];
|
||||
return FocusableMediaCard(
|
||||
item: item,
|
||||
onBack: onBack,
|
||||
isOffline: true, // Downloaded content works without server
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEmptyState(BuildContext context) {
|
||||
return EmptyStateWidget(
|
||||
message: t.downloads.noDownloads,
|
||||
subtitle: t.downloads.noDownloadsDescription,
|
||||
icon: Symbols.download_rounded,
|
||||
iconSize: 80,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plezy/widgets/app_icon.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import '../../services/plex_client.dart';
|
||||
import '../models/plex_hub.dart';
|
||||
import '../models/plex_metadata.dart';
|
||||
@@ -8,6 +10,7 @@ import '../utils/app_logger.dart';
|
||||
import '../widgets/media_grid_sliver.dart';
|
||||
import '../widgets/focused_scroll_scaffold.dart';
|
||||
import 'libraries/sort_bottom_sheet.dart';
|
||||
import 'libraries/state_messages.dart';
|
||||
import '../mixins/refreshable.dart';
|
||||
import '../i18n/strings.g.dart';
|
||||
|
||||
@@ -100,29 +103,10 @@ class _HubDetailScreenState extends State<HubDetailScreen> with Refreshable {
|
||||
|
||||
List<PlexSort> _getDefaultSortOptions() {
|
||||
return [
|
||||
PlexSort(
|
||||
key: 'titleSort',
|
||||
title: t.hubDetail.title,
|
||||
defaultDirection: 'asc',
|
||||
),
|
||||
PlexSort(
|
||||
key: 'year',
|
||||
descKey: 'year:desc',
|
||||
title: t.hubDetail.releaseYear,
|
||||
defaultDirection: 'desc',
|
||||
),
|
||||
PlexSort(
|
||||
key: 'addedAt',
|
||||
descKey: 'addedAt:desc',
|
||||
title: t.hubDetail.dateAdded,
|
||||
defaultDirection: 'desc',
|
||||
),
|
||||
PlexSort(
|
||||
key: 'rating',
|
||||
descKey: 'rating:desc',
|
||||
title: t.hubDetail.rating,
|
||||
defaultDirection: 'desc',
|
||||
),
|
||||
PlexSort(key: 'titleSort', title: t.hubDetail.title, defaultDirection: 'asc'),
|
||||
PlexSort(key: 'year', descKey: 'year:desc', title: t.hubDetail.releaseYear, defaultDirection: 'desc'),
|
||||
PlexSort(key: 'addedAt', descKey: 'addedAt:desc', title: t.hubDetail.dateAdded, defaultDirection: 'desc'),
|
||||
PlexSort(key: 'rating', descKey: 'rating:desc', title: t.hubDetail.rating, defaultDirection: 'desc'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -243,37 +227,23 @@ class _HubDetailScreenState extends State<HubDetailScreen> with Refreshable {
|
||||
title: Text(widget.hub.title),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.swap_vert, semanticLabel: t.libraries.sort),
|
||||
icon: AppIcon(Symbols.swap_vert_rounded, fill: 1, semanticLabel: t.libraries.sort),
|
||||
onPressed: _showSortBottomSheet,
|
||||
),
|
||||
],
|
||||
slivers: [
|
||||
if (_errorMessage != null)
|
||||
SliverFillRemaining(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.error_outline, size: 48, color: Colors.red),
|
||||
const SizedBox(height: 16),
|
||||
Text(_errorMessage!),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: _loadMoreItems,
|
||||
child: Text(t.common.retry),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: ErrorStateWidget(
|
||||
message: _errorMessage!,
|
||||
icon: Symbols.error_outline_rounded,
|
||||
onRetry: _loadMoreItems,
|
||||
),
|
||||
)
|
||||
else if (_filteredItems.isEmpty && _isLoading)
|
||||
const SliverFillRemaining(
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
)
|
||||
const SliverFillRemaining(child: Center(child: CircularProgressIndicator()))
|
||||
else if (_filteredItems.isEmpty)
|
||||
SliverFillRemaining(
|
||||
child: Center(child: Text(t.hubDetail.noItemsFound)),
|
||||
)
|
||||
SliverFillRemaining(child: Center(child: Text(t.hubDetail.noItemsFound)))
|
||||
else
|
||||
MediaGridSliver(
|
||||
items: _filteredItems,
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:provider/provider.dart';
|
||||
import '../../providers/settings_provider.dart';
|
||||
import '../../services/settings_service.dart' show ViewMode, LibraryDensity;
|
||||
import '../../utils/grid_size_calculator.dart';
|
||||
import '../../utils/layout_constants.dart';
|
||||
|
||||
/// A widget that automatically switches between grid and list view
|
||||
/// based on user settings, providing a consistent layout pattern
|
||||
@@ -20,10 +21,10 @@ class AdaptiveMediaGrid<T> extends StatelessWidget {
|
||||
final VoidCallback? onRefresh;
|
||||
|
||||
/// Optional padding around the grid/list
|
||||
final EdgeInsets padding;
|
||||
final EdgeInsets? padding;
|
||||
|
||||
/// Child aspect ratio for grid items (width / height)
|
||||
final double childAspectRatio;
|
||||
final double? childAspectRatio;
|
||||
|
||||
/// Optional focus node for the first item (for programmatic focus)
|
||||
final FocusNode? firstItemFocusNode;
|
||||
@@ -36,8 +37,8 @@ class AdaptiveMediaGrid<T> extends StatelessWidget {
|
||||
required this.items,
|
||||
required this.itemBuilder,
|
||||
this.onRefresh,
|
||||
this.padding = const EdgeInsets.fromLTRB(8, 8, 8, 8),
|
||||
this.childAspectRatio = 2 / 3.3,
|
||||
this.padding,
|
||||
this.childAspectRatio,
|
||||
this.firstItemFocusNode,
|
||||
this.onBack,
|
||||
});
|
||||
@@ -46,43 +47,33 @@ class AdaptiveMediaGrid<T> extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<SettingsProvider>(
|
||||
builder: (context, settingsProvider, child) {
|
||||
return _buildItemsView(
|
||||
context,
|
||||
settingsProvider.viewMode,
|
||||
settingsProvider.libraryDensity,
|
||||
);
|
||||
return _buildItemsView(context, settingsProvider.viewMode, settingsProvider.libraryDensity);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// Builds either a list or grid view based on the view mode
|
||||
Widget _buildItemsView(
|
||||
BuildContext context,
|
||||
ViewMode viewMode,
|
||||
LibraryDensity density,
|
||||
) {
|
||||
Widget _buildItemsView(BuildContext context, ViewMode viewMode, LibraryDensity density) {
|
||||
final effectivePadding = padding ?? GridLayoutConstants.gridPadding;
|
||||
final effectiveAspectRatio = childAspectRatio ?? GridLayoutConstants.posterAspectRatio;
|
||||
|
||||
if (viewMode == ViewMode.list) {
|
||||
return ListView.builder(
|
||||
padding: padding,
|
||||
padding: effectivePadding,
|
||||
itemCount: items.length,
|
||||
itemBuilder: (context, index) =>
|
||||
itemBuilder(context, items[index], index),
|
||||
itemBuilder: (context, index) => itemBuilder(context, items[index], index),
|
||||
);
|
||||
} else {
|
||||
return GridView.builder(
|
||||
padding: padding,
|
||||
padding: effectivePadding,
|
||||
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: GridSizeCalculator.getMaxCrossAxisExtent(
|
||||
context,
|
||||
density,
|
||||
),
|
||||
childAspectRatio: childAspectRatio,
|
||||
crossAxisSpacing: 0,
|
||||
mainAxisSpacing: 0,
|
||||
maxCrossAxisExtent: GridSizeCalculator.getMaxCrossAxisExtent(context, density),
|
||||
childAspectRatio: effectiveAspectRatio,
|
||||
crossAxisSpacing: GridLayoutConstants.crossAxisSpacing,
|
||||
mainAxisSpacing: GridLayoutConstants.mainAxisSpacing,
|
||||
),
|
||||
itemCount: items.length,
|
||||
itemBuilder: (context, index) =>
|
||||
itemBuilder(context, items[index], index),
|
||||
itemBuilder: (context, index) => itemBuilder(context, items[index], index),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import '../../i18n/strings.g.dart';
|
||||
import 'empty_state_widget.dart';
|
||||
import 'error_state_widget.dart';
|
||||
import 'state_messages.dart';
|
||||
|
||||
/// A widget that handles loading, error, empty, and content states
|
||||
/// Provides a consistent UI pattern across the app for data-driven screens
|
||||
@@ -49,7 +49,7 @@ class ContentStateBuilder<T> extends StatelessWidget {
|
||||
if (errorMessage != null && items.isEmpty) {
|
||||
return ErrorStateWidget(
|
||||
message: errorMessage!,
|
||||
icon: Icons.error_outline,
|
||||
icon: Symbols.error_outline_rounded,
|
||||
onRetry: onRetry,
|
||||
retryLabel: t.common.retry,
|
||||
);
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// A menu action item for context menus
|
||||
class ContextMenuItem {
|
||||
final String value;
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final bool requiresConfirmation;
|
||||
final String? confirmationTitle;
|
||||
final String? confirmationMessage;
|
||||
final bool isDestructive;
|
||||
|
||||
const ContextMenuItem({
|
||||
required this.value,
|
||||
required this.icon,
|
||||
required this.label,
|
||||
this.requiresConfirmation = false,
|
||||
this.confirmationTitle,
|
||||
this.confirmationMessage,
|
||||
this.isDestructive = false,
|
||||
});
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'state_message_widget.dart';
|
||||
|
||||
/// A reusable widget for displaying empty states throughout the app
|
||||
class EmptyStateWidget extends StatelessWidget {
|
||||
/// The message to display
|
||||
final String message;
|
||||
|
||||
/// Optional icon to display above the message
|
||||
final IconData? icon;
|
||||
|
||||
/// Optional callback for action button
|
||||
final VoidCallback? onAction;
|
||||
|
||||
/// Optional label for the action button
|
||||
final String? actionLabel;
|
||||
|
||||
const EmptyStateWidget({
|
||||
super.key,
|
||||
required this.message,
|
||||
this.icon,
|
||||
this.onAction,
|
||||
this.actionLabel,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StateMessageWidget(
|
||||
message: message,
|
||||
icon: icon,
|
||||
onAction: onAction,
|
||||
actionLabel: actionLabel,
|
||||
actionIcon: Icons.add,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'state_message_widget.dart';
|
||||
|
||||
/// A reusable widget for displaying error states throughout the app
|
||||
class ErrorStateWidget extends StatelessWidget {
|
||||
/// The error message to display
|
||||
final String message;
|
||||
|
||||
/// Optional icon to display above the message
|
||||
final IconData? icon;
|
||||
|
||||
/// Optional callback for retry action
|
||||
final VoidCallback? onRetry;
|
||||
|
||||
/// Optional label for the retry button
|
||||
final String? retryLabel;
|
||||
|
||||
const ErrorStateWidget({
|
||||
super.key,
|
||||
required this.message,
|
||||
this.icon,
|
||||
this.onRetry,
|
||||
this.retryLabel,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StateMessageWidget(
|
||||
message: message,
|
||||
icon: icon,
|
||||
iconColor: Theme.of(context).colorScheme.error,
|
||||
textColor: Theme.of(context).colorScheme.error,
|
||||
onAction: onRetry,
|
||||
actionLabel: retryLabel ?? 'Retry',
|
||||
actionIcon: Icons.refresh,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plezy/widgets/app_icon.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import '../../models/plex_filter.dart';
|
||||
import '../../widgets/app_bar_back_button.dart';
|
||||
import '../../widgets/bottom_sheet_header.dart';
|
||||
@@ -50,12 +52,8 @@ class _FiltersBottomSheetState extends State<FiltersBottomSheet> {
|
||||
|
||||
void _sortFilters() {
|
||||
// Separate boolean filters (toggles) from regular filters
|
||||
final booleanFilters = widget.filters
|
||||
.where((f) => f.filterType == 'boolean')
|
||||
.toList();
|
||||
final regularFilters = widget.filters
|
||||
.where((f) => f.filterType != 'boolean')
|
||||
.toList();
|
||||
final booleanFilters = widget.filters.where((f) => f.filterType == 'boolean').toList();
|
||||
final regularFilters = widget.filters.where((f) => f.filterType != 'boolean').toList();
|
||||
|
||||
// Combine with boolean filters first
|
||||
_sortedFilters = [...booleanFilters, ...regularFilters];
|
||||
@@ -128,17 +126,12 @@ class _FiltersBottomSheetState extends State<FiltersBottomSheet> {
|
||||
// Header with back button
|
||||
BottomSheetHeader(
|
||||
title: _currentFilter!.title,
|
||||
leading: AppBarBackButton(
|
||||
style: BackButtonStyle.plain,
|
||||
onPressed: _goBack,
|
||||
),
|
||||
leading: AppBarBackButton(style: BackButtonStyle.plain, onPressed: _goBack),
|
||||
),
|
||||
|
||||
// Filter options list
|
||||
if (_isLoadingValues)
|
||||
const Expanded(
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
)
|
||||
const Expanded(child: Center(child: CircularProgressIndicator()))
|
||||
else
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
@@ -147,18 +140,14 @@ class _FiltersBottomSheetState extends State<FiltersBottomSheet> {
|
||||
itemCount: _filterValues.length + 1,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
final isSelected = !_tempSelectedFilters.containsKey(
|
||||
_currentFilter!.filter,
|
||||
);
|
||||
final isSelected = !_tempSelectedFilters.containsKey(_currentFilter!.filter);
|
||||
return FocusableListTile(
|
||||
focusNode: _initialFocusNode,
|
||||
title: Text(t.libraries.all),
|
||||
selected: isSelected,
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_tempSelectedFilters.remove(
|
||||
_currentFilter!.filter,
|
||||
);
|
||||
_tempSelectedFilters.remove(_currentFilter!.filter);
|
||||
});
|
||||
_applyFilters();
|
||||
},
|
||||
@@ -166,24 +155,17 @@ class _FiltersBottomSheetState extends State<FiltersBottomSheet> {
|
||||
}
|
||||
|
||||
final value = _filterValues[index - 1];
|
||||
final filterValue = _extractFilterValue(
|
||||
value.key,
|
||||
_currentFilter!.filter,
|
||||
);
|
||||
final isSelected =
|
||||
_tempSelectedFilters[_currentFilter!.filter] ==
|
||||
filterValue;
|
||||
final filterValue = _extractFilterValue(value.key, _currentFilter!.filter);
|
||||
final isSelected = _tempSelectedFilters[_currentFilter!.filter] == filterValue;
|
||||
|
||||
return FocusableListTile(
|
||||
title: Text(value.title),
|
||||
selected: isSelected,
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_tempSelectedFilters[_currentFilter!.filter] =
|
||||
filterValue;
|
||||
_tempSelectedFilters[_currentFilter!.filter] = filterValue;
|
||||
// Cache the display name for this filter value
|
||||
_filterDisplayNames['${_currentFilter!.filter}:$filterValue'] =
|
||||
value.title;
|
||||
_filterDisplayNames['${_currentFilter!.filter}:$filterValue'] = value.title;
|
||||
});
|
||||
_applyFilters();
|
||||
},
|
||||
@@ -201,7 +183,7 @@ class _FiltersBottomSheetState extends State<FiltersBottomSheet> {
|
||||
// Header
|
||||
BottomSheetHeader(
|
||||
title: t.libraries.filters,
|
||||
leading: const Icon(Icons.filter_alt),
|
||||
leading: const AppIcon(Symbols.filter_alt_rounded, fill: 1),
|
||||
action: _tempSelectedFilters.isNotEmpty
|
||||
? TextButton.icon(
|
||||
onPressed: () {
|
||||
@@ -210,7 +192,7 @@ class _FiltersBottomSheetState extends State<FiltersBottomSheet> {
|
||||
});
|
||||
_applyFilters();
|
||||
},
|
||||
icon: const Icon(Icons.clear_all),
|
||||
icon: const AppIcon(Symbols.clear_all_rounded, fill: 1),
|
||||
label: Text(t.libraries.clearAll),
|
||||
)
|
||||
: null,
|
||||
@@ -228,8 +210,7 @@ class _FiltersBottomSheetState extends State<FiltersBottomSheet> {
|
||||
// Handle boolean filters as switches (unwatched, inProgress, unmatched, hdr, etc.)
|
||||
if (_isBooleanFilter(filter)) {
|
||||
final isActive =
|
||||
_tempSelectedFilters.containsKey(filter.filter) &&
|
||||
_tempSelectedFilters[filter.filter] == '1';
|
||||
_tempSelectedFilters.containsKey(filter.filter) && _tempSelectedFilters[filter.filter] == '1';
|
||||
return FocusableSwitchListTile(
|
||||
focusNode: index == 0 ? _initialFocusNode : null,
|
||||
value: isActive,
|
||||
@@ -252,9 +233,7 @@ class _FiltersBottomSheetState extends State<FiltersBottomSheet> {
|
||||
String? displayValue;
|
||||
if (selectedValue != null) {
|
||||
// Try to get the cached display name, fall back to the value itself
|
||||
displayValue =
|
||||
_filterDisplayNames['${filter.filter}:$selectedValue'] ??
|
||||
selectedValue;
|
||||
displayValue = _filterDisplayNames['${filter.filter}:$selectedValue'] ?? selectedValue;
|
||||
}
|
||||
|
||||
return FocusableListTile(
|
||||
@@ -275,7 +254,7 @@ class _FiltersBottomSheetState extends State<FiltersBottomSheet> {
|
||||
),
|
||||
),
|
||||
if (displayValue != null) const SizedBox(width: 8),
|
||||
const Icon(Icons.chevron_right),
|
||||
const AppIcon(Symbols.chevron_right_rounded, fill: 1),
|
||||
],
|
||||
),
|
||||
onTap: () => _loadFilterValues(filter),
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plezy/widgets/app_icon.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import '../../models/plex_metadata.dart';
|
||||
|
||||
/// Individual item in the folder tree
|
||||
@@ -25,24 +27,24 @@ class FolderTreeItem extends StatelessWidget {
|
||||
|
||||
IconData _getIcon() {
|
||||
if (isFolder) {
|
||||
return Icons.folder;
|
||||
return Symbols.folder_rounded;
|
||||
}
|
||||
|
||||
// File icons based on type
|
||||
final type = item.type.toLowerCase();
|
||||
switch (type) {
|
||||
case 'movie':
|
||||
return Icons.movie;
|
||||
return Symbols.movie_rounded;
|
||||
case 'show':
|
||||
return Icons.tv;
|
||||
return Symbols.tv_rounded;
|
||||
case 'season':
|
||||
return Icons.video_library;
|
||||
return Symbols.video_library_rounded;
|
||||
case 'episode':
|
||||
return Icons.play_circle_outline;
|
||||
return Symbols.play_circle_rounded;
|
||||
case 'collection':
|
||||
return Icons.collections;
|
||||
return Symbols.collections_rounded;
|
||||
default:
|
||||
return Icons.insert_drive_file;
|
||||
return Symbols.insert_drive_file_rounded;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,12 +63,7 @@ class FolderTreeItem extends StatelessWidget {
|
||||
return InkWell(
|
||||
onTap: _handleTap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 16.0 + indentation,
|
||||
right: 16.0,
|
||||
top: 12.0,
|
||||
bottom: 12.0,
|
||||
),
|
||||
padding: EdgeInsets.only(left: 16.0 + indentation, right: 16.0, top: 12.0, bottom: 12.0),
|
||||
child: Row(
|
||||
children: [
|
||||
// Expand/collapse icon for folders
|
||||
@@ -74,15 +71,10 @@ class FolderTreeItem extends StatelessWidget {
|
||||
SizedBox(
|
||||
width: 24,
|
||||
child: isLoading
|
||||
? const SizedBox(
|
||||
width: 16,
|
||||
height: 16,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: Icon(
|
||||
isExpanded
|
||||
? Icons.keyboard_arrow_down
|
||||
: Icons.keyboard_arrow_right,
|
||||
? const SizedBox(width: 16, height: 16, child: CircularProgressIndicator(strokeWidth: 2))
|
||||
: AppIcon(
|
||||
isExpanded ? Symbols.keyboard_arrow_down_rounded : Symbols.keyboard_arrow_right_rounded,
|
||||
fill: 1,
|
||||
size: 20,
|
||||
),
|
||||
)
|
||||
@@ -92,14 +84,13 @@ class FolderTreeItem extends StatelessWidget {
|
||||
const SizedBox(width: 8),
|
||||
|
||||
// File/folder icon
|
||||
Icon(
|
||||
AppIcon(
|
||||
_getIcon(),
|
||||
fill: 1,
|
||||
size: 20,
|
||||
color: isFolder
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(
|
||||
context,
|
||||
).colorScheme.onSurface.withValues(alpha: 0.7),
|
||||
: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7),
|
||||
),
|
||||
|
||||
const SizedBox(width: 12),
|
||||
@@ -108,10 +99,7 @@ class FolderTreeItem extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Text(
|
||||
item.title,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: isFolder ? FontWeight.w500 : FontWeight.w400,
|
||||
),
|
||||
style: TextStyle(fontSize: 14, fontWeight: isFolder ? FontWeight.w500 : FontWeight.w400),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
@@ -121,12 +109,7 @@ class FolderTreeItem extends StatelessWidget {
|
||||
if (!isFolder && item.year != null)
|
||||
Text(
|
||||
item.year.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Theme.of(
|
||||
context,
|
||||
).colorScheme.onSurface.withValues(alpha: 0.6),
|
||||
),
|
||||
style: TextStyle(fontSize: 12, color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.6)),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import '../../models/plex_metadata.dart';
|
||||
import '../../utils/app_logger.dart';
|
||||
import '../../utils/media_navigation_helper.dart';
|
||||
import '../../utils/provider_extensions.dart';
|
||||
import '../../utils/snackbar_helper.dart';
|
||||
import '../../i18n/strings.g.dart';
|
||||
import 'folder_tree_item.dart';
|
||||
import 'empty_state_widget.dart';
|
||||
import 'error_state_widget.dart';
|
||||
import 'state_messages.dart';
|
||||
|
||||
/// Expandable tree view for browsing library folders
|
||||
/// Shows a hierarchical file/folder structure
|
||||
@@ -15,12 +16,7 @@ class FolderTreeView extends StatefulWidget {
|
||||
final String? serverId; // Server this library belongs to
|
||||
final void Function(String)? onRefresh;
|
||||
|
||||
const FolderTreeView({
|
||||
super.key,
|
||||
required this.libraryKey,
|
||||
this.serverId,
|
||||
this.onRefresh,
|
||||
});
|
||||
const FolderTreeView({super.key, required this.libraryKey, this.serverId, this.onRefresh});
|
||||
|
||||
@override
|
||||
State<FolderTreeView> createState() => _FolderTreeViewState();
|
||||
@@ -73,10 +69,7 @@ class _FolderTreeViewState extends State<FolderTreeView> {
|
||||
|
||||
appLogger.e('Failed to load root folders', error: e);
|
||||
setState(() {
|
||||
_errorMessage = t.errors.failedToLoad(
|
||||
context: t.libraries.folders,
|
||||
error: e.toString(),
|
||||
);
|
||||
_errorMessage = t.errors.failedToLoad(context: t.libraries.folders, error: e.toString());
|
||||
_isLoadingRoot = false;
|
||||
});
|
||||
}
|
||||
@@ -112,9 +105,7 @@ class _FolderTreeViewState extends State<FolderTreeView> {
|
||||
_loadingFolders.remove(folder.key);
|
||||
});
|
||||
|
||||
appLogger.d(
|
||||
'Loaded ${children.length} children for folder: ${folder.title}',
|
||||
);
|
||||
appLogger.d('Loaded ${children.length} children for folder: ${folder.title}');
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
|
||||
@@ -124,16 +115,7 @@ class _FolderTreeViewState extends State<FolderTreeView> {
|
||||
});
|
||||
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
t.errors.failedToLoad(
|
||||
context: t.libraries.folders,
|
||||
error: e.toString(),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
showErrorSnackBar(context, t.errors.failedToLoad(context: t.libraries.folders, error: e.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -155,16 +137,10 @@ class _FolderTreeViewState extends State<FolderTreeView> {
|
||||
bool _isFolder(PlexMetadata item) {
|
||||
// Folders typically don't have a specific type or might have special indicators
|
||||
// Check for common folder indicators
|
||||
return item.key.contains('/folder') ||
|
||||
item.type.isEmpty ||
|
||||
item.type.toLowerCase() == 'folder';
|
||||
return item.key.contains('/folder') || item.type.isEmpty || item.type.toLowerCase() == 'folder';
|
||||
}
|
||||
|
||||
List<Widget> _buildTreeItems(
|
||||
List<PlexMetadata> items,
|
||||
int depth, [
|
||||
String parentPath = '',
|
||||
]) {
|
||||
List<Widget> _buildTreeItems(List<PlexMetadata> items, int depth, [String parentPath = '']) {
|
||||
final List<Widget> widgets = [];
|
||||
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
@@ -209,17 +185,14 @@ class _FolderTreeViewState extends State<FolderTreeView> {
|
||||
if (_errorMessage != null) {
|
||||
return ErrorStateWidget(
|
||||
message: _errorMessage!,
|
||||
icon: Icons.error_outline,
|
||||
icon: Symbols.error_outline_rounded,
|
||||
onRetry: _loadRootFolders,
|
||||
retryLabel: t.common.retry,
|
||||
);
|
||||
}
|
||||
|
||||
if (_rootFolders.isEmpty) {
|
||||
return EmptyStateWidget(
|
||||
message: t.libraries.noFoldersFound,
|
||||
icon: Icons.folder_open,
|
||||
);
|
||||
return EmptyStateWidget(message: t.libraries.noFoldersFound, icon: Symbols.folder_open_rounded);
|
||||
}
|
||||
|
||||
return RefreshIndicator(
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plezy/widgets/app_icon.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
@@ -14,20 +16,43 @@ import '../../providers/multi_server_provider.dart';
|
||||
import '../../utils/app_logger.dart';
|
||||
import '../../utils/platform_detector.dart';
|
||||
import '../../utils/provider_extensions.dart';
|
||||
import '../../utils/snackbar_helper.dart';
|
||||
import '../../utils/content_utils.dart';
|
||||
import '../../widgets/desktop_app_bar.dart';
|
||||
import '../../widgets/focusable_tab_chip.dart';
|
||||
import '../main_screen.dart';
|
||||
import 'context_menu_wrapper.dart';
|
||||
import '../../services/storage_service.dart';
|
||||
import '../../mixins/refreshable.dart';
|
||||
import '../../mixins/item_updatable.dart';
|
||||
import '../../i18n/strings.g.dart';
|
||||
import '../../utils/error_message_utils.dart';
|
||||
import 'state_messages.dart';
|
||||
import 'tabs/library_browse_tab.dart';
|
||||
import 'tabs/library_recommended_tab.dart';
|
||||
import 'tabs/library_collections_tab.dart';
|
||||
import 'tabs/library_playlists_tab.dart';
|
||||
|
||||
/// A menu action item for context menus
|
||||
class ContextMenuItem {
|
||||
final String value;
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final bool requiresConfirmation;
|
||||
final String? confirmationTitle;
|
||||
final String? confirmationMessage;
|
||||
final bool isDestructive;
|
||||
|
||||
const ContextMenuItem({
|
||||
required this.value,
|
||||
required this.icon,
|
||||
required this.label,
|
||||
this.requiresConfirmation = false,
|
||||
this.confirmationTitle,
|
||||
this.confirmationMessage,
|
||||
this.isDestructive = false,
|
||||
});
|
||||
}
|
||||
|
||||
class LibrariesScreen extends StatefulWidget {
|
||||
final VoidCallback? onLibraryOrderChanged;
|
||||
|
||||
@@ -38,19 +63,14 @@ class LibrariesScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
with Refreshable, ItemUpdatable, SingleTickerProviderStateMixin {
|
||||
with Refreshable, FullRefreshable, FocusableTab, LibraryLoadable, ItemUpdatable, SingleTickerProviderStateMixin {
|
||||
@override
|
||||
PlexClient get client {
|
||||
final multiServerProvider = Provider.of<MultiServerProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
final multiServerProvider = Provider.of<MultiServerProvider>(context, listen: false);
|
||||
if (!multiServerProvider.hasConnectedServers) {
|
||||
throw Exception(t.errors.noClientAvailable);
|
||||
}
|
||||
return context.getClientForServer(
|
||||
multiServerProvider.onlineServerIds.first,
|
||||
);
|
||||
return context.getClientForServer(multiServerProvider.onlineServerIds.first);
|
||||
}
|
||||
|
||||
late TabController _tabController;
|
||||
@@ -90,16 +110,10 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
final _libraryDropdownKey = GlobalKey<PopupMenuButtonState<String>>();
|
||||
|
||||
// Focus nodes for tab chips
|
||||
final _recommendedTabChipFocusNode = FocusNode(
|
||||
debugLabel: 'tab_chip_recommended',
|
||||
);
|
||||
final _recommendedTabChipFocusNode = FocusNode(debugLabel: 'tab_chip_recommended');
|
||||
final _browseTabChipFocusNode = FocusNode(debugLabel: 'tab_chip_browse');
|
||||
final _collectionsTabChipFocusNode = FocusNode(
|
||||
debugLabel: 'tab_chip_collections',
|
||||
);
|
||||
final _playlistsTabChipFocusNode = FocusNode(
|
||||
debugLabel: 'tab_chip_playlists',
|
||||
);
|
||||
final _collectionsTabChipFocusNode = FocusNode(debugLabel: 'tab_chip_collections');
|
||||
final _playlistsTabChipFocusNode = FocusNode(debugLabel: 'tab_chip_playlists');
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -139,10 +153,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
// Only save if this was a user-initiated tab change, not a restore
|
||||
if (!_isRestoringTab) {
|
||||
StorageService.getInstance().then((storage) {
|
||||
storage.saveLibraryTab(
|
||||
_selectedLibraryGlobalKey!,
|
||||
_tabController.index,
|
||||
);
|
||||
storage.saveLibraryTab(_selectedLibraryGlobalKey!, _tabController.index);
|
||||
});
|
||||
|
||||
// Focus first item in the current tab (only for user-initiated changes)
|
||||
@@ -229,9 +240,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
if (_tabController.index == tabIndex && mounted) {
|
||||
// Use post-frame callback to ensure the widget tree is fully built
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted &&
|
||||
_tabController.index == tabIndex &&
|
||||
!_suppressAutoFocus) {
|
||||
if (mounted && _tabController.index == tabIndex && !_suppressAutoFocus) {
|
||||
_focusCurrentTab();
|
||||
}
|
||||
});
|
||||
@@ -242,6 +251,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
/// If the active tab has already loaded data (often the case after preloading
|
||||
/// while on another main tab), re-request focus so the first item is focused
|
||||
/// once the screen is actually shown.
|
||||
@override
|
||||
void focusActiveTabIfReady() {
|
||||
if (_selectedLibraryGlobalKey == null) return;
|
||||
_focusCurrentTab();
|
||||
@@ -310,23 +320,14 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
|
||||
/// Check if libraries come from multiple servers
|
||||
bool get _hasMultipleServers {
|
||||
final uniqueServerIds = _allLibraries
|
||||
.where((lib) => lib.serverId != null)
|
||||
.map((lib) => lib.serverId)
|
||||
.toSet();
|
||||
final uniqueServerIds = _allLibraries.where((lib) => lib.serverId != null).map((lib) => lib.serverId).toSet();
|
||||
return uniqueServerIds.length > 1;
|
||||
}
|
||||
|
||||
Future<void> _loadLibraries() async {
|
||||
// Extract context dependencies before async gap
|
||||
final multiServerProvider = Provider.of<MultiServerProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
final hiddenLibrariesProvider = Provider.of<HiddenLibrariesProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
final multiServerProvider = Provider.of<MultiServerProvider>(context, listen: false);
|
||||
final hiddenLibrariesProvider = Provider.of<HiddenLibrariesProvider>(context, listen: false);
|
||||
|
||||
setState(() {
|
||||
_isLoadingLibraries = true;
|
||||
@@ -342,34 +343,25 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
final storage = await StorageService.getInstance();
|
||||
|
||||
// Fetch libraries from all servers
|
||||
final allLibraries = await multiServerProvider.aggregationService
|
||||
.getLibrariesFromAllServers();
|
||||
final allLibraries = await multiServerProvider.aggregationService.getLibrariesFromAllServers();
|
||||
|
||||
// Filter out music libraries (type: 'artist') since music playback is not yet supported
|
||||
// Only show movie and TV show libraries
|
||||
final filteredLibraries = allLibraries
|
||||
.where((lib) => lib.type.toLowerCase() != 'artist')
|
||||
.toList();
|
||||
final filteredLibraries = allLibraries.where((lib) => !ContentTypeHelper.isMusicLibrary(lib)).toList();
|
||||
|
||||
// Load saved library order and apply it
|
||||
final savedOrder = storage.getLibraryOrder();
|
||||
final orderedLibraries = _applyLibraryOrder(
|
||||
filteredLibraries,
|
||||
savedOrder,
|
||||
);
|
||||
final orderedLibraries = _applyLibraryOrder(filteredLibraries, savedOrder);
|
||||
|
||||
_updateState(() {
|
||||
_allLibraries =
|
||||
orderedLibraries; // Store all libraries with ordering applied
|
||||
_allLibraries = orderedLibraries; // Store all libraries with ordering applied
|
||||
_isLoadingLibraries = false;
|
||||
});
|
||||
|
||||
if (allLibraries.isNotEmpty) {
|
||||
// Compute visible libraries for initial load
|
||||
final hiddenKeys = hiddenLibrariesProvider.hiddenLibraryKeys;
|
||||
final visibleLibraries = allLibraries
|
||||
.where((lib) => !hiddenKeys.contains(lib.globalKey))
|
||||
.toList();
|
||||
final visibleLibraries = allLibraries.where((lib) => !hiddenKeys.contains(lib.globalKey)).toList();
|
||||
|
||||
// Load saved preferences
|
||||
final savedLibraryKey = storage.getSelectedLibraryKey();
|
||||
@@ -378,9 +370,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
String? libraryGlobalKeyToLoad;
|
||||
if (savedLibraryKey != null) {
|
||||
// Check if saved library exists and is visible
|
||||
final libraryExists = visibleLibraries.any(
|
||||
(lib) => lib.globalKey == savedLibraryKey,
|
||||
);
|
||||
final libraryExists = visibleLibraries.any((lib) => lib.globalKey == savedLibraryKey);
|
||||
if (libraryExists) {
|
||||
libraryGlobalKeyToLoad = savedLibraryKey;
|
||||
}
|
||||
@@ -392,9 +382,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
}
|
||||
|
||||
if (libraryGlobalKeyToLoad != null && mounted) {
|
||||
final savedFilters = storage.getLibraryFilters(
|
||||
sectionId: libraryGlobalKeyToLoad,
|
||||
);
|
||||
final savedFilters = storage.getLibraryFilters(sectionId: libraryGlobalKeyToLoad);
|
||||
if (savedFilters.isNotEmpty) {
|
||||
_selectedFilters = Map.from(savedFilters);
|
||||
}
|
||||
@@ -409,10 +397,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
}
|
||||
}
|
||||
|
||||
List<PlexLibrary> _applyLibraryOrder(
|
||||
List<PlexLibrary> libraries,
|
||||
List<String>? savedOrder,
|
||||
) {
|
||||
List<PlexLibrary> _applyLibraryOrder(List<PlexLibrary> libraries, List<String>? savedOrder) {
|
||||
if (savedOrder == null || savedOrder.isEmpty) {
|
||||
return libraries;
|
||||
}
|
||||
@@ -450,31 +435,24 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
}
|
||||
|
||||
/// Public method to load a library by key (called from MainScreen side nav)
|
||||
@override
|
||||
void loadLibraryByKey(String libraryGlobalKey) {
|
||||
_loadLibraryContent(libraryGlobalKey);
|
||||
}
|
||||
|
||||
Future<void> _loadLibraryContent(String libraryGlobalKey) async {
|
||||
// Compute visible libraries based on current provider state
|
||||
final hiddenLibrariesProvider = Provider.of<HiddenLibrariesProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
final hiddenLibrariesProvider = Provider.of<HiddenLibrariesProvider>(context, listen: false);
|
||||
final hiddenKeys = hiddenLibrariesProvider.hiddenLibraryKeys;
|
||||
final visibleLibraries = _allLibraries
|
||||
.where((lib) => !hiddenKeys.contains(lib.globalKey))
|
||||
.toList();
|
||||
final visibleLibraries = _allLibraries.where((lib) => !hiddenKeys.contains(lib.globalKey)).toList();
|
||||
|
||||
// Find the library by key
|
||||
final libraryIndex = visibleLibraries.indexWhere(
|
||||
(lib) => lib.globalKey == libraryGlobalKey,
|
||||
);
|
||||
final libraryIndex = visibleLibraries.indexWhere((lib) => lib.globalKey == libraryGlobalKey);
|
||||
if (libraryIndex == -1) return; // Library not found or hidden
|
||||
|
||||
final library = visibleLibraries[libraryIndex];
|
||||
|
||||
final isChangingLibrary =
|
||||
!_isInitialLoad && _selectedLibraryGlobalKey != libraryGlobalKey;
|
||||
final isChangingLibrary = !_isInitialLoad && _selectedLibraryGlobalKey != libraryGlobalKey;
|
||||
|
||||
// Get the correct client for this library's server
|
||||
final client = context.getClientForLibrary(library);
|
||||
@@ -517,9 +495,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
// However, on first load the tab might finish loading before the tab index
|
||||
// is restored. Check if the current tab has already loaded and focus if so.
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted &&
|
||||
_selectedLibraryGlobalKey == libraryGlobalKey &&
|
||||
_loadedTabs.contains(_tabController.index)) {
|
||||
if (mounted && _selectedLibraryGlobalKey == libraryGlobalKey && _loadedTabs.contains(_tabController.index)) {
|
||||
_focusCurrentTab();
|
||||
}
|
||||
});
|
||||
@@ -548,12 +524,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
final filtersWithSort = _buildFiltersWithSort();
|
||||
|
||||
// Load pages sequentially
|
||||
await _loadAllPagesSequentially(
|
||||
library,
|
||||
filtersWithSort,
|
||||
currentRequestId,
|
||||
client,
|
||||
);
|
||||
await _loadAllPagesSequentially(library, filtersWithSort, currentRequestId, client);
|
||||
} catch (e) {
|
||||
// Ignore cancellation errors
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) {
|
||||
@@ -585,12 +556,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
|
||||
// Tag items with server info for multi-server support
|
||||
final taggedItems = items
|
||||
.map(
|
||||
(item) => item.copyWith(
|
||||
serverId: library.serverId,
|
||||
serverName: library.serverName,
|
||||
),
|
||||
)
|
||||
.map((item) => item.copyWith(serverId: library.serverId, serverName: library.serverName))
|
||||
.toList();
|
||||
|
||||
// Check if request is still valid
|
||||
@@ -635,10 +601,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
if (savedSortData != null) {
|
||||
final sortKey = savedSortData['key'] as String?;
|
||||
if (sortKey != null) {
|
||||
savedSort = sortOptions.firstWhere(
|
||||
(s) => s.key == sortKey,
|
||||
orElse: () => sortOptions.first,
|
||||
);
|
||||
savedSort = sortOptions.firstWhere((s) => s.key == sortKey, orElse: () => sortOptions.first);
|
||||
descending = (savedSortData['descending'] as bool?) ?? false;
|
||||
} else {
|
||||
savedSort = sortOptions.first;
|
||||
@@ -662,9 +625,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
Map<String, String> _buildFiltersWithSort() {
|
||||
final filtersWithSort = Map<String, String>.from(_selectedFilters);
|
||||
if (_selectedSort != null) {
|
||||
filtersWithSort['sort'] = _selectedSort!.getSortKey(
|
||||
descending: _isSortDescending,
|
||||
);
|
||||
filtersWithSort['sort'] = _selectedSort!.getSortKey(descending: _isSortDescending);
|
||||
}
|
||||
return filtersWithSort;
|
||||
}
|
||||
@@ -714,6 +675,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
}
|
||||
|
||||
// Public method to fully reload all content (for profile switches)
|
||||
@override
|
||||
void fullRefresh() {
|
||||
appLogger.d('LibrariesScreen.fullRefresh() called - reloading all content');
|
||||
// Reload libraries and clear any selected library/filters
|
||||
@@ -724,20 +686,14 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
}
|
||||
|
||||
Future<void> _toggleLibraryVisibility(PlexLibrary library) async {
|
||||
final hiddenLibrariesProvider = Provider.of<HiddenLibrariesProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
final isHidden = hiddenLibrariesProvider.hiddenLibraryKeys.contains(
|
||||
library.globalKey,
|
||||
);
|
||||
final hiddenLibrariesProvider = Provider.of<HiddenLibrariesProvider>(context, listen: false);
|
||||
final isHidden = hiddenLibrariesProvider.hiddenLibraryKeys.contains(library.globalKey);
|
||||
|
||||
if (isHidden) {
|
||||
await hiddenLibrariesProvider.unhideLibrary(library.globalKey);
|
||||
} else {
|
||||
// Check if we're hiding the currently selected library
|
||||
final isCurrentlySelected =
|
||||
_selectedLibraryGlobalKey == library.globalKey;
|
||||
final isCurrentlySelected = _selectedLibraryGlobalKey == library.globalKey;
|
||||
|
||||
await hiddenLibrariesProvider.hideLibrary(library.globalKey);
|
||||
|
||||
@@ -745,11 +701,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
if (isCurrentlySelected) {
|
||||
// Compute visible libraries after hiding
|
||||
final visibleLibraries = _allLibraries
|
||||
.where(
|
||||
(lib) => !hiddenLibrariesProvider.hiddenLibraryKeys.contains(
|
||||
lib.globalKey,
|
||||
),
|
||||
)
|
||||
.where((lib) => !hiddenLibrariesProvider.hiddenLibraryKeys.contains(lib.globalKey))
|
||||
.toList();
|
||||
|
||||
if (visibleLibraries.isNotEmpty) {
|
||||
@@ -763,44 +715,36 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
return [
|
||||
ContextMenuItem(
|
||||
value: 'scan',
|
||||
icon: Icons.refresh,
|
||||
icon: Symbols.refresh_rounded,
|
||||
label: t.libraries.scanLibraryFiles,
|
||||
requiresConfirmation: true,
|
||||
confirmationTitle: t.libraries.scanLibrary,
|
||||
confirmationMessage: t.libraries.scanLibraryConfirm(
|
||||
title: library.title,
|
||||
),
|
||||
confirmationMessage: t.libraries.scanLibraryConfirm(title: library.title),
|
||||
),
|
||||
ContextMenuItem(
|
||||
value: 'analyze',
|
||||
icon: Icons.analytics_outlined,
|
||||
icon: Symbols.analytics_rounded,
|
||||
label: t.libraries.analyze,
|
||||
requiresConfirmation: true,
|
||||
confirmationTitle: t.libraries.analyzeLibrary,
|
||||
confirmationMessage: t.libraries.analyzeLibraryConfirm(
|
||||
title: library.title,
|
||||
),
|
||||
confirmationMessage: t.libraries.analyzeLibraryConfirm(title: library.title),
|
||||
),
|
||||
ContextMenuItem(
|
||||
value: 'refresh',
|
||||
icon: Icons.sync,
|
||||
icon: Symbols.sync_rounded,
|
||||
label: t.libraries.refreshMetadata,
|
||||
requiresConfirmation: true,
|
||||
confirmationTitle: t.libraries.refreshMetadata,
|
||||
confirmationMessage: t.libraries.refreshMetadataConfirm(
|
||||
title: library.title,
|
||||
),
|
||||
confirmationMessage: t.libraries.refreshMetadataConfirm(title: library.title),
|
||||
isDestructive: true,
|
||||
),
|
||||
ContextMenuItem(
|
||||
value: 'empty_trash',
|
||||
icon: Icons.delete_outline,
|
||||
icon: Symbols.delete_outline_rounded,
|
||||
label: t.libraries.emptyTrash,
|
||||
requiresConfirmation: true,
|
||||
confirmationTitle: t.libraries.emptyTrash,
|
||||
confirmationMessage: t.libraries.emptyTrashConfirm(
|
||||
title: library.title,
|
||||
),
|
||||
confirmationMessage: t.libraries.emptyTrashConfirm(title: library.title),
|
||||
isDestructive: true,
|
||||
),
|
||||
];
|
||||
@@ -824,10 +768,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
}
|
||||
|
||||
void _showLibraryManagementSheet() {
|
||||
final hiddenLibrariesProvider = Provider.of<HiddenLibrariesProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
);
|
||||
final hiddenLibrariesProvider = Provider.of<HiddenLibrariesProvider>(context, listen: false);
|
||||
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
@@ -859,34 +800,18 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
final client = context.getClientForLibrary(library);
|
||||
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(progressMessage),
|
||||
duration: const Duration(seconds: 2),
|
||||
),
|
||||
);
|
||||
showAppSnackBar(context, progressMessage, duration: const Duration(seconds: 2));
|
||||
}
|
||||
|
||||
await action(client);
|
||||
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(successMessage),
|
||||
duration: const Duration(seconds: 3),
|
||||
),
|
||||
);
|
||||
showSuccessSnackBar(context, successMessage);
|
||||
}
|
||||
} catch (e) {
|
||||
appLogger.e('Library action failed', error: e);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(failureMessage(e)),
|
||||
backgroundColor: Colors.red,
|
||||
duration: const Duration(seconds: 3),
|
||||
),
|
||||
);
|
||||
showErrorSnackBar(context, failureMessage(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -897,8 +822,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
action: (client) => client.scanLibrary(library.key),
|
||||
progressMessage: t.messages.libraryScanning(title: library.title),
|
||||
successMessage: t.messages.libraryScanStarted(title: library.title),
|
||||
failureMessage: (error) =>
|
||||
t.messages.libraryScanFailed(error: error.toString()),
|
||||
failureMessage: (error) => t.messages.libraryScanFailed(error: error.toString()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -908,8 +832,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
action: (client) => client.refreshLibraryMetadata(library.key),
|
||||
progressMessage: t.messages.metadataRefreshing(title: library.title),
|
||||
successMessage: t.messages.metadataRefreshStarted(title: library.title),
|
||||
failureMessage: (error) =>
|
||||
t.messages.metadataRefreshFailed(error: error.toString()),
|
||||
failureMessage: (error) => t.messages.metadataRefreshFailed(error: error.toString()),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -939,30 +862,25 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
for (final lib in libraries) {
|
||||
nameCounts[lib.title] = (nameCounts[lib.title] ?? 0) + 1;
|
||||
}
|
||||
return nameCounts.entries
|
||||
.where((e) => e.value > 1)
|
||||
.map((e) => e.key)
|
||||
.toSet();
|
||||
return nameCounts.entries.where((e) => e.value > 1).map((e) => e.key).toSet();
|
||||
}
|
||||
|
||||
/// Build dropdown menu items with server subtitle for non-unique names
|
||||
List<PopupMenuEntry<String>> _buildGroupedLibraryMenuItems(
|
||||
List<PlexLibrary> visibleLibraries,
|
||||
) {
|
||||
List<PopupMenuEntry<String>> _buildGroupedLibraryMenuItems(List<PlexLibrary> visibleLibraries) {
|
||||
// Find which library names are not unique
|
||||
final nonUniqueNames = _getNonUniqueLibraryNames(visibleLibraries);
|
||||
|
||||
return visibleLibraries.map((library) {
|
||||
final isSelected = library.globalKey == _selectedLibraryGlobalKey;
|
||||
final showServerName =
|
||||
nonUniqueNames.contains(library.title) && library.serverName != null;
|
||||
final showServerName = nonUniqueNames.contains(library.title) && library.serverName != null;
|
||||
|
||||
return PopupMenuItem<String>(
|
||||
value: library.globalKey,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
_getLibraryIcon(library.type),
|
||||
AppIcon(
|
||||
ContentTypeHelper.getLibraryIcon(library.type),
|
||||
fill: 1,
|
||||
size: 20,
|
||||
color: isSelected ? Theme.of(context).colorScheme.primary : null,
|
||||
),
|
||||
@@ -975,12 +893,8 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
Text(
|
||||
library.title,
|
||||
style: TextStyle(
|
||||
fontWeight: isSelected
|
||||
? FontWeight.w600
|
||||
: FontWeight.w400,
|
||||
color: isSelected
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: null,
|
||||
fontWeight: isSelected ? FontWeight.w600 : FontWeight.w400,
|
||||
color: isSelected ? Theme.of(context).colorScheme.primary : null,
|
||||
),
|
||||
),
|
||||
if (showServerName)
|
||||
@@ -988,9 +902,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
library.serverName!,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: Theme.of(
|
||||
context,
|
||||
).textTheme.bodySmall?.color?.withValues(alpha: 0.6),
|
||||
color: Theme.of(context).textTheme.bodySmall?.color?.withValues(alpha: 0.6),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -1092,34 +1004,26 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(_getLibraryIcon(selectedLibrary.type), size: 20),
|
||||
AppIcon(ContentTypeHelper.getLibraryIcon(selectedLibrary.type), fill: 1, size: 20),
|
||||
const SizedBox(width: 8),
|
||||
if (_hasMultipleServers && selectedLibrary.serverName != null)
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
selectedLibrary.title,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
Text(selectedLibrary.title, style: Theme.of(context).textTheme.titleMedium),
|
||||
Text(
|
||||
selectedLibrary.serverName!,
|
||||
style: Theme.of(context).textTheme.labelSmall?.copyWith(
|
||||
color: Theme.of(
|
||||
context,
|
||||
).textTheme.bodySmall?.color?.withValues(alpha: 0.6),
|
||||
color: Theme.of(context).textTheme.bodySmall?.color?.withValues(alpha: 0.6),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
else
|
||||
Text(
|
||||
selectedLibrary.title,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
),
|
||||
Text(selectedLibrary.title, style: Theme.of(context).textTheme.titleLarge),
|
||||
const SizedBox(width: 4),
|
||||
const Icon(Icons.arrow_drop_down, size: 24),
|
||||
const AppIcon(Symbols.arrow_drop_down_rounded, fill: 1, size: 24),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -1133,9 +1037,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
final hiddenKeys = hiddenLibrariesProvider.hiddenLibraryKeys;
|
||||
|
||||
// Compute visible libraries (filtered from all libraries)
|
||||
final visibleLibraries = _allLibraries
|
||||
.where((lib) => !hiddenKeys.contains(lib.globalKey))
|
||||
.toList();
|
||||
final visibleLibraries = _allLibraries.where((lib) => !hiddenKeys.contains(lib.globalKey)).toList();
|
||||
|
||||
return Scaffold(
|
||||
body: CustomScrollView(
|
||||
@@ -1151,70 +1053,37 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
actions: [
|
||||
if (_allLibraries.isNotEmpty)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.edit),
|
||||
icon: const AppIcon(Symbols.edit_rounded, fill: 1),
|
||||
tooltip: t.libraries.manageLibraries,
|
||||
onPressed: _showLibraryManagementSheet,
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.refresh),
|
||||
icon: const AppIcon(Symbols.refresh_rounded, fill: 1),
|
||||
tooltip: t.common.refresh,
|
||||
onPressed: _refreshCurrentTab,
|
||||
),
|
||||
],
|
||||
),
|
||||
if (_isLoadingLibraries)
|
||||
const SliverFillRemaining(
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
)
|
||||
const SliverFillRemaining(child: Center(child: CircularProgressIndicator()))
|
||||
else if (_errorMessage != null && visibleLibraries.isEmpty)
|
||||
SliverFillRemaining(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.error_outline,
|
||||
size: 48,
|
||||
color: Colors.red,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(_errorMessage!),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: _loadLibraries,
|
||||
child: Text(t.common.retry),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: ErrorStateWidget(
|
||||
message: _errorMessage!,
|
||||
icon: Symbols.error_outline_rounded,
|
||||
onRetry: _loadLibraries,
|
||||
),
|
||||
)
|
||||
else if (visibleLibraries.isEmpty)
|
||||
SliverFillRemaining(
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.video_library_outlined,
|
||||
size: 64,
|
||||
color: Colors.grey,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(t.libraries.noLibrariesFound),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: EmptyStateWidget(message: t.libraries.noLibrariesFound, icon: Symbols.video_library_rounded),
|
||||
)
|
||||
else ...[
|
||||
// Tab selector chips (only on mobile - desktop has them in app bar)
|
||||
if (_selectedLibraryGlobalKey != null &&
|
||||
!PlatformDetector.shouldUseSideNavigation(context))
|
||||
if (_selectedLibraryGlobalKey != null && !PlatformDetector.shouldUseSideNavigation(context))
|
||||
SliverToBoxAdapter(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 8,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
@@ -1241,9 +1110,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
children: [
|
||||
LibraryRecommendedTab(
|
||||
key: _recommendedTabKey,
|
||||
library: _allLibraries.firstWhere(
|
||||
(lib) => lib.globalKey == _selectedLibraryGlobalKey,
|
||||
),
|
||||
library: _allLibraries.firstWhere((lib) => lib.globalKey == _selectedLibraryGlobalKey),
|
||||
isActive: _tabController.index == 0,
|
||||
suppressAutoFocus: _suppressAutoFocus,
|
||||
onDataLoaded: () => _handleTabDataLoaded(0),
|
||||
@@ -1251,9 +1118,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
),
|
||||
LibraryBrowseTab(
|
||||
key: _browseTabKey,
|
||||
library: _allLibraries.firstWhere(
|
||||
(lib) => lib.globalKey == _selectedLibraryGlobalKey,
|
||||
),
|
||||
library: _allLibraries.firstWhere((lib) => lib.globalKey == _selectedLibraryGlobalKey),
|
||||
isActive: _tabController.index == 1,
|
||||
suppressAutoFocus: _suppressAutoFocus,
|
||||
onDataLoaded: () => _handleTabDataLoaded(1),
|
||||
@@ -1261,9 +1126,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
),
|
||||
LibraryCollectionsTab(
|
||||
key: _collectionsTabKey,
|
||||
library: _allLibraries.firstWhere(
|
||||
(lib) => lib.globalKey == _selectedLibraryGlobalKey,
|
||||
),
|
||||
library: _allLibraries.firstWhere((lib) => lib.globalKey == _selectedLibraryGlobalKey),
|
||||
isActive: _tabController.index == 2,
|
||||
suppressAutoFocus: _suppressAutoFocus,
|
||||
onDataLoaded: () => _handleTabDataLoaded(2),
|
||||
@@ -1271,9 +1134,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
),
|
||||
LibraryPlaylistsTab(
|
||||
key: _playlistsTabKey,
|
||||
library: _allLibraries.firstWhere(
|
||||
(lib) => lib.globalKey == _selectedLibraryGlobalKey,
|
||||
),
|
||||
library: _allLibraries.firstWhere((lib) => lib.globalKey == _selectedLibraryGlobalKey),
|
||||
isActive: _tabController.index == 3,
|
||||
suppressAutoFocus: _suppressAutoFocus,
|
||||
onDataLoaded: () => _handleTabDataLoaded(3),
|
||||
@@ -1287,21 +1148,6 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
IconData _getLibraryIcon(String type) {
|
||||
switch (type.toLowerCase()) {
|
||||
case 'movie':
|
||||
return Icons.movie;
|
||||
case 'show':
|
||||
return Icons.tv;
|
||||
case 'artist':
|
||||
return Icons.music_note;
|
||||
case 'photo':
|
||||
return Icons.photo;
|
||||
default:
|
||||
return Icons.folder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class _LibraryManagementSheet extends StatefulWidget {
|
||||
@@ -1322,8 +1168,7 @@ class _LibraryManagementSheet extends StatefulWidget {
|
||||
});
|
||||
|
||||
@override
|
||||
State<_LibraryManagementSheet> createState() =>
|
||||
_LibraryManagementSheetState();
|
||||
State<_LibraryManagementSheet> createState() => _LibraryManagementSheetState();
|
||||
}
|
||||
|
||||
class _LibraryManagementSheetState extends State<_LibraryManagementSheet> {
|
||||
@@ -1461,10 +1306,7 @@ class _LibraryManagementSheetState extends State<_LibraryManagementSheet> {
|
||||
widget.onReorder(_tempLibraries);
|
||||
}
|
||||
|
||||
Future<void> _showLibraryMenuBottomSheet(
|
||||
BuildContext outerContext,
|
||||
PlexLibrary library,
|
||||
) async {
|
||||
Future<void> _showLibraryMenuBottomSheet(BuildContext outerContext, PlexLibrary library) async {
|
||||
final menuItems = widget.getLibraryMenuItems(library);
|
||||
final selected = await showModalBottomSheet<String>(
|
||||
context: outerContext,
|
||||
@@ -1474,17 +1316,11 @@ class _LibraryManagementSheetState extends State<_LibraryManagementSheet> {
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Text(
|
||||
library.title,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
child: Text(library.title, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
...menuItems.indexed.map(
|
||||
(entry) => ListTile(
|
||||
leading: Icon(entry.$2.icon),
|
||||
leading: AppIcon(entry.$2.icon, fill: 1),
|
||||
title: Text(entry.$2.label),
|
||||
onTap: () => Navigator.pop(context, entry.$2.value),
|
||||
),
|
||||
@@ -1496,32 +1332,20 @@ class _LibraryManagementSheetState extends State<_LibraryManagementSheet> {
|
||||
|
||||
if (selected != null && mounted) {
|
||||
// Find the selected item to check if confirmation is needed
|
||||
final selectedItem = menuItems.firstWhere(
|
||||
(item) => item.value == selected,
|
||||
);
|
||||
final selectedItem = menuItems.firstWhere((item) => item.value == selected);
|
||||
|
||||
if (selectedItem.requiresConfirmation) {
|
||||
if (!mounted || !context.mounted) return;
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(
|
||||
selectedItem.confirmationTitle ?? t.dialog.confirmAction,
|
||||
),
|
||||
content: Text(
|
||||
selectedItem.confirmationMessage ??
|
||||
t.libraries.confirmActionMessage,
|
||||
),
|
||||
title: Text(selectedItem.confirmationTitle ?? t.dialog.confirmAction),
|
||||
content: Text(selectedItem.confirmationMessage ?? t.libraries.confirmActionMessage),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: Text(t.common.cancel),
|
||||
),
|
||||
TextButton(onPressed: () => Navigator.pop(context, false), child: Text(t.common.cancel)),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
style: selectedItem.isDestructive
|
||||
? TextButton.styleFrom(foregroundColor: Colors.red)
|
||||
: null,
|
||||
style: selectedItem.isDestructive ? TextButton.styleFrom(foregroundColor: Colors.red) : null,
|
||||
child: Text(t.common.confirm),
|
||||
),
|
||||
],
|
||||
@@ -1535,31 +1359,13 @@ class _LibraryManagementSheetState extends State<_LibraryManagementSheet> {
|
||||
}
|
||||
}
|
||||
|
||||
IconData _getLibraryIcon(String type) {
|
||||
switch (type.toLowerCase()) {
|
||||
case 'movie':
|
||||
return Icons.movie;
|
||||
case 'show':
|
||||
return Icons.tv;
|
||||
case 'artist':
|
||||
return Icons.music_note;
|
||||
case 'photo':
|
||||
return Icons.photo;
|
||||
default:
|
||||
return Icons.folder;
|
||||
}
|
||||
}
|
||||
|
||||
/// Get set of library names that appear more than once (not globally unique)
|
||||
Set<String> _getNonUniqueLibraryNames() {
|
||||
final nameCounts = <String, int>{};
|
||||
for (final lib in _tempLibraries) {
|
||||
nameCounts[lib.title] = (nameCounts[lib.title] ?? 0) + 1;
|
||||
}
|
||||
return nameCounts.entries
|
||||
.where((e) => e.value > 1)
|
||||
.map((e) => e.key)
|
||||
.toSet();
|
||||
return nameCounts.entries.where((e) => e.value > 1).map((e) => e.key).toSet();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -1580,25 +1386,20 @@ class _LibraryManagementSheetState extends State<_LibraryManagementSheet> {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Theme.of(context).dividerColor),
|
||||
),
|
||||
border: Border(bottom: BorderSide(color: Theme.of(context).dividerColor)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.edit),
|
||||
const AppIcon(Symbols.edit_rounded, fill: 1),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(
|
||||
t.libraries.manageLibraries,
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
icon: const AppIcon(Symbols.close_rounded, fill: 1),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
],
|
||||
@@ -1611,10 +1412,7 @@ class _LibraryManagementSheetState extends State<_LibraryManagementSheet> {
|
||||
focusNode: _listFocusNode,
|
||||
autofocus: InputModeTracker.isKeyboardMode(context),
|
||||
onKeyEvent: _handleKeyEvent,
|
||||
child: _buildFlatLibraryList(
|
||||
scrollController,
|
||||
hiddenLibraryKeys,
|
||||
),
|
||||
child: _buildFlatLibraryList(scrollController, hiddenLibraryKeys),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -1624,10 +1422,7 @@ class _LibraryManagementSheetState extends State<_LibraryManagementSheet> {
|
||||
}
|
||||
|
||||
/// Build flat library list with server subtitle for non-unique names
|
||||
Widget _buildFlatLibraryList(
|
||||
ScrollController scrollController,
|
||||
Set<String> hiddenLibraryKeys,
|
||||
) {
|
||||
Widget _buildFlatLibraryList(ScrollController scrollController, Set<String> hiddenLibraryKeys) {
|
||||
final nonUniqueNames = _getNonUniqueLibraryNames();
|
||||
final isKeyboardMode = InputModeTracker.isKeyboardMode(context);
|
||||
|
||||
@@ -1639,9 +1434,7 @@ class _LibraryManagementSheetState extends State<_LibraryManagementSheet> {
|
||||
buildDefaultDragHandles: false,
|
||||
itemBuilder: (context, index) {
|
||||
final library = _tempLibraries[index];
|
||||
final showServerName =
|
||||
nonUniqueNames.contains(library.title) &&
|
||||
library.serverName != null;
|
||||
final showServerName = nonUniqueNames.contains(library.title) && library.serverName != null;
|
||||
final isFocused = isKeyboardMode && index == _focusedIndex;
|
||||
final isMoving = index == _movingIndex;
|
||||
return _buildLibraryTile(
|
||||
@@ -1694,15 +1487,14 @@ class _LibraryManagementSheetState extends State<_LibraryManagementSheet> {
|
||||
children: [
|
||||
ReorderableDragStartListener(
|
||||
index: index,
|
||||
child: Icon(
|
||||
isMoving ? Icons.swap_vert : Icons.drag_indicator,
|
||||
color: isMoving
|
||||
? colorScheme.primary
|
||||
: IconTheme.of(context).color?.withValues(alpha: 0.5),
|
||||
child: AppIcon(
|
||||
isMoving ? Symbols.swap_vert_rounded : Symbols.drag_indicator_rounded,
|
||||
fill: 1,
|
||||
color: isMoving ? colorScheme.primary : IconTheme.of(context).color?.withValues(alpha: 0.5),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Icon(_getLibraryIcon(library.type)),
|
||||
AppIcon(ContentTypeHelper.getLibraryIcon(library.type), fill: 1),
|
||||
],
|
||||
),
|
||||
title: Text(library.title),
|
||||
@@ -1711,9 +1503,7 @@ class _LibraryManagementSheetState extends State<_LibraryManagementSheet> {
|
||||
library.serverName!,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: Theme.of(
|
||||
context,
|
||||
).textTheme.bodySmall?.color?.withValues(alpha: 0.6),
|
||||
color: Theme.of(context).textTheme.bodySmall?.color?.withValues(alpha: 0.6),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
@@ -1722,33 +1512,22 @@ class _LibraryManagementSheetState extends State<_LibraryManagementSheet> {
|
||||
children: [
|
||||
Container(
|
||||
decoration: isVisibilityButtonFocused
|
||||
? BoxDecoration(
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
)
|
||||
? BoxDecoration(color: colorScheme.surfaceContainerHighest, borderRadius: BorderRadius.circular(20))
|
||||
: null,
|
||||
child: IconButton(
|
||||
icon: Icon(
|
||||
isHidden ? Icons.visibility_off : Icons.visibility,
|
||||
),
|
||||
tooltip: isHidden
|
||||
? t.libraries.showLibrary
|
||||
: t.libraries.hideLibrary,
|
||||
icon: AppIcon(isHidden ? Symbols.visibility_off_rounded : Symbols.visibility_rounded, fill: 1),
|
||||
tooltip: isHidden ? t.libraries.showLibrary : t.libraries.hideLibrary,
|
||||
onPressed: () => widget.onToggleVisibility(library),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: isOptionsButtonFocused
|
||||
? BoxDecoration(
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
)
|
||||
? BoxDecoration(color: colorScheme.surfaceContainerHighest, borderRadius: BorderRadius.circular(20))
|
||||
: null,
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.more_vert),
|
||||
icon: const AppIcon(Symbols.more_vert_rounded, fill: 1),
|
||||
tooltip: t.libraries.libraryOptions,
|
||||
onPressed: () =>
|
||||
_showLibraryMenuBottomSheet(context, library),
|
||||
onPressed: () => _showLibraryMenuBottomSheet(context, library),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plezy/widgets/app_icon.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import '../../models/plex_sort.dart';
|
||||
import '../../widgets/bottom_sheet_header.dart';
|
||||
import '../../widgets/focusable_bottom_sheet.dart';
|
||||
@@ -77,52 +79,51 @@ class _SortBottomSheetState extends State<SortBottomSheet> {
|
||||
BottomSheetHeader(
|
||||
title: t.libraries.sortBy,
|
||||
action: widget.onClear != null
|
||||
? TextButton(
|
||||
onPressed: _handleClear,
|
||||
child: Text(t.common.clear),
|
||||
)
|
||||
? TextButton(onPressed: _handleClear, child: Text(t.common.clear))
|
||||
: null,
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
controller: scrollController,
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
itemCount: widget.sortOptions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final sort = widget.sortOptions[index];
|
||||
final isSelected = _currentSort?.key == sort.key;
|
||||
|
||||
return FocusableRadioListTile<PlexSort>(
|
||||
focusNode: index == 0 ? _initialFocusNode : null,
|
||||
title: Text(sort.title),
|
||||
value: sort,
|
||||
groupValue: _currentSort,
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
_handleSortChange(value, value.isDefaultDescending);
|
||||
}
|
||||
},
|
||||
secondary: isSelected
|
||||
? SegmentedButton<bool>(
|
||||
showSelectedIcon: false,
|
||||
segments: const [
|
||||
ButtonSegment(
|
||||
value: false,
|
||||
icon: Icon(Icons.arrow_upward, size: 16),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: true,
|
||||
icon: Icon(Icons.arrow_downward, size: 16),
|
||||
),
|
||||
],
|
||||
selected: {_currentDescending},
|
||||
onSelectionChanged: (Set<bool> newSelection) {
|
||||
_handleSortChange(sort, newSelection.first);
|
||||
},
|
||||
)
|
||||
: null,
|
||||
);
|
||||
child: RadioGroup<PlexSort>(
|
||||
groupValue: _currentSort,
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
_handleSortChange(value, value.isDefaultDescending);
|
||||
}
|
||||
},
|
||||
child: ListView.builder(
|
||||
controller: scrollController,
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
itemCount: widget.sortOptions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final sort = widget.sortOptions[index];
|
||||
final isSelected = _currentSort?.key == sort.key;
|
||||
|
||||
return FocusableRadioListTile<PlexSort>(
|
||||
focusNode: index == 0 ? _initialFocusNode : null,
|
||||
title: Text(sort.title),
|
||||
value: sort,
|
||||
secondary: isSelected
|
||||
? SegmentedButton<bool>(
|
||||
showSelectedIcon: false,
|
||||
segments: const [
|
||||
ButtonSegment(
|
||||
value: false,
|
||||
icon: AppIcon(Symbols.arrow_upward_rounded, fill: 1, size: 16),
|
||||
),
|
||||
ButtonSegment(
|
||||
value: true,
|
||||
icon: AppIcon(Symbols.arrow_downward_rounded, fill: 1, size: 16),
|
||||
),
|
||||
],
|
||||
selected: {_currentDescending},
|
||||
onSelectionChanged: (Set<bool> newSelection) {
|
||||
_handleSortChange(sort, newSelection.first);
|
||||
},
|
||||
)
|
||||
: null,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Base widget for displaying state messages (empty, error, etc.)
|
||||
/// Provides a consistent UI pattern for showing icons, messages, and actions
|
||||
class StateMessageWidget extends StatelessWidget {
|
||||
/// The message to display
|
||||
final String message;
|
||||
|
||||
/// Optional icon to display above the message
|
||||
final IconData? icon;
|
||||
|
||||
/// Optional color for the icon
|
||||
final Color? iconColor;
|
||||
|
||||
/// Optional color for the message text
|
||||
final Color? textColor;
|
||||
|
||||
/// Optional callback for action button
|
||||
final VoidCallback? onAction;
|
||||
|
||||
/// Optional label for the action button
|
||||
final String? actionLabel;
|
||||
|
||||
/// Optional icon for the action button
|
||||
final IconData? actionIcon;
|
||||
|
||||
const StateMessageWidget({
|
||||
super.key,
|
||||
required this.message,
|
||||
this.icon,
|
||||
this.iconColor,
|
||||
this.textColor,
|
||||
this.onAction,
|
||||
this.actionLabel,
|
||||
this.actionIcon,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (icon != null) ...[
|
||||
Icon(
|
||||
icon,
|
||||
size: 64,
|
||||
color:
|
||||
iconColor ??
|
||||
Theme.of(
|
||||
context,
|
||||
).colorScheme.onSurface.withValues(alpha: 0.4),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
Text(
|
||||
message,
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
color:
|
||||
textColor ??
|
||||
Theme.of(
|
||||
context,
|
||||
).colorScheme.onSurface.withValues(alpha: 0.6),
|
||||
),
|
||||
),
|
||||
if (onAction != null && actionLabel != null) ...[
|
||||
const SizedBox(height: 24),
|
||||
FilledButton.icon(
|
||||
onPressed: onAction,
|
||||
icon: Icon(actionIcon ?? Icons.refresh),
|
||||
label: Text(actionLabel!),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plezy/widgets/app_icon.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
|
||||
/// Base widget for displaying state messages (empty, error, etc.)
|
||||
/// Provides a consistent UI pattern for showing icons, messages, and actions
|
||||
class StateMessageWidget extends StatelessWidget {
|
||||
/// The main message/title to display
|
||||
final String message;
|
||||
|
||||
/// Optional subtitle/description below the message
|
||||
final String? subtitle;
|
||||
|
||||
/// Optional icon to display above the message
|
||||
final IconData? icon;
|
||||
|
||||
/// Optional size for the icon (default: 64)
|
||||
final double iconSize;
|
||||
|
||||
/// Optional color for the icon
|
||||
final Color? iconColor;
|
||||
|
||||
/// Optional color for the message text
|
||||
final Color? textColor;
|
||||
|
||||
/// Optional color for the subtitle text
|
||||
final Color? subtitleColor;
|
||||
|
||||
/// Optional callback for action button
|
||||
final VoidCallback? onAction;
|
||||
|
||||
/// Optional label for the action button
|
||||
final String? actionLabel;
|
||||
|
||||
/// Optional icon for the action button
|
||||
final IconData? actionIcon;
|
||||
|
||||
const StateMessageWidget({
|
||||
super.key,
|
||||
required this.message,
|
||||
this.subtitle,
|
||||
this.icon,
|
||||
this.iconSize = 64,
|
||||
this.iconColor,
|
||||
this.textColor,
|
||||
this.subtitleColor,
|
||||
this.onAction,
|
||||
this.actionLabel,
|
||||
this.actionIcon,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (icon != null) ...[
|
||||
AppIcon(
|
||||
icon,
|
||||
fill: 1,
|
||||
size: iconSize,
|
||||
color: iconColor ?? theme.colorScheme.onSurface.withValues(alpha: 0.4),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
Text(
|
||||
message,
|
||||
textAlign: TextAlign.center,
|
||||
style: theme.textTheme.titleLarge?.copyWith(
|
||||
color: textColor ?? theme.colorScheme.onSurface.withValues(alpha: 0.6),
|
||||
),
|
||||
),
|
||||
if (subtitle != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
subtitle!,
|
||||
textAlign: TextAlign.center,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(color: subtitleColor ?? theme.colorScheme.onSurfaceVariant),
|
||||
),
|
||||
],
|
||||
if (onAction != null && actionLabel != null) ...[
|
||||
const SizedBox(height: 24),
|
||||
FilledButton.icon(
|
||||
onPressed: onAction,
|
||||
icon: AppIcon(actionIcon ?? Symbols.refresh_rounded, fill: 1),
|
||||
label: Text(actionLabel!),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A reusable widget for displaying empty states throughout the app
|
||||
class EmptyStateWidget extends StatelessWidget {
|
||||
/// The message to display
|
||||
final String message;
|
||||
|
||||
/// Optional subtitle/description below the message
|
||||
final String? subtitle;
|
||||
|
||||
/// Optional icon to display above the message
|
||||
final IconData? icon;
|
||||
|
||||
/// Optional size for the icon
|
||||
final double iconSize;
|
||||
|
||||
/// Optional callback for action button
|
||||
final VoidCallback? onAction;
|
||||
|
||||
/// Optional label for the action button
|
||||
final String? actionLabel;
|
||||
|
||||
const EmptyStateWidget({
|
||||
super.key,
|
||||
required this.message,
|
||||
this.subtitle,
|
||||
this.icon,
|
||||
this.iconSize = 64,
|
||||
this.onAction,
|
||||
this.actionLabel,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StateMessageWidget(
|
||||
message: message,
|
||||
subtitle: subtitle,
|
||||
icon: icon,
|
||||
iconSize: iconSize,
|
||||
onAction: onAction,
|
||||
actionLabel: actionLabel,
|
||||
actionIcon: Symbols.add_rounded,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A reusable widget for displaying error states throughout the app
|
||||
class ErrorStateWidget extends StatelessWidget {
|
||||
/// The error message to display
|
||||
final String message;
|
||||
|
||||
/// Optional icon to display above the message
|
||||
final IconData? icon;
|
||||
|
||||
/// Optional callback for retry action
|
||||
final VoidCallback? onRetry;
|
||||
|
||||
/// Optional label for the retry button
|
||||
final String? retryLabel;
|
||||
|
||||
const ErrorStateWidget({super.key, required this.message, this.icon, this.onRetry, this.retryLabel});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StateMessageWidget(
|
||||
message: message,
|
||||
icon: icon,
|
||||
iconColor: Theme.of(context).colorScheme.error,
|
||||
textColor: Theme.of(context).colorScheme.error,
|
||||
onAction: onRetry,
|
||||
actionLabel: retryLabel ?? 'Retry',
|
||||
actionIcon: Symbols.refresh_rounded,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -55,8 +55,7 @@ abstract class BaseLibraryTab<T> extends StatefulWidget {
|
||||
|
||||
/// State mixin that provides the common implementation for library tabs
|
||||
/// This preserves AutomaticKeepAliveClientMixin functionality
|
||||
abstract class BaseLibraryTabState<T, W extends BaseLibraryTab<T>>
|
||||
extends State<W>
|
||||
abstract class BaseLibraryTabState<T, W extends BaseLibraryTab<T>> extends State<W>
|
||||
with AutomaticKeepAliveClientMixin, Refreshable, LibraryTabStateMixin {
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
@@ -167,10 +166,7 @@ abstract class BaseLibraryTabState<T, W extends BaseLibraryTab<T>>
|
||||
// Don't auto-focus if suppressed (e.g., when navigating via tab bar)
|
||||
if (widget.suppressAutoFocus) return;
|
||||
|
||||
if (widget.isActive &&
|
||||
_hasLoadedData &&
|
||||
!_hasFocused &&
|
||||
_items.isNotEmpty) {
|
||||
if (widget.isActive && _hasLoadedData && !_hasFocused && _items.isNotEmpty) {
|
||||
_hasFocused = true;
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) {
|
||||
@@ -235,8 +231,7 @@ abstract class BaseLibraryTabState<T, W extends BaseLibraryTab<T>>
|
||||
emptyIcon: emptyIcon,
|
||||
emptyMessage: emptyMessage,
|
||||
onRetry: loadItems,
|
||||
builder: (items) =>
|
||||
RefreshIndicator(onRefresh: loadItems, child: buildContent(items)),
|
||||
builder: (items) => RefreshIndicator(onRefresh: loadItems, child: buildContent(items)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import '../../../../services/plex_client.dart';
|
||||
@@ -15,12 +16,10 @@ import '../../../mixins/library_tab_focus_mixin.dart';
|
||||
import '../folder_tree_view.dart';
|
||||
import '../filters_bottom_sheet.dart';
|
||||
import '../sort_bottom_sheet.dart';
|
||||
import '../empty_state_widget.dart';
|
||||
import '../error_state_widget.dart';
|
||||
import '../state_messages.dart';
|
||||
import '../../../services/storage_service.dart';
|
||||
import '../../../services/settings_service.dart' show ViewMode;
|
||||
import '../../../mixins/item_updatable.dart';
|
||||
import '../../../mixins/library_tab_state.dart';
|
||||
import '../../../i18n/strings.g.dart';
|
||||
import 'base_library_tab.dart';
|
||||
|
||||
@@ -42,9 +41,8 @@ class LibraryBrowseTab extends BaseLibraryTab<PlexMetadata> {
|
||||
State<LibraryBrowseTab> createState() => _LibraryBrowseTabState();
|
||||
}
|
||||
|
||||
class _LibraryBrowseTabState
|
||||
extends BaseLibraryTabState<PlexMetadata, LibraryBrowseTab>
|
||||
with ItemUpdatable, LibraryTabStateMixin, LibraryTabFocusMixin {
|
||||
class _LibraryBrowseTabState extends BaseLibraryTabState<PlexMetadata, LibraryBrowseTab>
|
||||
with ItemUpdatable, LibraryTabFocusMixin {
|
||||
@override
|
||||
PlexClient get client => getClientForLibrary();
|
||||
|
||||
@@ -80,9 +78,7 @@ class _LibraryBrowseTabState
|
||||
static const int _pageSize = 500;
|
||||
|
||||
// Focus nodes for filter chips
|
||||
final FocusNode _groupingChipFocusNode = FocusNode(
|
||||
debugLabel: 'grouping_chip',
|
||||
);
|
||||
final FocusNode _groupingChipFocusNode = FocusNode(debugLabel: 'grouping_chip');
|
||||
final FocusNode _filtersChipFocusNode = FocusNode(debugLabel: 'filters_chip');
|
||||
final FocusNode _sortChipFocusNode = FocusNode(debugLabel: 'sort_chip');
|
||||
|
||||
@@ -111,7 +107,7 @@ class _LibraryBrowseTabState
|
||||
|
||||
// Required abstract implementations from base class
|
||||
@override
|
||||
IconData get emptyIcon => Icons.folder_open;
|
||||
IconData get emptyIcon => Symbols.folder_open_rounded;
|
||||
|
||||
@override
|
||||
String get emptyMessage => t.libraries.thisLibraryIsEmpty;
|
||||
@@ -172,13 +168,9 @@ class _LibraryBrowseTabState
|
||||
final sorts = await client.getLibrarySorts(widget.library.key);
|
||||
|
||||
// Load saved preferences
|
||||
final savedFilters = storage.getLibraryFilters(
|
||||
sectionId: widget.library.globalKey,
|
||||
);
|
||||
final savedFilters = storage.getLibraryFilters(sectionId: widget.library.globalKey);
|
||||
final savedSort = storage.getLibrarySort(widget.library.globalKey);
|
||||
final savedGrouping = storage.getLibraryGrouping(
|
||||
widget.library.globalKey,
|
||||
);
|
||||
final savedGrouping = storage.getLibraryGrouping(widget.library.globalKey);
|
||||
|
||||
// Check if request was cancelled
|
||||
if (currentRequestId != _requestId) return;
|
||||
@@ -247,9 +239,7 @@ class _LibraryBrowseTabState
|
||||
|
||||
// Add sort
|
||||
if (_selectedSort != null) {
|
||||
filterParams['sort'] = _selectedSort!.getSortKey(
|
||||
descending: _isSortDescending,
|
||||
);
|
||||
filterParams['sort'] = _selectedSort!.getSortKey(descending: _isSortDescending);
|
||||
}
|
||||
|
||||
// Items are automatically tagged with server info by PlexClient
|
||||
@@ -365,35 +355,30 @@ class _LibraryBrowseTabState
|
||||
context: context,
|
||||
builder: (sheetContext) {
|
||||
final options = _getGroupingOptions();
|
||||
return ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: options.length,
|
||||
itemBuilder: (context, index) {
|
||||
final grouping = options[index];
|
||||
return RadioListTile<String>(
|
||||
title: Text(_getGroupingLabel(grouping)),
|
||||
value: grouping,
|
||||
groupValue: _selectedGrouping,
|
||||
onChanged: (value) async {
|
||||
if (value != null) {
|
||||
setState(() {
|
||||
_selectedGrouping = value;
|
||||
});
|
||||
return RadioGroup<String>(
|
||||
groupValue: _selectedGrouping,
|
||||
onChanged: (value) async {
|
||||
if (value == null) return;
|
||||
setState(() {
|
||||
_selectedGrouping = value;
|
||||
});
|
||||
|
||||
final storage = await StorageService.getInstance();
|
||||
await storage.saveLibraryGrouping(
|
||||
widget.library.globalKey,
|
||||
value,
|
||||
);
|
||||
final storage = await StorageService.getInstance();
|
||||
await storage.saveLibraryGrouping(widget.library.globalKey, value);
|
||||
|
||||
if (!sheetContext.mounted) return;
|
||||
if (!sheetContext.mounted || !mounted) return;
|
||||
|
||||
Navigator.pop(sheetContext);
|
||||
_loadItems();
|
||||
}
|
||||
},
|
||||
);
|
||||
Navigator.pop(sheetContext);
|
||||
_loadItems();
|
||||
},
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: options.length,
|
||||
itemBuilder: (context, index) {
|
||||
final grouping = options[index];
|
||||
return RadioListTile<String>(title: Text(_getGroupingLabel(grouping)), value: grouping);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -415,10 +400,7 @@ class _LibraryBrowseTabState
|
||||
|
||||
// Save filters to storage
|
||||
final storage = await StorageService.getInstance();
|
||||
await storage.saveLibraryFilters(
|
||||
filters,
|
||||
sectionId: widget.library.globalKey,
|
||||
);
|
||||
await storage.saveLibraryFilters(filters, sectionId: widget.library.globalKey);
|
||||
|
||||
_loadItems();
|
||||
},
|
||||
@@ -441,11 +423,7 @@ class _LibraryBrowseTabState
|
||||
});
|
||||
|
||||
StorageService.getInstance().then((storage) {
|
||||
storage.saveLibrarySort(
|
||||
widget.library.globalKey,
|
||||
sort.key,
|
||||
descending: descending,
|
||||
);
|
||||
storage.saveLibrarySort(widget.library.globalKey, sort.key, descending: descending);
|
||||
});
|
||||
|
||||
_loadItems();
|
||||
@@ -467,16 +445,9 @@ class _LibraryBrowseTabState
|
||||
}
|
||||
|
||||
/// Calculate the number of columns in the current grid based on screen width
|
||||
int _getGridColumnCount(
|
||||
BuildContext context,
|
||||
SettingsProvider settingsProvider,
|
||||
) {
|
||||
final screenWidth =
|
||||
MediaQuery.of(context).size.width - 16; // Subtract padding
|
||||
final maxCrossAxisExtent = GridSizeCalculator.getMaxCrossAxisExtent(
|
||||
context,
|
||||
settingsProvider.libraryDensity,
|
||||
);
|
||||
int _getGridColumnCount(BuildContext context, SettingsProvider settingsProvider) {
|
||||
final screenWidth = MediaQuery.of(context).size.width - 16; // Subtract padding
|
||||
final maxCrossAxisExtent = GridSizeCalculator.getMaxCrossAxisExtent(context, settingsProvider.libraryDensity);
|
||||
return (screenWidth / maxCrossAxisExtent).floor().clamp(1, 100);
|
||||
}
|
||||
|
||||
@@ -503,7 +474,7 @@ class _LibraryBrowseTabState
|
||||
// Grouping chip
|
||||
FocusableFilterChip(
|
||||
focusNode: _groupingChipFocusNode,
|
||||
icon: Icons.category,
|
||||
icon: Symbols.category_rounded,
|
||||
label: _getGroupingLabel(_selectedGrouping),
|
||||
onPressed: _showGroupingBottomSheet,
|
||||
onNavigateDown: _navigateToGrid,
|
||||
@@ -515,24 +486,21 @@ class _LibraryBrowseTabState
|
||||
if (_filters.isNotEmpty && _selectedGrouping != 'folders')
|
||||
FocusableFilterChip(
|
||||
focusNode: _filtersChipFocusNode,
|
||||
icon: Icons.filter_alt,
|
||||
icon: Symbols.filter_alt_rounded,
|
||||
label: _selectedFilters.isEmpty
|
||||
? t.libraries.filters
|
||||
: t.libraries.filtersWithCount(
|
||||
count: _selectedFilters.length,
|
||||
),
|
||||
: t.libraries.filtersWithCount(count: _selectedFilters.length),
|
||||
onPressed: _showFiltersBottomSheet,
|
||||
onNavigateDown: _navigateToGrid,
|
||||
onNavigateUp: widget.onBack,
|
||||
onBack: widget.onBack,
|
||||
),
|
||||
if (_filters.isNotEmpty && _selectedGrouping != 'folders')
|
||||
const SizedBox(width: 8),
|
||||
if (_filters.isNotEmpty && _selectedGrouping != 'folders') const SizedBox(width: 8),
|
||||
// Sort chip
|
||||
if (_sortOptions.isNotEmpty && _selectedGrouping != 'folders')
|
||||
FocusableFilterChip(
|
||||
focusNode: _sortChipFocusNode,
|
||||
icon: Icons.sort,
|
||||
icon: Symbols.sort_rounded,
|
||||
label: _selectedSort?.title ?? t.libraries.sort,
|
||||
onPressed: _showSortBottomSheet,
|
||||
onNavigateDown: _navigateToGrid,
|
||||
@@ -553,11 +521,7 @@ class _LibraryBrowseTabState
|
||||
Widget _buildContent() {
|
||||
// Show folder tree view when in folders mode
|
||||
if (_selectedGrouping == 'folders') {
|
||||
return FolderTreeView(
|
||||
libraryKey: widget.library.key,
|
||||
serverId: widget.library.serverId,
|
||||
onRefresh: updateItem,
|
||||
);
|
||||
return FolderTreeView(libraryKey: widget.library.key, serverId: widget.library.serverId, onRefresh: updateItem);
|
||||
}
|
||||
|
||||
if (isLoading && items.isEmpty) {
|
||||
@@ -567,25 +531,19 @@ class _LibraryBrowseTabState
|
||||
if (errorMessage != null && items.isEmpty) {
|
||||
return ErrorStateWidget(
|
||||
message: errorMessage!,
|
||||
icon: Icons.error_outline,
|
||||
icon: Symbols.error_outline_rounded,
|
||||
onRetry: _loadContent,
|
||||
retryLabel: t.common.retry,
|
||||
);
|
||||
}
|
||||
|
||||
if (items.isEmpty) {
|
||||
return EmptyStateWidget(
|
||||
message: t.libraries.thisLibraryIsEmpty,
|
||||
icon: Icons.folder_open,
|
||||
);
|
||||
return EmptyStateWidget(message: t.libraries.thisLibraryIsEmpty, icon: Symbols.folder_open_rounded);
|
||||
}
|
||||
|
||||
return NotificationListener<ScrollNotification>(
|
||||
onNotification: (notification) {
|
||||
if (notification.metrics.pixels >=
|
||||
notification.metrics.maxScrollExtent - 300 &&
|
||||
_hasMoreItems &&
|
||||
!isLoading) {
|
||||
if (notification.metrics.pixels >= notification.metrics.maxScrollExtent - 300 && _hasMoreItems && !isLoading) {
|
||||
_loadItems(loadMore: true);
|
||||
}
|
||||
return false;
|
||||
@@ -599,10 +557,7 @@ class _LibraryBrowseTabState
|
||||
}
|
||||
|
||||
/// Builds either a list or grid view based on the view mode
|
||||
Widget _buildItemsView(
|
||||
BuildContext context,
|
||||
SettingsProvider settingsProvider,
|
||||
) {
|
||||
Widget _buildItemsView(BuildContext context, SettingsProvider settingsProvider) {
|
||||
final itemCount = items.length + (_hasMoreItems && isLoading ? 1 : 0);
|
||||
|
||||
if (settingsProvider.viewMode == ViewMode.list) {
|
||||
@@ -610,23 +565,16 @@ class _LibraryBrowseTabState
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.all(8),
|
||||
itemCount: itemCount,
|
||||
itemBuilder: (context, index) =>
|
||||
_buildMediaCardItem(index, isFirstRow: index == 0),
|
||||
itemBuilder: (context, index) => _buildMediaCardItem(index, isFirstRow: index == 0),
|
||||
);
|
||||
} else {
|
||||
// In grid view, calculate columns and pass to item builder
|
||||
final columnCount = _getGridColumnCount(context, settingsProvider);
|
||||
return GridView.builder(
|
||||
padding: const EdgeInsets.all(8),
|
||||
gridDelegate: MediaGridDelegate.createDelegate(
|
||||
context: context,
|
||||
density: settingsProvider.libraryDensity,
|
||||
),
|
||||
gridDelegate: MediaGridDelegate.createDelegate(context: context, density: settingsProvider.libraryDensity),
|
||||
itemCount: itemCount,
|
||||
itemBuilder: (context, index) => _buildMediaCardItem(
|
||||
index,
|
||||
isFirstRow: _isFirstRow(index, columnCount),
|
||||
),
|
||||
itemBuilder: (context, index) => _buildMediaCardItem(index, isFirstRow: _isFirstRow(index, columnCount)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import '../../../models/plex_metadata.dart';
|
||||
import '../../../utils/library_refresh_notifier.dart';
|
||||
import '../../../widgets/focusable_media_card.dart';
|
||||
@@ -24,13 +25,12 @@ class LibraryCollectionsTab extends BaseLibraryTab<PlexMetadata> {
|
||||
State<LibraryCollectionsTab> createState() => _LibraryCollectionsTabState();
|
||||
}
|
||||
|
||||
class _LibraryCollectionsTabState
|
||||
extends LibraryGridTabState<PlexMetadata, LibraryCollectionsTab> {
|
||||
class _LibraryCollectionsTabState extends LibraryGridTabState<PlexMetadata, LibraryCollectionsTab> {
|
||||
@override
|
||||
String get focusNodeDebugLabel => 'collections_first_item';
|
||||
|
||||
@override
|
||||
IconData get emptyIcon => Icons.collections;
|
||||
IconData get emptyIcon => Symbols.collections_rounded;
|
||||
|
||||
@override
|
||||
String get emptyMessage => t.libraries.noCollections;
|
||||
@@ -39,8 +39,7 @@ class _LibraryCollectionsTabState
|
||||
String get errorContext => t.collections.title;
|
||||
|
||||
@override
|
||||
Stream<void>? getRefreshStream() =>
|
||||
LibraryRefreshNotifier().collectionsStream;
|
||||
Stream<void>? getRefreshStream() => LibraryRefreshNotifier().collectionsStream;
|
||||
|
||||
@override
|
||||
Future<List<PlexMetadata>> loadData() async {
|
||||
|
||||
@@ -8,8 +8,7 @@ import 'base_library_tab.dart';
|
||||
///
|
||||
/// Handles focus, item counting, and grid wiring so individual tabs only
|
||||
/// implement data loading and per-item rendering.
|
||||
abstract class LibraryGridTabState<T, W extends BaseLibraryTab<T>>
|
||||
extends BaseLibraryTabState<T, W>
|
||||
abstract class LibraryGridTabState<T, W extends BaseLibraryTab<T>> extends BaseLibraryTabState<T, W>
|
||||
with LibraryTabFocusMixin {
|
||||
/// Build a single grid item.
|
||||
Widget buildGridItem(BuildContext context, T item, int index);
|
||||
@@ -21,8 +20,7 @@ abstract class LibraryGridTabState<T, W extends BaseLibraryTab<T>>
|
||||
Widget buildContent(List<T> items) {
|
||||
return AdaptiveMediaGrid<T>(
|
||||
items: items,
|
||||
itemBuilder: (context, item, index) =>
|
||||
buildGridItem(context, item, index),
|
||||
itemBuilder: (context, item, index) => buildGridItem(context, item, index),
|
||||
onRefresh: loadItems,
|
||||
firstItemFocusNode: firstItemFocusNode,
|
||||
onBack: widget.onBack,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import '../../../models/plex_playlist.dart';
|
||||
import '../../../utils/library_refresh_notifier.dart';
|
||||
import '../../../widgets/focusable_media_card.dart';
|
||||
@@ -24,13 +25,12 @@ class LibraryPlaylistsTab extends BaseLibraryTab<PlexPlaylist> {
|
||||
State<LibraryPlaylistsTab> createState() => _LibraryPlaylistsTabState();
|
||||
}
|
||||
|
||||
class _LibraryPlaylistsTabState
|
||||
extends LibraryGridTabState<PlexPlaylist, LibraryPlaylistsTab> {
|
||||
class _LibraryPlaylistsTabState extends LibraryGridTabState<PlexPlaylist, LibraryPlaylistsTab> {
|
||||
@override
|
||||
String get focusNodeDebugLabel => 'playlists_first_item';
|
||||
|
||||
@override
|
||||
IconData get emptyIcon => Icons.playlist_play;
|
||||
IconData get emptyIcon => Symbols.playlist_play_rounded;
|
||||
|
||||
@override
|
||||
String get emptyMessage => t.playlists.noPlaylists;
|
||||
@@ -47,10 +47,7 @@ class _LibraryPlaylistsTabState
|
||||
final client = getClientForLibrary();
|
||||
|
||||
// Playlists are automatically tagged with server info by PlexClient
|
||||
return await client.getLibraryPlaylists(
|
||||
sectionId: widget.library.key,
|
||||
playlistType: 'video',
|
||||
);
|
||||
return await client.getLibraryPlaylists(sectionId: widget.library.key, playlistType: 'video');
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
|
||||
import '../../../../services/plex_client.dart';
|
||||
import '../../../i18n/strings.g.dart';
|
||||
@@ -24,9 +25,7 @@ class LibraryRecommendedTab extends BaseLibraryTab<PlexHub> {
|
||||
State<LibraryRecommendedTab> createState() => _LibraryRecommendedTabState();
|
||||
}
|
||||
|
||||
class _LibraryRecommendedTabState
|
||||
extends BaseLibraryTabState<PlexHub, LibraryRecommendedTab>
|
||||
with ItemUpdatable {
|
||||
class _LibraryRecommendedTabState extends BaseLibraryTabState<PlexHub, LibraryRecommendedTab> with ItemUpdatable {
|
||||
/// GlobalKeys for each hub section to enable vertical navigation
|
||||
final List<GlobalKey<HubSectionState>> _hubKeys = [];
|
||||
|
||||
@@ -37,9 +36,7 @@ class _LibraryRecommendedTabState
|
||||
void updateItemInLists(String ratingKey, PlexMetadata updatedMetadata) {
|
||||
// Update the item in any hub that contains it
|
||||
for (final hub in items) {
|
||||
final itemIndex = hub.items.indexWhere(
|
||||
(item) => item.ratingKey == ratingKey,
|
||||
);
|
||||
final itemIndex = hub.items.indexWhere((item) => item.ratingKey == ratingKey);
|
||||
if (itemIndex != -1) {
|
||||
hub.items[itemIndex] = updatedMetadata;
|
||||
}
|
||||
@@ -47,7 +44,7 @@ class _LibraryRecommendedTabState
|
||||
}
|
||||
|
||||
@override
|
||||
IconData get emptyIcon => Icons.recommend;
|
||||
IconData get emptyIcon => Symbols.recommend_rounded;
|
||||
|
||||
@override
|
||||
String get emptyMessage => t.libraries.noRecommendations;
|
||||
@@ -150,8 +147,7 @@ class _LibraryRecommendedTabState
|
||||
itemCount: items.length,
|
||||
itemBuilder: (context, index) {
|
||||
final hub = items[index];
|
||||
final isContinueWatching =
|
||||
hub.hubIdentifier == '_library_continue_watching_';
|
||||
final isContinueWatching = hub.hubIdentifier == '_library_continue_watching_';
|
||||
|
||||
return HubSection(
|
||||
key: index < _hubKeys.length ? _hubKeys[index] : null,
|
||||
@@ -159,11 +155,8 @@ class _LibraryRecommendedTabState
|
||||
icon: _getHubIcon(hub),
|
||||
isInContinueWatching: isContinueWatching,
|
||||
onRefresh: updateItem,
|
||||
onRemoveFromContinueWatching: isContinueWatching
|
||||
? _refreshContinueWatching
|
||||
: null,
|
||||
onVerticalNavigation: (isUp) =>
|
||||
_handleVerticalNavigation(index, isUp),
|
||||
onRemoveFromContinueWatching: isContinueWatching ? _refreshContinueWatching : null,
|
||||
onVerticalNavigation: (isUp) => _handleVerticalNavigation(index, isUp),
|
||||
onBack: widget.onBack,
|
||||
);
|
||||
},
|
||||
@@ -179,20 +172,20 @@ class _LibraryRecommendedTabState
|
||||
IconData _getHubIcon(PlexHub hub) {
|
||||
final title = hub.title.toLowerCase();
|
||||
if (title.contains('continue watching') || title.contains('on deck')) {
|
||||
return Icons.play_circle;
|
||||
return Symbols.play_circle_rounded;
|
||||
} else if (title.contains('recently') || title.contains('new')) {
|
||||
return Icons.fiber_new;
|
||||
return Symbols.fiber_new_rounded;
|
||||
} else if (title.contains('popular') || title.contains('trending')) {
|
||||
return Icons.trending_up;
|
||||
return Symbols.trending_up_rounded;
|
||||
} else if (title.contains('top') || title.contains('rated')) {
|
||||
return Icons.star;
|
||||
return Symbols.star_rounded;
|
||||
} else if (title.contains('recommended')) {
|
||||
return Icons.thumb_up;
|
||||
return Symbols.thumb_up_rounded;
|
||||
} else if (title.contains('unwatched')) {
|
||||
return Icons.visibility_off;
|
||||
return Symbols.visibility_off_rounded;
|
||||
} else if (title.contains('genre')) {
|
||||
return Icons.category;
|
||||
return Symbols.category_rounded;
|
||||
}
|
||||
return Icons.movie;
|
||||
return Symbols.movie_rounded;
|
||||
}
|
||||
}
|
||||
|
||||
+269
-89
@@ -2,16 +2,19 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../services/plex_client.dart';
|
||||
import '../i18n/strings.g.dart';
|
||||
import '../utils/app_logger.dart';
|
||||
import '../utils/provider_extensions.dart';
|
||||
import '../utils/platform_detector.dart';
|
||||
import '../utils/video_player_navigation.dart';
|
||||
import '../main.dart';
|
||||
import '../mixins/refreshable.dart';
|
||||
import '../navigation/navigation_tabs.dart';
|
||||
import '../providers/multi_server_provider.dart';
|
||||
import '../providers/server_state_provider.dart';
|
||||
import '../providers/hidden_libraries_provider.dart';
|
||||
import '../providers/playback_state_provider.dart';
|
||||
import '../services/offline_watch_sync_service.dart';
|
||||
import '../providers/offline_mode_provider.dart';
|
||||
import '../services/plex_auth_service.dart';
|
||||
import '../services/storage_service.dart';
|
||||
import '../utils/desktop_window_padding.dart';
|
||||
@@ -19,7 +22,10 @@ import '../widgets/side_navigation_rail.dart';
|
||||
import 'discover_screen.dart';
|
||||
import 'libraries/libraries_screen.dart';
|
||||
import 'search_screen.dart';
|
||||
import 'downloads/downloads_screen.dart';
|
||||
import 'settings/settings_screen.dart';
|
||||
import 'video_player_screen.dart';
|
||||
import '../watch_together/watch_together.dart';
|
||||
|
||||
/// Provides access to the main screen's focus control.
|
||||
class MainScreenFocusScope extends InheritedWidget {
|
||||
@@ -46,59 +52,72 @@ class MainScreenFocusScope extends InheritedWidget {
|
||||
}
|
||||
|
||||
class MainScreen extends StatefulWidget {
|
||||
final PlexClient client;
|
||||
final PlexClient? client;
|
||||
final bool isOfflineMode;
|
||||
|
||||
const MainScreen({super.key, required this.client});
|
||||
const MainScreen({super.key, this.client, this.isOfflineMode = false});
|
||||
|
||||
@override
|
||||
State<MainScreen> createState() => _MainScreenState();
|
||||
}
|
||||
|
||||
class _MainScreenState extends State<MainScreen> with RouteAware {
|
||||
int _currentIndex = 0;
|
||||
late int _currentIndex;
|
||||
String? _selectedLibraryGlobalKey;
|
||||
|
||||
late final List<Widget> _screens;
|
||||
/// Whether the app is in offline mode (no server connection)
|
||||
bool _isOffline = false;
|
||||
|
||||
/// Last selected online tab (restored when coming back online after an offline fallback)
|
||||
NavigationTabId? _lastOnlineTabId;
|
||||
|
||||
/// Whether we auto-switched to Downloads because the previous tab was unavailable offline
|
||||
bool _autoSwitchedToDownloads = false;
|
||||
|
||||
OfflineModeProvider? _offlineModeProvider;
|
||||
|
||||
late List<Widget> _screens;
|
||||
final GlobalKey<State<DiscoverScreen>> _discoverKey = GlobalKey();
|
||||
final GlobalKey<State<LibrariesScreen>> _librariesKey = GlobalKey();
|
||||
final GlobalKey<State<SearchScreen>> _searchKey = GlobalKey();
|
||||
final GlobalKey<State<DownloadsScreen>> _downloadsKey = GlobalKey();
|
||||
final GlobalKey<State<SettingsScreen>> _settingsKey = GlobalKey();
|
||||
final GlobalKey<SideNavigationRailState> _sideNavKey = GlobalKey();
|
||||
|
||||
// Focus management for sidebar/content switching
|
||||
final FocusScopeNode _sidebarFocusScope = FocusScopeNode(
|
||||
debugLabel: 'Sidebar',
|
||||
);
|
||||
final FocusScopeNode _contentFocusScope = FocusScopeNode(
|
||||
debugLabel: 'Content',
|
||||
);
|
||||
final FocusScopeNode _sidebarFocusScope = FocusScopeNode(debugLabel: 'Sidebar');
|
||||
final FocusScopeNode _contentFocusScope = FocusScopeNode(debugLabel: 'Content');
|
||||
bool _isSidebarFocused = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_isOffline = widget.isOfflineMode;
|
||||
|
||||
_screens = [
|
||||
DiscoverScreen(
|
||||
key: _discoverKey,
|
||||
onBecameVisible: _onDiscoverBecameVisible,
|
||||
),
|
||||
LibrariesScreen(
|
||||
key: _librariesKey,
|
||||
onLibraryOrderChanged: _onLibraryOrderChanged,
|
||||
),
|
||||
SearchScreen(key: _searchKey),
|
||||
SettingsScreen(key: _settingsKey),
|
||||
];
|
||||
// Start on Downloads tab when in offline mode
|
||||
// In offline mode: visual index 0 = Downloads (screen 3), 1 = Settings (screen 4)
|
||||
// In online mode: indices match directly
|
||||
_currentIndex = _isOffline ? 0 : 0;
|
||||
_lastOnlineTabId = _isOffline ? null : NavigationTabId.discover;
|
||||
_autoSwitchedToDownloads = _isOffline;
|
||||
|
||||
// Set up data invalidation callback for profile switching
|
||||
_screens = _buildScreens(_isOffline);
|
||||
|
||||
// Set up Watch Together callbacks immediately (must be synchronous to catch early messages)
|
||||
if (!_isOffline) {
|
||||
_setupWatchTogetherCallback();
|
||||
}
|
||||
|
||||
// Set up data invalidation callback for profile switching (skip in offline mode)
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
// Initialize UserProfileProvider to ensure it's ready after sign-in
|
||||
final userProfileProvider = context.userProfile;
|
||||
await userProfileProvider.initialize();
|
||||
if (!_isOffline) {
|
||||
// Initialize UserProfileProvider to ensure it's ready after sign-in
|
||||
final userProfileProvider = context.userProfile;
|
||||
await userProfileProvider.initialize();
|
||||
|
||||
// Set up data invalidation callback for profile switching
|
||||
userProfileProvider.setDataInvalidationCallback(_invalidateAllScreens);
|
||||
// Set up data invalidation callback for profile switching
|
||||
userProfileProvider.setDataInvalidationCallback(_invalidateAllScreens);
|
||||
}
|
||||
|
||||
// Focus content initially (replaces autofocus which caused focus stealing issues)
|
||||
if (!_isSidebarFocused) {
|
||||
@@ -107,20 +126,179 @@ class _MainScreenState extends State<MainScreen> with RouteAware {
|
||||
});
|
||||
}
|
||||
|
||||
/// Set up the Watch Together navigation callback for guests
|
||||
void _setupWatchTogetherCallback() {
|
||||
try {
|
||||
final watchTogether = context.read<WatchTogetherProvider>();
|
||||
watchTogether.onMediaSwitched = (ratingKey, serverId, mediaTitle) async {
|
||||
appLogger.d('WatchTogether: Media switch received - navigating to $mediaTitle');
|
||||
await _navigateToWatchTogetherMedia(ratingKey, serverId);
|
||||
};
|
||||
watchTogether.onHostExitedPlayer = () {
|
||||
appLogger.d('WatchTogether: Host exited player - exiting player for guest');
|
||||
// Use rootNavigator to ensure we pop the video player even if nested
|
||||
if (!mounted) return;
|
||||
final navigator = Navigator.of(context, rootNavigator: true);
|
||||
bool isVideoPlayerOnTop = false;
|
||||
navigator.popUntil((route) {
|
||||
if (route.isCurrent) {
|
||||
isVideoPlayerOnTop = route.settings.name == kVideoPlayerRouteName;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (isVideoPlayerOnTop && navigator.canPop()) {
|
||||
navigator.pop();
|
||||
}
|
||||
};
|
||||
} catch (e) {
|
||||
appLogger.w('Could not set up Watch Together callback', error: e);
|
||||
}
|
||||
}
|
||||
|
||||
/// Navigate to media when host switches content in Watch Together session
|
||||
Future<void> _navigateToWatchTogetherMedia(String ratingKey, String serverId) async {
|
||||
if (!mounted) return; // Check before any context usage
|
||||
|
||||
try {
|
||||
final multiServer = context.read<MultiServerProvider>();
|
||||
final client = multiServer.getClientForServer(serverId);
|
||||
|
||||
if (client == null) {
|
||||
appLogger.w('WatchTogether: Server $serverId not available');
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetch the metadata for the new media
|
||||
final metadata = await client.getMetadataWithImages(ratingKey);
|
||||
|
||||
if (metadata == null || !mounted) return;
|
||||
|
||||
// Use push to preserve WatchTogetherScreen in navigation stack
|
||||
// VideoPlayerScreen handles its own replacement via onPlayerMediaSwitched
|
||||
Navigator.of(context, rootNavigator: true).push(
|
||||
MaterialPageRoute(
|
||||
settings: const RouteSettings(name: kVideoPlayerRouteName),
|
||||
builder: (_) => VideoPlayerScreen(metadata: metadata),
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
appLogger.e('WatchTogether: Failed to navigate to media', error: e);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
|
||||
// Listen for offline/online transitions to refresh navigation & screens
|
||||
// Note: We don't call _handleOfflineStatusChanged() immediately because
|
||||
// widget.isOfflineMode (from SetupScreen navigation) is authoritative for
|
||||
// initial state. The provider may not yet have received the server status
|
||||
// update due to initialization timing. The listener handles runtime changes.
|
||||
final provider = context.read<OfflineModeProvider?>();
|
||||
if (provider != null && provider != _offlineModeProvider) {
|
||||
_offlineModeProvider?.removeListener(_handleOfflineStatusChanged);
|
||||
_offlineModeProvider = provider;
|
||||
_offlineModeProvider!.addListener(_handleOfflineStatusChanged);
|
||||
}
|
||||
|
||||
routeObserver.subscribe(this, ModalRoute.of(context) as PageRoute);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
routeObserver.unsubscribe(this);
|
||||
_offlineModeProvider?.removeListener(_handleOfflineStatusChanged);
|
||||
_sidebarFocusScope.dispose();
|
||||
_contentFocusScope.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
List<Widget> _buildScreens(bool offline) {
|
||||
// In offline mode, only show Downloads and Settings
|
||||
// In online mode, show all 5 screens
|
||||
if (offline) {
|
||||
return [DownloadsScreen(key: _downloadsKey), SettingsScreen(key: _settingsKey)];
|
||||
}
|
||||
|
||||
return [
|
||||
DiscoverScreen(key: _discoverKey, onBecameVisible: _onDiscoverBecameVisible),
|
||||
LibrariesScreen(key: _librariesKey, onLibraryOrderChanged: _onLibraryOrderChanged),
|
||||
SearchScreen(key: _searchKey),
|
||||
DownloadsScreen(key: _downloadsKey),
|
||||
SettingsScreen(key: _settingsKey),
|
||||
];
|
||||
}
|
||||
|
||||
/// Normalize tab index when switching between offline/online modes.
|
||||
/// Preserves the current tab if it exists in the new mode, otherwise defaults to first tab.
|
||||
int _normalizeIndexForMode(int currentIndex, bool wasOffline, bool isOffline) {
|
||||
if (wasOffline == isOffline) return currentIndex;
|
||||
|
||||
final oldTabs = _getVisibleTabs(wasOffline);
|
||||
final newTabs = _getVisibleTabs(isOffline);
|
||||
|
||||
// Get the tab ID at the current index (or first tab if out of bounds)
|
||||
final currentTabId = currentIndex >= 0 && currentIndex < oldTabs.length
|
||||
? oldTabs[currentIndex].id
|
||||
: oldTabs.first.id;
|
||||
|
||||
// Find the same tab in the new mode's tab list
|
||||
final newIndex = newTabs.indexWhere((tab) => tab.id == currentTabId);
|
||||
return newIndex >= 0 ? newIndex : 0;
|
||||
}
|
||||
|
||||
void _handleOfflineStatusChanged() {
|
||||
final newOffline = _offlineModeProvider?.isOffline ?? widget.isOfflineMode;
|
||||
|
||||
if (newOffline == _isOffline) return;
|
||||
|
||||
final previousTabId = _tabIdForIndex(_isOffline, _currentIndex);
|
||||
final wasOffline = _isOffline;
|
||||
setState(() {
|
||||
_isOffline = newOffline;
|
||||
_screens = _buildScreens(_isOffline);
|
||||
_selectedLibraryGlobalKey = _isOffline ? null : _selectedLibraryGlobalKey;
|
||||
|
||||
if (_isOffline) {
|
||||
// Remember the online tab so we can restore it when reconnecting.
|
||||
if (!wasOffline) {
|
||||
_lastOnlineTabId = previousTabId;
|
||||
}
|
||||
|
||||
_currentIndex = _normalizeIndexForMode(_currentIndex, wasOffline, _isOffline);
|
||||
|
||||
// Track if we auto-switched to Downloads because the previous tab was unavailable.
|
||||
_autoSwitchedToDownloads =
|
||||
previousTabId != NavigationTabId.downloads &&
|
||||
_tabIdForIndex(true, _currentIndex) == NavigationTabId.downloads;
|
||||
} else {
|
||||
// Coming back online: restore the last online tab if we forced a switch to Downloads.
|
||||
if (_autoSwitchedToDownloads) {
|
||||
final restoredTab = _lastOnlineTabId ?? NavigationTabId.discover;
|
||||
final restoredIndex = NavigationTab.indexFor(restoredTab, isOffline: _isOffline);
|
||||
_currentIndex = restoredIndex >= 0 ? restoredIndex : 0;
|
||||
} else {
|
||||
_currentIndex = _normalizeIndexForMode(_currentIndex, wasOffline, _isOffline);
|
||||
}
|
||||
_autoSwitchedToDownloads = false;
|
||||
}
|
||||
});
|
||||
|
||||
// Refresh sidebar focus after rebuilding navigation
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_sideNavKey.currentState?.focusActiveItem();
|
||||
});
|
||||
|
||||
// Ensure profile provider is initialized when coming back online
|
||||
if (!_isOffline) {
|
||||
final userProfileProvider = context.userProfile;
|
||||
userProfileProvider.initialize().then((_) {
|
||||
userProfileProvider.setDataInvalidationCallback(_invalidateAllScreens);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void _focusSidebar() {
|
||||
setState(() => _isSidebarFocused = true);
|
||||
_sidebarFocusScope.requestFocus();
|
||||
@@ -136,9 +314,8 @@ class _MainScreenState extends State<MainScreen> with RouteAware {
|
||||
// When content regains focus while on Libraries, retry focusing the active tab
|
||||
if (_currentIndex == 1) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
final librariesState = _librariesKey.currentState;
|
||||
if (librariesState != null) {
|
||||
(librariesState as dynamic).focusActiveTabIfReady();
|
||||
if (_librariesKey.currentState case final FocusableTab focusable) {
|
||||
focusable.focusActiveTabIfReady();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -169,7 +346,7 @@ class _MainScreenState extends State<MainScreen> with RouteAware {
|
||||
@override
|
||||
void didPush() {
|
||||
// Called when this route has been pushed (initial navigation)
|
||||
if (_currentIndex == 0) {
|
||||
if (_currentIndex == 0 && !_isOffline) {
|
||||
_onDiscoverBecameVisible();
|
||||
}
|
||||
}
|
||||
@@ -177,7 +354,7 @@ class _MainScreenState extends State<MainScreen> with RouteAware {
|
||||
@override
|
||||
void didPopNext() {
|
||||
// Called when returning to this route from a child route (e.g., from video player)
|
||||
if (_currentIndex == 0) {
|
||||
if (_currentIndex == 0 && !_isOffline) {
|
||||
_onDiscoverBecameVisible();
|
||||
}
|
||||
}
|
||||
@@ -199,9 +376,7 @@ class _MainScreenState extends State<MainScreen> with RouteAware {
|
||||
/// Invalidate all cached data across all screens when profile is switched
|
||||
/// Receives the list of servers with new profile tokens for reconnection
|
||||
Future<void> _invalidateAllScreens(List<PlexServer> servers) async {
|
||||
appLogger.d(
|
||||
'Invalidating all screen data due to profile switch with ${servers.length} servers',
|
||||
);
|
||||
appLogger.d('Invalidating all screen data due to profile switch with ${servers.length} servers');
|
||||
|
||||
// Get all providers
|
||||
final multiServerProvider = context.read<MultiServerProvider>();
|
||||
@@ -214,13 +389,14 @@ class _MainScreenState extends State<MainScreen> with RouteAware {
|
||||
final storage = await StorageService.getInstance();
|
||||
final clientId = storage.getClientIdentifier();
|
||||
|
||||
final connectedCount = await multiServerProvider.reconnectWithServers(
|
||||
servers,
|
||||
clientIdentifier: clientId,
|
||||
);
|
||||
appLogger.d(
|
||||
'Reconnected to $connectedCount/${servers.length} servers after profile switch',
|
||||
);
|
||||
final connectedCount = await multiServerProvider.reconnectWithServers(servers, clientIdentifier: clientId);
|
||||
appLogger.d('Reconnected to $connectedCount/${servers.length} servers after profile switch');
|
||||
|
||||
// Trigger watch state sync now that servers are connected
|
||||
if (connectedCount > 0) {
|
||||
if (!mounted) return;
|
||||
context.read<OfflineWatchSyncService>().onServersConnected();
|
||||
}
|
||||
}
|
||||
|
||||
// Reset other provider states
|
||||
@@ -231,21 +407,18 @@ class _MainScreenState extends State<MainScreen> with RouteAware {
|
||||
appLogger.d('Cleared all provider states for profile switch');
|
||||
|
||||
// Full refresh discover screen (reload all content for new profile)
|
||||
final discoverState = _discoverKey.currentState;
|
||||
if (discoverState != null) {
|
||||
(discoverState as dynamic).fullRefresh();
|
||||
if (_discoverKey.currentState case final FullRefreshable refreshable) {
|
||||
refreshable.fullRefresh();
|
||||
}
|
||||
|
||||
// Full refresh libraries screen (clear filters and reload for new profile)
|
||||
final librariesState = _librariesKey.currentState;
|
||||
if (librariesState != null) {
|
||||
(librariesState as dynamic).fullRefresh();
|
||||
if (_librariesKey.currentState case final FullRefreshable refreshable) {
|
||||
refreshable.fullRefresh();
|
||||
}
|
||||
|
||||
// Full refresh search screen (clear search for new profile)
|
||||
final searchState = _searchKey.currentState;
|
||||
if (searchState != null) {
|
||||
(searchState as dynamic).fullRefresh();
|
||||
if (_searchKey.currentState case final FullRefreshable refreshable) {
|
||||
refreshable.fullRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,23 +426,31 @@ class _MainScreenState extends State<MainScreen> with RouteAware {
|
||||
final previousIndex = _currentIndex;
|
||||
setState(() {
|
||||
_currentIndex = index;
|
||||
if (!_isOffline) {
|
||||
_lastOnlineTabId = _tabIdForIndex(false, index);
|
||||
} else if (previousIndex != index) {
|
||||
// User made an explicit offline selection, so don't auto-restore later.
|
||||
_autoSwitchedToDownloads = false;
|
||||
}
|
||||
});
|
||||
|
||||
// Skip screen-specific logic in offline mode (only Downloads and Settings available)
|
||||
if (_isOffline) return;
|
||||
|
||||
// Notify discover screen when it becomes visible via tab switch
|
||||
if (index == 0) {
|
||||
_onDiscoverBecameVisible();
|
||||
}
|
||||
// Ensure the libraries screen applies focus when brought into view
|
||||
if (index == 1 && previousIndex != 1) {
|
||||
final librariesState = _librariesKey.currentState;
|
||||
if (librariesState != null) {
|
||||
(librariesState as dynamic).focusActiveTabIfReady();
|
||||
if (_librariesKey.currentState case final FocusableTab focusable) {
|
||||
focusable.focusActiveTabIfReady();
|
||||
}
|
||||
}
|
||||
// Focus search input when selecting Search tab
|
||||
if (index == 2) {
|
||||
final searchState = _searchKey.currentState;
|
||||
if (searchState != null) {
|
||||
(searchState as dynamic).focusSearchInput();
|
||||
if (_searchKey.currentState case final SearchInputFocusable searchable) {
|
||||
searchable.focusSearchInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,13 +460,35 @@ class _MainScreenState extends State<MainScreen> with RouteAware {
|
||||
setState(() {
|
||||
_selectedLibraryGlobalKey = libraryGlobalKey;
|
||||
_currentIndex = 1; // Switch to Libraries tab
|
||||
if (!_isOffline) {
|
||||
_lastOnlineTabId = NavigationTabId.libraries;
|
||||
}
|
||||
});
|
||||
// Tell LibrariesScreen to load this library
|
||||
final librariesState = _librariesKey.currentState;
|
||||
if (librariesState != null) {
|
||||
(librariesState as dynamic).loadLibraryByKey(libraryGlobalKey);
|
||||
(librariesState as dynamic).focusActiveTabIfReady();
|
||||
if (_librariesKey.currentState case final LibraryLoadable loadable) {
|
||||
loadable.loadLibraryByKey(libraryGlobalKey);
|
||||
}
|
||||
if (_librariesKey.currentState case final FocusableTab focusable) {
|
||||
focusable.focusActiveTabIfReady();
|
||||
}
|
||||
}
|
||||
|
||||
/// Get navigation tabs filtered by offline mode
|
||||
List<NavigationTab> _getVisibleTabs(bool isOffline) {
|
||||
return NavigationTab.getVisibleTabs(isOffline: isOffline);
|
||||
}
|
||||
|
||||
/// Get the tab ID for a given index, clamping to the available range.
|
||||
NavigationTabId _tabIdForIndex(bool isOffline, int index) {
|
||||
final tabs = _getVisibleTabs(isOffline);
|
||||
if (tabs.isEmpty) return NavigationTabId.discover;
|
||||
final safeIndex = index.clamp(0, tabs.length - 1).toInt();
|
||||
return tabs[safeIndex].id;
|
||||
}
|
||||
|
||||
/// Build navigation destinations for bottom navigation bar.
|
||||
List<NavigationDestination> _buildNavDestinations(bool isOffline) {
|
||||
return _getVisibleTabs(isOffline).map((tab) => tab.toDestination()).toList();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -315,6 +518,7 @@ class _MainScreenState extends State<MainScreen> with RouteAware {
|
||||
key: _sideNavKey,
|
||||
selectedIndex: _currentIndex,
|
||||
selectedLibraryKey: _selectedLibraryGlobalKey,
|
||||
isOfflineMode: _isOffline,
|
||||
onDestinationSelected: (index) {
|
||||
_selectTab(index);
|
||||
_focusContent();
|
||||
@@ -330,10 +534,7 @@ class _MainScreenState extends State<MainScreen> with RouteAware {
|
||||
node: _contentFocusScope,
|
||||
// No autofocus - we control focus programmatically to prevent
|
||||
// autofocus from stealing focus back after setState() rebuilds
|
||||
child: IndexedStack(
|
||||
index: _currentIndex,
|
||||
children: _screens,
|
||||
),
|
||||
child: IndexedStack(index: _currentIndex, children: _screens),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -349,28 +550,7 @@ class _MainScreenState extends State<MainScreen> with RouteAware {
|
||||
bottomNavigationBar: NavigationBar(
|
||||
selectedIndex: _currentIndex,
|
||||
onDestinationSelected: _selectTab,
|
||||
destinations: [
|
||||
NavigationDestination(
|
||||
icon: const Icon(Icons.home_outlined),
|
||||
selectedIcon: const Icon(Icons.home),
|
||||
label: t.navigation.home,
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: const Icon(Icons.video_library_outlined),
|
||||
selectedIcon: const Icon(Icons.video_library),
|
||||
label: t.navigation.libraries,
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: const Icon(Icons.search),
|
||||
selectedIcon: const Icon(Icons.search),
|
||||
label: t.navigation.search,
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: const Icon(Icons.settings_outlined),
|
||||
selectedIcon: const Icon(Icons.settings),
|
||||
label: t.navigation.settings,
|
||||
),
|
||||
],
|
||||
destinations: _buildNavDestinations(_isOffline),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
+1181
-870
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plezy/widgets/app_icon.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import '../../services/plex_client.dart';
|
||||
import '../../services/play_queue_launcher.dart';
|
||||
import '../../models/plex_playlist.dart';
|
||||
@@ -22,8 +24,7 @@ class PlaylistDetailScreen extends StatefulWidget {
|
||||
State<PlaylistDetailScreen> createState() => _PlaylistDetailScreenState();
|
||||
}
|
||||
|
||||
class _PlaylistDetailScreenState
|
||||
extends BaseMediaListDetailScreen<PlaylistDetailScreen>
|
||||
class _PlaylistDetailScreenState extends BaseMediaListDetailScreen<PlaylistDetailScreen>
|
||||
with StandardItemLoader<PlaylistDetailScreen> {
|
||||
@override
|
||||
dynamic get mediaItem => widget.playlist;
|
||||
@@ -35,7 +36,7 @@ class _PlaylistDetailScreenState
|
||||
String get emptyMessage => t.playlists.emptyPlaylist;
|
||||
|
||||
@override
|
||||
IconData get emptyIcon => Icons.playlist_play;
|
||||
IconData get emptyIcon => Symbols.playlist_play_rounded;
|
||||
|
||||
@override
|
||||
Future<List<PlexMetadata>> fetchItems() async {
|
||||
@@ -64,14 +65,10 @@ class _PlaylistDetailScreenState
|
||||
|
||||
if (mounted) {
|
||||
if (success) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(t.playlists.deleted)));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(t.playlists.deleted)));
|
||||
Navigator.pop(context); // Return to playlists screen
|
||||
} else {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(t.playlists.errorDeleting)));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(t.playlists.errorDeleting)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,9 +89,7 @@ class _PlaylistDetailScreenState
|
||||
if (movedItem.playlistItemID == null) {
|
||||
appLogger.e('Cannot reorder: item missing playlistItemID');
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(t.playlists.errorReordering)));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(t.playlists.errorReordering)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -110,18 +105,14 @@ class _PlaylistDetailScreenState
|
||||
if (afterItem.playlistItemID == null) {
|
||||
appLogger.e('Cannot reorder: after item missing playlistItemID');
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(t.playlists.errorReordering)));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(t.playlists.errorReordering)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
afterPlaylistItemId = afterItem.playlistItemID!;
|
||||
}
|
||||
|
||||
appLogger.d(
|
||||
'Reordering item from $oldIndex to $newIndex (after ID: $afterPlaylistItemId)',
|
||||
);
|
||||
appLogger.d('Reordering item from $oldIndex to $newIndex (after ID: $afterPlaylistItemId)');
|
||||
|
||||
// Optimistically update UI
|
||||
setState(() {
|
||||
@@ -145,9 +136,7 @@ class _PlaylistDetailScreenState
|
||||
items.insert(oldIndex, item);
|
||||
});
|
||||
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(t.playlists.errorReordering)));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(t.playlists.errorReordering)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -159,16 +148,12 @@ class _PlaylistDetailScreenState
|
||||
if (item.playlistItemID == null) {
|
||||
appLogger.e('Cannot remove: item missing playlistItemID');
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(t.playlists.errorRemoving)));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(t.playlists.errorRemoving)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
appLogger.d(
|
||||
'Removing item ${item.title} (playlistItemID: ${item.playlistItemID}) from playlist',
|
||||
);
|
||||
appLogger.d('Removing item ${item.title} (playlistItemID: ${item.playlistItemID}) from playlist');
|
||||
|
||||
// Optimistically update UI
|
||||
setState(() {
|
||||
@@ -183,9 +168,7 @@ class _PlaylistDetailScreenState
|
||||
|
||||
if (mounted) {
|
||||
if (success) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(t.playlists.itemRemoved)));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(t.playlists.itemRemoved)));
|
||||
} else {
|
||||
// Revert on failure
|
||||
appLogger.e('Failed to remove playlist item, reverting UI');
|
||||
@@ -193,9 +176,7 @@ class _PlaylistDetailScreenState
|
||||
items.insert(index, item);
|
||||
});
|
||||
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(t.playlists.errorRemoving)));
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(t.playlists.errorRemoving)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,15 +212,11 @@ class _PlaylistDetailScreenState
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.auto_awesome, size: 12, color: Colors.blue[300]),
|
||||
AppIcon(Symbols.auto_awesome_rounded, fill: 1, size: 12, color: Colors.blue[300]),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
t.playlists.smartPlaylist,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: Colors.blue[300],
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
style: TextStyle(fontSize: 11, color: Colors.blue[300], fontWeight: FontWeight.normal),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plezy/widgets/app_icon.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import '../../services/plex_client.dart';
|
||||
import '../../models/plex_metadata.dart';
|
||||
import '../../utils/duration_formatter.dart';
|
||||
import '../../utils/formatters.dart';
|
||||
import '../../utils/provider_extensions.dart';
|
||||
import '../../i18n/strings.g.dart';
|
||||
import '../../widgets/media_context_menu.dart';
|
||||
import '../../widgets/media_progress_bar.dart';
|
||||
import '../../widgets/plex_optimized_image.dart';
|
||||
|
||||
/// Custom list item widget for playlist items
|
||||
@@ -56,7 +59,7 @@ class _PlaylistItemCardState extends State<PlaylistItemCard> {
|
||||
index: widget.index,
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.only(right: 12),
|
||||
child: Icon(Icons.drag_indicator, color: Colors.grey),
|
||||
child: AppIcon(Symbols.drag_indicator_rounded, fill: 1, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -74,10 +77,7 @@ class _PlaylistItemCardState extends State<PlaylistItemCard> {
|
||||
// Title
|
||||
Text(
|
||||
item.displayTitle,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w500),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
@@ -96,14 +96,7 @@ class _PlaylistItemCardState extends State<PlaylistItemCard> {
|
||||
if (item.viewOffset != null && item.duration != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 6),
|
||||
child: LinearProgressIndicator(
|
||||
value: item.viewOffset! / item.duration!,
|
||||
backgroundColor: Colors.grey[800],
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
minHeight: 3,
|
||||
),
|
||||
child: MediaProgressBar(viewOffset: item.viewOffset!, duration: item.duration!, minHeight: 3),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -113,16 +106,13 @@ class _PlaylistItemCardState extends State<PlaylistItemCard> {
|
||||
|
||||
// Duration
|
||||
if (item.duration != null)
|
||||
Text(
|
||||
formatDurationTextual(item.duration!),
|
||||
style: TextStyle(fontSize: 13, color: Colors.grey[400]),
|
||||
),
|
||||
Text(formatDurationTextual(item.duration!), style: TextStyle(fontSize: 13, color: Colors.grey[400])),
|
||||
|
||||
const SizedBox(width: 8),
|
||||
|
||||
// Remove button
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close, size: 20),
|
||||
icon: const AppIcon(Symbols.close_rounded, fill: 1, size: 20),
|
||||
onPressed: widget.onRemove,
|
||||
tooltip: t.playlists.removeItem,
|
||||
color: Colors.grey[400],
|
||||
@@ -160,11 +150,8 @@ class _PlaylistItemCardState extends State<PlaylistItemCard> {
|
||||
return Container(
|
||||
width: 60,
|
||||
height: 90,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[850],
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: const Icon(Icons.movie, color: Colors.grey, size: 24),
|
||||
decoration: BoxDecoration(color: Colors.grey[850], borderRadius: BorderRadius.circular(6)),
|
||||
child: const AppIcon(Symbols.movie_rounded, fill: 1, color: Colors.grey, size: 24),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plezy/widgets/app_icon.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import '../../i18n/strings.g.dart';
|
||||
|
||||
@@ -13,8 +15,7 @@ class PinEntryDialog extends StatefulWidget {
|
||||
State<PinEntryDialog> createState() => _PinEntryDialogState();
|
||||
}
|
||||
|
||||
class _PinEntryDialogState extends State<PinEntryDialog>
|
||||
with SingleTickerProviderStateMixin {
|
||||
class _PinEntryDialogState extends State<PinEntryDialog> with SingleTickerProviderStateMixin {
|
||||
final _pinController = TextEditingController();
|
||||
final _focusNode = FocusNode();
|
||||
bool _obscureText = true;
|
||||
@@ -26,22 +27,16 @@ class _PinEntryDialogState extends State<PinEntryDialog>
|
||||
super.initState();
|
||||
|
||||
// Setup shake animation
|
||||
_shakeController = AnimationController(
|
||||
duration: const Duration(milliseconds: 600),
|
||||
vsync: this,
|
||||
);
|
||||
_shakeController = AnimationController(duration: const Duration(milliseconds: 600), vsync: this);
|
||||
|
||||
// Create a shake effect that oscillates
|
||||
_shakeAnimation =
|
||||
TweenSequence<double>([
|
||||
TweenSequenceItem(tween: Tween(begin: 0.0, end: 10.0), weight: 1),
|
||||
TweenSequenceItem(tween: Tween(begin: 10.0, end: -10.0), weight: 1),
|
||||
TweenSequenceItem(tween: Tween(begin: -10.0, end: 10.0), weight: 1),
|
||||
TweenSequenceItem(tween: Tween(begin: 10.0, end: -10.0), weight: 1),
|
||||
TweenSequenceItem(tween: Tween(begin: -10.0, end: 0.0), weight: 1),
|
||||
]).animate(
|
||||
CurvedAnimation(parent: _shakeController, curve: Curves.easeInOut),
|
||||
);
|
||||
_shakeAnimation = TweenSequence<double>([
|
||||
TweenSequenceItem(tween: Tween(begin: 0.0, end: 10.0), weight: 1),
|
||||
TweenSequenceItem(tween: Tween(begin: 10.0, end: -10.0), weight: 1),
|
||||
TweenSequenceItem(tween: Tween(begin: -10.0, end: 10.0), weight: 1),
|
||||
TweenSequenceItem(tween: Tween(begin: 10.0, end: -10.0), weight: 1),
|
||||
TweenSequenceItem(tween: Tween(begin: -10.0, end: 0.0), weight: 1),
|
||||
]).animate(CurvedAnimation(parent: _shakeController, curve: Curves.easeInOut));
|
||||
|
||||
// Auto-focus the PIN field when dialog opens
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
@@ -78,23 +73,14 @@ class _PinEntryDialogState extends State<PinEntryDialog>
|
||||
return AnimatedBuilder(
|
||||
animation: _shakeAnimation,
|
||||
builder: (context, child) {
|
||||
return Transform.translate(
|
||||
offset: Offset(_shakeAnimation.value, 0),
|
||||
child: child,
|
||||
);
|
||||
return Transform.translate(offset: Offset(_shakeAnimation.value, 0), child: child);
|
||||
},
|
||||
child: AlertDialog(
|
||||
title: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.lock_outline,
|
||||
size: 24,
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
AppIcon(Symbols.lock_outline_rounded, fill: 1, size: 24, color: theme.colorScheme.primary),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text(widget.userName, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
Expanded(child: Text(widget.userName, overflow: TextOverflow.ellipsis)),
|
||||
],
|
||||
),
|
||||
content: Column(
|
||||
@@ -106,18 +92,16 @@ class _PinEntryDialogState extends State<PinEntryDialog>
|
||||
focusNode: _focusNode,
|
||||
obscureText: _obscureText,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.digitsOnly,
|
||||
LengthLimitingTextInputFormatter(10),
|
||||
],
|
||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly, LengthLimitingTextInputFormatter(10)],
|
||||
decoration: InputDecoration(
|
||||
hintText: t.pinEntry.enterPin,
|
||||
border: const OutlineInputBorder(),
|
||||
errorText: widget.errorMessage,
|
||||
errorMaxLines: 2,
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
_obscureText ? Icons.visibility_off : Icons.visibility,
|
||||
icon: AppIcon(
|
||||
_obscureText ? Symbols.visibility_off_rounded : Symbols.visibility_rounded,
|
||||
fill: 1,
|
||||
size: 20,
|
||||
),
|
||||
onPressed: () {
|
||||
@@ -125,9 +109,7 @@ class _PinEntryDialogState extends State<PinEntryDialog>
|
||||
_obscureText = !_obscureText;
|
||||
});
|
||||
},
|
||||
tooltip: _obscureText
|
||||
? t.pinEntry.showPin
|
||||
: t.pinEntry.hidePin,
|
||||
tooltip: _obscureText ? t.pinEntry.showPin : t.pinEntry.hidePin,
|
||||
),
|
||||
),
|
||||
onSubmitted: (_) => _submit(),
|
||||
@@ -135,10 +117,7 @@ class _PinEntryDialogState extends State<PinEntryDialog>
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(null),
|
||||
child: Text(t.common.cancel),
|
||||
),
|
||||
TextButton(onPressed: () => Navigator.of(context).pop(null), child: Text(t.common.cancel)),
|
||||
FilledButton(onPressed: _submit, child: Text(t.common.submit)),
|
||||
],
|
||||
),
|
||||
@@ -147,15 +126,10 @@ class _PinEntryDialogState extends State<PinEntryDialog>
|
||||
}
|
||||
|
||||
/// Shows the PIN entry dialog and returns the entered PIN, or null if cancelled
|
||||
Future<String?> showPinEntryDialog(
|
||||
BuildContext context,
|
||||
String userName, {
|
||||
String? errorMessage,
|
||||
}) {
|
||||
Future<String?> showPinEntryDialog(BuildContext context, String userName, {String? errorMessage}) {
|
||||
return showDialog<String>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) =>
|
||||
PinEntryDialog(userName: userName, errorMessage: errorMessage),
|
||||
builder: (context) => PinEntryDialog(userName: userName, errorMessage: errorMessage),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plezy/widgets/app_icon.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import '../../i18n/strings.g.dart';
|
||||
import '../../models/plex_home_user.dart';
|
||||
import '../../theme/mono_tokens.dart';
|
||||
import 'user_avatar_widget.dart';
|
||||
|
||||
enum UserAttribute { admin, restricted, protected }
|
||||
@@ -26,15 +29,13 @@ class ProfileListTile extends StatelessWidget {
|
||||
return ListTile(
|
||||
leading: UserAvatarWidget(user: user, size: 40, showIndicators: false),
|
||||
title: Text(user.displayName),
|
||||
subtitle: _hasUserAttributes()
|
||||
? Row(children: _buildUserAttributes(theme))
|
||||
: null,
|
||||
subtitle: _hasUserAttributes() ? Row(children: _buildUserAttributes(theme)) : null,
|
||||
trailing: isCurrentUser
|
||||
? Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primary,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(tokens(context).radiusMd),
|
||||
),
|
||||
child: Text(
|
||||
t.userStatus.current,
|
||||
@@ -46,7 +47,7 @@ class ProfileListTile extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
)
|
||||
: (showTrailingIcon ? const Icon(Icons.chevron_right) : null),
|
||||
: (showTrailingIcon ? const AppIcon(Symbols.chevron_right_rounded, fill: 1) : null),
|
||||
onTap: isCurrentUser ? null : onTap,
|
||||
enabled: !isCurrentUser,
|
||||
);
|
||||
@@ -76,13 +77,7 @@ class ProfileListTile extends StatelessWidget {
|
||||
if (i > 0) {
|
||||
attributes.addAll([
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'•',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: theme.colorScheme.onSurface.withValues(alpha: 0.5),
|
||||
),
|
||||
),
|
||||
Text('•', style: TextStyle(fontSize: 12, color: theme.colorScheme.onSurface.withValues(alpha: 0.5))),
|
||||
const SizedBox(width: 8),
|
||||
]);
|
||||
}
|
||||
@@ -92,11 +87,7 @@ class ProfileListTile extends StatelessWidget {
|
||||
attributes.add(
|
||||
Text(
|
||||
_getAttributeLabel(attribute),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: _getAttributeColor(attribute, theme),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
style: TextStyle(fontSize: 12, color: _getAttributeColor(attribute, theme), fontWeight: FontWeight.w500),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user