Updated update and added an update script
The --update flag accepts the file no rather than goes to download. Simpler. Better. Don't need the entire download.rs file now
This commit is contained in:
9
scryfall_deser/scripts/update_with_rofi.sh
Executable file
9
scryfall_deser/scripts/update_with_rofi.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRYFALL_BULK=$(rofi -modi filebrowser -show filebrowser -filebrowser-command printf)
|
||||
echo "$SCRYFALL_BULK"
|
||||
|
||||
/home/arthurr/code/mini_projects/scryfall_deser/target/debug/scryfall_deser --update "$SCRYFALL_BULK"
|
||||
|
||||
# TODO - check return value
|
||||
rofi -e "Should be updated"
|
||||
@@ -47,7 +47,6 @@ pub fn download_latest(
|
||||
stype: ScryfallBulkType,
|
||||
mut dest_file: &NamedTempFile,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
panic!();
|
||||
let bulk_body: ScryfallBulk = ureq::get(SCRYFALL_BULK_API)
|
||||
.header("User-Agent", "Arthur's Card Finger Testing v0.1")
|
||||
.header("Accept", "application/json")
|
||||
|
||||
@@ -31,9 +31,9 @@ enum MtgCardExit {
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version, about, long_about = None)]
|
||||
struct Args {
|
||||
/// Download the latest bulk from Scryfall and update local db
|
||||
/// Update the local db from given Scryfall bulk download
|
||||
#[arg(short, long)]
|
||||
update: bool,
|
||||
update: Option<String>,
|
||||
/// Search for the exact string
|
||||
#[arg(short, long)]
|
||||
exact: bool,
|
||||
@@ -69,11 +69,11 @@ fn _combine_search_strings(search_strings: Vec<String>) -> String {
|
||||
|
||||
fn main() -> MtgCardExit {
|
||||
let args = Args::parse();
|
||||
if args.update {
|
||||
if let Some(update) = args.update {
|
||||
dbg!(&update);
|
||||
init_db();
|
||||
let mut path = get_local_cache_folder();
|
||||
// TODO - actually download the file - probably do away with TempFile stuff
|
||||
path.push("oracle-cards-20250814210711.json");
|
||||
path.push(update);
|
||||
update_db_with_file(path);
|
||||
return MtgCardExit::Success;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user