Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: connect to remote media player #121

Merged
merged 39 commits into from
Jan 11, 2023
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
13d117a
feat(webui): add connect button
tsirysndr Dec 11, 2022
a5048b4
feat(webui): add placeholder texts
tsirysndr Dec 12, 2022
85deb05
feat(graphql): add device queries and mutations
tsirysndr Dec 12, 2022
db56140
feat(graphql): implement `From` trait for Device
tsirysndr Dec 12, 2022
8b18f30
feat(webui): show scanned devices
tsirysndr Dec 12, 2022
20da6da
feat(graphql): return `device_name` from settings
tsirysndr Dec 13, 2022
114f8d8
rebuild webui
tsirysndr Dec 14, 2022
b6cc01f
feat(graphql): add `connected_device` state
tsirysndr Dec 15, 2022
f3ebfd0
feat(graphql): refactor device detection
tsirysndr Dec 18, 2022
8c3199a
fix(graphql): remove duplicate devices/services
tsirysndr Dec 18, 2022
f3e2797
chore: fix unit tests
tsirysndr Dec 18, 2022
707f5a6
chore: fix unit tests
tsirysndr Dec 18, 2022
f91423c
chore: fix bazel build
tsirysndr Dec 22, 2022
9033fdf
chore: update cargo-bazel-lock.json
tsirysndr Dec 23, 2022
65b2b96
chore(bazel): fix `rust-embed` build issues
tsirysndr Dec 23, 2022
29c6b39
refacto: add reusable entity repositories
tsirysndr Dec 25, 2022
623f2e6
feat(api): add pagination
tsirysndr Dec 25, 2022
5b85084
chore(webui): fix broken storybook
tsirysndr Dec 25, 2022
f8f3836
feat(graphql): return trait `Box<dyn Browseable + Send>` instead inst…
tsirysndr Dec 25, 2022
9cb6976
feat(graphql): optimize remote device connection
tsirysndr Dec 26, 2022
e9e1fb2
feat(graphql): return remote track url
tsirysndr Dec 26, 2022
5cf798f
feat(graphql): use `RemoteTrackUrl` and `RemoteCoverUrl` traits
tsirysndr Dec 26, 2022
39a4a95
styles(webui): change connect button colors
tsirysndr Dec 27, 2022
4bc943e
feat(audio): implement streaming from http(s) url
tsirysndr Dec 28, 2022
7f204df
feat(audio): add `AudioFile::Local` enum
tsirysndr Dec 28, 2022
557f17e
feat(playback): use `AudioFile` from `music-player-audio` crate
tsirysndr Dec 29, 2022
c00cb0b
chore: fix broken tests
tsirysndr Dec 30, 2022
afebede
feat: improve remote connect
tsirysndr Jan 4, 2023
84e4951
feat: implement remote media cache feature
tsirysndr Jan 6, 2023
f9cf66f
fix(webui): resolve issue with cover url
tsirysndr Jan 10, 2023
ee20f5d
fix(graphql): resolve issue with remote track url
tsirysndr Jan 10, 2023
6bdfaad
chore(bazel): fix bazel issue
tsirysndr Jan 10, 2023
b54959c
fix(graphql): resolve issue with cover url
tsirysndr Jan 10, 2023
d2ad9ee
fix(graphql): resolve issue with cover url (artist's tracks)
tsirysndr Jan 10, 2023
0c9b063
fix(server): return complete artist's albums
tsirysndr Jan 10, 2023
5363f36
fix(types): return artist's song remote cover url
tsirysndr Jan 10, 2023
6b5a92c
fix(server): re-generate proto
tsirysndr Jan 10, 2023
cf150c0
feat(webui): call `connectToDevice` and `disconnectFormDevice` queries
tsirysndr Jan 10, 2023
12903fa
feat(webui): show Snackbar on connnected/disconnected to a device
tsirysndr Jan 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(graphql): refactor device detection
  • Loading branch information
tsirysndr committed Jan 11, 2023
commit f3ebfd086772b6b1f6d15796badfa8b69037428d
15 changes: 15 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -191,3 +191,4 @@ futures-channel = "0.3.24"
serde_json = "1.0.85"
dirs = "4.0.0"
spinners = "4.1.0"
anyhow = "1.0.67"
11 changes: 11 additions & 0 deletions addons/Cargo.toml
Original file line number Diff line number Diff line change
@@ -8,4 +8,15 @@ authors = ["Tsiry Sandratraina <tsiry.sndr@aol.com>"]
description = "The addons for the music player"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies.music-player-types]
path = "../types"
version = "0.1.1"

[dependencies.music-player-client]
path = "../client"
version = "0.1.1"

[dependencies]
surf = "2.3.2"
async-trait = "0.1.59"
anyhow = "1.0.67"
4 changes: 3 additions & 1 deletion addons/src/datpiff.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use anyhow::Error;

use super::{Addon, StreamingAddon};

