mirror of
https://github.com/alexpasmantier/television.git
synced 2025-06-06 11:35:25 +00:00
wip: override prototypes with cli preview
This commit is contained in:
parent
5afb3c5e7e
commit
fc3f24fd89
@ -80,7 +80,7 @@ impl From<Cli> for PostProcessedCli {
|
|||||||
offset_expr: None,
|
offset_expr: None,
|
||||||
});
|
});
|
||||||
|
|
||||||
let channel: CableChannelPrototype;
|
let mut channel: CableChannelPrototype;
|
||||||
let working_directory: Option<String>;
|
let working_directory: Option<String>;
|
||||||
|
|
||||||
let cable_channels = cable::load_cable_channels().unwrap_or_default();
|
let cable_channels = cable::load_cable_channels().unwrap_or_default();
|
||||||
@ -118,6 +118,12 @@ impl From<Cli> for PostProcessedCli {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let Some(preview_cmd) = &preview_command {
|
||||||
|
channel.preview_command = Some(preview_cmd.command.clone());
|
||||||
|
channel.preview_delimiter = Some(preview_cmd.delimiter.clone());
|
||||||
|
channel.preview_offset = preview_cmd.offset_expr.clone();
|
||||||
|
}
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
channel,
|
channel,
|
||||||
preview_command,
|
preview_command,
|
||||||
|
@ -30,8 +30,8 @@ impl Previewer {
|
|||||||
// fast for most standard file sizes, plus we're caching the previews,
|
// fast for most standard file sizes, plus we're caching the previews,
|
||||||
// I'm not sure the extra complexity is worth it.
|
// I'm not sure the extra complexity is worth it.
|
||||||
pub fn handle_request(&mut self, entry: &Entry) -> Option<Arc<Preview>> {
|
pub fn handle_request(&mut self, entry: &Entry) -> Option<Arc<Preview>> {
|
||||||
// check if we have a preview for the current request
|
// check if we have a preview in cache for the current request
|
||||||
if let Some(preview) = self.preview(entry) {
|
if let Some(preview) = self.cached(entry) {
|
||||||
return Some(preview);
|
return Some(preview);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user