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:
parent
f19e02988f
commit
c3764c125a
13 changed files with 240 additions and 11 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue