mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-08 15:08:18 -07:00
feature: Improved sync capability
This commit is contained in:
parent
f3e920ac79
commit
c5c7f71b84
31 changed files with 500 additions and 344 deletions
|
|
@ -26,7 +26,6 @@ class CredentialsModel {
|
|||
Map<String, String> header(Ref ref) {
|
||||
final application = ref.read(applicationInfoProvider);
|
||||
final headers = {
|
||||
'content-type': 'application/json',
|
||||
'authorization':
|
||||
'MediaBrowser Token="$token", Client="${application.name}", Device="${application.os}", DeviceId="$deviceId", Version="${application.version}"'
|
||||
};
|
||||
|
|
|
|||
|
|
@ -74,6 +74,9 @@ class SeasonModel extends ItemBaseModel with SeasonModelMappable {
|
|||
episodes.firstWhereOrNull((element) => element.userData.played == false);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get syncAble => true;
|
||||
|
||||
@override
|
||||
ImagesData? get getPosters => images ?? parentImages;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ class ISyncedItem {
|
|||
String id;
|
||||
bool syncing;
|
||||
String? sortName;
|
||||
@Index()
|
||||
String? parentId;
|
||||
String? path;
|
||||
int? fileSize;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,16 @@ const ISyncedItemSchema = IsarGeneratedSchema(
|
|||
type: IsarType.string,
|
||||
),
|
||||
],
|
||||
indexes: [],
|
||||
indexes: [
|
||||
IsarIndexSchema(
|
||||
name: 'parentId',
|
||||
properties: [
|
||||
"parentId",
|
||||
],
|
||||
unique: false,
|
||||
hash: false,
|
||||
),
|
||||
],
|
||||
),
|
||||
converter: IsarObjectConverter<String, ISyncedItem>(
|
||||
serialize: serializeISyncedItem,
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ class SyncedItem with _$SyncedItem {
|
|||
}) = _SyncItem;
|
||||
|
||||
static String trickPlayPath = "TrickPlay";
|
||||
static String chaptersPath = "Chapters";
|
||||
|
||||
List<Chapter> get chapters => fChapters.map((e) => e.copyWith(imageUrl: joinAll({"$path", e.imageUrl}))).toList();
|
||||
|
||||
|
|
@ -94,6 +95,7 @@ class SyncedItem with _$SyncedItem {
|
|||
try {
|
||||
await videoFile.delete();
|
||||
await Directory(joinAll([directory.path, trickPlayPath])).delete(recursive: true);
|
||||
await Directory(joinAll([directory.path, chaptersPath])).delete(recursive: true);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue