feat: add the concept of tags

Tags are attached to all magnet links provided by a given source, and
passed to actions. This allows for e.g. better categorization in
Bitmagnet.
This commit is contained in:
Marc Plano-Lesay 2025-05-04 15:41:02 +10:00
parent f19e02988f
commit c3764c125a
Signed by: kernald
GPG key ID: 66A41B08CC62A6CF
13 changed files with 240 additions and 11 deletions

View file

@ -37,7 +37,10 @@ impl Action for TransmissionAction {
let mut failed_magnets = Vec::new();
for magnet in unprocessed_magnets {
match self.client.submit_magnet(&magnet.link).await {
let tags = db.get_tags_for_magnet(magnet.id)?;
let tag_refs: Vec<&str> = tags.iter().map(|s| s.as_str()).collect();
match self.client.submit_magnet(&magnet.link, tag_refs).await {
Ok(_) => {
debug!(
"Successfully submitted magnet link to {}: {}",
@ -45,6 +48,9 @@ impl Action for TransmissionAction {
magnet.title
);
debug!("Magnet link: {}", magnet.link);
if !tags.is_empty() {
debug!("Tags: {:?}", tags);
}
db.mark_magnet_processed_for_table::<TransmissionProcessedTable>(magnet.id)?;
processed_magnets.push(magnet);
}