Always fix video story file type in scan_fs.

This commit is contained in:
levlam 2023-09-11 16:38:41 +03:00
parent 622762f6ef
commit c3a985fade
2 changed files with 4 additions and 4 deletions

View File

@ -129,7 +129,7 @@ void scan_fs(CancellationToken &token, CallbackT &&callback) {
FsFileInfo info;
info.path = path.str();
info.size = stat.real_size_;
info.file_type = file_type;
info.file_type = guess_file_type_by_path(path, file_type);
info.atime_nsec = stat.atime_nsec_;
info.mtime_nsec = stat.mtime_nsec_;
callback(info);
@ -152,9 +152,6 @@ void FileStatsWorker::get_stats(bool need_all_files, bool split_by_owner_dialog_
scan_fs(token_, [&](FsFileInfo &fs_info) {
FullFileInfo info;
info.file_type = fs_info.file_type;
if (info.file_type == FileType::PhotoStory && ends_with(fs_info.path, ".mp4")) {
info.file_type = FileType::VideoStory;
}
info.path = std::move(fs_info.path);
info.size = fs_info.size;
info.atime_nsec = fs_info.atime_nsec;

View File

@ -320,6 +320,9 @@ bool can_reuse_remote_file(FileType file_type) {
FileType guess_file_type_by_path(Slice file_path, FileType default_file_type) {
if (default_file_type != FileType::None) {
if (default_file_type == FileType::PhotoStory && ends_with(file_path, ".mp4")) {
return FileType::VideoStory;
}
return default_file_type;
}