Giter Site home page Giter Site logo

kingtous / rustplayer Goto Github PK

View Code? Open in Web Editor NEW
157.0 8.0 16.0 217 KB

An local audio player & m3u8 radio player using Rust and completely terminal gui🎵. 使用Rust开发的纯终端本地/m3u8网络电台播放器🎵.

License: GNU General Public License v3.0

Rust 90.69% Inno Setup 9.31%
rust media-player audio-player terminal-based windows linux macos player player-controls linux-desktop

rustplayer's Introduction

RustPlayer GitHub tag GitHub stars

build status rustplayer rustplayer

Linux macOS Windows Codacy Badge commit stars

An local audio player & network m3u8 radio player using completely terminal gui. MacOS, Linux, Windows are all supported.

RustPlayer is under development. If u have encountered any problem, please open issues :)

Features

  • Support mp3, wav, flac format
  • Support m3u8 network radio
    • tested: 央广之声、经济之声. check radio.ini for details.
    • please copy radio.ini to ~/.config/rustplayer
  • Lyrics Supported
  • Multi-platform supported
  • Low CPU and memory usage
  • File explorer
  • Playlist playback supported
  • Wave animation
  • Playback progress
  • Next audio
  • Adjust volume
  • Developed by KetaNetwork

Install RustPlayer by Snap Store

snap install rustplayer --devmode

Download Binary Release Directly and Run

The binary release of macOS, Ubuntu/Debian Linux, Windows can be found in artifacts of latest prerelease. Click the top item of the list to download the latest release.

For Arch/Manjaro users, use yay -S rustplayer instead.

Screenshots

Windows

Play with lyrics. If no lyrics found, the wave animation will be the replacement of the block. See screenshots from Linux and macOS below.

image.png

Linux

The screenshot from Deepin

Deepin RustPlayer

macOS

image

Compile RustPlayer and run

If u found this binary release is not working or u like compiling RustPlayer by youselef. Yes, The step to compile RustPlayer is really easy.

  • clone this repo.
    • for arch/manjaro, please use fix/arch branch.
  • install dependencies
    • check .github/rust.yml for details
  • cargo run in root of this project.

if u think this repo is helpful, ⭐ this project and let me know :)

TroubleShoot

Linux

Q: No sound in Linux, console shows "unable to open slave". I'm using snd_hda_intel drivers.

A: check your valid sound card. Check by lspci -knn|grep -iA2 audio. An example is:

04:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Renoir Radeon High Definition Audio Controller [1002:1637]
        Subsystem: Lenovo Device [17aa:3814]
        Kernel driver in use: snd_hda_intel
--
04:00.5 Multimedia controller [0480]: Advanced Micro Devices, Inc. [AMD] ACP/ACP3X/ACP6x Audio Coprocessor [1022:15e2] (rev 01)
        Subsystem: Lenovo Device [17aa:3832]
        Kernel modules: snd_pci_acp3x, snd_rn_pci_acp3x, snd_pci_acp5x
04:00.6 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] Family 17h/19h HD Audio Controller [1022:15e3]
        Subsystem: Lenovo Device [17aa:3833]
        Kernel driver in use: snd_hda_intel

In the case above, 2 audio devices found in your Linux. Let's check which device is in use, we will use index to identify the default device. Type modinfo snd_hda_intel | grep index, if only shows:

parm: index:Index value for Intel HD audio interface. (array of int)

which means index 0 will be chosen to be the default output device.

In this case, you can try device 1. create files below:

> cat /etc/modprobe.d/default.conf                

options snd_hda_intel index=1

reboot and check if it works.

rustplayer's People

Contributors

kingtous avatar luisleee avatar rilysh 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  avatar  avatar  avatar  avatar

rustplayer's Issues

没有声音

系统:Archlinux wayland
终端:Alacritty
可以运行播放器,但是无声音,cmus可正常播放且有声音。
0

在Linux中不可用

B站慕名而来的用户...
环境:Archlinux X11 (KDE Plasma)使用Konsole终端可以运行播放器,可以用上下方向键和回车切换目录,但是无法用回车键播放歌曲,鼠标左右键无效

Remove unused imports

There seems to be a large number of unused imports. Considering removing them as well I saw there are some unused_assignments exists, usually, the Rust compiler will emit warnings about both of them.
image

不能记忆音量大小

当播放下一曲时,音量会重置为最大
系统:Archlinux wayland
终端:Alacritty
声音系统:PipeWire

无法播放flac无损格式文件

