Giter Club home page Giter Club logo

radio-cli's Introduction

GitHub Rust

radio-cli

A simple radio CLI written in rust.

NEW: Now it can search for any radio station! Just select the "Other" option to be prompted for the search.

asciicast

Warning! (DEPENDENCIES)

  • Needed: mpv is called to play the audio/video. (See the How it works section).
  • Optional dependency: To play youtube music you need to have yt-dlp or youtube-dl installed!

Contributing and code of conduct

Please, take a look at the Contributing and Code of Conduct guidelines

Usage

To use it, just type radio-cli after installing it and the program will guide you.

When playing music, you can use the mpv keybindings to control it (spacebar to play/pause, etc).

You can add a country to your config (optional) and search for any radio station!

Installation

  • On Arch (and derivatives such as Manjaro), you can just install it through the AUR package called radio-cli-bin. If you have an AUR helper:
$ yay -S radio-cli-bin

Note: radio-cli-git is now unsupported

  • On other systems you can:
    • Install it manually, without automatic update capabilities:
      git clone https://github.com/margual56/radio-cli.git radio-cli
      cd radio-cli
      cargo build --release
      sudo cp "./target/release/radio-cli" "/usr/bin/radio"
      mkdir -p "${XDG_CONFIG_HOME}/radio-cli/"
      cp "./config.json" "${XDG_CONFIG_HOME}/radio-cli/"
    • Install it through cargo: cargo install --git https://github.com/margual56/radio-cli

How it works...

...is very simple. The idea is to have a compilation of radio stations in the config file and have a tool to be able to easily select one or the other.

The rest is thanks to the wonderful and amazing mpv player. mpv is the one that does all the heavy-lifting and plays whatever you throw at it.

Let's say this is just a cli frontend for playing things on mpv ๐Ÿ˜„, kinda like ani-cli but without search functionalities and focused on radio stations.

If the station you want was not defined in the config, you will be able to search for it!

Configurability

As said before, this app is just a compilation of radios + a search prompt for online radios. It can be found in the config file as a JSON, with a list of station names and their URLs.

Of course you can add literally WHATEVER you want, even youtube videos (again, all thanks to mpv).

Otherwise, you can just use the online search functionality.

Fork me!

If you (wrongfully xD) think mpv is not the best player, go ahead, fork me and change it :)

The license is GPLv2

Planned features

Don't be surprised if these are not implemented in the end hehe (if there is no interest in the project, certainly not)

  • Audio (mpv) controls when not in verbose mode
  • Loop to selection list when pressing q while playing
  • Some kind of online updating of the list of stations (kind of)
  • Code optimizations/beautification
  • Search international online radios
  • Languages:
    • English
    • Spanish
    • Others(?)
  • An AUR installer

Honorable mentions

radio-cli's People

Contributors

hannesbraun avatar margual56 avatar prx0 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

radio-cli's Issues

Cannot install via yay

Output:

yay -S radio-cli-git
:: Checking for conflicts...
:: Checking for inner conflicts...
[Aur:1]  radio-cli-git-0.1.0-1

  1 radio-cli-git                            (Build Files Exist)
==> Packages to cleanBuild?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==>
:: PKGBUILD up to date, Skipping (1/0): radio-cli-git
  1 radio-cli-git                            (Build Files Exist)
==> Diffs to show?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==>
:: (1/1) Parsing SRCINFO: radio-cli-git
==> Making package: radio-cli-git 0.1.0-1 (Mon Mar 28 16:20:12 2022)
==> Retrieving sources...
  -> Updating radio-cli git repo...
Fetching origin
==> Validating source files with md5sums...
    radio-cli ... Skipped
==> Making package: radio-cli-git 0.1.0-1 (Mon Mar 28 16:20:14 2022)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Updating radio-cli git repo...
Fetching origin
==> Validating source files with md5sums...
    radio-cli ... Skipped
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Creating working copy of radio-cli git repo...
Cloning into 'radio-cli'...
done.
==> Starting prepare()...
mkdir: cannot create directory โ€˜/radio-cli/โ€™: Permission denied
==> ERROR: A failure occurred in prepare().
    Aborting...
 -> error making: radio-cli-git

There seems to be some permission issues in the "prepare()" function. I have tried executing yay -S radio-cli-git with sudo and I have rust installed.

[BUG] - No controls when not verbose

Describe the bug
mpv can be controlled through the terminal too, but with radio-cli in non-verbose mode you can't.

To Reproduce

  1. Run radio-cli
  2. Play something

Expected behavior
The keypresses are passed to mpv

[Feature] - More stations

Hi, I see the config contains radio station URL's. Would you be open to PR's adding additional stations?

[Feature] - Make `mpv` dependency optional, use e.g. `symphonia` for playback

The README doesn't make it very obvious that radio-cli is just a thin wrapper that merely parses a JSON file and then runs mpv.

This should be at the top of the README. The README gives the impression this was a client that can play (radio) media. It is not.

The fact that I need mpv is mentioned further down in a section called How it works... that section is closed by default. And it is after the installation instructions.

I actually only saw the mpv dependency when I looked at the source code because all that happened on my system when trying to use radio-cli was this:

? Select a station to play: Los 40 Principales
Los 40 Principales
Info: press 'q' to exit
thread 'main' panicked at 'Failed to execute command: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/main.rs:169:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To be blunt: if I always listen to the same station, running mpv with the link from my shell's history is less work (and less time & disk space wasted) than installing this and editing the ~/.config/radio-cli/config.json.

Suggestions:

  1. Mention the mpv dependency at the top of the README.
  2. Remove the mpv dependency. Use a pure Rust solution that can play back the streams.

Regarding 2.:
While there is the libmpv crate, this is itself a wrapper around the C libmpv library.

The latter needs to exist somewhere (i.e. possibly manually built and an env. var pointing to it to be set) so the build/installation of radio-cli would become potentially complicated.

Because of this I'd rather suggest to use something in pure Rust like the symphonia crate for playback and only fall back to libmpv for the few formats not (yet) supported by symphonia.

To not complicate the build by default, put the libmpv fallback behind a feature flag that is off by default so using cargo to install radio-cli just works.

[Bug] - `stderr` not displayed

Describe the bug
Errors from mpv are only displayed in verbose mode

To Reproduce
Steps to reproduce the behavior:

  1. Uninstall youtube-dl if present
  2. Try to listen to a youtube video (you can't because mpv needs youtube-dl for this) without verbose mode
  3. The aplication exits cleanly without errors

Expected behavior
Errors should be displayed and the exit status should be non-zero

Desktop (please complete the following information):

  • OS: Linux, Arch x86_64
  • Version v1.0.0

[Feature] - Show name of song

Is it possible to show the name of the song is played, in the title of the terminal window for example ?
Many thx for the job !
Cheers
julien

[BUG] - Exit codes are wrong

Describe the bug
The program always exits with an error code.

Expected behavior
When choosing an option, the only way to exit is to press Ctrl+c.
That should be a clean exit because no error occurred.

Same case with exiting when playing. Then, you can exit by pressing cleanly q and with an error when pressing Ctrl+c.

Additional context
Pressing q would terminate mpv, therefore terminating the parent process

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.