clippy-fix
This commit is contained in:
parent
3f2f57f8e7
commit
cbf5fe3d9d
14 changed files with 166 additions and 184 deletions
|
@ -13,7 +13,7 @@ pub fn bg_from_video(
|
||||||
) -> Result<(), Box<dyn Error>> {
|
) -> Result<(), Box<dyn Error>> {
|
||||||
if !screenshot.exists() {
|
if !screenshot.exists() {
|
||||||
let output_duration = Command::new("ffprobe")
|
let output_duration = Command::new("ffprobe")
|
||||||
.args(&["-i", &video.to_string_lossy()])
|
.args(["-i", &video.to_string_lossy()])
|
||||||
.output()
|
.output()
|
||||||
.expect("failed to execute ffprobe");
|
.expect("failed to execute ffprobe");
|
||||||
io::stderr().write_all(&output_duration.stderr).unwrap();
|
io::stderr().write_all(&output_duration.stderr).unwrap();
|
||||||
|
@ -49,7 +49,7 @@ pub fn bg_from_video(
|
||||||
debug!(hours, minutes, seconds, at_second);
|
debug!(hours, minutes, seconds, at_second);
|
||||||
}
|
}
|
||||||
let _output = Command::new("ffmpeg")
|
let _output = Command::new("ffmpeg")
|
||||||
.args(&[
|
.args([
|
||||||
"-i",
|
"-i",
|
||||||
&video.to_string_lossy(),
|
&video.to_string_lossy(),
|
||||||
"-ss",
|
"-ss",
|
||||||
|
@ -103,7 +103,7 @@ mod test {
|
||||||
let result = bg_from_video(video, &screenshot);
|
let result = bg_from_video(video, &screenshot);
|
||||||
// let result = runtime.block_on(future);
|
// let result = runtime.block_on(future);
|
||||||
match result {
|
match result {
|
||||||
Ok(o) => assert_eq!(screenshot.exists(), true),
|
Ok(_o) => assert!(screenshot.exists()),
|
||||||
Err(e) => debug_assert!(
|
Err(e) => debug_assert!(
|
||||||
false,
|
false,
|
||||||
"There was an error in the runtime future. {:?}",
|
"There was an error in the runtime future. {:?}",
|
||||||
|
|
|
@ -39,7 +39,7 @@ mod qobject {
|
||||||
use cxx_qt_lib::{QString, QUrl};
|
use cxx_qt_lib::{QString, QUrl};
|
||||||
use rfd::FileDialog;
|
use rfd::FileDialog;
|
||||||
use std::{path::Path, pin::Pin};
|
use std::{path::Path, pin::Pin};
|
||||||
use tracing::{debug, debug_span, error, info, instrument};
|
use tracing::{debug, error};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct FileHelperRust {
|
pub struct FileHelperRust {
|
||||||
|
|
|
@ -155,7 +155,7 @@ mod qobject {
|
||||||
}
|
}
|
||||||
|
|
||||||
use crate::schema::images::dsl::*;
|
use crate::schema::images::dsl::*;
|
||||||
use cxx_qt::{CxxQtType, Threading};
|
use cxx_qt::{CxxQtType};
|
||||||
use cxx_qt_lib::{QModelIndex, QString, QUrl, QVariant};
|
use cxx_qt_lib::{QModelIndex, QString, QUrl, QVariant};
|
||||||
use diesel::sqlite::SqliteConnection;
|
use diesel::sqlite::SqliteConnection;
|
||||||
use diesel::{delete, insert_into, prelude::*, update};
|
use diesel::{delete, insert_into, prelude::*, update};
|
||||||
|
@ -428,7 +428,7 @@ impl qobject::ImageModel {
|
||||||
}
|
}
|
||||||
let role_names = self.as_ref().role_names();
|
let role_names = self.as_ref().role_names();
|
||||||
let role_names_iter = role_names.iter();
|
let role_names_iter = role_names.iter();
|
||||||
if let Some(image) = self.rust().images.get(index as usize) {
|
if let Some(_image) = self.rust().images.get(index as usize) {
|
||||||
for i in role_names_iter {
|
for i in role_names_iter {
|
||||||
qvariantmap.insert(
|
qvariantmap.insert(
|
||||||
QString::from(&i.1.to_string()),
|
QString::from(&i.1.to_string()),
|
||||||
|
|
|
@ -3,13 +3,14 @@ use cxx_qt::CxxQtType;
|
||||||
use cxx_qt_lib::{QString, QStringList};
|
use cxx_qt_lib::{QString, QStringList};
|
||||||
use obws::responses::scenes::Scenes;
|
use obws::responses::scenes::Scenes;
|
||||||
use obws::Client;
|
use obws::Client;
|
||||||
use std::thread::sleep;
|
|
||||||
use std::time::Duration;
|
|
||||||
use std::{error::Error, pin::Pin};
|
use std::{error::Error, pin::Pin};
|
||||||
use tracing::{debug, error};
|
use tracing::{debug, error};
|
||||||
|
|
||||||
use crate::obs::qobject::QList_QString;
|
use crate::obs::qobject::QList_QString;
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct Obs {
|
pub struct Obs {
|
||||||
scenes: Scenes,
|
scenes: Scenes,
|
||||||
client: Option<Client>,
|
client: Option<Client>,
|
||||||
|
@ -35,15 +36,7 @@ impl Clone for Obs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Obs {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
scenes: Scenes::default(),
|
|
||||||
client: None,
|
|
||||||
current_program_scene: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Obs {
|
impl Obs {
|
||||||
pub async fn new() -> Result<Self, Box<dyn Error>> {
|
pub async fn new() -> Result<Self, Box<dyn Error>> {
|
||||||
|
@ -68,7 +61,7 @@ impl Obs {
|
||||||
.iter()
|
.iter()
|
||||||
.map(|x| x.name.clone())
|
.map(|x| x.name.clone())
|
||||||
.collect::<Vec<String>>();
|
.collect::<Vec<String>>();
|
||||||
if scenes.len() > 0 {
|
if !scenes.is_empty() {
|
||||||
Ok(scenes)
|
Ok(scenes)
|
||||||
} else {
|
} else {
|
||||||
Err(format!("Scenes found: {}", scenes.len()))?
|
Err(format!("Scenes found: {}", scenes.len()))?
|
||||||
|
@ -80,19 +73,19 @@ impl Obs {
|
||||||
scene: String,
|
scene: String,
|
||||||
) -> Result<(), Box<dyn Error>> {
|
) -> Result<(), Box<dyn Error>> {
|
||||||
// debug!("Starting function");
|
// debug!("Starting function");
|
||||||
if let Some(client) = &self.client {
|
if let Some(_client) = &self.client {
|
||||||
debug!(scene, "setting scene in obs");
|
debug!(scene, "setting scene in obs");
|
||||||
|
|
||||||
let client = make_client();
|
let client = make_client();
|
||||||
let runtime = tokio::runtime::Runtime::new()?;
|
let runtime = tokio::runtime::Runtime::new()?;
|
||||||
let handle = runtime.spawn(async move {
|
let _handle = runtime.spawn(async move {
|
||||||
debug!("in spawn: before setting");
|
debug!("in spawn: before setting");
|
||||||
let res = client
|
let res = client
|
||||||
.scenes()
|
.scenes()
|
||||||
.set_current_program_scene(&scene)
|
.set_current_program_scene(&scene)
|
||||||
.await;
|
.await;
|
||||||
match res {
|
match res {
|
||||||
Ok(o) => {
|
Ok(_o) => {
|
||||||
debug!("in spawn: after setting: success")
|
debug!("in spawn: after setting: success")
|
||||||
}
|
}
|
||||||
Err(e) => error!(?e, "in spawn: after setting"),
|
Err(e) => error!(?e, "in spawn: after setting"),
|
||||||
|
@ -118,8 +111,8 @@ impl Obs {
|
||||||
fn make_client() -> Client {
|
fn make_client() -> Client {
|
||||||
let runtime = tokio::runtime::Runtime::new().unwrap();
|
let runtime = tokio::runtime::Runtime::new().unwrap();
|
||||||
let future = Client::connect("localhost", 4455, Some(""));
|
let future = Client::connect("localhost", 4455, Some(""));
|
||||||
let client = runtime.block_on(future).unwrap();
|
|
||||||
client
|
runtime.block_on(future).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cxx_qt::bridge]
|
#[cxx_qt::bridge]
|
||||||
|
|
|
@ -472,7 +472,7 @@ impl qobject::PresentationModel {
|
||||||
index: i32,
|
index: i32,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
let binding = self.as_mut();
|
let binding = self.as_mut();
|
||||||
let pres = binding.presentations.get(index as usize).clone();
|
let pres = binding.presentations.get(index as usize);
|
||||||
if let Some(item) = pres {
|
if let Some(item) = pres {
|
||||||
let item = item.clone();
|
let item = item.clone();
|
||||||
binding.add_presentation(item);
|
binding.add_presentation(item);
|
||||||
|
@ -636,8 +636,8 @@ impl qobject::PresentationModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn row_count(&self, _parent: &QModelIndex) -> i32 {
|
pub fn row_count(&self, _parent: &QModelIndex) -> i32 {
|
||||||
let cnt = self.presentations.len() as i32;
|
|
||||||
// println!("row count is {cnt}");
|
// println!("row count is {cnt}");
|
||||||
cnt
|
self.presentations.len() as i32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,7 +298,6 @@ use cxx_qt_lib::{
|
||||||
};
|
};
|
||||||
use dirs;
|
use dirs;
|
||||||
use serde_json::{json, Value};
|
use serde_json::{json, Value};
|
||||||
use std::io::{Read, Write};
|
|
||||||
use std::iter;
|
use std::iter;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
|
@ -397,7 +396,7 @@ impl Default for ServiceItemModelRust {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl qobject::ServiceItemModel {
|
impl qobject::ServiceItemModel {
|
||||||
pub fn setup(mut self: Pin<&mut Self>) {
|
pub fn setup(self: Pin<&mut Self>) {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,7 +413,7 @@ impl qobject::ServiceItemModel {
|
||||||
pub fn remove_items(mut self: Pin<&mut Self>) {
|
pub fn remove_items(mut self: Pin<&mut Self>) {
|
||||||
let mut indices = vec![];
|
let mut indices = vec![];
|
||||||
let mut items = self.service_items.clone();
|
let mut items = self.service_items.clone();
|
||||||
for (index, item) in items.iter_mut().enumerate().filter(|(y, x)| x.selected) {
|
for (index, _item) in items.iter_mut().enumerate().filter(|(_y, x)| x.selected) {
|
||||||
let index = index as i32;
|
let index = index as i32;
|
||||||
indices.push(index);
|
indices.push(index);
|
||||||
}
|
}
|
||||||
|
@ -434,7 +433,7 @@ impl qobject::ServiceItemModel {
|
||||||
self.as_mut().end_remove_rows();
|
self.as_mut().end_remove_rows();
|
||||||
}
|
}
|
||||||
let item = self.as_mut().get_item(*index);
|
let item = self.as_mut().get_item(*index);
|
||||||
self.as_mut().item_removed(&index, &item);
|
self.as_mut().item_removed(index, &item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,7 +566,7 @@ impl qobject::ServiceItemModel {
|
||||||
}
|
}
|
||||||
let rn = self.as_ref().role_names();
|
let rn = self.as_ref().role_names();
|
||||||
let rn_iter = rn.iter();
|
let rn_iter = rn.iter();
|
||||||
if let Some(service_item) =
|
if let Some(_service_item) =
|
||||||
self.service_items.get(index as usize)
|
self.service_items.get(index as usize)
|
||||||
{
|
{
|
||||||
for i in rn_iter {
|
for i in rn_iter {
|
||||||
|
@ -705,7 +704,7 @@ impl qobject::ServiceItemModel {
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.service_items
|
.service_items
|
||||||
.iter()
|
.iter()
|
||||||
.position(|i| i.selected == true)
|
.position(|i| i.selected)
|
||||||
{
|
{
|
||||||
// Here we will need to branch to get the selected items
|
// Here we will need to branch to get the selected items
|
||||||
debug!(first_item = ?current_index);
|
debug!(first_item = ?current_index);
|
||||||
|
@ -829,7 +828,7 @@ impl qobject::ServiceItemModel {
|
||||||
// println!("service_item is deactivating {:?}", i);
|
// println!("service_item is deactivating {:?}", i);
|
||||||
service_item.active = false;
|
service_item.active = false;
|
||||||
}
|
}
|
||||||
let obs = self.as_mut().obs.clone();
|
let _obs = self.as_mut().obs.clone();
|
||||||
|
|
||||||
if let Some(service_item) = self
|
if let Some(service_item) = self
|
||||||
.as_mut()
|
.as_mut()
|
||||||
|
@ -919,7 +918,7 @@ impl qobject::ServiceItemModel {
|
||||||
s.insert_str(0, "temp_");
|
s.insert_str(0, "temp_");
|
||||||
temp_dir.push(s);
|
temp_dir.push(s);
|
||||||
match fs::create_dir_all(&temp_dir) {
|
match fs::create_dir_all(&temp_dir) {
|
||||||
Ok(f) => {
|
Ok(_f) => {
|
||||||
println!("created_temp_dir: {:?}", &temp_dir)
|
println!("created_temp_dir: {:?}", &temp_dir)
|
||||||
}
|
}
|
||||||
Err(e) => println!("temp-dir-error: {e}"),
|
Err(e) => println!("temp-dir-error: {e}"),
|
||||||
|
@ -928,8 +927,8 @@ impl qobject::ServiceItemModel {
|
||||||
temp_service_file.push("serviceitems.json");
|
temp_service_file.push("serviceitems.json");
|
||||||
self.as_mut().save_progress_updated(10);
|
self.as_mut().save_progress_updated(10);
|
||||||
let mut service_json: Vec<Value> = vec![];
|
let mut service_json: Vec<Value> = vec![];
|
||||||
let progress_fraction = items.len() as f32 / 100 as f32;
|
let progress_fraction = items.len() as f32 / 100_f32;
|
||||||
for (id, item) in items.iter().enumerate() {
|
for (_id, item) in items.iter().enumerate() {
|
||||||
let text_list = QList_QString::from(&item.text);
|
let text_list = QList_QString::from(&item.text);
|
||||||
let mut text_vec = Vec::<String>::default();
|
let mut text_vec = Vec::<String>::default();
|
||||||
|
|
||||||
|
@ -942,7 +941,7 @@ impl qobject::ServiceItemModel {
|
||||||
);
|
);
|
||||||
println!("bg_path: {:?}", background_path);
|
println!("bg_path: {:?}", background_path);
|
||||||
let flat_background_name =
|
let flat_background_name =
|
||||||
background_path.file_name().clone();
|
background_path.file_name();
|
||||||
let flat_background;
|
let flat_background;
|
||||||
match flat_background_name {
|
match flat_background_name {
|
||||||
Some(name) => {
|
Some(name) => {
|
||||||
|
@ -975,7 +974,7 @@ impl qobject::ServiceItemModel {
|
||||||
println!("audio: {:?}", &name);
|
println!("audio: {:?}", &name);
|
||||||
if name.to_str().unwrap() != "temp" {
|
if name.to_str().unwrap() != "temp" {
|
||||||
flat_audio =
|
flat_audio =
|
||||||
name.to_str().unwrap().clone()
|
name.to_str().unwrap()
|
||||||
} else {
|
} else {
|
||||||
flat_audio = "";
|
flat_audio = "";
|
||||||
}
|
}
|
||||||
|
@ -1055,7 +1054,7 @@ impl qobject::ServiceItemModel {
|
||||||
service_file,
|
service_file,
|
||||||
&service_json,
|
&service_json,
|
||||||
) {
|
) {
|
||||||
Ok(e) => {
|
Ok(_e) => {
|
||||||
debug!(time = ?now.elapsed(), "file written");
|
debug!(time = ?now.elapsed(), "file written");
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
debug!(time = ?now.elapsed(), "idk");
|
debug!(time = ?now.elapsed(), "idk");
|
||||||
|
@ -1138,8 +1137,8 @@ impl qobject::ServiceItemModel {
|
||||||
datadir.push("lumina");
|
datadir.push("lumina");
|
||||||
datadir.push("temp");
|
datadir.push("temp");
|
||||||
println!("datadir: {:?}", datadir);
|
println!("datadir: {:?}", datadir);
|
||||||
fs::remove_dir_all(&datadir);
|
let _ = fs::remove_dir_all(&datadir);
|
||||||
fs::create_dir_all(&datadir);
|
let _ = fs::create_dir_all(&datadir);
|
||||||
|
|
||||||
if let Ok(lf) = &lfr {
|
if let Ok(lf) = &lfr {
|
||||||
println!("archive: {:?}", lf);
|
println!("archive: {:?}", lf);
|
||||||
|
@ -1154,14 +1153,17 @@ impl qobject::ServiceItemModel {
|
||||||
println!("filename: {:?}", file.path().unwrap());
|
println!("filename: {:?}", file.path().unwrap());
|
||||||
println!("size: {:?}", file.size());
|
println!("size: {:?}", file.size());
|
||||||
if !file_path.exists() {
|
if !file_path.exists() {
|
||||||
file.unpack_in(&datadir);
|
match file.unpack_in(&datadir) {
|
||||||
|
Ok(t) => (),
|
||||||
|
Err(e) => error!("Error unpacking archive: {}", e),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// older save files use servicelist.json instead of serviceitems.json
|
// older save files use servicelist.json instead of serviceitems.json
|
||||||
// Let's check to see if that's the case and change it's name in the
|
// Let's check to see if that's the case and change it's name in the
|
||||||
// temp dir.
|
// temp dir.
|
||||||
for mut file in
|
for file in
|
||||||
fs::read_dir(datadir.clone()).unwrap().filter(|f| {
|
fs::read_dir(datadir.clone()).unwrap().filter(|f| {
|
||||||
f.as_ref()
|
f.as_ref()
|
||||||
.map(|e| {
|
.map(|e| {
|
||||||
|
@ -1176,7 +1178,7 @@ impl qobject::ServiceItemModel {
|
||||||
let mut service_path = datadir.clone();
|
let mut service_path = datadir.clone();
|
||||||
service_path.push("serviceitems.json");
|
service_path.push("serviceitems.json");
|
||||||
match fs::rename(file.unwrap().path(), service_path) {
|
match fs::rename(file.unwrap().path(), service_path) {
|
||||||
Ok(i) => println!("We did it captain"),
|
Ok(_i) => println!("We did it captain"),
|
||||||
Err(e) => println!("error: {:?}", e),
|
Err(e) => println!("error: {:?}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1186,7 +1188,7 @@ impl qobject::ServiceItemModel {
|
||||||
// let mut service_list =
|
// let mut service_list =
|
||||||
// fs::File::open(service_path).unwrap();
|
// fs::File::open(service_path).unwrap();
|
||||||
|
|
||||||
let mut s = fs::read_to_string(service_path).unwrap();
|
let s = fs::read_to_string(service_path).unwrap();
|
||||||
// service_list.read_to_string(&mut s);
|
// service_list.read_to_string(&mut s);
|
||||||
let ds: Value = serde_json::from_str(&s).unwrap();
|
let ds: Value = serde_json::from_str(&s).unwrap();
|
||||||
for obj in ds.as_array().unwrap() {
|
for obj in ds.as_array().unwrap() {
|
||||||
|
@ -1208,7 +1210,7 @@ impl qobject::ServiceItemModel {
|
||||||
// it exists on disk, if not use the flat version
|
// it exists on disk, if not use the flat version
|
||||||
let audio_string =
|
let audio_string =
|
||||||
obj.get("audio").unwrap().as_str().unwrap();
|
obj.get("audio").unwrap().as_str().unwrap();
|
||||||
let mut audio;
|
let audio;
|
||||||
println!("audio_on_disk: {audio_string}");
|
println!("audio_on_disk: {audio_string}");
|
||||||
|
|
||||||
if !Path::new(&audio_string).exists() {
|
if !Path::new(&audio_string).exists() {
|
||||||
|
@ -1242,7 +1244,7 @@ impl qobject::ServiceItemModel {
|
||||||
|
|
||||||
let bgstr =
|
let bgstr =
|
||||||
obj.get("background").unwrap().as_str().unwrap();
|
obj.get("background").unwrap().as_str().unwrap();
|
||||||
let mut background;
|
let background;
|
||||||
println!("background_on_disk: {bgstr}");
|
println!("background_on_disk: {bgstr}");
|
||||||
let bgpath =
|
let bgpath =
|
||||||
bgstr.strip_prefix("file://").unwrap_or("");
|
bgstr.strip_prefix("file://").unwrap_or("");
|
||||||
|
@ -1350,7 +1352,7 @@ impl qobject::ServiceItemModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn load_last_saved(mut self: Pin<&mut Self>) -> bool {
|
pub fn load_last_saved(self: Pin<&mut Self>) -> bool {
|
||||||
todo!();
|
todo!();
|
||||||
// Don't actually need
|
// Don't actually need
|
||||||
}
|
}
|
||||||
|
@ -1505,14 +1507,14 @@ impl qobject::ServiceItemModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn row_count(&self, _parent: &QModelIndex) -> i32 {
|
pub fn row_count(&self, _parent: &QModelIndex) -> i32 {
|
||||||
let cnt = self.service_items.len() as i32;
|
|
||||||
// println!("row count is {cnt}");
|
// println!("row count is {cnt}");
|
||||||
cnt
|
self.service_items.len() as i32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ServiceItemModelRust {
|
impl ServiceItemModelRust {
|
||||||
pub fn save(mut model: Pin<&mut ServiceItemModel>, file: QUrl) -> bool {
|
pub fn save(_model: Pin<&mut ServiceItemModel>, _file: QUrl) -> bool {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ use configparser::ini::Ini;
|
||||||
use cxx_qt::CxxQtType;
|
use cxx_qt::CxxQtType;
|
||||||
use cxx_qt_lib::{QString, QUrl};
|
use cxx_qt_lib::{QString, QUrl};
|
||||||
use dirs;
|
use dirs;
|
||||||
use std::{path::PathBuf, pin::Pin};
|
use std::{pin::Pin};
|
||||||
|
|
||||||
// In order for settings to save to the ini file,
|
// In order for settings to save to the ini file,
|
||||||
// I'll need to create my own setting functions I think.
|
// I'll need to create my own setting functions I think.
|
||||||
|
@ -68,7 +68,7 @@ impl qobject::Settings {
|
||||||
conf.push("lumina");
|
conf.push("lumina");
|
||||||
conf.push("lumina.conf");
|
conf.push("lumina.conf");
|
||||||
match self.as_mut().rust_mut().config.load(conf) {
|
match self.as_mut().rust_mut().config.load(conf) {
|
||||||
Ok(map) => {
|
Ok(_map) => {
|
||||||
// println!("{:?}", self.rust().config);
|
// println!("{:?}", self.rust().config);
|
||||||
let sf = self
|
let sf = self
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
@ -100,7 +100,7 @@ impl qobject::Settings {
|
||||||
"lastSaveFile",
|
"lastSaveFile",
|
||||||
Some(file.to_string()),
|
Some(file.to_string()),
|
||||||
) {
|
) {
|
||||||
Some(s) => {
|
Some(_s) => {
|
||||||
println!(
|
println!(
|
||||||
"set-save-file: {:?}",
|
"set-save-file: {:?}",
|
||||||
self.as_mut()
|
self.as_mut()
|
||||||
|
|
|
@ -221,7 +221,7 @@ use cxx_qt_lib::{
|
||||||
};
|
};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::{path::PathBuf, pin::Pin};
|
use std::{path::PathBuf, pin::Pin};
|
||||||
use tracing::{debug, debug_span, error, info, instrument};
|
use tracing::{debug, error};
|
||||||
|
|
||||||
use self::qobject::{
|
use self::qobject::{
|
||||||
QHash_i32_QByteArray, QMap_QString_QVariant, QVector_i32,
|
QHash_i32_QByteArray, QMap_QString_QVariant, QVector_i32,
|
||||||
|
@ -355,7 +355,7 @@ impl qobject::SlideModel {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
match result {
|
match result {
|
||||||
Ok(o) => {
|
Ok(_o) => {
|
||||||
debug!("Success in creating qt_thread")
|
debug!("Success in creating qt_thread")
|
||||||
}
|
}
|
||||||
Err(error) => error!(
|
Err(error) => error!(
|
||||||
|
@ -448,7 +448,7 @@ impl qobject::SlideModel {
|
||||||
slide: &Slide,
|
slide: &Slide,
|
||||||
index: i32,
|
index: i32,
|
||||||
) {
|
) {
|
||||||
let mut slide = slide.clone();
|
let slide = slide.clone();
|
||||||
// slide.slide_index = index;
|
// slide.slide_index = index;
|
||||||
debug!(?slide);
|
debug!(?slide);
|
||||||
|
|
||||||
|
@ -695,7 +695,7 @@ impl qobject::SlideModel {
|
||||||
let mut slide = Slide::default();
|
let mut slide = Slide::default();
|
||||||
let iter = service_item.iter();
|
let iter = service_item.iter();
|
||||||
|
|
||||||
for (key, value) in iter {
|
for (key, _value) in iter {
|
||||||
debug!(?key);
|
debug!(?key);
|
||||||
// match key.to_string().as_str() {
|
// match key.to_string().as_str() {
|
||||||
// "ty" => slide.ty = QString::from(value),
|
// "ty" => slide.ty = QString::from(value),
|
||||||
|
@ -910,9 +910,7 @@ impl qobject::SlideModel {
|
||||||
|
|
||||||
if let Some((i, slide)) = slides_iter
|
if let Some((i, slide)) = slides_iter
|
||||||
.clone()
|
.clone()
|
||||||
.enumerate()
|
.enumerate().find(|slide| slide.1.service_item_id == source_index)
|
||||||
.filter(|slide| slide.1.service_item_id == source_index)
|
|
||||||
.next()
|
|
||||||
{
|
{
|
||||||
debug!(index = i, ?slide);
|
debug!(index = i, ?slide);
|
||||||
first_slide = i as i32;
|
first_slide = i as i32;
|
||||||
|
@ -929,10 +927,9 @@ impl qobject::SlideModel {
|
||||||
.clone()
|
.clone()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.rev()
|
.rev()
|
||||||
.filter(|slide| {
|
.find(|slide| {
|
||||||
slide.1.service_item_id == destination_index
|
slide.1.service_item_id == destination_index
|
||||||
})
|
})
|
||||||
.next()
|
|
||||||
{
|
{
|
||||||
dest_slide = i as i32;
|
dest_slide = i as i32;
|
||||||
dest_count = if slide.slide_count == 0 {
|
dest_count = if slide.slide_count == 0 {
|
||||||
|
@ -945,13 +942,11 @@ impl qobject::SlideModel {
|
||||||
dest_slide, dest_count
|
dest_slide, dest_count
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else if let Some((i, slide)) = slides_iter
|
||||||
if let Some((i, slide)) = slides_iter
|
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter(|slide| {
|
.find(|slide| {
|
||||||
slide.1.service_item_id == destination_index
|
slide.1.service_item_id == destination_index
|
||||||
})
|
})
|
||||||
.next()
|
|
||||||
{
|
{
|
||||||
dest_slide = i as i32;
|
dest_slide = i as i32;
|
||||||
dest_count = if slide.slide_count == 0 {
|
dest_count = if slide.slide_count == 0 {
|
||||||
|
@ -960,7 +955,6 @@ impl qobject::SlideModel {
|
||||||
slide.slide_count
|
slide.slide_count
|
||||||
};
|
};
|
||||||
debug!("RUST_dest_slide: {:?}", dest_slide);
|
debug!("RUST_dest_slide: {:?}", dest_slide);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!(count, first_slide, dest_slide);
|
debug!(count, first_slide, dest_slide);
|
||||||
|
@ -978,7 +972,7 @@ impl qobject::SlideModel {
|
||||||
// self.as_mut().begin_reset_model();
|
// self.as_mut().begin_reset_model();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
let rc = self.as_ref().count() - 1;
|
let _rc = self.as_ref().count() - 1;
|
||||||
let tl = &self.as_ref().index(
|
let tl = &self.as_ref().index(
|
||||||
first_slide,
|
first_slide,
|
||||||
0,
|
0,
|
||||||
|
@ -998,7 +992,7 @@ impl qobject::SlideModel {
|
||||||
if count > 1 {
|
if count > 1 {
|
||||||
if move_down {
|
if move_down {
|
||||||
debug!("While moving down, change service items id of moved slide");
|
debug!("While moving down, change service items id of moved slide");
|
||||||
for (i, slide) in slides_iter
|
for (i, _slide) in slides_iter
|
||||||
.clone()
|
.clone()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter(|x| {
|
.filter(|x| {
|
||||||
|
@ -1022,7 +1016,7 @@ impl qobject::SlideModel {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
debug!("While moving up, change service items id of moved slide");
|
debug!("While moving up, change service items id of moved slide");
|
||||||
for (i, slide) in slides_iter
|
for (i, _slide) in slides_iter
|
||||||
.clone()
|
.clone()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter(|x| x.0 >= dest_slide as usize)
|
.filter(|x| x.0 >= dest_slide as usize)
|
||||||
|
@ -1040,8 +1034,7 @@ impl qobject::SlideModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if let Some(slide) = self
|
||||||
if let Some(slide) = self
|
|
||||||
.as_mut()
|
.as_mut()
|
||||||
.rust_mut()
|
.rust_mut()
|
||||||
.slides
|
.slides
|
||||||
|
@ -1055,12 +1048,11 @@ impl qobject::SlideModel {
|
||||||
);
|
);
|
||||||
slide.service_item_id = destination_index;
|
slide.service_item_id = destination_index;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Change the service_item_id of the shifted slides, not the moved service_item
|
// Change the service_item_id of the shifted slides, not the moved service_item
|
||||||
if move_down {
|
if move_down {
|
||||||
debug!("While moving down, change service item id");
|
debug!("While moving down, change service item id");
|
||||||
for (i, slide) in slides_iter
|
for (i, _slide) in slides_iter
|
||||||
.clone()
|
.clone()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter(|x| x.1.service_item_id <= destination_index)
|
.filter(|x| x.1.service_item_id <= destination_index)
|
||||||
|
@ -1081,7 +1073,7 @@ impl qobject::SlideModel {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
debug!("While moving up, change service item id");
|
debug!("While moving up, change service item id");
|
||||||
for (i, slide) in slides_iter
|
for (i, _slide) in slides_iter
|
||||||
.clone()
|
.clone()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter(|x| x.0 >= (dest_slide + count) as usize)
|
.filter(|x| x.0 >= (dest_slide + count) as usize)
|
||||||
|
@ -1173,7 +1165,7 @@ impl qobject::SlideModel {
|
||||||
}
|
}
|
||||||
let rn = self.as_ref().role_names();
|
let rn = self.as_ref().role_names();
|
||||||
let rn_iter = rn.iter();
|
let rn_iter = rn.iter();
|
||||||
if let Some(slide) = self.rust().slides.get(index as usize) {
|
if let Some(_slide) = self.rust().slides.get(index as usize) {
|
||||||
for i in rn_iter {
|
for i in rn_iter {
|
||||||
qvariantmap.insert(
|
qvariantmap.insert(
|
||||||
QString::from(&i.1.to_string()),
|
QString::from(&i.1.to_string()),
|
||||||
|
@ -1193,9 +1185,7 @@ impl qobject::SlideModel {
|
||||||
debug!(service_item = index, "Getting slide from this item");
|
debug!(service_item = index, "Getting slide from this item");
|
||||||
let mut id = 0;
|
let mut id = 0;
|
||||||
if let Some((i, slide)) = slides_iter
|
if let Some((i, slide)) = slides_iter
|
||||||
.enumerate()
|
.enumerate().find(|(_i, slide)| slide.service_item_id == index)
|
||||||
.filter(|(i, slide)| slide.service_item_id == index)
|
|
||||||
.next()
|
|
||||||
{
|
{
|
||||||
debug!(slide_id = i, ?slide);
|
debug!(slide_id = i, ?slide);
|
||||||
id = i as i32;
|
id = i as i32;
|
||||||
|
@ -1425,7 +1415,7 @@ impl qobject::SlideModel {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_obs_setting_scene() {
|
pub fn test_obs_setting_scene() {
|
||||||
|
|
|
@ -145,11 +145,11 @@ impl qobject::SlideObject {
|
||||||
item: QMap_QString_QVariant,
|
item: QMap_QString_QVariant,
|
||||||
slide_index: i32,
|
slide_index: i32,
|
||||||
) {
|
) {
|
||||||
let current_index = self.as_ref().get_ref().slide_index();
|
let _current_index = self.as_ref().get_ref().slide_index();
|
||||||
let icount_variant = item
|
let icount_variant = item
|
||||||
.get(&QString::from("imageCount"))
|
.get(&QString::from("imageCount"))
|
||||||
.unwrap_or(QVariant::from(&1));
|
.unwrap_or(QVariant::from(&1));
|
||||||
let count = icount_variant.value::<i32>().unwrap_or_default();
|
let _count = icount_variant.value::<i32>().unwrap_or_default();
|
||||||
|
|
||||||
let slindex = item
|
let slindex = item
|
||||||
.get(&QString::from("slideIndex"))
|
.get(&QString::from("slideIndex"))
|
||||||
|
@ -434,7 +434,7 @@ impl qobject::SlideObject {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
pub fn play_pause(mut self: Pin<&mut Self>) -> bool {
|
pub fn play_pause(mut self: Pin<&mut Self>) -> bool {
|
||||||
let playing = self.as_ref().is_playing().clone();
|
let playing = *self.as_ref().is_playing();
|
||||||
match playing {
|
match playing {
|
||||||
true => self.as_mut().set_is_playing(false),
|
true => self.as_mut().set_is_playing(false),
|
||||||
false => self.as_mut().set_is_playing(true),
|
false => self.as_mut().set_is_playing(true),
|
||||||
|
|
|
@ -49,7 +49,7 @@ pub mod qobject {
|
||||||
// use crate::songs::song_model::qobject::SongModel;
|
// use crate::songs::song_model::qobject::SongModel;
|
||||||
use cxx_qt_lib::QString;
|
use cxx_qt_lib::QString;
|
||||||
use std::{path::PathBuf, pin::Pin};
|
use std::{path::PathBuf, pin::Pin};
|
||||||
use tracing::{debug, debug_span, error, info, instrument};
|
use tracing::{debug};
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct SongEditorRust {
|
pub struct SongEditorRust {
|
||||||
|
@ -95,7 +95,7 @@ impl Default for SongEditorRust {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl qobject::SongEditor {
|
impl qobject::SongEditor {
|
||||||
fn idk(mut self: Pin<&mut Self>) {
|
fn idk(self: Pin<&mut Self>) {
|
||||||
// if let Some(model) = unsafe { self.song_model().as_mut() } {
|
// if let Some(model) = unsafe { self.song_model().as_mut() } {
|
||||||
// let pinned_model = unsafe { Pin::new_unchecked(model) };
|
// let pinned_model = unsafe { Pin::new_unchecked(model) };
|
||||||
// pinned_model.update_ccli(0, QString::from("idk"));
|
// pinned_model.update_ccli(0, QString::from("idk"));
|
||||||
|
@ -105,10 +105,10 @@ impl qobject::SongEditor {
|
||||||
|
|
||||||
pub fn check_verse_order(mut self: Pin<&mut Self>) {
|
pub fn check_verse_order(mut self: Pin<&mut Self>) {
|
||||||
let vo = self.verse_order().to_string();
|
let vo = self.verse_order().to_string();
|
||||||
let split = vo.split(" ");
|
let split = vo.split(' ');
|
||||||
debug!(verse_order = ?vo, iterator = ?split);
|
debug!(verse_order = ?vo, iterator = ?split);
|
||||||
for s in split {
|
for s in split {
|
||||||
if s.contains(",") || s.is_empty() {
|
if s.contains(',') || s.is_empty() {
|
||||||
self.as_mut().set_verse_order_error(true);
|
self.as_mut().set_verse_order_error(true);
|
||||||
} else {
|
} else {
|
||||||
self.as_mut().set_verse_order_error(false);
|
self.as_mut().set_verse_order_error(false);
|
||||||
|
|
|
@ -249,7 +249,7 @@ use diesel::sqlite::SqliteConnection;
|
||||||
use diesel::{delete, insert_into, prelude::*, update};
|
use diesel::{delete, insert_into, prelude::*, update};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
use tracing::{debug, debug_span, error, info, instrument};
|
use tracing::{debug, error};
|
||||||
|
|
||||||
use self::qobject::{
|
use self::qobject::{
|
||||||
QHash_i32_QByteArray, QMap_QString_QVariant, QVector_i32,
|
QHash_i32_QByteArray, QMap_QString_QVariant, QVector_i32,
|
||||||
|
@ -465,7 +465,7 @@ impl qobject::SongModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_indices(
|
fn get_indices(
|
||||||
mut self: Pin<&mut Self>,
|
self: Pin<&mut Self>,
|
||||||
song_id: i32,
|
song_id: i32,
|
||||||
role: SongRoles,
|
role: SongRoles,
|
||||||
) -> (usize, QModelIndex, QVector_i32) {
|
) -> (usize, QModelIndex, QVector_i32) {
|
||||||
|
@ -955,7 +955,7 @@ impl qobject::SongModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_lyric_list(
|
pub fn get_lyric_list(
|
||||||
mut self: Pin<&mut Self>,
|
self: Pin<&mut Self>,
|
||||||
index: i32,
|
index: i32,
|
||||||
) -> QStringList {
|
) -> QStringList {
|
||||||
println!("LYRIC_LIST: {index}");
|
println!("LYRIC_LIST: {index}");
|
||||||
|
@ -980,12 +980,12 @@ impl qobject::SongModel {
|
||||||
"Intro 1", "Intro 2", "Ending 1", "Ending 2",
|
"Intro 1", "Intro 2", "Ending 1", "Ending 2",
|
||||||
"Other 1", "Other 2", "Other 3", "Other 4",
|
"Other 1", "Other 2", "Other 3", "Other 4",
|
||||||
];
|
];
|
||||||
let mut first_item = true;
|
let _first_item = true;
|
||||||
|
|
||||||
let mut lyric_map = HashMap::new();
|
let mut lyric_map = HashMap::new();
|
||||||
let mut verse_title = String::from("");
|
let mut verse_title = String::from("");
|
||||||
let mut lyric = String::from("");
|
let mut lyric = String::from("");
|
||||||
for (i, line) in raw_lyrics.split("\n").enumerate() {
|
for (i, line) in raw_lyrics.split('\n').enumerate() {
|
||||||
if keywords.contains(&line) {
|
if keywords.contains(&line) {
|
||||||
if i != 0 {
|
if i != 0 {
|
||||||
// println!("{verse_title}");
|
// println!("{verse_title}");
|
||||||
|
@ -1002,13 +1002,13 @@ impl qobject::SongModel {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lyric.push_str(line);
|
lyric.push_str(line);
|
||||||
lyric.push_str("\n");
|
lyric.push('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lyric_map.insert(verse_title, lyric);
|
lyric_map.insert(verse_title, lyric);
|
||||||
// println!("da-map: {:?}", lyric_map);
|
// println!("da-map: {:?}", lyric_map);
|
||||||
|
|
||||||
for mut verse in vorder {
|
for verse in vorder {
|
||||||
let mut verse_name = "";
|
let mut verse_name = "";
|
||||||
// debug!(verse = verse);
|
// debug!(verse = verse);
|
||||||
for word in keywords.clone() {
|
for word in keywords.clone() {
|
||||||
|
@ -1033,7 +1033,7 @@ impl qobject::SongModel {
|
||||||
let split_lyrics: Vec<&str> =
|
let split_lyrics: Vec<&str> =
|
||||||
lyric.split("\n\n").collect();
|
lyric.split("\n\n").collect();
|
||||||
for lyric in split_lyrics {
|
for lyric in split_lyrics {
|
||||||
if lyric == "" {
|
if lyric.is_empty() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
lyric_list.append(QString::from(lyric));
|
lyric_list.append(QString::from(lyric));
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
|
|
||||||
use time::macros::format_description;
|
|
||||||
use tokio::runtime::Runtime;
|
use tokio::runtime::Runtime;
|
||||||
use tracing::{debug, info, instrument::WithSubscriber};
|
use tracing::{debug, info};
|
||||||
use tracing_subscriber::{
|
use tracing_subscriber::{
|
||||||
fmt::{self, time::LocalTime},
|
|
||||||
EnvFilter,
|
EnvFilter,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,7 +12,7 @@ use self::qobject::{QString, QUrl};
|
||||||
mod db {
|
mod db {
|
||||||
use diesel::{Connection, SqliteConnection};
|
use diesel::{Connection, SqliteConnection};
|
||||||
use dirs::data_local_dir;
|
use dirs::data_local_dir;
|
||||||
use sqlx::{Connection as SqlxConnection, Error};
|
|
||||||
|
|
||||||
pub enum Model {
|
pub enum Model {
|
||||||
Songs,
|
Songs,
|
||||||
|
@ -97,15 +96,15 @@ impl qobject::Utils {
|
||||||
crate::utils::setup();
|
crate::utils::setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dbg(self: &Self, message: QString) {
|
pub fn dbg(&self, message: QString) {
|
||||||
debug!(msg = ?message);
|
debug!(msg = ?message);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn inf(self: &Self, message: QString) {
|
pub fn inf(&self, message: QString) {
|
||||||
info!(msg = ?message);
|
info!(msg = ?message);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn url_to_string(self: &Self, url: QUrl) -> QString {
|
pub fn url_to_string(&self, url: QUrl) -> QString {
|
||||||
url.path()
|
url.path()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,13 +176,13 @@ mod qobject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use crate::models::*;
|
|
||||||
use crate::schema::videos::dsl::*;
|
use crate::schema::videos::dsl::*;
|
||||||
use cxx_qt::CxxQtType;
|
use cxx_qt::CxxQtType;
|
||||||
use cxx_qt_lib::{QByteArray, QModelIndex, QString, QUrl, QVariant};
|
use cxx_qt_lib::{QByteArray, QModelIndex, QString, QUrl, QVariant};
|
||||||
use diesel::sqlite::SqliteConnection;
|
use diesel::sqlite::SqliteConnection;
|
||||||
use diesel::{delete, insert_into, prelude::*, update};
|
use diesel::{delete, insert_into, prelude::*, update};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{PathBuf};
|
||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
|
|
||||||
use self::qobject::{
|
use self::qobject::{
|
||||||
|
@ -438,7 +438,7 @@ impl qobject::VideoModel {
|
||||||
.iter_mut()
|
.iter_mut()
|
||||||
.filter(|x| x.id == index)
|
.filter(|x| x.id == index)
|
||||||
{
|
{
|
||||||
video.looping = loop_value.clone();
|
video.looping = loop_value;
|
||||||
println!("rust-video: {:?}", video.title);
|
println!("rust-video: {:?}", video.title);
|
||||||
}
|
}
|
||||||
self.as_mut().data_changed(
|
self.as_mut().data_changed(
|
||||||
|
@ -477,7 +477,7 @@ impl qobject::VideoModel {
|
||||||
.iter_mut()
|
.iter_mut()
|
||||||
.filter(|x| x.id == index)
|
.filter(|x| x.id == index)
|
||||||
{
|
{
|
||||||
video.end_time = updated_end_time.clone();
|
video.end_time = updated_end_time;
|
||||||
}
|
}
|
||||||
self.as_mut().data_changed(
|
self.as_mut().data_changed(
|
||||||
model_index,
|
model_index,
|
||||||
|
@ -515,7 +515,7 @@ impl qobject::VideoModel {
|
||||||
.iter_mut()
|
.iter_mut()
|
||||||
.filter(|x| x.id == index)
|
.filter(|x| x.id == index)
|
||||||
{
|
{
|
||||||
video.start_time = updated_start_time.clone();
|
video.start_time = updated_start_time;
|
||||||
}
|
}
|
||||||
self.as_mut().data_changed(
|
self.as_mut().data_changed(
|
||||||
model_index,
|
model_index,
|
||||||
|
|
|
@ -44,8 +44,7 @@ impl qobject::Ytdl {
|
||||||
pub fn get_video(mut self: Pin<&mut Self>, url: QUrl) -> bool {
|
pub fn get_video(mut self: Pin<&mut Self>, url: QUrl) -> bool {
|
||||||
if !url.is_valid() {
|
if !url.is_valid() {
|
||||||
false
|
false
|
||||||
} else {
|
} else if let Some(mut data_dir) = dirs::data_local_dir() {
|
||||||
if let Some(mut data_dir) = dirs::data_local_dir() {
|
|
||||||
data_dir.push("lumina");
|
data_dir.push("lumina");
|
||||||
data_dir.push("ytdl");
|
data_dir.push("ytdl");
|
||||||
if !data_dir.exists() {
|
if !data_dir.exists() {
|
||||||
|
@ -77,9 +76,9 @@ impl qobject::Ytdl {
|
||||||
&output.thumbnail.unwrap_or_default(),
|
&output.thumbnail.unwrap_or_default(),
|
||||||
);
|
);
|
||||||
let mut file = String::from(output_dirs);
|
let mut file = String::from(output_dirs);
|
||||||
file.push_str("/");
|
file.push('/');
|
||||||
file.push_str(&output.title);
|
file.push_str(&output.title);
|
||||||
file.push_str(".");
|
file.push('.');
|
||||||
file.push_str(&output.ext.unwrap_or_default());
|
file.push_str(&output.ext.unwrap_or_default());
|
||||||
debug!(file);
|
debug!(file);
|
||||||
|
|
||||||
|
@ -100,7 +99,6 @@ impl qobject::Ytdl {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
async fn dl_video() {}
|
async fn dl_video() {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue