mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
Init repo
This commit is contained in:
commit
764b6034e3
566 changed files with 212335 additions and 0 deletions
75
lib/models/syncing/i_synced_item.dart
Normal file
75
lib/models/syncing/i_synced_item.dart
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:fladder/models/syncing/sync_item.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
|
||||
part 'i_synced_item.g.dart';
|
||||
|
||||
// extension IsarExtensions on String? {
|
||||
// int get fastHash {
|
||||
// if (this == null) return 0;
|
||||
// var hash = 0xcbf29ce484222325;
|
||||
|
||||
// var i = 0;
|
||||
// while (i < this!.length) {
|
||||
// final codeUnit = this!.codeUnitAt(i++);
|
||||
// hash ^= codeUnit >> 8;
|
||||
// hash *= 0x100000001b3;
|
||||
// hash ^= codeUnit & 0xFF;
|
||||
// hash *= 0x100000001b3;
|
||||
// }
|
||||
|
||||
// return hash;
|
||||
// }
|
||||
// }
|
||||
|
||||
@collection
|
||||
class ISyncedItem {
|
||||
String? userId;
|
||||
String id;
|
||||
int? sortKey;
|
||||
String? parentId;
|
||||
String? path;
|
||||
int? fileSize;
|
||||
String? videoFileName;
|
||||
String? trickPlayModel;
|
||||
String? introOutroSkipModel;
|
||||
String? images;
|
||||
List<String>? chapters;
|
||||
List<String>? subtitles;
|
||||
String? userData;
|
||||
ISyncedItem({
|
||||
this.userId,
|
||||
required this.id,
|
||||
this.sortKey,
|
||||
this.parentId,
|
||||
this.path,
|
||||
this.fileSize,
|
||||
this.videoFileName,
|
||||
this.trickPlayModel,
|
||||
this.introOutroSkipModel,
|
||||
this.images,
|
||||
this.chapters,
|
||||
this.subtitles,
|
||||
this.userData,
|
||||
});
|
||||
|
||||
factory ISyncedItem.fromSynced(SyncedItem syncedItem, String? path) {
|
||||
return ISyncedItem(
|
||||
id: syncedItem.id,
|
||||
parentId: syncedItem.parentId,
|
||||
userId: syncedItem.userId,
|
||||
path: syncedItem.path?.replaceAll(path ?? "", '').substring(1),
|
||||
fileSize: syncedItem.fileSize,
|
||||
sortKey: syncedItem.sortKey,
|
||||
videoFileName: syncedItem.videoFileName,
|
||||
trickPlayModel: syncedItem.fTrickPlayModel != null ? jsonEncode(syncedItem.fTrickPlayModel?.toJson()) : null,
|
||||
introOutroSkipModel:
|
||||
syncedItem.introOutSkipModel != null ? jsonEncode(syncedItem.introOutSkipModel?.toJson()) : null,
|
||||
images: syncedItem.fImages != null ? jsonEncode(syncedItem.fImages?.toJson()) : null,
|
||||
chapters: syncedItem.fChapters.map((e) => jsonEncode(e.toJson())).toList(),
|
||||
subtitles: syncedItem.subtitles.map((e) => jsonEncode(e.toJson())).toList(),
|
||||
userData: syncedItem.userData != null ? jsonEncode(syncedItem.userData?.toJson()) : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue