Made main buildable again.
This commit is contained in:
14
src/main.rs
14
src/main.rs
@@ -77,7 +77,7 @@ fn new_client(
|
||||
}
|
||||
|
||||
fn search_media_items(
|
||||
client: google_photoslibrary1::Client,
|
||||
client: &google_photoslibrary1::Client,
|
||||
album_id: String,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
let mut page_token = None;
|
||||
@@ -113,7 +113,7 @@ fn search_media_items(
|
||||
}
|
||||
|
||||
fn sync_albums(
|
||||
client: google_photoslibrary1::Client,
|
||||
client: &google_photoslibrary1::Client,
|
||||
title_filter: Option<Regex>,
|
||||
output_dir: PathBuf,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
@@ -128,7 +128,7 @@ fn sync_albums(
|
||||
let path = album_dir.join("album.json");
|
||||
info!("saving {}", path.to_string_lossy());
|
||||
fs::write(path, j)?;
|
||||
search_media_items(client, a.id)
|
||||
search_media_items(client, a.id.as_ref().expect("unset album id").to_string());
|
||||
}
|
||||
// Serialize it to a JSON string.
|
||||
let j = serde_json::to_string(&albums)?;
|
||||
@@ -151,7 +151,7 @@ fn print_albums(albums: Vec<Album>) {
|
||||
}
|
||||
|
||||
fn list_albums(
|
||||
client: google_photoslibrary1::Client,
|
||||
client: &google_photoslibrary1::Client,
|
||||
title_filter: Option<Regex>,
|
||||
) -> Result<Vec<Album>, Box<dyn Error>> {
|
||||
Ok(client
|
||||
@@ -185,13 +185,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let client = new_client(&opt.credentials, &opt.token_cache)?;
|
||||
match opt.cmd {
|
||||
Command::ListAlbums { title_filter } => {
|
||||
print_albums(list_albums(client, title_filter)?);
|
||||
print_albums(list_albums(&client, title_filter)?);
|
||||
Ok(())
|
||||
}
|
||||
Command::SearchMediaItems { album_id } => search_media_items(client, album_id),
|
||||
Command::SearchMediaItems { album_id } => search_media_items(&client, album_id),
|
||||
Command::Sync {
|
||||
title_filter,
|
||||
output,
|
||||
} => sync_albums(client, title_filter, output),
|
||||
} => sync_albums(&client, title_filter, output),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user