55 lines
1.3 KiB
Rust
55 lines
1.3 KiB
Rust
pub mod songmeta;
|
|
use crate::songmeta::songmeta::*;
|
|
|
|
pub mod playlist;
|
|
use crate::playlist::playlist::*;
|
|
|
|
pub mod audioplayer;
|
|
use crate::audioplayer::audioplayer::*;
|
|
|
|
use std::thread::sleep;
|
|
use std::time::Duration;
|
|
|
|
fn main() {
|
|
let mysong = SongMeta::frompath(&String::from("/home/justine/Music/one.mp3")).unwrap();
|
|
let mysong2 = SongMeta::frompath(&String::from("/home/justine/Music/two.mp3")).unwrap();
|
|
let mysong3 = SongMeta::frompath(&String::from("/home/justine/Music/three.mp3")).unwrap();
|
|
|
|
|
|
let mut playlist = Playlist::new();
|
|
playlist.songs.push(mysong);
|
|
playlist.songs.push(mysong2);
|
|
playlist.songs.push(mysong3);
|
|
|
|
let mut player = AudioPlayer::new().unwrap();
|
|
|
|
|
|
player.playlist = playlist;
|
|
player.play_at(0);
|
|
dbg!(player.get_state());
|
|
sleep(Duration::from_secs(3));
|
|
|
|
dbg!("SKIPPING FORW TWICE");
|
|
player.skip_forward();
|
|
player.skip_forward();
|
|
sleep(Duration::from_secs(3));
|
|
|
|
dbg!("BACKW 5");
|
|
player.skip_backwards();
|
|
player.skip_backwards();
|
|
player.skip_backwards();
|
|
player.skip_backwards();
|
|
player.skip_backwards();
|
|
|
|
player.unpause();
|
|
player.set_vol(0.9);
|
|
|
|
loop {
|
|
println!("{:?} - {:?}", player.get_state(), player.get_vol());
|
|
sleep(Duration::from_secs(1));
|
|
}
|
|
|
|
}
|
|
|
|
|