mirror of
https://github.com/bobwen-dev/hunter
synced 2025-04-12 00:55:41 +02:00
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!
|
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.
|
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!
|
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
|
### 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/
|
cd {source_dir}/hunter/
|
||||||
|
|
||||||
// (Optional) Build
|
// (Optional) Build
|
||||||
// cargo build --release (--features=...)
|
// cargo build --release (--no-default-features --features=...)
|
||||||
|
|
||||||
// Install
|
// Install
|
||||||
cargo install (--features=...) --path .
|
cargo install (--no-default-features --features=...) --path .
|
||||||
```
|
```
|
||||||
|
|
||||||
## NOTE:
|
## NOTE:
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
use image::{Pixel, FilterType, DynamicImage, GenericImageView};
|
use image::{Pixel, FilterType, DynamicImage, GenericImageView};
|
||||||
|
|
||||||
use termion::{color::{Bg, Fg, Rgb},
|
use termion::color::{Bg, Fg, Rgb};
|
||||||
input::TermRead,
|
#[cfg(feature = "video")]
|
||||||
|
use termion::{input::TermRead,
|
||||||
event::Key};
|
event::Key};
|
||||||
|
|
||||||
#[cfg(feature = "video")]
|
#[cfg(feature = "video")]
|
||||||
@ -12,7 +13,9 @@ use gstreamer::{self, prelude::*};
|
|||||||
#[cfg(feature = "video")]
|
#[cfg(feature = "video")]
|
||||||
use gstreamer_app;
|
use gstreamer_app;
|
||||||
|
|
||||||
use failure::{Error, format_err};
|
use failure::Error;
|
||||||
|
#[cfg(feature = "video")]
|
||||||
|
use failure::format_err;
|
||||||
|
|
||||||
use rayon::prelude::*;
|
use rayon::prelude::*;
|
||||||
|
|
||||||
@ -30,14 +33,17 @@ fn main() -> MResult<()> {
|
|||||||
.expect("provide ysize")
|
.expect("provide ysize")
|
||||||
.parse()
|
.parse()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
#[cfg(feature = "video")]
|
||||||
let preview_type = args.get(3)
|
let preview_type = args.get(3)
|
||||||
.expect("Provide preview type")
|
.expect("Provide preview type")
|
||||||
.parse::<String>()
|
.parse::<String>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
#[cfg(feature = "video")]
|
||||||
let autoplay = args.get(4)
|
let autoplay = args.get(4)
|
||||||
.expect("Autoplay?")
|
.expect("Autoplay?")
|
||||||
.parse::<bool>()
|
.parse::<bool>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
#[cfg(feature = "video")]
|
||||||
let mute = args.get(5)
|
let mute = args.get(5)
|
||||||
.expect("Muted?")
|
.expect("Muted?")
|
||||||
.parse::<bool>()
|
.parse::<bool>()
|
||||||
@ -80,6 +86,7 @@ fn image_preview(path: &str,
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "video")]
|
||||||
fn video_preview(path: &String,
|
fn video_preview(path: &String,
|
||||||
xsize: usize,
|
xsize: usize,
|
||||||
ysize: usize,
|
ysize: usize,
|
||||||
@ -159,6 +166,7 @@ fn video_preview(path: &String,
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "video")]
|
||||||
pub fn read_keys(player: gstreamer::Element) -> MResult<()> {
|
pub fn read_keys(player: gstreamer::Element) -> MResult<()> {
|
||||||
let seek_time = gstreamer::ClockTime::from_seconds(5);
|
let seek_time = gstreamer::ClockTime::from_seconds(5);
|
||||||
for key in std::io::stdin().keys() {
|
for key in std::io::stdin().keys() {
|
||||||
@ -216,6 +224,7 @@ pub fn read_keys(player: gstreamer::Element) -> MResult<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "video")]
|
||||||
pub fn audio_preview(path: &String,
|
pub fn audio_preview(path: &String,
|
||||||
autoplay: bool,
|
autoplay: bool,
|
||||||
mute: bool)
|
mute: bool)
|
||||||
@ -271,6 +280,7 @@ pub fn audio_preview(path: &String,
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "video")]
|
||||||
pub fn make_gstreamer() -> MResult<(gstreamer::Element,
|
pub fn make_gstreamer() -> MResult<(gstreamer::Element,
|
||||||
gstreamer_app::AppSink)> {
|
gstreamer_app::AppSink)> {
|
||||||
gstreamer::init()?;
|
gstreamer::init()?;
|
||||||
@ -330,7 +340,7 @@ impl Renderer {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "video")]
|
||||||
fn send_frame(&self,
|
fn send_frame(&self,
|
||||||
frame: &gstreamer::sample::SampleRef,
|
frame: &gstreamer::sample::SampleRef,
|
||||||
position: u64,
|
position: u64,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user