pub struct DatPiff {
@@ -47,7 +49,7 @@ impl Addon for DatPiff {
}

impl StreamingAddon for DatPiff {
fn stream(&self, url: &str) -> Result<(), Box<dyn std::error::Error>> {
fn stream(&self, url: &str) -> Result<(), Error> {
todo!("Implement DatPiff::stream");
}
}
4 changes: 3 additions & 1 deletion addons/src/deezer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use anyhow::Error;

use super::{Addon, StreamingAddon};

pub struct Deezer {
@@ -47,7 +49,7 @@ impl Addon for Deezer {
}

impl StreamingAddon for Deezer {
fn stream(&self, url: &str) -> Result<(), Box<dyn std::error::Error>> {
fn stream(&self, url: &str) -> Result<(), Error> {
todo!("Implement Deezer::stream");
}
}
125 changes: 125 additions & 0 deletions addons/src/kodi.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
use anyhow::Error;

use async_trait::async_trait;
use music_player_types::types::{Album, Artist, Device, Track};

use super::{Addon, Browseable, Player, StreamingAddon};

pub struct Client {
pub host: String,
pub port: u16,
}

pub struct Kodi {
name: String,
version: String,
author: String,
description: String,
enabled: bool,
client: Option<Client>,
}

impl Kodi {
pub fn new() -> Self {
Self {
name: "Kodi".to_string(),
version: "0.1.0".to_string(),
author: "Tsiry Sandratraina".to_string(),
description: "Kodi addon".to_string(),
enabled: true,
client: None,
}
}
}

impl Addon for Kodi {
fn name(&self) -> &str {
&self.name
}

fn version(&self) -> &str {
&self.version
}

fn author(&self) -> &str {
&self.author
}

fn description(&self) -> &str {
&self.description
}

fn enabled(&self) -> bool {
self.enabled
}

fn set_enabled(&mut self, enabled: bool) {
self.enabled = enabled;
}
}

impl StreamingAddon for Kodi {
fn stream(&self, url: &str) -> Result<(), Error> {
todo!("Implement Kodi::stream");
}
}

#[async_trait]
impl Browseable for Kodi {
async fn albums(&mut self) -> Result<Vec<Album>, Error> {
todo!()
}

async fn artists(&mut self) -> Result<Vec<Artist>, Error> {
todo!()
}

async fn tracks(&mut self) -> Result<Vec<Track>, Error> {
todo!()
}

async fn album(&mut self, id: &str) -> Result<Album, Error> {
todo!()
}

async fn artist(&mut self, id: &str) -> Result<Artist, Error> {
todo!()
}

async fn track(&mut self, id: &str) -> Result<Track, Error> {
todo!()
}
}

#[async_trait]
impl Player for Kodi {
async fn play(&mut self) -> Result<(), Error> {
todo!()
}

async fn pause(&mut self) -> Result<(), Error> {
todo!()
}

async fn stop(&mut self) -> Result<(), Error> {
todo!()
}

async fn next(&mut self) -> Result<(), Error> {
todo!()
}

async fn previous(&mut self) -> Result<(), Error> {
todo!()
}

async fn seek(&mut self, position: u32) -> Result<(), Error> {
todo!()
}
}

impl From<Device> for Kodi {
fn from(device: Device) -> Self {
Self { ..Kodi::new() }
}
}
27 changes: 26 additions & 1 deletion addons/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
pub mod datpiff;
pub mod deezer;
pub mod genius;
pub mod kodi;
pub mod local;
pub mod myvazo;
pub mod tononkira;

use anyhow::Error;
use async_trait::async_trait;
use music_player_types::types::{Album, Artist, Track};

pub trait Addon {
fn name(&self) -> &str;
fn version(&self) -> &str;
@@ -15,9 +20,29 @@ pub trait Addon {
}

pub trait StreamingAddon {
fn stream(&self, url: &str) -> Result<(), Box<dyn std::error::Error>>;
fn stream(&self, url: &str) -> Result<(), Error>;
}

pub trait LyricsAddon {
fn get_lyrics(&self, artist: &str, title: &str) -> Option<String>;
}

#[async_trait]
pub trait Browseable {
async fn albums(&mut self) -> Result<Vec<Album>, Error>;
async fn artists(&mut self) -> Result<Vec<Artist>, Error>;
async fn tracks(&mut self) -> Result<Vec<Track>, Error>;
async fn album(&mut self, id: &str) -> Result<Album, Error>;
async fn artist(&mut self, id: &str) -> Result<Artist, Error>;
async fn track(&mut self, id: &str) -> Result<Track, Error>;
}

#[async_trait]
pub trait Player {
async fn play(&mut self) -> Result<(), Error>;
async fn pause(&mut self) -> Result<(), Error>;
async fn stop(&mut self) -> Result<(), Error>;
async fn next(&mut self) -> Result<(), Error>;
async fn previous(&mut self) -> Result<(), Error>;
async fn seek(&mut self, position: u32) -> Result<(), Error>;
}
Loading