Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yt-dlp support #31

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

gmanley
Copy link

@gmanley gmanley commented Mar 20, 2023

Initial implementation supporting yt-dlp as a recorder. I'm fairly new to Rust so I may be doing some silly things.
I want to add some tests and move the shared logic from the record function. Everything works from my testing. I'll need to do a bit more, before I'm confident in the yt-dlp side.

Copy link
Member

@hizkifw hizkifw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the PR! I've added some comments :)

@@ -88,6 +89,7 @@ pub struct ChannelConfig {
pub outpath: String,
/// If not present, will be fetched during runtime.
pub picture_url: Option<String>,
pub recorder: String, // TODO: Check this is a valid recorder on config load.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be better if you make an enum instead of using a string here

.ok_or(anyhow!("Failed to get filename"))?;
let destpath = Path::new(&task.output_directory).join(filename);

// Try to rename the file into the output directory
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this rename-otherwise-copy logic can be pulled out to a separate utility module

video_status: VideoStatus,
}

impl YTDOutputParser {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since ytarchive and yt-dlp uses a similar method to parse the command line output, I think it'd be good if you can create an OutputParser trait, so both YTDOutputParser and YTAOutputParser shares the same interface.

return;
}

let waiting_text = "[wait] Remaining time until next attempt:"; // Does it make sense to have this as a variable? Move to constant?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine, it'll (probably) get optimized into a constant anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants