Compare commits
3 Commits
3ad5c4f706
...
dbb282d73c
| Author | SHA1 | Date | |
|---|---|---|---|
| dbb282d73c | |||
| df3d29ce7c | |||
| cced612139 |
102
Cargo.lock
generated
102
Cargo.lock
generated
@ -70,15 +70,15 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.1.2"
|
||||
version = "3.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fb8038c1ddc0a5f73787b130f4cc75151e96ed33e417fde765eb5a81e3532f4"
|
||||
checksum = "1f359dc14ff8911330a51ef78022d376f25ed00248912803b58f00cb1c27f742"
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.3.2"
|
||||
version = "1.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
|
||||
checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
@ -168,7 +168,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3aa945d63861bfe624b55d153a39684da1e8c0bc8fba932f7ee3a3c16cea3ca"
|
||||
dependencies = [
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils 0.7.0",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -179,7 +179,7 @@ checksum = "5064ebdbf05ce3cb95e45c8b086f72263f4166b29b97f6baff7ef7fe047b55ac"
|
||||
dependencies = [
|
||||
"autocfg 0.1.7",
|
||||
"cfg-if",
|
||||
"crossbeam-utils 0.7.0",
|
||||
"crossbeam-utils",
|
||||
"lazy_static 1.4.0",
|
||||
"memoffset",
|
||||
"scopeguard",
|
||||
@ -187,21 +187,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-queue"
|
||||
version = "0.1.2"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b"
|
||||
dependencies = [
|
||||
"crossbeam-utils 0.6.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.6.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6"
|
||||
checksum = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"lazy_static 1.4.0",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -354,6 +345,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "google-photoslibrary1"
|
||||
version = "0.1.0-20200203"
|
||||
source = "git+https://git.z.xinu.tv/wathiede/google-api-photoslibrary#7480a9c0a0e432169d6c300adb50276f21a54eb7"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"google_api_auth",
|
||||
@ -369,7 +361,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "google_api_auth"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/google-apis-rs/generator#7504e310e8c4c361aca998ea14c309d5c46967cc"
|
||||
source = "git+https://github.com/google-apis-rs/generator#a848301466556f16d48df64ef16b92a8327a8406"
|
||||
dependencies = [
|
||||
"tokio 0.1.22",
|
||||
"yup-oauth2",
|
||||
@ -378,7 +370,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "google_field_selector"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/google-apis-rs/generator#7504e310e8c4c361aca998ea14c309d5c46967cc"
|
||||
source = "git+https://github.com/google-apis-rs/generator#a848301466556f16d48df64ef16b92a8327a8406"
|
||||
dependencies = [
|
||||
"google_field_selector_derive",
|
||||
]
|
||||
@ -386,7 +378,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "google_field_selector_derive"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/google-apis-rs/generator#7504e310e8c4c361aca998ea14c309d5c46967cc"
|
||||
source = "git+https://github.com/google-apis-rs/generator#a848301466556f16d48df64ef16b92a8327a8406"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -611,9 +603,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.3.1"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b54058f0a6ff80b6803da8faf8997cde53872b38f4023728f6830b06cd3c0dc"
|
||||
checksum = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292"
|
||||
dependencies = [
|
||||
"autocfg 1.0.0",
|
||||
]
|
||||
@ -1185,9 +1177,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ring"
|
||||
version = "0.16.10"
|
||||
version = "0.16.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "113f53b644c5442e20ff3a299be3d6c61ba143737af5bd2ab298e248a7575b2d"
|
||||
checksum = "741ba1704ae21999c00942f9f5944f801e977f54302af346b596287599ad1862"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"lazy_static 1.4.0",
|
||||
@ -1344,9 +1336,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.46"
|
||||
version = "1.0.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21b01d7f0288608a01dca632cf1df859df6fd6ffa885300fc275ce2ba6221953"
|
||||
checksum = "15913895b61e0be854afd32fd4163fcd2a3df34142cf2cb961b310ce694cbf90"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
@ -1600,9 +1592,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-codec"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f"
|
||||
checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b"
|
||||
dependencies = [
|
||||
"bytes 0.4.12",
|
||||
"futures",
|
||||
@ -1611,9 +1603,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-current-thread"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d16217cad7f1b840c5a97dfb3c43b0c871fef423a6e8d2118c604e843662a443"
|
||||
checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"tokio-executor",
|
||||
@ -1621,19 +1613,19 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-executor"
|
||||
version = "0.1.9"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca6df436c42b0c3330a82d855d2ef017cd793090ad550a6bc2184f4b933532ab"
|
||||
checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671"
|
||||
dependencies = [
|
||||
"crossbeam-utils 0.6.6",
|
||||
"crossbeam-utils",
|
||||
"futures",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-fs"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fe6dc22b08d6993916647d108a1a7d15b9cd29c4f4496c62b92c45b5041b7af"
|
||||
checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"tokio-io",
|
||||
@ -1642,9 +1634,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-io"
|
||||
version = "0.1.12"
|
||||
version = "0.1.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5090db468dad16e1a7a54c8c67280c5e4b544f3d3e018f0b913b400261f85926"
|
||||
checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674"
|
||||
dependencies = [
|
||||
"bytes 0.4.12",
|
||||
"futures",
|
||||
@ -1653,11 +1645,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-reactor"
|
||||
version = "0.1.11"
|
||||
version = "0.1.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6732fe6b53c8d11178dcb77ac6d9682af27fc6d4cb87789449152e5377377146"
|
||||
checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351"
|
||||
dependencies = [
|
||||
"crossbeam-utils 0.6.6",
|
||||
"crossbeam-utils",
|
||||
"futures",
|
||||
"lazy_static 1.4.0",
|
||||
"log 0.4.8",
|
||||
@ -1698,9 +1690,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-sync"
|
||||
version = "0.1.7"
|
||||
version = "0.1.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d06554cce1ae4a50f42fba8023918afa931413aded705b560e29600ccf7c6d76"
|
||||
checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"futures",
|
||||
@ -1708,9 +1700,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-tcp"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119"
|
||||
checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72"
|
||||
dependencies = [
|
||||
"bytes 0.4.12",
|
||||
"futures",
|
||||
@ -1722,13 +1714,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-threadpool"
|
||||
version = "0.1.17"
|
||||
version = "0.1.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0c32ffea4827978e9aa392d2f743d973c1dfa3730a2ed3f22ce1e6984da848c"
|
||||
checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89"
|
||||
dependencies = [
|
||||
"crossbeam-deque",
|
||||
"crossbeam-queue",
|
||||
"crossbeam-utils 0.6.6",
|
||||
"crossbeam-utils",
|
||||
"futures",
|
||||
"lazy_static 1.4.0",
|
||||
"log 0.4.8",
|
||||
@ -1739,11 +1731,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-timer"
|
||||
version = "0.2.12"
|
||||
version = "0.2.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1739638e364e558128461fc1ad84d997702c8e31c2e6b18fb99842268199e827"
|
||||
checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296"
|
||||
dependencies = [
|
||||
"crossbeam-utils 0.6.6",
|
||||
"crossbeam-utils",
|
||||
"futures",
|
||||
"slab",
|
||||
"tokio-executor",
|
||||
@ -1751,9 +1743,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-udp"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f02298505547f73e60f568359ef0d016d5acd6e830ab9bc7c4a5b3403440121b"
|
||||
checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82"
|
||||
dependencies = [
|
||||
"bytes 0.4.12",
|
||||
"futures",
|
||||
@ -1766,9 +1758,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio-uds"
|
||||
version = "0.2.5"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445"
|
||||
checksum = "5076db410d6fdc6523df7595447629099a1fdc47b3d9f896220780fa48faf798"
|
||||
dependencies = [
|
||||
"bytes 0.4.12",
|
||||
"futures",
|
||||
|
||||
@ -10,7 +10,7 @@ edition = "2018"
|
||||
yup-oauth2 = "^3.1"
|
||||
google_api_auth = { git = "https://github.com/google-apis-rs/generator", features = ["with-yup-oauth2"] }
|
||||
# TODO, use https://git.z.xinu.tv/wathiede/google-api-photoslibrary and figure out auth story.
|
||||
google-photoslibrary1 = { path = "../google-api-photoslibrary" }
|
||||
google-photoslibrary1 = { git = "https://git.z.xinu.tv/wathiede/google-api-photoslibrary" }
|
||||
structopt = "0.3.9"
|
||||
regex = "1.3.4"
|
||||
log = "0.4.8"
|
||||
|
||||
@ -36,3 +36,7 @@
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.figure {
|
||||
width: 285px;
|
||||
}
|
||||
|
||||
22
react-debug/src/App.js
vendored
22
react-debug/src/App.js
vendored
@ -1,5 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
import './App.css';
|
||||
|
||||
class Album extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@ -25,18 +27,16 @@ class Album extends React.Component {
|
||||
} else if (album !== null) {
|
||||
console.log(album);
|
||||
return album.map((a) => {
|
||||
let img = <img src="https://via.placeholder.com/256x128" className="mr-3" alt="unset"/>;
|
||||
if (a.coverPhotoBaseUrl !== undefined) {
|
||||
img = <img src={ a.coverPhotoBaseUrl + "=w256" } className="mr-3" alt={ a.title }/>;
|
||||
}
|
||||
|
||||
let figure = <figure key={ a.id } className="figure">
|
||||
{img}
|
||||
<figcaption className="figure-caption">{ a.title || "No title" } - { a.mediaItemsCount || 0 } photos </figcaption>
|
||||
</figure>;
|
||||
return <a key={ a.id } href={ a.productUrl }>
|
||||
{ figure }
|
||||
// TODO(wathiede): use coverPhotoMediaItemId and fetch from a
|
||||
// locally cached image.
|
||||
return <figure key={ a.id } className="figure">
|
||||
<img src={ a.baseUrl + "=w256-h256-c" } className="mr-3" alt={ a.filename }/>
|
||||
<figcaption className="figure-caption">
|
||||
<a key={ a.id } href={ a.productUrl }>
|
||||
<p className="text-truncate">{ a.filename}</p>
|
||||
</a>
|
||||
</figcaption>
|
||||
</figure>
|
||||
});
|
||||
} else {
|
||||
return <h2>Loading...</h2>;
|
||||
|
||||
43
src/main.rs
43
src/main.rs
@ -123,8 +123,21 @@ impl<'a> Iterator for SearchIter<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn search_media_items(client: &photos::Client, album_id: String) -> Result<(), Box<dyn Error>> {
|
||||
let mut total = 0;
|
||||
fn print_media_items(media_items: Vec<MediaItem>) {
|
||||
for mi in &media_items {
|
||||
println!(
|
||||
"{} {}",
|
||||
mi.id.as_ref().unwrap_or(&"NO ID".to_string()),
|
||||
mi.filename.as_ref().unwrap_or(&"NO FILENAME".to_string())
|
||||
);
|
||||
}
|
||||
println!("({}) items total", media_items.len());
|
||||
}
|
||||
|
||||
fn search_media_items(
|
||||
client: &photos::Client,
|
||||
album_id: String,
|
||||
) -> Result<Vec<MediaItem>, Box<dyn Error>> {
|
||||
let media_items = SearchIter::new(
|
||||
&client,
|
||||
SearchMediaItemsRequest {
|
||||
@ -133,18 +146,10 @@ fn search_media_items(client: &photos::Client, album_id: String) -> Result<(), B
|
||||
page_size: Some(100),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
for mi in media_items {
|
||||
let mi = mi?;
|
||||
total += 1;
|
||||
println!(
|
||||
"{} {}",
|
||||
mi.id.unwrap_or("NO ID".to_string()),
|
||||
mi.filename.unwrap_or("NO FILENAME".to_string())
|
||||
);
|
||||
}
|
||||
println!("({}) items total", total);
|
||||
Ok(())
|
||||
)
|
||||
.filter_map(|mi| mi.ok())
|
||||
.collect();
|
||||
Ok(media_items)
|
||||
}
|
||||
|
||||
fn sync_albums(
|
||||
@ -159,11 +164,12 @@ fn sync_albums(
|
||||
info!("making album directory {}", album_dir.to_string_lossy());
|
||||
fs::create_dir_all(&album_dir)?;
|
||||
}
|
||||
let j = serde_json::to_string(&albums)?;
|
||||
|
||||
let album = search_media_items(client, a.id.as_ref().expect("unset album id").to_string())?;
|
||||
let j = serde_json::to_string(&album)?;
|
||||
let path = album_dir.join("album.json");
|
||||
info!("saving {}", path.to_string_lossy());
|
||||
fs::write(path, j)?;
|
||||
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)?;
|
||||
@ -223,7 +229,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
print_albums(list_albums(&client, title_filter)?);
|
||||
Ok(())
|
||||
}
|
||||
Command::SearchMediaItems { album_id } => search_media_items(&client, album_id),
|
||||
Command::SearchMediaItems { album_id } => {
|
||||
print_media_items(search_media_items(&client, album_id)?);
|
||||
Ok(())
|
||||
}
|
||||
Command::Sync {
|
||||
title_filter,
|
||||
output,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user