Skip to content

Commit

Permalink
more changes
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmr committed Jul 9, 2024
1 parent abfce5f commit 7b76b01
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/transcription_downloader.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
// Manages the download of asset files for transcription courses.
//
// Transcription courses include references to the assets used in the course. Manually downloading
// them is a cumbersome process, so this module automates the process.
//! Manages the download of asset files for transcription courses.
//!
//! Transcription courses include references to external assets. Manually downloading them is a
//! cumbersome process, so this module automates the process.
use crate::{
data::course_generator::transcription::TranscriptionAsset, TranscriptionDownloaderError,
};

/// Downloads transcription assets to local storage.
pub trait TranscriptionDownloader {
/// Performs any initialization required to download assets.
fn initialize(&self) -> Result<(), TranscriptionDownloaderError>;

/// Downloads the given asset.
fn download_asset(&self, asset: TranscriptionAsset)
-> Result<(), TranscriptionDownloaderError>;
Expand All @@ -21,4 +18,18 @@ pub trait TranscriptionDownloader {
&self,
asset: &TranscriptionAsset,
) -> Result<bool, TranscriptionDownloaderError>;

/// Downloads all assets for all the transcription courses in the current Trane library.
fn download_all_assets(&self) -> Result<(), TranscriptionDownloaderError>;
}

/// An implementation of `TranscriptionDownloader` that downloads assets to a directory inside the
/// `.trane` directory.
pub struct LocalTranscriptionDownloader {}

impl LocalTranscriptionDownloader {
/// Creates a new `LocalTranscriptionDownloader`.
pub fn new() -> Self {
Self{}
}
}

0 comments on commit 7b76b01

Please sign in to comment.