Skip to content

Commit e69f38c

Browse files
committed
Simplify database fetch
Fetch database columns directly by name (without getting the column number first)
1 parent 5351889 commit e69f38c

File tree

8 files changed

+12
-16
lines changed

8 files changed

+12
-16
lines changed

WavyBackgroundsClient/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "WavyBackgrounds",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "An app to imitate the dynamic backgrounds from macOS Sonoma",
55
"scripts": {
66
"start": "vite",

WavyBackgroundsClient/src-tauri/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WavyBackgroundsClient/src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "WavyBackgrounds"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
description = "An app to imitate the dynamic backgrounds from macOS Sonoma"
55
authors = ["Philipp Remy"]
66
license = "MIT"

WavyBackgroundsClient/src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"package": {
1010
"productName": "WavyBackgrounds",
11-
"version": "0.1.1"
11+
"version": "0.1.2"
1212
},
1313
"tauri": {
1414
"systemTray": {

libDynamicWallpapaper/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libResourceManager/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libResourceManager/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "libResourceManager"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

libResourceManager/src/lib.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,13 @@ pub fn get_full_database(app_handle: &AppHandle) -> Option<Vec<WallpaperVideoEnt
3535
assert!(aerial_db_file.exists(), "It appears we are not on a Sonoma System. Aborting... (Custom Videos are WIP!)");
3636
let conn = rusqlite::Connection::open_with_flags(aerial_db_file, rusqlite::OpenFlags::SQLITE_OPEN_READ_ONLY).unwrap();
3737
let mut stmt = conn.prepare("SELECT * FROM ZASSET").unwrap();
38-
let fn_col = stmt.column_index("ZACCESSIBILITYLABEL").expect("There is no column called 'ZACCESSIBILITYLABEL'");
39-
let urlplist_col = stmt.column_index("ZREMOTEURLS").expect("There is no column called 'ZREMOTEURLS'");
40-
let preview_col = stmt.column_index("ZPREVIEWIMAGEURL").expect("There is no column called 'ZPREVIEWIMAGEURL'");
41-
let ident_col = stmt.column_index("ZIDENTIFIER").expect("There is no column called 'ZIDENTIFIER'");
4238
let entry_iter = stmt.query_map([], |row| {
4339
Ok(WallpaperVideoEntry {
44-
friendly_name: row.get::<usize, String>(fn_col).unwrap().to_string(),
45-
video_url_plist: row.get::<usize, Vec<u8>>(urlplist_col).unwrap(),
40+
friendly_name: row.get::<&str, String>("ZACCESSIBILITYLABEL").unwrap().to_string(),
41+
video_url_plist: row.get::<&str, Vec<u8>>("ZREMOTEURLS").unwrap(),
4642
video_url: String::new(),
47-
preview_image_url: row.get::<usize, String>(preview_col).unwrap().to_string(),
48-
identifier: row.get::<usize, String>(ident_col).unwrap().to_string(),
43+
preview_image_url: row.get::<&str, String>("ZPREVIEWIMAGEURL").unwrap().to_string(),
44+
identifier: row.get::<&str, String>("ZIDENTIFIER").unwrap().to_string(),
4945
preview_image_save_path: None,
5046
video_save_path: None
5147
})

0 commit comments

Comments
 (0)