-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc067aa
commit b0b85c0
Showing
21 changed files
with
290 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,27 @@ | ||
# musicplayer2-tauri | ||
|
||
<center> | ||
<img src="assets/logo/logo.png"> | ||
</center> | ||
|
||
An semi-complciated music player written in React and Tailwind, using Tauri for cross-platform. | ||
|
||
Supports: | ||
1. Full LastFM compatability | ||
2. **ONLY** Subsonic is supported. Local file support might come eventually, but don't count on it. | ||
3. Most of Subsonic API. | ||
|
||
4. DiscordRPC support | ||
|
||
## To build | ||
Just run `npm i`, then `npm run tauri dev`. You must have rust & cargo installed, webkitGTK and whatnot else. | ||
Check the [tauri V2 docs](https://next--tauri.netlify.app/next/guides/building/) for more information on building. | ||
Check the [tauri V2 docs](https://next--tauri.netlify.app/next/guides/building/) for more information on building. | ||
|
||
## Screenshots | ||
### Pages | ||
![1st screenshot, showing login](assets/screenshots/1.png) | ||
![2nd screenshot, showing songs](assets/screenshots/2.png) | ||
![3rd screenshot, showing integrations](assets/screenshots/3.png) | ||
### Appearance | ||
![4th screenshot, showing appearance selections](assets/screenshots/4.png) | ||
#### Themes | ||
![5th screenshot, showing light-red theme](assets/screenshots/5.png) | ||
![6th screenshot, showing dark-slate](assets/screenshots/6.png) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,71 @@ | ||
#![cfg_attr( | ||
all(not(debug_assertions), target_os = "windows"), | ||
windows_subsystem = "windows" | ||
)] | ||
use musicplayer2_tauri::AppBuilder; | ||
pub fn main() { | ||
AppBuilder::new().run(); | ||
} | ||
// Prevents additional console window on Windows in release, DO NOT REMOVE!! | ||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] | ||
|
||
use discord_presence::{Client, Event}; | ||
use once_cell::sync::Lazy; | ||
use tauri_plugin_log::{TargetKind, Target}; | ||
|
||
// TODO: Eventually - when I get better at Rust I'm going to remove these static mutables | ||
static mut CLIENT: Lazy<Client> = Lazy::new(|| Client::new(988215000676073532)); | ||
static mut STARTED_CLIENT: bool = false; | ||
|
||
#[cfg(not(mobile))] | ||
#[tauri::command] | ||
fn start_discord_rpc() { | ||
println!("[RUST] DiscordRPC requested to be started by JS."); | ||
|
||
unsafe { | ||
if STARTED_CLIENT { | ||
println!("[RUST] Client was already started!"); | ||
return; | ||
} | ||
STARTED_CLIENT = true; | ||
_ = CLIENT.start(); | ||
|
||
CLIENT.block_until_event(Event::Ready).unwrap(); | ||
} | ||
|
||
println!("[RUST] DiscordRPC connected to Client.") | ||
} | ||
|
||
#[cfg(not(mobile))] | ||
#[tauri::command] | ||
fn clear_actvitiy() { | ||
unsafe { | ||
if STARTED_CLIENT { | ||
CLIENT.clear_activity().expect("failed to clear activity"); | ||
} | ||
} | ||
} | ||
|
||
#[cfg(not(mobile))] | ||
#[tauri::command] | ||
fn set_discord_rpc(state: String, details: String, image: String) { | ||
println!("[RUST] Attempting to set DiscordRPC state to \"{}\" and details to \"{}\" and to \"{}\".", state, details, image); | ||
if state.is_empty() { return; } | ||
if details.is_empty() { return; } | ||
if image.is_empty() { return; } | ||
|
||
unsafe { | ||
CLIENT.set_activity(|act| | ||
act | ||
.state(state) | ||
.details(details) | ||
.assets(|aset| | ||
aset.large_image(image).large_text("musicplayer2") | ||
)) | ||
.expect("[RUST] Failed to set activity"); | ||
} | ||
println!("[RUST] Succeeded!") | ||
} | ||
|
||
fn main() { | ||
tauri::Builder::default() | ||
.plugin(tauri_plugin_log::Builder::default().targets([ | ||
Target::new(TargetKind::Stdout), | ||
Target::new(TargetKind::Webview), | ||
]).build()) | ||
.invoke_handler(tauri::generate_handler![set_discord_rpc, start_discord_rpc, clear_actvitiy]) | ||
.run(tauri::generate_context!()) | ||
.expect("error while running tauri application"); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.