Coder Social home page Coder Social logo

tarkah / karaoke-rs Goto Github PK

View Code? Open in Web Editor NEW
157.0 4.0 11.0 6.23 MB

A simple, network enabled karaoke player in Rust

License: MIT License

Rust 94.41% HTML 0.23% Dockerfile 0.74% CSS 4.07% JavaScript 0.56%
karaoke music rust actix-web glium rodio yew wasm

karaoke-rs's Introduction

A simple, network enabled karaoke player in Rust.


Your karaoke collection can be browsed and queued from a self served website and played either natively on your computer, or remotely through any browser. Only supports MP3+G (mp3 & corresponding cdg) files.

Now includes a web player. Songs can be played from any modern browser, anywhere in the world! Use command line flag --use-web-player to enable this feature. Player is accessible from the /player page on the website and can be controlled just like the native player through commands on the queue page.

Setup

Linux

  • Download latest release or build from source
  • Run karaoke-rs --help to see all arguments
  • Place your song collection at ~/.local/share/karaoke-rs/songs, or specify location via --songs path/to/song/directory
  • Default configuration file is created at ~/.config/karaoke-rs/config.yaml. This can be copied / changed and specified via --config path/to/config.yaml
  • You may need to force disable vsync to eliminate flickering, set environment variable vblank_mode=0

macOS

  • Download latest release or build from source
  • Run karaoke-rs --help to see all arguments
  • Place your song collection at $HOME/Library/Application Support/karaoke-rs/songs, or specify location via --songs path/to/song/directory
  • Default configuration file is created at $HOME/Library/Preferences/karaoke-rs/config.yaml. This can be copied / changed and specified via --config path/to/config.yaml

Windows

  • Download latest release or build from source
  • Double click karaoke-rs.exe to run with default configuration. Run from command prompt / powershell karaoke-rs.exe --help to see all arguments
  • Place your song collection at %APPDATA%\karaoke-rs\songs, or specify location via --songs C:\path\to\song\directory
  • Default configuration file is created at %APPDATA%\karaoke-rs\config.yaml. This can be copied / changed and specified via --config C:\path\to\config.yaml
  • Ensure all paths supplied via argument are absolute from the root of the applicable drive. Relative paths appear to cause program to crash

Build from Source

  • Build frontend

First install wasm-pack, then run:

cd frontend
npm install
npm run build
  • Compile
cd ..
cargo build --release
  • Binary located at target/release/karaoke-rs

CLI Arguments

karoake-rs 0.11.1
tarkah <[email protected]>
A simple, network enabled karaoke player in Rust

USAGE:
    karaoke-rs [FLAGS] [OPTIONS]

FLAGS:
    -h, --help              Prints help information
    -w, --use-web-player    Use web player instead of native player
    -V, --version           Prints version information

OPTIONS:
    -c, --config <FILE>                Sets a custom config file
    -d, --data <DIR>                   Sets a custom data directory
    -p, --port <PORT>                  Specify website port
        --port-ws <PORT_WS>            Specify a websocket port when using the web player feature
    -r, --refresh-collection <BOOL>    Specify if collection should be refreshed on startup [possible values: true,
                                       false]
    -s, --songs <DIR>                  Sets a custom song directory

Screenshots

Songs Page

songs

Favorites Page

favorites

Artists Page

artists

Queue Page

queue

Player

player1

player1

player2

Acknowledgments

  • @maxjoehnk - Thanks for designing the frontend!
  • @Keavon - Thanks for helping extensively test the new frontend & web player!

karaoke-rs's People

Contributors

keavon avatar lazear avatar tarkah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

karaoke-rs's Issues

Error when opening web player

With use_web_player: true set and upon clicking the "Player" tab in the web app, the console spits out:

[2020-01-27T02:49:37Z INFO  karaoke_rs::websocket] Connection from 127.0.0.1:64870
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: IoError(Os { code: 10035, kind: WouldBlock, message: "A non-blocking socket operation could not be completed immediately." })', src\libcore\result.rs:1165:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', src\libcore\result.rs:1165:5

I am using Windows 10 64-bit and the karaoke-rs-v0.8.0-x86_64-pc-windows-msvc.zip build.

Project listed on GitHub

Discrepancy: GitHub is terrible and the project should be hosted on a superior platform.

Suggested Action(s): Rehost project on Dropbox.

Chrome requires user gesture to start audio context

Unfortunately there's some edge cases like this one we have to deal with...

The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu

(Start the program in web mode, open a window for the player and a window to start a song, hit play on a song, after a few seconds the song loads and the screen goes black with this in the console.)

Web player websocket port and handshake issues

