aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-02-04 17:26:44 +0100
committermetamuffin <metamuffin@disroot.org>2025-02-04 17:26:44 +0100
commite74d53391acc55772e45cc38791b1f8414b11b9d (patch)
treebf25cfdd3082a8507f81861432947f3fd1755793
parent4da2e04eeaf2c6a40b01329d1ae741ac64635f16 (diff)
downloadjellything-e74d53391acc55772e45cc38791b1f8414b11b9d.tar
jellything-e74d53391acc55772e45cc38791b1f8414b11b9d.tar.bz2
jellything-e74d53391acc55772e45cc38791b1f8414b11b9d.tar.zst
fix search filter
-rw-r--r--base/src/database.rs8
-rw-r--r--server/src/routes/ui/sort.rs23
-rw-r--r--transcoder/src/image.rs2
3 files changed, 16 insertions, 17 deletions
diff --git a/base/src/database.rs b/base/src/database.rs
index 2eecbf6..f1e023c 100644
--- a/base/src/database.rs
+++ b/base/src/database.rs
@@ -10,7 +10,7 @@ use jellycommon::{
Node, NodeID,
};
use log::info;
-use redb::{ReadableTable, StorageError, TableDefinition};
+use redb::{Durability, ReadableTable, StorageError, TableDefinition};
use std::{
fs::create_dir_all,
path::Path,
@@ -103,7 +103,7 @@ impl Database {
}
pub fn clear_nodes(&self) -> Result<()> {
- let txn = self.inner.begin_write()?;
+ let mut txn = self.inner.begin_write()?;
let mut t_node = txn.open_table(T_NODE)?;
let mut t_node_children = txn.open_table(T_NODE_CHILDREN)?;
let mut t_node_external_id = txn.open_table(T_NODE_EXTERNAL_ID)?;
@@ -118,6 +118,7 @@ impl Database {
t_node_external_id,
t_import_file_mtime,
));
+ txn.set_durability(Durability::Eventual);
txn.commit()?;
Ok(())
}
@@ -137,7 +138,7 @@ impl Database {
id: NodeID,
update: impl FnOnce(&mut Node) -> Result<()>,
) -> Result<()> {
- let txn = self.inner.begin_write()?;
+ let mut txn = self.inner.begin_write()?;
let mut t_nodes = txn.open_table(T_NODE)?;
let mut t_node_children = txn.open_table(T_NODE_CHILDREN)?;
let mut t_node_external_id = txn.open_table(T_NODE_EXTERNAL_ID)?;
@@ -151,6 +152,7 @@ impl Database {
}
t_nodes.insert(&id.0, Ser(node))?;
drop((t_nodes, t_node_children, t_node_external_id));
+ txn.set_durability(Durability::Eventual);
txn.commit()?;
Ok(())
}
diff --git a/server/src/routes/ui/sort.rs b/server/src/routes/ui/sort.rs
index 382c4a6..af874f8 100644
--- a/server/src/routes/ui/sort.rs
+++ b/server/src/routes/ui/sort.rs
@@ -1,8 +1,4 @@
-use jellycommon::{
- helpers::SortAnyway,
- user::{NodeUserData, WatchedState},
- Node, NodeKind, Rating,
-};
+use jellycommon::{helpers::SortAnyway, user::NodeUserData, Node, NodeKind, Rating};
use markup::RenderAttributeValue;
use rocket::{
http::uri::fmt::{Query, UriDisplay},
@@ -140,14 +136,14 @@ pub fn filter_and_sort_nodes(
nodes: &mut Vec<(Arc<Node>, NodeUserData)>,
) {
let sort_prop = f.sort_by.unwrap_or(default_sort.0);
- nodes.retain(|(node, udata)| {
+ nodes.retain(|(node, _udata)| {
let mut o = true;
if let Some(prop) = &f.filter_kind {
o = false;
for p in prop {
o |= match p {
- FilterProperty::FederationLocal => node.federated.is_none(),
- FilterProperty::FederationRemote => node.federated.is_some(),
+ // FilterProperty::FederationLocal => node.federated.is_none(),
+ // FilterProperty::FederationRemote => node.federated.is_some(),
FilterProperty::KindMovie => node.kind == NodeKind::Movie,
FilterProperty::KindVideo => node.kind == NodeKind::Video,
FilterProperty::KindShortFormVideo => node.kind == NodeKind::ShortFormVideo,
@@ -158,11 +154,12 @@ pub fn filter_and_sort_nodes(
FilterProperty::KindSeries => node.kind == NodeKind::Series,
FilterProperty::KindSeason => node.kind == NodeKind::Season,
FilterProperty::KindEpisode => node.kind == NodeKind::Episode,
- FilterProperty::Watched => udata.watched == WatchedState::Watched,
- FilterProperty::Unwatched => udata.watched == WatchedState::None,
- FilterProperty::WatchProgress => {
- matches!(udata.watched, WatchedState::Progress(_))
- }
+ // FilterProperty::Watched => udata.watched == WatchedState::Watched,
+ // FilterProperty::Unwatched => udata.watched == WatchedState::None,
+ // FilterProperty::WatchProgress => {
+ // matches!(udata.watched, WatchedState::Progress(_))
+ // }
+ _ => false, // TODO
}
}
}
diff --git a/transcoder/src/image.rs b/transcoder/src/image.rs
index cce5437..28b253a 100644
--- a/transcoder/src/image.rs
+++ b/transcoder/src/image.rs
@@ -37,7 +37,7 @@ pub async fn transcode(
// TODO: use better image library that supports AVIF
let is_avif = {
let mut magic = [0u8; 12];
- file.read_exact(&mut magic).context("reading magic")?;
+ let _ = file.read_exact(&mut magic);
file.seek(SeekFrom::Start(0))
.context("seeking back to start")?;
// TODO: magic experimentally found and probably not working in all cases but fine as long as our avif enc uses that