mirror of
https://github.com/ente-io/ente.git
synced 2025-08-08 23:39:30 +00:00
fix: processing and display logic
This commit is contained in:
parent
330a3b4dea
commit
a72ae560c9
@ -1737,7 +1737,7 @@ class FilesDB {
|
|||||||
final db = await instance.sqliteAsyncDB;
|
final db = await instance.sqliteAsyncDB;
|
||||||
final results = await db.getAll(
|
final results = await db.getAll(
|
||||||
'''
|
'''
|
||||||
SELECT * FROM $filesTable WHERE $columnFileType = ? AND $columnCreationTime > ?
|
SELECT * FROM $filesTable WHERE $columnFileType = ? AND $columnCreationTime > ? AND $columnUploadedFileID != -1
|
||||||
''',
|
''',
|
||||||
[getInt(fileType), beginDate.millisecondsSinceEpoch],
|
[getInt(fileType), beginDate.millisecondsSinceEpoch],
|
||||||
);
|
);
|
||||||
|
@ -96,6 +96,7 @@ class PreviewVideoStore {
|
|||||||
final file = await getFile(enteFile, isOrigin: true);
|
final file = await getFile(enteFile, isOrigin: true);
|
||||||
if (file == null) return;
|
if (file == null) return;
|
||||||
|
|
||||||
|
try {
|
||||||
try {
|
try {
|
||||||
// check if playlist already exist
|
// check if playlist already exist
|
||||||
await getPlaylist(enteFile);
|
await getPlaylist(enteFile);
|
||||||
@ -294,7 +295,7 @@ class PreviewVideoStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Bus.instance.fire(PreviewUpdatedEvent(_items));
|
Bus.instance.fire(PreviewUpdatedEvent(_items));
|
||||||
|
} finally {
|
||||||
isUploading = false;
|
isUploading = false;
|
||||||
if (files.isNotEmpty) {
|
if (files.isNotEmpty) {
|
||||||
final file = files.first;
|
final file = files.first;
|
||||||
@ -302,6 +303,7 @@ class PreviewVideoStore {
|
|||||||
await chunkAndUploadVideo(ctx, file);
|
await chunkAndUploadVideo(ctx, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _reportVideoPreview(
|
Future<void> _reportVideoPreview(
|
||||||
EnteFile file,
|
EnteFile file,
|
||||||
@ -498,18 +500,8 @@ class PreviewVideoStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final allFiles = files
|
final allFiles = files
|
||||||
.where(
|
.where((file) => previewIds?[file.uploadedFileID] == null)
|
||||||
(file) =>
|
|
||||||
file.uploadedFileID != null &&
|
|
||||||
previewIds?[file.uploadedFileID] == null &&
|
|
||||||
file.fileType == FileType.video,
|
|
||||||
)
|
|
||||||
.toList();
|
.toList();
|
||||||
final file = allFiles.first;
|
|
||||||
allFiles.remove(file);
|
|
||||||
|
|
||||||
this.files.addAll(allFiles);
|
|
||||||
await chunkAndUploadVideo(null, file);
|
|
||||||
|
|
||||||
// set all video status to be in queue
|
// set all video status to be in queue
|
||||||
for (final file in allFiles) {
|
for (final file in allFiles) {
|
||||||
@ -519,5 +511,13 @@ class PreviewVideoStore {
|
|||||||
collectionID: file.collectionID ?? 0,
|
collectionID: file.collectionID ?? 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Bus.instance.fire(PreviewUpdatedEvent(_items));
|
||||||
|
|
||||||
|
final file = allFiles.first;
|
||||||
|
allFiles.remove(file);
|
||||||
|
|
||||||
|
this.files.addAll(allFiles);
|
||||||
|
|
||||||
|
await chunkAndUploadVideo(null, file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ class StatusBarWidget extends StatefulWidget {
|
|||||||
|
|
||||||
class _StatusBarWidgetState extends State<StatusBarWidget> {
|
class _StatusBarWidgetState extends State<StatusBarWidget> {
|
||||||
static final _logger = Logger("StatusBarWidget");
|
static final _logger = Logger("StatusBarWidget");
|
||||||
int previewCount = 0;
|
late int previewCount = 0;
|
||||||
|
|
||||||
late StreamSubscription<SyncStatusUpdate> _subscription;
|
late StreamSubscription<SyncStatusUpdate> _subscription;
|
||||||
late StreamSubscription<NotificationEvent> _notificationSubscription;
|
late StreamSubscription<NotificationEvent> _notificationSubscription;
|
||||||
@ -88,12 +88,11 @@ class _StatusBarWidgetState extends State<StatusBarWidget> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// visit LinkedHashMap and calculat previewCount
|
|
||||||
previewCount = PreviewVideoStore.instance.previews.values
|
previewCount = PreviewVideoStore.instance.previews.values
|
||||||
.where(
|
.where(
|
||||||
(element) =>
|
(element) =>
|
||||||
element.status == PreviewItemStatus.compressing ||
|
element.status != PreviewItemStatus.uploaded &&
|
||||||
element.status == PreviewItemStatus.uploading,
|
element.status != PreviewItemStatus.failed,
|
||||||
)
|
)
|
||||||
.length;
|
.length;
|
||||||
|
|
||||||
@ -102,10 +101,11 @@ class _StatusBarWidgetState extends State<StatusBarWidget> {
|
|||||||
previewCount = event.items.values
|
previewCount = event.items.values
|
||||||
.where(
|
.where(
|
||||||
(element) =>
|
(element) =>
|
||||||
element.status == PreviewItemStatus.compressing ||
|
element.status != PreviewItemStatus.uploaded &&
|
||||||
element.status == PreviewItemStatus.uploading,
|
element.status != PreviewItemStatus.failed,
|
||||||
)
|
)
|
||||||
.length;
|
.length;
|
||||||
|
setState(() {});
|
||||||
});
|
});
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
@ -79,9 +79,9 @@ class _PreviewStatusWidgetState extends State<PreviewStatusWidget> {
|
|||||||
preview?.status == PreviewItemStatus.retry;
|
preview?.status == PreviewItemStatus.retry;
|
||||||
final isFailed = preview?.status == PreviewItemStatus.failed;
|
final isFailed = preview?.status == PreviewItemStatus.failed;
|
||||||
|
|
||||||
final isBeforeCutoffDate = widget.file.updationTime != null &&
|
final isBeforeCutoffDate = widget.file.creationTime != null &&
|
||||||
PreviewVideoStore.instance.videoStreamingCutoff != null
|
PreviewVideoStore.instance.videoStreamingCutoff != null
|
||||||
? DateTime.fromMillisecondsSinceEpoch(widget.file.updationTime!)
|
? DateTime.fromMillisecondsSinceEpoch(widget.file.creationTime!)
|
||||||
.isBefore(
|
.isBefore(
|
||||||
PreviewVideoStore.instance.videoStreamingCutoff!,
|
PreviewVideoStore.instance.videoStreamingCutoff!,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user