The web player keeps defaulting back to port :9000 when accessed directly from its URL (or the page is reloaded):

  1. Enable web player and set HTTP and websocket ports to different values
  2. Open web player (I am using a domain name in my case, tunneling my computer with ssh -R to a Raspberry Pi server connected to a DNS entry).
  3. Visit the web interface
  4. Click the Player tab, then this works the first time (the dev tools Network tab shows the websocket connection is the newly chosen one)
  5. Reload the player page, now the websocket connection is back to :9000 and fails.
  6. It appears every time /player is loaded directly, it requests :9000 while every time it is accessed by clicking the Player tab, the port is correct.

The web player fails to establish a websocket connection when visiting the Player link a second time:

  1. Visit the web interface home page and hard refresh (Ctrl Shift R)
  2. Click the Player tab, the connection should be working and videos play
  3. Hit the back button in the browser
  4. The console shows this error and eventually the music for the currently queued karaoke video plays despite not even being on the player:
Uncaught TypeError: Cannot read property 'callback' of undefined
    at r (1.karaoke-rs.js:1)
    at Module.Ve (1.karaoke-rs.js:1)
    at __wbg_cargowebsnippetf5302c0143e9bd10d39262404fc2b4c9660c7f9d_645c5ca38dda53ac (karaoke-rs.js:1)
    at <yew::services::resize::ResizeTask as core::ops::drop::Drop>::drop::hf45e7f94856691f9 (:my-http-port/wasm-function[768]:0xbbe35)
    at core::ptr::real_drop_in_place::h76a109ebe0812206 (:my-http-port/wasm-function[673]:0xb2ce2)
    at <yew::html::scope::DestroyComponent<COMP> as yew::scheduler::Runnable>::run::h82153cfbd3015bc8 (:my-http-port/wasm-function[358]:0x823cd)
    at yew::scheduler::Scheduler::put_and_try_run::h654711681d8a2ef3 (:my-http-port/wasm-function[576]:0xa7e23)
    at yew::agent::AgentLink<AGN>::callback::{{closure}}::h164a1611c4638d27 (:my-http-port/wasm-function[860]:0xc32ba)
    at <stdweb::webcore::newtype::Newtype<(stdweb::webcore::serialization::FunctionTag, (A12,)),stdweb::webcore::mutfn::Mut<F>> as stdweb::webcore::serialization::FuncallAdapter<F>>::funcall_adapter::h3f17d9ef7d5dc8f9 (:my-http-port/wasm-function[243]:0x5aa58)
    at Object.n.STDWEB_PRIVATE.dyncall (1.karaoke-rs.js:1)
  1. If you fool around with it enough, like remove the /player from the URL and hit enter, or reload the page on the home page, sometimes (often more consistently than other times) this error appears instead of the currently-queued video:
karaoke-rs.js:1 WebSocket connection to 'ws://my-domain:my-websocket-port/' failed: Connection closed before receiving a handshake response

Add notification when player can't decode song

When a song can't be decoded, the player no longer panics, but it will just sit on a blank screen. Now that we have a modal created on the player page for when a user gesture is needed, we can use that same system to display to the use that the current song can't be played, and to remove it from the queue.

Panic when occasionally loading a web player song

Load up web player, play some songs, eventually what seems to be a random song will not load and when I check the console, the following appears. Reloading the web player page with F5 will make it play, however.

1.karaoke-rs.js:1 panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:378:21

Stack:

Error
    at Module.N (http://localhost:6484/1.karaoke-rs.js:1:11733)
    at __wbg_new_59cb74e423758ede (http://localhost:6484/karaoke-rs.js:1:1020)
    at wasm-function[434]:0x7a0c0
    at wasm-function[1499]:0xab4a6
    at wasm-function[777]:0x9aee7
    at wasm-function[1045]:0xa61bb
    at wasm-function[1232]:0xa9cf3
    at wasm-function[1200]:0xa969b
    at wasm-function[153]:0x1b7b7
    at wasm-function[153]:0x1b322


I @ 1.karaoke-rs.js:1
wasm://wasm/wasm-0060a61e:778 Uncaught RuntimeError: unreachable
    at wasm-function[777]:0x9af1d
    at wasm-function[1045]:0xa61bb
    at wasm-function[1232]:0xa9cf3
    at wasm-function[1200]:0xa969b
    at wasm-function[153]:0x1b7b7
    at wasm-function[153]:0x1b322
    at wasm-function[201]:0x3e7aa
    at wasm-function[523]:0x854f4
    at wasm-function[681]:0x942d4
    at wasm-function[522]:0x8532d

Parse song file name as "[Artist] - [Title]"

My collection has all songs in the form Frank Sinatra - Fly Me To The Moon.mp3 and Frank Sinatra - Fly Me To The Moon.cdg. At the moment, all of these are being assigned a title of Frank Sinatra - Fly Me To The Moon and an artist of <None>. An option to parse the collection in [Artist] - [Title] format, or a user-templated format, would be excellent.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.