Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
[target.aarch64-unknown-linux-gnu]
linker = "mold"
[target.x86_64-unknown-linux-gnu]
linker = "mold"

[build]
rustflags = ["--cfg", "tokio_unstable"]
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SCM syntax highlighting & preventing 3-way merges
pixi.lock merge=binary linguist-language=YAML linguist-generated=true
88 changes: 62 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
name: Cargo Build & Test
name: Backdrop CI

on:
push:
branches: [main]
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
build_and_test:
name: Rust project
build:
name: Build
runs-on: ubuntu-22.04
strategy:
matrix:
toolchain:
- stable
fail-fast: false

steps:
- uses: actions/checkout@v3

- name: Install `nasm`
- name: Install an assembler
run: sudo apt-get install yasm -y

- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
# install required system dependencies
- uses: prefix-dev/[email protected]
with:
toolchain: ${{ matrix.toolchain }}
override: true
pixi-version: v0.44.0
cache: true

- name: Cache cargo registry
uses: actions/cache@v4
Expand All @@ -47,31 +45,69 @@ jobs:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }}

- name: Cache cargo bin # bc wow why does it take three minutes to build `cargo-deny`
- name: Cache cargo bin
uses: actions/cache@v4
with:
path: ~/.cargo/bin
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }}

- name: Build
run: cargo build --verbose
run: pixi run build

- name: Install `cargo` tools to do more testing
uses: taiki-e/install-action@v2
check:
name: Run checks
runs-on: ubuntu-22.04
needs: build
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v3

- name: Install an assembler
run: sudo apt-get install yasm -y

- uses: prefix-dev/[email protected]
with:
tool: cargo-deny,cargo-nextest,cargo-rdme
pixi-version: v0.44.0
cache: true

- name: Check for unused dependencies
uses: bnjbvr/cargo-machete@main
- uses: actions/cache@v4
name: Restore cargo registry
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-

- name: Make sure README is up-to-date
run: cargo rdme --check
- uses: actions/cache@v4
name: Restore cargo index
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-

- name: Run cargo-deny
run: cargo deny check
- uses: actions/cache@v4
name: Restore cargo build outputs
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ matrix.toolchain }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-target-${{ matrix.toolchain }}-

- name: Run tests
run: cargo nextest run
- uses: actions/cache@v4
name: Restore cargo bin
with:
path: ~/.cargo/bin
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-bin-

- name: Install `cargo` tools to do more testing
uses: taiki-e/install-action@v2
with:
tool: cargo-deny,cargo-machete,cargo-nextest,cargo-rdme

- name: Run doctests
run: cargo test --doc
- name: Run checks
run: pixi run check
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@
**.sqlite
Cargo.lock
_BACKUP_BEFORE_MERGING_MEDIA_AND_RECORD/
build/
build/

# macOS
**/.DS_Store

# pixi environments
.pixi/
*.egg-info
17 changes: 17 additions & 0 deletions .scripts/check.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -e

# check for unused dependencies
cargo machete

# ensure readme is up-to-date
cargo rdme --check

# check dependency security
cargo deny check

# run our test suite
cargo nextest run

# run doc tests
cargo test --doc
52 changes: 52 additions & 0 deletions .scripts/check.pre.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash
set -e

# ensure `cargo` is present!
if ! command -v cargo >/dev/null 2>&1; then
echo "Failed to find \`cargo\` installation!"
exit 255
fi

# ...and that curl is around
if ! command -v curl >/dev/null 2>&1; then
echo "Failed to find \`curl\`!"
echo "Since you've installed \`pixi\`, you probably have it installed. So, please ensure it's in your path."
exit 255
fi

# great..! now, grab `cargo-binstall` if it isn't installed already!
if ! command -v cargo-binstall >/dev/null 2>&1; then
echo "Installing \`cargo-binstall\`..."
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
echo "Completed \`cargo-binstall\` installation!"
fi

