mirror of
https://github.com/Dummi26/musicdb.git
synced 2026-04-28 09:39:58 +02:00
feat: musicdb-shuffle-all-songs tool
This commit is contained in:
1
musicdb-shuffle-all-songs/.gitignore
vendored
Executable file
1
musicdb-shuffle-all-songs/.gitignore
vendored
Executable file
@@ -0,0 +1 @@
|
|||||||
|
/target
|
||||||
9
musicdb-shuffle-all-songs/Cargo.toml
Normal file
9
musicdb-shuffle-all-songs/Cargo.toml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[package]
|
||||||
|
name = "musicdb-shuffle-all-songs"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
musicdb-lib = { path = "../musicdb-lib" }
|
||||||
43
musicdb-shuffle-all-songs/src/main.rs
Executable file
43
musicdb-shuffle-all-songs/src/main.rs
Executable file
@@ -0,0 +1,43 @@
|
|||||||
|
use std::{io::Write, net::TcpStream};
|
||||||
|
|
||||||
|
use musicdb_lib::{
|
||||||
|
data::{
|
||||||
|
database::Database,
|
||||||
|
queue::{QueueContent, QueueFolder},
|
||||||
|
},
|
||||||
|
load::ToFromBytes,
|
||||||
|
server::{Action, Command, Req},
|
||||||
|
};
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let mut con = TcpStream::connect(
|
||||||
|
std::env::args()
|
||||||
|
.nth(1)
|
||||||
|
.expect("required argument: server address and port"),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
writeln!(con, "main").unwrap();
|
||||||
|
let mut db = Database::new_clientside();
|
||||||
|
while !db.is_client_init() {
|
||||||
|
db.apply_action_unchecked_seq(Command::from_bytes(&mut con).unwrap().action, None);
|
||||||
|
}
|
||||||
|
db.seq
|
||||||
|
.pack(Action::Multiple(vec![
|
||||||
|
Action::QueueUpdate(
|
||||||
|
vec![],
|
||||||
|
QueueContent::Folder(QueueFolder {
|
||||||
|
content: db
|
||||||
|
.songs()
|
||||||
|
.keys()
|
||||||
|
.map(|id| QueueContent::Song(*id).into())
|
||||||
|
.collect(),
|
||||||
|
..Default::default()
|
||||||
|
})
|
||||||
|
.into(),
|
||||||
|
Req::none(),
|
||||||
|
),
|
||||||
|
Action::QueueShuffle(vec![], 0),
|
||||||
|
]))
|
||||||
|
.to_bytes(&mut con)
|
||||||
|
.unwrap();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user