mirror of
https://github.com/thegeneralist01/archivr
synced 2026-05-30 08:36:47 +02:00
Compare commits
2 commits
df05687ad9
...
b9f45d148b
| Author | SHA1 | Date | |
|---|---|---|---|
| b9f45d148b | |||
| 7d2ab89180 |
2 changed files with 17 additions and 9 deletions
15
flake.nix
15
flake.nix
|
|
@ -1,6 +1,18 @@
|
||||||
{
|
{
|
||||||
description = "Archivr - An open-source archive manager";
|
description = "Archivr - An open-source archive manager";
|
||||||
|
|
||||||
|
nixConfig = {
|
||||||
|
extra-substituters = [
|
||||||
|
"https://cache.thegeneralist01.com/"
|
||||||
|
"https://cache.garnix.io/"
|
||||||
|
"https://cache.nixos.org/"
|
||||||
|
];
|
||||||
|
extra-trusted-public-keys = [
|
||||||
|
"cache.thegeneralist01.com:jkKcenR877r7fQuWq6cr0JKv2piqBWmYLAYsYsSJnT4="
|
||||||
|
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
|
|
@ -21,7 +33,7 @@
|
||||||
pname = "archivr";
|
pname = "archivr";
|
||||||
version = "0.1.0";
|
version = "0.1.0";
|
||||||
src = pkgs.lib.cleanSource ./.;
|
src = pkgs.lib.cleanSource ./.;
|
||||||
cargoHash = "sha256-y47+Fmp3BID86aPnLtrvzg40lOr9cHyg/38+onisK7w=";
|
cargoHash = "sha256-4m+4SMYA/rJ0eHEOc32zA2VdZI1pqzB5NenD0R0f2zM=";
|
||||||
nativeBuildInputs = [ pkgs.pkg-config ];
|
nativeBuildInputs = [ pkgs.pkg-config ];
|
||||||
};
|
};
|
||||||
archivr = pkgs.stdenv.mkDerivation {
|
archivr = pkgs.stdenv.mkDerivation {
|
||||||
|
|
@ -49,6 +61,7 @@
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
default = archivr;
|
||||||
archivr = archivr;
|
archivr = archivr;
|
||||||
archivr-unwrapped = archivr_unwrapped;
|
archivr-unwrapped = archivr_unwrapped;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
11
src/main.rs
11
src/main.rs
|
|
@ -77,7 +77,7 @@ enum Source {
|
||||||
// INFO: yt-dlp supports a lot of sites; so, when archiving (for example) a website, the user
|
// INFO: yt-dlp supports a lot of sites; so, when archiving (for example) a website, the user
|
||||||
// -> should be asked whether they want to archive the whole website or just the video(s) on it.
|
// -> should be asked whether they want to archive the whole website or just the video(s) on it.
|
||||||
fn determine_source(path: &str) -> Source {
|
fn determine_source(path: &str) -> Source {
|
||||||
// INFO: Extractors' URLs can be found here:
|
// INFO: Extractor URLs can be found here:
|
||||||
// -> https://github.com/yt-dlp/yt-dlp/tree/dfc0a84c192a7357dd1768cc345d590253a14fe5/yt_dlp/extractor
|
// -> https://github.com/yt-dlp/yt-dlp/tree/dfc0a84c192a7357dd1768cc345d590253a14fe5/yt_dlp/extractor
|
||||||
// TEST: X posts can have multiple videos.
|
// TEST: X posts can have multiple videos.
|
||||||
|
|
||||||
|
|
@ -272,13 +272,7 @@ fn main() -> Result<()> {
|
||||||
// Dir or whatever. it's midnight and my brain ain't wording/braining.
|
// Dir or whatever. it's midnight and my brain ain't wording/braining.
|
||||||
if hash_exists {
|
if hash_exists {
|
||||||
println!("File already archived.");
|
println!("File already archived.");
|
||||||
let _ = fs::remove_file(
|
let _ = fs::remove_file(store_path.join("temp").join(×tamp));
|
||||||
store_path
|
|
||||||
.join("temp")
|
|
||||||
.join(×tamp)
|
|
||||||
.join(format!("{timestamp}{file_extension}")),
|
|
||||||
);
|
|
||||||
process::exit(0);
|
|
||||||
} else {
|
} else {
|
||||||
move_temp_to_raw(
|
move_temp_to_raw(
|
||||||
&store_path
|
&store_path
|
||||||
|
|
@ -288,6 +282,7 @@ fn main() -> Result<()> {
|
||||||
&hash,
|
&hash,
|
||||||
&store_path,
|
&store_path,
|
||||||
)?;
|
)?;
|
||||||
|
let _ = fs::remove_file(store_path.join("temp").join(×tamp));
|
||||||
|
|
||||||
println!("File archived successfully.");
|
println!("File archived successfully.");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue