+4
-1
changelog
+4
-1
changelog
+1
-1
src-tauri/Cargo.lock
+1
-1
src-tauri/Cargo.lock
+1
-1
src-tauri/Cargo.toml
+1
-1
src-tauri/Cargo.toml
+1
-1
src-tauri/src/frontend_calls/load_photo_meta.rs
+1
-1
src-tauri/src/frontend_calls/load_photo_meta.rs
+16
-4
src-tauri/src/frontend_calls/load_photos.rs
+16
-4
src-tauri/src/frontend_calls/load_photos.rs
···
32
32
let re1 = Regex::new(r"(?m)VRChat_[0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}-[0-9]{2}-[0-9]{2}.[0-9]{3}_[0-9]{4}x[0-9]{4}.png").unwrap();
33
33
let re2 = Regex::new(
34
34
r"(?m)VRChat_[0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}-[0-9]{2}-[0-9]{2}.[0-9]{3}_[0-9]{4}x[0-9]{4}_wrld_[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}.png").unwrap();
35
+
let re3 = Regex::new("VRChat_[0-9]{4}x[0-9]{4}_[0-9]{4}-[0-9]{2}-[0-9]{2}_[0-9]{2}-[0-9]{2}-[0-9]{2}.[0-9]{3}.png").unwrap();
35
36
36
-
if re1.is_match(p.file_name().to_str().unwrap())
37
-
|| re2.is_match(p.file_name().to_str().unwrap())
37
+
let name = p.file_name();
38
+
let name = name.to_str().unwrap();
39
+
40
+
let re3_match = re3.is_match(name);
41
+
42
+
if re1.is_match(name)
43
+
|| re2.is_match(name)
44
+
|| re3_match
38
45
{
39
46
let path = fname.to_path_buf().clone();
40
47
let metadata = fs::metadata(&path).unwrap();
···
42
49
if metadata.is_file() {
43
50
size += metadata.len() as usize;
44
51
45
-
let path = path.strip_prefix(&base_dir).unwrap().to_path_buf();
46
-
photos.push(path);
52
+
let pth = path.strip_prefix(&base_dir).unwrap().to_path_buf();
53
+
54
+
if re3_match{
55
+
photos.push(path::PathBuf::from("legacy://").join(pth));
56
+
} else{
57
+
photos.push(pth);
58
+
}
47
59
}
48
60
} else {
49
61
println!("Ignoring {:#?} as it doesn't match regex", p.file_name());
+32
-4
src/Components/PhotoList.tsx
+32
-4
src/Components/PhotoList.tsx
···
125
125
scaledHeight?: number;
126
126
127
127
dateString: string;
128
+
date: Date;
129
+
130
+
legacy: boolean = false;
128
131
129
132
public onMetaLoaded: () => void = () => {};
130
133
131
-
constructor( path: string ){
134
+
constructor( path: string, isLegacy: boolean = false ){
132
135
this.path = path;
133
-
this.dateString = this.path.split('_')[1];
136
+
this.legacy = isLegacy;
137
+
138
+
if(this.legacy)
139
+
this.dateString = this.path.split('_')[2];
140
+
else
141
+
this.dateString = this.path.split('_')[1];
142
+
143
+
let splitDateString = this.dateString.split('-');
144
+
145
+
this.date = new Date();
146
+
147
+
this.date.setFullYear(parseInt(splitDateString[0]));
148
+
this.date.setMonth(parseInt(splitDateString[1]));
149
+
this.date.setDate(parseInt(splitDateString[2]));
134
150
}
135
151
136
152
loadMeta(){
···
453
469
props.setPhotoCount(photoPaths.length);
454
470
props.setPhotoSize(event.payload.size);
455
471
472
+
let doesHaveLegacy = false;
473
+
456
474
photoPaths.forEach(( path: string ) => {
457
-
let photo = new Photo(path);
458
-
photos.push(photo);
475
+
let photo
459
476
477
+
if(path.slice(0, 9) === "legacy://"){
478
+
photo = new Photo(path.slice(9), true);
479
+
doesHaveLegacy = true;
480
+
} else
481
+
photo = new Photo(path, false);
482
+
483
+
photos.push(photo);
460
484
photo.loadMeta();
461
485
})
486
+
487
+
if(doesHaveLegacy){
488
+
photos = photos.sort(( a, b ) => b.date.valueOf() - a.date.valueOf());
489
+
}
462
490
})
463
491
}
464
492