aboutsummaryrefslogtreecommitdiffstats
path: root/crates
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-07-24 17:18:07 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-07-24 17:18:07 +0200
commit19d3c02396ac1c00742e50e60a0a840fbfade1ac (patch)
tree31ada80cf14a889b34ba5bdc075ab76e0a2cf17d /crates
parentchore(treewide): Add missing license headers (diff)
downloadyt-19d3c02396ac1c00742e50e60a0a840fbfade1ac.zip
style(treewide): Format
Diffstat (limited to '')
-rw-r--r--crates/yt/Cargo.toml2
-rw-r--r--crates/yt/src/commands/download/implm/download/mod.rs5
-rw-r--r--crates/yt/src/commands/update/implm/updater.rs3
-rw-r--r--crates/yt/src/storage/db/get/mod.rs4
-rw-r--r--crates/yt/src/storage/db/mod.rs4
-rw-r--r--crates/yt/src/storage/db/video/comments/mod.rs1
-rw-r--r--crates/yt/src/storage/mod.rs2
-rw-r--r--crates/yt_dlp/crates/pyo3-pylogger/Cargo.toml6
-rw-r--r--crates/yt_dlp/crates/pyo3-pylogger/README.md32
-rw-r--r--crates/yt_dlp/src/options.rs4
10 files changed, 41 insertions, 22 deletions
diff --git a/crates/yt/Cargo.toml b/crates/yt/Cargo.toml
index 14d25a4..0b6c581 100644
--- a/crates/yt/Cargo.toml
+++ b/crates/yt/Cargo.toml
@@ -25,7 +25,7 @@ publish = false
[dependencies]
anyhow = "1.0.98"
-blake3 = {version = "1.8.2", features = ["serde"]}
+blake3 = { version = "1.8.2", features = ["serde"] }
chrono = { version = "0.4.41", features = ["now"] }
chrono-humanize = "0.2.3"
clap = { version = "4.5.41", features = ["derive"] }
diff --git a/crates/yt/src/commands/download/implm/download/mod.rs b/crates/yt/src/commands/download/implm/download/mod.rs
index f0d5f67..876d6e6 100644
--- a/crates/yt/src/commands/download/implm/download/mod.rs
+++ b/crates/yt/src/commands/download/implm/download/mod.rs
@@ -240,10 +240,7 @@ impl Downloader {
info!(
"Noticed, that the next video is not the video being downloaded, replacing it ('{}' vs. '{}')!",
next_video.extractor_hash.as_short_hash(&app).await?,
- current_download
- .extractor_hash
- .as_short_hash(&app)
- .await?
+ current_download.extractor_hash.as_short_hash(&app).await?
);
// Replace the currently downloading video
diff --git a/crates/yt/src/commands/update/implm/updater.rs b/crates/yt/src/commands/update/implm/updater.rs
index ee61fa1..2b96bf2 100644
--- a/crates/yt/src/commands/update/implm/updater.rs
+++ b/crates/yt/src/commands/update/implm/updater.rs
@@ -16,7 +16,8 @@ use log::{Level, debug, error, log_enabled};
use tokio::io::{AsyncWriteExt, stderr};
use tokio_util::task::LocalPoolHandle;
use yt_dlp::{
- info_json::InfoJson, json_cast, json_try_get, options::YoutubeDLOptions, process_ie_result, python_error::PythonError
+ info_json::InfoJson, json_cast, json_try_get, options::YoutubeDLOptions, process_ie_result,
+ python_error::PythonError,
};
use crate::{
diff --git a/crates/yt/src/storage/db/get/mod.rs b/crates/yt/src/storage/db/get/mod.rs
index dca16fc..4bcd066 100644
--- a/crates/yt/src/storage/db/get/mod.rs
+++ b/crates/yt/src/storage/db/get/mod.rs
@@ -8,8 +8,8 @@
// You should have received a copy of the License along with this program.
// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-pub(crate) mod subscription;
-pub(crate) mod video;
pub(crate) mod extractor_hash;
pub(crate) mod playlist;
+pub(crate) mod subscription;
pub(crate) mod txn_log;
+pub(crate) mod video;
diff --git a/crates/yt/src/storage/db/mod.rs b/crates/yt/src/storage/db/mod.rs
index f42c3fc..926bab0 100644
--- a/crates/yt/src/storage/db/mod.rs
+++ b/crates/yt/src/storage/db/mod.rs
@@ -12,7 +12,7 @@ pub(crate) mod get;
pub(crate) mod insert;
pub(crate) mod extractor_hash;
-pub(crate) mod subscription;
-pub(crate) mod video;
pub(crate) mod playlist;
+pub(crate) mod subscription;
pub(crate) mod txn_log;
+pub(crate) mod video;
diff --git a/crates/yt/src/storage/db/video/comments/mod.rs b/crates/yt/src/storage/db/video/comments/mod.rs
index b89aa63..41a03be 100644
--- a/crates/yt/src/storage/db/video/comments/mod.rs
+++ b/crates/yt/src/storage/db/video/comments/mod.rs
@@ -154,7 +154,6 @@ impl Comments {
}
let comment_author_matches_target = comment.value.author == reply_target_author;
-
match find_in_replies(comment, reply_target_author) {
Some(_) => Some(
// PERFORMANCE(@bpeetz): We should not need to run this code twice. <2025-07-18>
diff --git a/crates/yt/src/storage/mod.rs b/crates/yt/src/storage/mod.rs
index 2d9133b..6dcff74 100644
--- a/crates/yt/src/storage/mod.rs
+++ b/crates/yt/src/storage/mod.rs
@@ -9,6 +9,6 @@
// You should have received a copy of the License along with this program.
// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
-pub(crate) mod migrate;
pub(crate) mod db;
+pub(crate) mod migrate;
pub(crate) mod notify;
diff --git a/crates/yt_dlp/crates/pyo3-pylogger/Cargo.toml b/crates/yt_dlp/crates/pyo3-pylogger/Cargo.toml
index 259ea98..6375528 100644
--- a/crates/yt_dlp/crates/pyo3-pylogger/Cargo.toml
+++ b/crates/yt_dlp/crates/pyo3-pylogger/Cargo.toml
@@ -12,7 +12,11 @@
name = "pyo3-pylogger"
version = "0.5.0"
edition = "2021"
-authors = ["Dylan Bobby Storey <dylan.storey@gmail.com>", "cpu <daniel@binaryparadox.net>" , "Warren Snipes <contact@warrensnipes.dev>"]
+authors = [
+ "Dylan Bobby Storey <dylan.storey@gmail.com>",
+ "cpu <daniel@binaryparadox.net>",
+ "Warren Snipes <contact@warrensnipes.dev>",
+]
description = "Enables `log` for pyo3 based Rust applications using the `logging` modules."
publish = ["crates-io"]
license = "Apache-2.0"
diff --git a/crates/yt_dlp/crates/pyo3-pylogger/README.md b/crates/yt_dlp/crates/pyo3-pylogger/README.md
index 1f6c419..e68903b 100644
--- a/crates/yt_dlp/crates/pyo3-pylogger/README.md
+++ b/crates/yt_dlp/crates/pyo3-pylogger/README.md
@@ -12,14 +12,19 @@ If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
# pyo3-pylogger
-Enables log messages for pyo3 embedded Python applications using Python's `logging` or module.
+Enables log messages for pyo3 embedded Python applications using Python's
+`logging` or module.
# Features
+
- Logging integration between Python's `logging` module and Rust's `log` crate
-- Structured logging support via the logging [extra](https://docs.python.org/3/library/logging.html#logging.Logger.debug) field (requires `kv` or `tracing-kv`feature)
+- Structured logging support via the logging
+ [extra](https://docs.python.org/3/library/logging.html#logging.Logger.debug)
+ field (requires `kv` or `tracing-kv`feature)
- Integration with Rust's `tracing` library (requires `tracing` feature)
# Usage
+
```rust
use log::{info, warn};
use pyo3::{ffi::c_str, prelude::*};
@@ -85,21 +90,25 @@ Then you can use Python's `extra` parameter to pass structured data:
logging.info("Processing order", extra={"order_id": "12345", "amount": 99.99})
```
-When using a structured logging subscriber in Rust, these key-value pairs will be properly captured, for example:
+When using a structured logging subscriber in Rust, these key-value pairs will
+be properly captured, for example:
```bash
[2025-03-28T01:12:29Z INFO example_application_py_logger] Processing order order_id=12345 amount=99.99
```
+
## Tracing Support
-To enable integration with Rust's `tracing` library, add the `tracing` feature to your `Cargo.toml`:
+To enable integration with Rust's `tracing` library, add the `tracing` feature
+to your `Cargo.toml`:
```toml
[dependencies]
pyo3-pylogger = { version = "0.4", default-features = false, features = ["tracing"] }
```
-When the `tracing` feature is enabled, Python logs will be forwarded to the active tracing subscriber:
+When the `tracing` feature is enabled, Python logs will be forwarded to the
+active tracing subscriber:
```rust
use tracing::{info, warn};
@@ -135,10 +144,17 @@ logging.info('This will be captured by tracing')"#
### Structured Data with Tracing
-The `tracing` feature automatically supports Python's `extra` field for structured data. However, the KV fields are json serialized and not available as tracing attributes. This is a limitation of the `tracing` library and is not specific to this crate. See [this issue](https://github.com/tokio-rs/tracing/issues/372) for more information.
+The `tracing` feature automatically supports Python's `extra` field for
+structured data. However, the KV fields are json serialized and not available as
+tracing attributes. This is a limitation of the `tracing` library and is not
+specific to this crate. See
+[this issue](https://github.com/tokio-rs/tracing/issues/372) for more
+information.
# Feature Flags
-- `kv`: Enables structured logging support via Python's `extra` fields. This adds support for the `log` crate's key-value system.
+- `kv`: Enables structured logging support via Python's `extra` fields. This
+ adds support for the `log` crate's key-value system.
- `tracing`: Enables integration with Rust's `tracing` library.
-- `tracing-kv`: Enables structured logging support via Python's `extra` fields and integration with Rust's `tracing` library.
+- `tracing-kv`: Enables structured logging support via Python's `extra` fields
+ and integration with Rust's `tracing` library.
diff --git a/crates/yt_dlp/src/options.rs b/crates/yt_dlp/src/options.rs
index dedb03c..ad30301 100644
--- a/crates/yt_dlp/src/options.rs
+++ b/crates/yt_dlp/src/options.rs
@@ -170,7 +170,9 @@ signal.signal(signal.SIGINT, signal.SIG_DFL)
{
// Setup the post processors
- let add_post_processor_fun = inner.getattr(intern!(py, "add_post_processor")).wrap_exc(py)?;
+ let add_post_processor_fun = inner
+ .getattr(intern!(py, "add_post_processor"))
+ .wrap_exc(py)?;
for pp in options.post_processors {
add_post_processor_fun