mirror of
https://codeberg.org/postscriptum/snac2nex.git
synced 2026-04-01 21:55:27 +00:00
fix updated counter
This commit is contained in:
parent
9f18f63df9
commit
1df12cee92
2 changed files with 5 additions and 6 deletions
|
|
@ -44,7 +44,7 @@ fn sync(snac: &Snac, nex: &Nex, is_binary: bool) -> Result<(usize, usize)> {
|
||||||
// skip non authorized content
|
// skip non authorized content
|
||||||
if let Some(content) = post.source_content {
|
if let Some(content) = post.source_content {
|
||||||
println!("\t\tsync post `{}`...", post.id);
|
println!("\t\tsync post `{}`...", post.id);
|
||||||
nex.sync(
|
u += nex.sync(
|
||||||
&user.name,
|
&user.name,
|
||||||
content,
|
content,
|
||||||
post.url,
|
post.url,
|
||||||
|
|
@ -76,9 +76,8 @@ fn sync(snac: &Snac, nex: &Nex, is_binary: bool) -> Result<(usize, usize)> {
|
||||||
}),
|
}),
|
||||||
(post.published, post.updated),
|
(post.published, post.updated),
|
||||||
)?;
|
)?;
|
||||||
u += 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok((t, u))
|
Ok((u, t))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ impl Nex {
|
||||||
attachments: Option<Vec<(String, String, Source)>>,
|
attachments: Option<Vec<(String, String, Source)>>,
|
||||||
tags: Option<Vec<String>>,
|
tags: Option<Vec<String>>,
|
||||||
(published, updated): (DateTime<Utc>, Option<DateTime<Utc>>),
|
(published, updated): (DateTime<Utc>, Option<DateTime<Utc>>),
|
||||||
) -> Result<()> {
|
) -> Result<usize> {
|
||||||
// prepare destination
|
// prepare destination
|
||||||
let mut p = PathBuf::from(self.users.get(name).unwrap());
|
let mut p = PathBuf::from(self.users.get(name).unwrap());
|
||||||
p.push(published.format("%Y").to_string());
|
p.push(published.format("%Y").to_string());
|
||||||
|
|
@ -82,7 +82,7 @@ impl Nex {
|
||||||
fs::write(s, updated.unwrap_or(published).to_string())?
|
fs::write(s, updated.unwrap_or(published).to_string())?
|
||||||
} else {
|
} else {
|
||||||
println!("\t\t\tpost is up to date.");
|
println!("\t\t\tpost is up to date.");
|
||||||
return Ok(());
|
return Ok(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// format content pattern
|
// format content pattern
|
||||||
|
|
@ -169,6 +169,6 @@ impl Nex {
|
||||||
}
|
}
|
||||||
fs::write(&p, c)?;
|
fs::write(&p, c)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue