Update most dependencies

This commit is contained in:
Elias Projahn 2022-12-19 17:00:45 +01:00
parent 51030545db
commit d6b79fae59
15 changed files with 687 additions and 532 deletions

View file

@ -4,16 +4,16 @@ version = "0.1.0"
edition = "2021"
[dependencies]
fragile = "1.2.0"
gio = "0.15.11"
glib = "0.15.11"
gstreamer = "0.18.8"
gstreamer-player = "0.18.0"
log = { version = "0.4.16", features = ["std"] }
fragile = "2"
gio = "0.16"
glib = "0.16"
gstreamer = "0.19"
gstreamer-player = "0.19"
log = { version = "0.4", features = ["std"] }
musicus_database = { version = "0.1.0", path = "../database" }
musicus_import = { version = "0.1.0", path = "../import" }
thiserror = "1.0.31"
tokio = { version = "1.18.0", features = ["sync"] }
thiserror = "1"
tokio = { version = "1", features = ["sync"] }
[target.'cfg(target_os = "linux")'.dependencies]
mpris-player = "0.6.1"
mpris-player = "0.6"

View file

@ -1,6 +1,5 @@
use crate::{Backend, Error, Result};
use glib::clone;
use gstreamer_player::prelude::*;
use musicus_database::Track;
use std::cell::{Cell, RefCell};
use std::path::PathBuf;
@ -32,7 +31,10 @@ pub struct Player {
impl Player {
pub fn new(music_library_path: PathBuf) -> Rc<Self> {
let dispatcher = gstreamer_player::PlayerGMainContextSignalDispatcher::new(None);
let player = gstreamer_player::Player::new(None, Some(&dispatcher.upcast()));
let player = gstreamer_player::Player::new(
gstreamer_player::PlayerVideoRenderer::NONE,
Some(&dispatcher),
);
let mut config = player.config();
config.set_position_update_interval(250);
player.set_config(config).unwrap();
@ -196,7 +198,7 @@ impl Player {
/// Add some items to the playlist.
pub fn add_items(&self, mut items: Vec<Track>) -> Result<()> {
if items.is_empty() {
return Ok(())
return Ok(());
}
let was_empty = {

View file

@ -4,10 +4,10 @@ version = "0.1.0"
edition = "2021"
[dependencies]
diesel = { version = "1.4.8", features = ["sqlite"] }
diesel_migrations = "1.4.0"
chrono = "0.4.19"
log = "0.4.16"
rand = "0.8.5"
thiserror = "1.0.31"
uuid = { version = "1.0.0", features = ["v4"] }
diesel = { version = "1", features = ["sqlite"] }
diesel_migrations = "1"
chrono = "0.4"
log = "0.4"
rand = "0.8"
thiserror = "1"
uuid = { version = "1", features = ["v4"] }

View file

@ -60,7 +60,12 @@ pub struct Track {
}
impl Track {
pub fn new(recording: Recording, work_parts: Vec<usize>, source_index: usize, path: String) -> Self {
pub fn new(
recording: Recording,
work_parts: Vec<usize>,
source_index: usize,
path: String,
) -> Self {
Self {
recording,
work_parts,
@ -295,8 +300,8 @@ impl Database {
name: row.name,
discid: row.discid,
tracks,
last_used: row.last_used.map(|t| Utc.timestamp(t, 0)),
last_played: row.last_played.map(|t| Utc.timestamp(t, 0)),
last_used: row.last_used.map(|t| Utc.timestamp_opt(t, 0).unwrap()),
last_played: row.last_played.map(|t| Utc.timestamp_opt(t, 0).unwrap()),
};
Ok(medium)
@ -328,8 +333,8 @@ impl Database {
work_parts: part_indices,
source_index: row.source_index as usize,
path: row.path,
last_used: row.last_used.map(|t| Utc.timestamp(t, 0)),
last_played: row.last_played.map(|t| Utc.timestamp(t, 0)),
last_used: row.last_used.map(|t| Utc.timestamp_opt(t, 0).unwrap()),
last_played: row.last_played.map(|t| Utc.timestamp_opt(t, 0).unwrap()),
};
Ok(track)

View file

@ -275,8 +275,8 @@ impl Database {
work,
comment: row.comment,
performances: performance_descriptions,
last_used: row.last_used.map(|t| Utc.timestamp(t, 0)),
last_played: row.last_played.map(|t| Utc.timestamp(t, 0)),
last_used: row.last_used.map(|t| Utc.timestamp_opt(t, 0).unwrap()),
last_played: row.last_played.map(|t| Utc.timestamp_opt(t, 0).unwrap()),
};
Ok(recording_description)

View file

@ -67,7 +67,13 @@ pub struct Work {
}
impl Work {
pub fn new(id: String, title: String, composer: Person, instruments: Vec<Instrument>, parts: Vec<WorkPart>) -> Self {
pub fn new(
id: String,
title: String,
composer: Person,
instruments: Vec<Instrument>,
parts: Vec<WorkPart>,
) -> Self {
Self {
id,
title,
@ -219,8 +225,8 @@ impl Database {
title: row.title,
instruments,
parts,
last_used: row.last_used.map(|t| Utc.timestamp(t, 0)),
last_played: row.last_played.map(|t| Utc.timestamp(t, 0)),
last_used: row.last_used.map(|t| Utc.timestamp_opt(t, 0).unwrap()),
last_played: row.last_played.map(|t| Utc.timestamp_opt(t, 0).unwrap()),
})
}

View file

@ -4,13 +4,13 @@ version = "0.1.0"
edition = "2021"
[dependencies]
base64 = "0.13.0"
glib = "0.15.11"
gstreamer = "0.18.8"
gstreamer-pbutils = "0.18.7"
log = "0.4.16"
once_cell = "1.10.0"
rand = "0.8.5"
thiserror = "1.0.31"
sha2 = "0.10.2"
tokio = { version = "1.18.0", features = ["sync"] }
base64 = "0.13"
glib = "0.16"
gstreamer = "0.19"
gstreamer-pbutils = "0.19"
log = "0.4"
once_cell = "1"
rand = "0.8"
thiserror = "1"
sha2 = "0.10"
tokio = { version = "1", features = ["sync"] }

View file

@ -18,11 +18,11 @@ pub(super) fn new() -> Result<ImportSession> {
// Build the GStreamer pipeline. It will contain a fakesink initially to be able to run it
// forward to the paused state without specifying a file name before knowing the tracks.
let cdparanoiasrc = ElementFactory::make("cdparanoiasrc", None)?;
let queue = ElementFactory::make("queue", None)?;
let audioconvert = ElementFactory::make("audioconvert", None)?;
let flacenc = ElementFactory::make("flacenc", None)?;
let fakesink = gstreamer::ElementFactory::make("fakesink", None)?;
let cdparanoiasrc = ElementFactory::make("cdparanoiasrc").build()?;
let queue = ElementFactory::make("queue").build()?;
let audioconvert = ElementFactory::make("audioconvert").build()?;
let flacenc = ElementFactory::make("flacenc").build()?;
let fakesink = gstreamer::ElementFactory::make("fakesink").build()?;
let pipeline = gstreamer::Pipeline::new(None);
pipeline.add_many(&[&cdparanoiasrc, &queue, &audioconvert, &flacenc, &fakesink])?;
@ -64,7 +64,7 @@ pub(super) fn new() -> Result<ImportSession> {
fakesink.set_state(gstreamer::State::Null)?;
pipeline.remove(&fakesink)?;
let filesink = gstreamer::ElementFactory::make("filesink", None)?;
let filesink = gstreamer::ElementFactory::make("filesink").build()?;
pipeline.add(&filesink)?;
gstreamer::Element::link(&flacenc, &filesink)?;

View file

@ -4,17 +4,17 @@ version = "0.1.0"
edition = "2021"
[dependencies]
anyhow = "1.0.57"
adw = { git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs.git", package = "libadwaita", features = ["v1_2"] }
futures-channel = "0.3.21"
gettext-rs = { version = "0.7.0", features = ["gettext-system"] }
gio = {git = "https://github.com/gtk-rs/gtk-rs-core"}
glib = {git = "https://github.com/gtk-rs/gtk-rs-core"}
gstreamer = "0.18.8"
gtk = { git = "https://github.com/gtk-rs/gtk4-rs.git", package = "gtk4" }
gtk-macros = "0.3.0"
log = "0.4.16"
anyhow = "1"
adw = { package = "libadwaita", version = "0.2", features = ["v1_2"] }
futures-channel = "0.3"
gettext-rs = { version = "0.7", features = ["gettext-system"] }
gio = "0.16"
glib = "0.16"
gstreamer = "0.19"
gtk = { package = "gtk4", version = "0.5" }
gtk-macros = "0.3"
log = "0.4"
musicus_backend = { version = "0.1.0", path = "../backend" }
once_cell = "1.10.0"
rand = "0.8.5"
sanitize-filename = "0.3.0"
once_cell = "1"
rand = "0.8"
sanitize-filename = "0.4"

View file

@ -5,7 +5,7 @@ use adw::builders::ActionRowBuilder;
use anyhow::{anyhow, Result};
use gettextrs::gettext;
use glib::clone;
use gtk::builders::{ListBoxBuilder, FrameBuilder};
use gtk::builders::{FrameBuilder, ListBoxBuilder};
use gtk::prelude::*;
use gtk_macros::get_widget;
use musicus_backend::db::Medium;

View file

@ -26,8 +26,7 @@ fn main() {
gettextrs::textdomain("musicus").unwrap();
gstreamer::init().expect("Failed to initialize GStreamer!");
gtk::init().expect("Failed to initialize GTK!");
adw::init();
adw::init().expect("Failed to initialize libadwaita!");
resources::init().expect("Failed to initialize resources!");
let app = gtk::Application::new(Some("de.johrpan.musicus"), gio::ApplicationFlags::empty());

View file

@ -1,5 +1,5 @@
use super::Widget;
use adw::{prelude::*, builders::ActionRowBuilder};
use adw::{builders::ActionRowBuilder, prelude::*};
use gtk::builders::ButtonBuilder;
/// A list box row with a single button.

View file

@ -20,7 +20,7 @@ impl IndexedListModel {
impl Default for IndexedListModel {
fn default() -> Self {
glib::Object::new(&[]).unwrap()
glib::Object::new(&[])
}
}
@ -57,13 +57,7 @@ mod indexed_list_model_imp {
PROPERTIES.as_ref()
}
fn set_property(
&self,
_: &Self::Type,
_: usize,
value: &glib::Value,
pspec: &glib::ParamSpec,
) {
fn set_property(&self, _: usize, value: &glib::Value, pspec: &glib::ParamSpec) {
match pspec.name() {
"length" => {
let length = value.get::<u32>().unwrap();
@ -73,7 +67,7 @@ mod indexed_list_model_imp {
}
}
fn property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
fn property(&self, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
match pspec.name() {
"length" => self.length.get().to_value(),
_ => unimplemented!(),
@ -82,15 +76,15 @@ mod indexed_list_model_imp {
}
impl ListModelImpl for IndexedListModel {
fn item_type(&self, _: &Self::Type) -> glib::Type {
fn item_type(&self) -> glib::Type {
ItemIndex::static_type()
}
fn n_items(&self, _: &Self::Type) -> u32 {
fn n_items(&self) -> u32 {
self.length.get()
}
fn item(&self, _: &Self::Type, position: u32) -> Option<glib::Object> {
fn item(&self, position: u32) -> Option<glib::Object> {
Some(ItemIndex::new(position).upcast())
}
}
@ -104,7 +98,7 @@ glib::wrapper! {
impl ItemIndex {
/// Create a new item index.
pub fn new(value: u32) -> Self {
glib::Object::new(&[("value", &value)]).unwrap()
glib::Object::new(&[("value", &value)])
}
/// Get the value of the item index..
@ -146,13 +140,7 @@ mod item_index_imp {
PROPERTIES.as_ref()
}
fn set_property(
&self,
_: &Self::Type,
_: usize,
value: &glib::Value,
pspec: &glib::ParamSpec,
) {
fn set_property(&self, _: usize, value: &glib::Value, pspec: &glib::ParamSpec) {
match pspec.name() {
"value" => {
let value = value.get::<u32>().unwrap();
@ -162,7 +150,7 @@ mod item_index_imp {
}
}
fn property(&self, _obj: &Self::Type, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
fn property(&self, _id: usize, pspec: &glib::ParamSpec) -> glib::Value {
match pspec.name() {
"value" => self.value.get().to_value(),
_ => unimplemented!(),

View file

@ -1,5 +1,5 @@
use super::Widget;
use gtk::{prelude::*, builders::ButtonBuilder};
use gtk::{builders::ButtonBuilder, prelude::*};
use gtk_macros::get_widget;
/// A widget displaying a title, a framed child widget and, if needed, some