音频文件格式flac
MIME类型 audio/x-flas
采样率 96000
分辨率 24
音轨 2
长度 07:22 min(42459919个采样)
结果:无法找到该文件
尝试:系统内播放器正确识别播放。
image

cargo 编译报错 macOS

➜ RustPlayer git:(master) cargo run
Compiling ffmpeg-sys-next v4.4.0 (https://github.com/Kingtous/rust-ffmpeg-sys.git?branch=fix/4.4.0#2c8b9240)
Compiling reqwest v0.11.10
error: failed to run custom build command for ffmpeg-sys-next v4.4.0 (https://github.com/Kingtous/rust-ffmpeg-sys.git?branch=fix/4.4.0#2c8b9240)

Caused by:
process didn't exit successfully: /Users/fang/Projects/RustPlayer/target/debug/build/ffmpeg-sys-next-319c6c336636ac4c/build-script-build (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=LIBAVUTIL_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_x86_64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_PATH_x86_64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_PATH
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR_x86_64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_LIBDIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64-apple-darwin
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_x86_64_apple_darwin
cargo:rerun-if-env-changed=HOST_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR

--- stderr
thread 'main' panicked at 'called Result::unwrap() on an Err value: PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="1" PKG_CONFIG_ALLOW_SYSTEM_LIBS="1" "pkg-config" "--static" "--libs" "--cflags" "libavutil" did not exit successfully: exit status: 1
error: could not find system library 'libavutil' required by the 'ffmpeg-sys-next' crate

--- stderr
Package libavutil was not found in the pkg-config search path.
Perhaps you should add the directory containing libavutil.pc' to the PKG_CONFIG_PATH environment variable No package 'libavutil' found ', /Users/fang/.cargo/git/checkouts/rust-ffmpeg-sys-7a8823067faec914/2c8b924/build.rs:704:14 note: run with RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

cargo 编译报错

windows11

error[E0793]: reference to packed field is unaligned
    --> C:\Users\lbc15\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ntapi-0.3.7\src\ntexapi.rs:2783:52
     |
2783 |         *tick_count.QuadPart_mut() = read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad);
     |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
     = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
     = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)

error[E0793]: reference to packed field is unaligned
    --> C:\Users\lbc15\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ntapi-0.3.7\src\ntexapi.rs:2807:25
     |
2807 |         ((read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad)
     |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses
     = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
     = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)

   Compiling tui v0.19.0
   Compiling failure v0.1.8
For more information about this error, try `rustc --explain E0793`.
error: could not compile `ntapi` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
PS D:\projects\rust_demos\RustPlayer> rustc --explain E0793
An unaligned references to a field of a [packed] struct got created.

Erroneous code example:

#[repr(packed)]
pub struct Foo {
field1: u64,
field2: u8,
}

unsafe {
let foo = Foo { field1: 0, field2: 0 };
// Accessing the field directly is fine.
let val = foo.field1;
// A reference to a packed field causes a error.
let val = &foo.field1; // ERROR
// An implicit & is added in format strings, causing the same error.
println!("{}", foo.field1); // ERROR
}


Creating a reference to an insufficiently aligned packed field is
[undefined behavior] and therefore disallowed. Using an `unsafe` block does not
change anything about this. Instead, the code should do a copy of the data in
the packed field or use raw pointers and unaligned accesses.

#[repr(packed)]
pub struct Foo {
field1: u64,
field2: u8,
}

unsafe {
let foo = Foo { field1: 0, field2: 0 };

// Instead of a reference, we can create a raw pointer...
let ptr = std::ptr::addr_of!(foo.field1);
// ... and then (crucially!) access it in an explicitly unaligned way.
let val = unsafe { ptr.read_unaligned() };
// This would *NOT* be correct:
// let val = unsafe { *ptr }; // Undefined Behavior due to unaligned load!

// For formatting, we can create a copy to avoid the direct reference.
let copy = foo.field1;
println!("{}", copy);
// Creating a copy can be written in a single line with curly braces.
// (This is equivalent to the two lines above.)
println!("{}", { foo.field1 });

}


### Additional information

Note that this error is specifically about *references* to packed fields.
Direct by-value access of those fields is fine, since then the compiler has
enough information to generate the correct kind of access.

See [issue #82523] for more information.

[packed]: https://doc.rust-lang.org/reference/type-layout.html#the-alignment-modifiers
[undefined behavior]: https://doc.rust-lang.org/reference/behavior-considered-undefined.html
[issue #82523]: https://github.com/rust-lang/rust/issues/82523

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.