Clean things up a bit
This commit is contained in:
parent
a91e243ecc
commit
3275f4890d
18 changed files with 572 additions and 249 deletions
|
|
@ -11,7 +11,7 @@ pub struct TransmissionAction {
|
|||
}
|
||||
|
||||
impl TransmissionAction {
|
||||
pub async fn new(config: &TransmissionConfig) -> Result<Self> {
|
||||
pub fn new(config: &TransmissionConfig) -> Result<Self> {
|
||||
let client = TransmissionClient::new(config)?;
|
||||
|
||||
Ok(TransmissionAction { client })
|
||||
|
|
@ -21,10 +21,14 @@ impl TransmissionAction {
|
|||
#[async_trait::async_trait]
|
||||
impl Action for TransmissionAction {
|
||||
/// Return the name of the action
|
||||
fn name(&self) -> &str {
|
||||
fn name() -> &'static str {
|
||||
"Transmission"
|
||||
}
|
||||
|
||||
fn get_name(&self) -> &'static str {
|
||||
Self::name()
|
||||
}
|
||||
|
||||
/// Process all unprocessed magnet links and return the list of processed magnets
|
||||
async fn process_unprocessed_magnets(&mut self, db: &mut Database) -> Result<ProcessedMagnets> {
|
||||
let unprocessed_magnets =
|
||||
|
|
@ -37,7 +41,8 @@ impl Action for TransmissionAction {
|
|||
match self.client.submit_magnet(&magnet.link).await {
|
||||
Ok(_) => {
|
||||
debug!(
|
||||
"Successfully submitted magnet link to Transmission: {}",
|
||||
"Successfully submitted magnet link to {}: {}",
|
||||
Self::name(),
|
||||
magnet.title
|
||||
);
|
||||
debug!("Magnet link: {}", magnet.link);
|
||||
|
|
@ -45,7 +50,7 @@ impl Action for TransmissionAction {
|
|||
processed_magnets.push(magnet);
|
||||
}
|
||||
Err(e) => {
|
||||
warn!("Failed to submit magnet link to Transmission: {}", e);
|
||||
warn!("Failed to submit magnet link to {}: {}", Self::name(), e);
|
||||
failed_magnets.push(magnet);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue