hls: cargo fmt + clippy::cloned_ref_to_slice_refs
Pure mechanical pass on the files this branch added/modified: rustfmt reflow of a few long lines / chains, and the one non-pre-existing clippy warning — replacing `&[rel_path.clone()]` with `std::slice::from_ref(&rel_path)` in `handlers::video::generate_video` to avoid the alloc + clone for a single-element slice. All 707 tests still pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -79,9 +79,10 @@ pub fn cleanup_orphaned_playlists(
|
||||
info!(" Cleanup interval: {} seconds", cleanup_interval_secs);
|
||||
info!(" HLS directory: {}", video_path.display());
|
||||
|
||||
let exif_dao: Arc<Mutex<Box<dyn ExifDao>>> = Arc::new(Mutex::new(
|
||||
Box::new(SqliteExifDao::new()) as Box<dyn ExifDao>
|
||||
));
|
||||
let exif_dao: Arc<Mutex<Box<dyn ExifDao>>> = Arc::new(Mutex::new(Box::new(
|
||||
SqliteExifDao::new(),
|
||||
)
|
||||
as Box<dyn ExifDao>));
|
||||
|
||||
loop {
|
||||
std::thread::sleep(Duration::from_secs(cleanup_interval_secs));
|
||||
@@ -163,11 +164,7 @@ pub fn cleanup_orphaned_playlists(
|
||||
|
||||
for shard_entry in read_root.flatten() {
|
||||
let shard_path = shard_entry.path();
|
||||
if !shard_entry
|
||||
.file_type()
|
||||
.map(|t| t.is_dir())
|
||||
.unwrap_or(false)
|
||||
{
|
||||
if !shard_entry.file_type().map(|t| t.is_dir()).unwrap_or(false) {
|
||||
continue;
|
||||
}
|
||||
let shard_name = match shard_path.file_name().and_then(|n| n.to_str()) {
|
||||
@@ -194,16 +191,14 @@ pub fn cleanup_orphaned_playlists(
|
||||
let mut shard_emptied = true;
|
||||
for hash_entry in read_shard.flatten() {
|
||||
let hash_path = hash_entry.path();
|
||||
if !hash_entry
|
||||
.file_type()
|
||||
.map(|t| t.is_dir())
|
||||
.unwrap_or(false)
|
||||
{
|
||||
if !hash_entry.file_type().map(|t| t.is_dir()).unwrap_or(false) {
|
||||
shard_emptied = false;
|
||||
continue;
|
||||
}
|
||||
let Some(hash_name) =
|
||||
hash_path.file_name().and_then(|n| n.to_str()).map(|n| n.to_owned())
|
||||
let Some(hash_name) = hash_path
|
||||
.file_name()
|
||||
.and_then(|n| n.to_str())
|
||||
.map(|n| n.to_owned())
|
||||
else {
|
||||
shard_emptied = false;
|
||||
continue;
|
||||
@@ -586,13 +581,9 @@ pub fn watch_files(
|
||||
// quick scans because the cost is non-trivial on big
|
||||
// libraries and the data only meaningfully changes on
|
||||
// full passes.
|
||||
let video_dir_str =
|
||||
dotenv::var("VIDEO_PATH").expect("VIDEO_PATH must be set");
|
||||
let stats = hls_stats::compute_and_publish(
|
||||
&libs,
|
||||
&exif_dao,
|
||||
Path::new(&video_dir_str),
|
||||
);
|
||||
let video_dir_str = dotenv::var("VIDEO_PATH").expect("VIDEO_PATH must be set");
|
||||
let stats =
|
||||
hls_stats::compute_and_publish(&libs, &exif_dao, Path::new(&video_dir_str));
|
||||
hls_stats::log_summary(&stats);
|
||||
|
||||
last_full_scan = now;
|
||||
|
||||
Reference in New Issue
Block a user