mirror of https://github.com/bobwen-dev/hunter
fix build and correct feature explanation in README
This commit is contained in:
parent
423647a6d8
commit
6e81584eca
|
@ -57,7 +57,7 @@ If it works on a system not mentioned here, please open an issue. Also feel free
|
|||
Compiling hunter currently requires a nightly Rust compiler!
|
||||
The easiest way to get a nightly compiler is with [rustup](https://rustup.rs/). If you have rustup installed it will automatically download and use a version that is known to work when you run cargo.
|
||||
|
||||
By default it will install a full-featured version with support for media-previews. You can control this using the feature flags ```img```, and ```video```. These can be disabled by calling cargo with ```--features ""```, if you want to disable all media previews, or ```--features=img"``` if you only want to disable video/audio previews.
|
||||
By default it will install a full-featured version with support for media-previews. You can control this using the feature flags ```img```, and ```video```. These can be disabled by calling cargo with ```--no-default-features```. You can then enable image previews with ```--features=img``` and add video/audio with ```--feature=img,video```. Note that video requires img!
|
||||
|
||||
Note that this only works if hunter can find the "preview-gen" tool somewhere in $PATH!
|
||||
|
||||
|
@ -71,7 +71,7 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|||
### Build with cargo
|
||||
|
||||
```
|
||||
cargo install (--features=...) hunter
|
||||
cargo install (--no-default-features --features=...) hunter
|
||||
```
|
||||
|
||||
|
||||
|
@ -85,10 +85,10 @@ git clone https://github.com/rabite0/hunter.git
|
|||
cd {source_dir}/hunter/
|
||||
|
||||
// (Optional) Build
|
||||
// cargo build --release (--features=...)
|
||||
// cargo build --release (--no-default-features --features=...)
|
||||
|
||||
// Install
|
||||
cargo install (--features=...) --path .
|
||||
cargo install (--no-default-features --features=...) --path .
|
||||
```
|
||||
|
||||
## NOTE:
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
|
||||
use image::{Pixel, FilterType, DynamicImage, GenericImageView};
|
||||
|
||||
use termion::{color::{Bg, Fg, Rgb},
|
||||
input::TermRead,
|
||||
use termion::color::{Bg, Fg, Rgb};
|
||||
#[cfg(feature = "video")]
|
||||
use termion::{input::TermRead,
|
||||
event::Key};
|
||||
|
||||
#[cfg(feature = "video")]
|
||||
|
@ -12,7 +13,9 @@ use gstreamer::{self, prelude::*};
|
|||
#[cfg(feature = "video")]
|
||||
use gstreamer_app;
|
||||
|
||||
use failure::{Error, format_err};
|
||||
use failure::Error;
|
||||
#[cfg(feature = "video")]
|
||||
use failure::format_err;
|
||||
|
||||
use rayon::prelude::*;
|
||||
|
||||
|
@ -30,14 +33,17 @@ fn main() -> MResult<()> {
|
|||
.expect("provide ysize")
|
||||
.parse()
|
||||
.unwrap();
|
||||
#[cfg(feature = "video")]
|
||||
let preview_type = args.get(3)
|
||||
.expect("Provide preview type")
|
||||
.parse::<String>()
|
||||
.unwrap();
|
||||
#[cfg(feature = "video")]
|
||||
let autoplay = args.get(4)
|
||||
.expect("Autoplay?")
|
||||
.parse::<bool>()
|
||||
.unwrap();
|
||||
#[cfg(feature = "video")]
|
||||
let mute = args.get(5)
|
||||
.expect("Muted?")
|
||||
.parse::<bool>()
|
||||
|
@ -80,6 +86,7 @@ fn image_preview(path: &str,
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "video")]
|
||||
fn video_preview(path: &String,
|
||||
xsize: usize,
|
||||
ysize: usize,
|
||||
|
@ -159,6 +166,7 @@ fn video_preview(path: &String,
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "video")]
|
||||
pub fn read_keys(player: gstreamer::Element) -> MResult<()> {
|
||||
let seek_time = gstreamer::ClockTime::from_seconds(5);
|
||||
for key in std::io::stdin().keys() {
|
||||
|
@ -216,6 +224,7 @@ pub fn read_keys(player: gstreamer::Element) -> MResult<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "video")]
|
||||
pub fn audio_preview(path: &String,
|
||||
autoplay: bool,
|
||||
mute: bool)
|
||||
|
@ -271,6 +280,7 @@ pub fn audio_preview(path: &String,
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(feature = "video")]
|
||||
pub fn make_gstreamer() -> MResult<(gstreamer::Element,
|
||||
gstreamer_app::AppSink)> {
|
||||
gstreamer::init()?;
|
||||
|
@ -330,7 +340,7 @@ impl Renderer {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
#[cfg(feature = "video")]
|
||||
fn send_frame(&self,
|
||||
frame: &gstreamer::sample::SampleRef,
|
||||
position: u64,
|
||||
|
|
Loading…
Reference in New Issue