# if not present, install each tool...
#
# ...cargo-rdme
if ! command -v cargo-rdme >/dev/null 2>&1; then
echo "Installing \`cargo-rdme\`..."
cargo binstall cargo-rdme -y --quiet
echo "Completed \`cargo-rdme\` installation!"
fi
#
# ...cargo-deny
if ! command -v cargo-deny >/dev/null 2>&1; then
echo "Installing \`cargo-deny\`..."
cargo binstall cargo-deny -y --quiet
echo "Completed \`cargo-deny\` installation!"
fi
#
# ...cargo-machete
if ! command -v cargo-machete >/dev/null 2>&1; then
echo "Installing \`cargo-machete\`..."
cargo binstall cargo-machete -y --quiet
echo "Completed \`cargo-machete\` installation!"
fi
#
# ...cargo-nextest
if ! command -v cargo-nextest >/dev/null 2>&1; then
echo "Installing \`cargo-nextest\`..."
cargo binstall cargo-nextest -y --quiet
echo "Completed \`cargo-nextest\` installation!"
fi
27 changes: 15 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "backdrop"
version = "0.1.0"
edition = "2021"
license = "MIT"

[dependencies]
fraction = { version = "0.15.3", features = ["with-serde-support"] }
Expand Down Expand Up @@ -37,8 +38,8 @@ nom-exif = { git = "https://github.com/onkoe/nom-exif", branch = "main", feature
image = "0.25.2"
infer = "0.16.0"
mp4parse = "0.17.0"
matroska = "0.27.0"
camino = { version = "1.1.9", features = ["serde", "serde1"] }
matroska = { version = "0.27.0", default-features = false }
camino = { version = "1.1.9", features = ["serde1"] }
sqlx = { version = "0.8.3", features = [
"sqlite",
"chrono",
Expand All @@ -51,23 +52,25 @@ chrono = { version = "0.4.39", features = ["serde"] }
uuid = { version = "1.12.0", features = ["v4", "serde"] }
avif-parse = "1.3.2"
blake3 = { version = "1.5.5", features = ["mmap", "rayon"] }
# crc32fast = "1.4.2"

# sys dependencies
# note: we have to use a git version of ffmpeg-next because of cross-compilation bug
# (see https://github.com/zmwangx/rust-ffmpeg-sys/issues/84)
#ffmpeg-next = { version = "7.0", features = ["build", "static"] }


[dependencies.ffmpeg-next]
git = "https://github.com/onkoe/rust-ffmpeg"
branch = "master"
# features = ["build", "static"]
features = ["build"]

[dev-dependencies]
async-ctrlc = "1.2.0"
tracing-subscriber = "0.3.18"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
dirs = "6.0.0"
anyhow = "1.0.95"
console-subscriber = "0.4.1"

[profile.ci]
codegen-units = 256
debug = "none"
debug-assertions = false
incremental = true
inherits = "dev"
lto = "off"
opt-level = 0
overflow-checks = false
panic = "abort"
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 Barrett Ray

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,17 @@ Internally, `backdrop` is based on a database of collected/created metadata cach

## Building

To build this, there are a few dependencies you need to install. I use Fedora, but please feel free to submit PRs to add package lists for other distributions.
To build `backdrop`, you'll need to use Pixi. Grab `curl`, then follow [Pixi's installation instructions](https://pixi.sh/latest/installation/) to set it up (don't worry - it takes maybe 30 seconds). Afterward, clone the repo and run `pixi i && pixi shell`. You can now `cargo build`!

### Fedora

`sudo dnf install -y nasm libgexiv2-devel libdav1d libdav1d-devel`
If you want to make changes, ensure you open your editor within the Pixi workspace: `pixi i && pixi shell && zed . --new`. Otherwise, system dependencies will be missing...

## Status

Under active development.

- [ ] GOAL: Feature-completeness
- [ ] Metadata scanning for `Media`
- [ ] Images
- [x] Metadata scanning for `Media`
- [x] Images
- [ ] GIFS
- [ ] Video
- [ ] General (including Folder. i.e. `stat`)
Expand Down
19 changes: 19 additions & 0 deletions deny.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[licenses]
# https://spdx.org/licenses/
allow = [
"MIT",
"Apache-2.0",
"Unicode-3.0",
"BSD-2-Clause",
"BSD-3-Clause",
"Apache-2.0 WITH LLVM-exception",
"CC0-1.0",
"ISC",
"MPL-2.0",
"NCSA",
"Zlib",
"WTFPL",
]

[advisories]
unmaintained = "workspace"
Loading
Loading