Initial Netflex TV app
This commit is contained in:
62
src/main.rs
Normal file
62
src/main.rs
Normal file
@@ -0,0 +1,62 @@
|
||||
//! Netflex for SmartFox: a native TV client for a Netflex server.
|
||||
//!
|
||||
//! - UI: Slint (ui/*.slint) on sf-ui's Liquid Glass layer.
|
||||
//! - State and focus: src/app.rs and the screen modules; every remote key
|
||||
//! arrives in `App::key`.
|
||||
//! - Playback: sf-ui's GStreamer player (Linux), streaming the file straight
|
||||
//! from the server while the torrent downloads.
|
||||
|
||||
// Without a player (Windows, for UI work) some playback code sits unused.
|
||||
#![cfg_attr(not(target_os = "linux"), allow(dead_code, unused_imports))]
|
||||
|
||||
mod api;
|
||||
mod app;
|
||||
mod config;
|
||||
mod detail;
|
||||
mod format;
|
||||
mod home;
|
||||
mod player;
|
||||
mod task;
|
||||
|
||||
use slint::{ComponentHandle, Model};
|
||||
|
||||
slint::include_modules!();
|
||||
sf_ui::glue!(App);
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init();
|
||||
sf_ui::init()?;
|
||||
#[cfg(target_os = "linux")]
|
||||
if let Err(e) = sf_ui::video::init() {
|
||||
log::error!("video: {e:#}");
|
||||
}
|
||||
|
||||
let ui = App::new()?;
|
||||
ui.sf_ui_setup();
|
||||
if std::env::var_os("SF_UI_SIZE").is_none() && std::env::var_os("NETFLEX_WINDOWED").is_none() {
|
||||
ui.window().set_fullscreen(true);
|
||||
}
|
||||
|
||||
let glass = sf_ui::Glass::install(&ui, |ui, p| {
|
||||
p.extend(ui.get_glass_message().iter());
|
||||
p.extend(ui.get_glass_signin().iter());
|
||||
p.extend(ui.get_glass_signin_keyboard().iter());
|
||||
p.extend(ui.get_glass_home().iter());
|
||||
p.extend(ui.get_glass_home_keyboard().iter());
|
||||
p.extend(ui.get_glass_detail().iter());
|
||||
p.extend(ui.get_glass_detail_menu().iter());
|
||||
p.extend(ui.get_glass_player().iter());
|
||||
p.extend(ui.get_glass_player_audio().iter());
|
||||
p.extend(ui.get_glass_player_subs().iter());
|
||||
p.extend(ui.get_glass_player_sync().iter());
|
||||
})?;
|
||||
glass.set_palette(sf_ui::Palette::from_hex(["#ff4a3d", "#8c0b14", "#120305"]));
|
||||
|
||||
let images = sf_ui::images::Images::new(384 << 20);
|
||||
let app = app::Controller::new(&ui, glass, images);
|
||||
app.start();
|
||||
|
||||
ui.run()?;
|
||||
app.shutdown();
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user