Git Product home page Git Product logo

mpvc's Introduction

GitHub GitHub Release Date GitHub release (latest by date) GitHub top language GitHub lines of Code

mpvc ๐ŸŽง

An mpc-like control interface for the mpv player with a nearly complete compatibility layer for mpc commands in addition to GNU style arguments. This forks lwillets/mpvc providing some extra goodies such as: improved CLI, TUI, FZF, WEB & playing media from YouTube & streaming services. Check the Wiki, LogBook & Casts for a detailed view of the extra features of this fork.

Overview

mpvc functionality is provided by:

For more details on how to use the above tools have a look at the logbok.html. In addition, the casts/ directory to shows some screencasts of mpvc in action.

QuickInstall โ–ถ๏ธ

mpvc-installer fetch-user: installs mpvc under BINDIR=~/bin/

curl -fsSL -o mpvc-installer https://github.com/gmt4/mpvc/raw/master/extras/mpvc-installer && sh ./mpvc-installer fetch-user

QuickStart

 # fetch a local copy of the github repo
 git clone https://github.com/gmt4/mpvc/
 # use extras/mpvc-installer: just copy/link to your $HOME/bin
 (cd mpvc; extras/mpvc-installer link-user)

 # use mpvc-fzf to search and play youtube media
 mpvc-fzf -p 'kupla mirage'
 # use mpvc to add/load/save media files or online YT URLs
 mpvc add /path/to/your/*.mp3 # or your URLs
 find . -type f -name | mpvc load
 mpvc save my-playlist

 # use mpvc-fzf to manage the playlist
 mpvc-fzf -f
 # use mpvc-tui to start the tui + desktop notifications
 mpvc-tui -T

Screenshots

mpvc-tui -T: running the mpvc TUI

mpvc-tui -T screenshot

mpvc-fzf -f: running with fzf to manage the playlist (screenshot click to view)

mpvc-fzf screenshot

mpvc-tui -n: running with mpvc-fzf and desktop notifications on the upper-right corner (screenshot click to view)

mpvc tui+fzf+notifications screenshot

Dependencies

Required:

  • mpv
  • socat: is recommended due to the differing implementations of netcat across UNIXes.
  • awk: a sane version of awk is recommended

Recommended extras:

  • curl
  • fzf
  • notify-send

Debian (and derivatives such as Ubuntu):

apt install mpv gawk curl socat fzf rlwrap jq libnotify-bin

Arch (and derivatives):

pacman -Sy mpv gawk curl socat fzf rlwrap jq libnotify

BSD (and pkg(1) based derivatives):

pkg install -y mpv gawk curl socat fzf rlwrap jq libnotify

MacOS (and brew(1) based derivatives see FAQ):

brew install gawk socat fzf rlwrap jq gnu-sed yt-dlp # mpv curl libnotify

Check for missing dependencies using mpvc-installer check-reqs

Install

To install mpvc:

Distro packages:

  • Arch Linux package: pacaur -y mpvc-git mpvc-git
  • Gentoo Linux package: emerge mpvc mpvc
  • Nix package: nix-env -i mpvc mpvc

Usage

mpvc requires the use of mpv and its --input-ipc-server option.

mpvc automatically opens an ipc-server for you when adding files to be played, but by default will close the ipc-server when all files have finished playing.

To keep the ipc-server open permanently, use:

$ mpv --input-ipc-server=/tmp/mpvsocket

You can also specify the default ipc server in your $XDG_CONFIG_HOME/mpv.conf which will make the most recent mpv instance you start be controllable via mpvc:

input-ipc-server=/tmp/mpvsocket

However, this may not be suitable if you have background music added to the socket and then open a video using mpv. The new mpv instance will be controllable through the socket, but the previous instance is not. You can get around this by adding the video via mpvc, and manually switching to the video.

Useful Tricks

Some basic tricks are provided in QuickStart. For more tips on loading/saving/maniputaling the mpv playlist/state, managing av/vf filters, etc. are provided in the LogBook.

  • Hotkey daemons like sxhkd can be used to bind mpvc commands to key combinations. Alternatively check your window manager documentation on how to bind keys to commands.
  • Any URL that can be played using mpv can be added to the playlist, e.g. using mps-youtube with player set to mpvc and playerargs set to add.
  • mpvc executes faster ~4x faster when using dash symlinked to /bin/sh instead of bash. Another faster alternative is mksh.
  • mpvc should be fully POSIX compliant, meaning it should run on any UNIX-like variant. Please report an issue if you experience trouble.

Limitations

Like any piece of software, mpvc is not perfect:

  • mpvc does not resolve individual files in a directory unless it is currently in or has been inside that directory, giving misleading results about the total number of files in the current playlist. This is a limitation of mpv.
  • mpvc depends on shell tools. If your shell is misconfigured or you are using unusual variants of basic UNIX tools, mpvc is not guaranteed to work. However, all effort has been made to make mpvc as POSIX compliant as possible.

Check out the Issue Tracker for further improvements to be made.

mpvc's People

Contributors

awan avatar bricewge avatar gergesh avatar gmt4 avatar heckendorfc avatar l-acs avatar lwilletts avatar neeasade avatar wildefyr avatar woorst 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

mpvc's Issues

mpvc is not able anymore to add folders or YT videos to a playlist

I've been a long time enjoyer of mpvc since 2017, with my personal little addition mentioned here: #40 (comment).

However, after many years of not updating mpvc I finally took the time to try the new commits.

Since commit 7f3543c mpvc seems to have lost the ability to add folders or YT videos to a playlist.

For example when adding a YT video with:
mpvc add ytvideourl

I get:
/tmp/mpvsocket does not exist. Use mpv --input-ipc-server to start one.

and if I manually create the socket with mpv:
No files added to /tmp/mpvsocket

It works only when I add files with absolute paths.

I use:
Debian Sid
bash 5.2.0
mpv 0.34.1

--input-unix-socket is being replaced with --input-ipc-server

But --input-ipc-server is still very new, having only been added last mpv release, breaking compatibility with older mpv versions. I think the best solution will be to wait until mpv git removes --input-unix-socket completely, then start using and recommending it.

Suggestion: make mpvc busybox compatible

nc - busybox's nc does not have the -U or -N flags

Solution: install socat

grep - busybox's grep does not have the -G flag

Solution: install gnugrep

Could there be a work around?

Remove bc checks

I believe bc is a required utility for POSIX. Is it okay to remove from the dep checks / README?

Better mps-youtube integration

Might I suggest a better way to use mpvc and mps-youtube?

set download_command mpvc add https://youtu.be/%i#%f -- --vid=no

Then add tracks in mpsyt using, for example: da 1-5

Advantages:

  • When using mpvc current you actually see info for the track playing instead of a crazy googlevideo.com link.
  • When using mpvc -i the filename will include more interesting track information which can better parsed in the script.

Script not POSIX on OpenBSD

Not currently working with the #!/bin/sh shebang that comes default on OpenBSD, (which has /bin/sh linked to ksh)

proof:
Image

Changing the shebang to /bin/bash solves all problems -- works flawlessly.

Request: make POSIX to remove bash dependency

New release

Many commits have been made since 2016, can we get a 1.3 release?

Would be great for packaging this as ports without needing to use git.

Thanks.

Phrasing Error

The following is an issue someone emailed to me:

Hi,

I noticed an error when -q -a are used together and then immediately -R.

I looked at the code and the playlist appends are backgrounded, so
mpvc exits but items are still being added, so I think it just need a
wait.

Implement playlist-move function.

Allows the user to move a track in the current playlist to somewhere else in the playlist, respecting ranges.

Main barrier is implementing a safe way to get ONLY two args and no more.

Phraser cannot handle files with spaces in them.

Is it worth mentioning that mpvc -a $(find . -type f) will not work if the filenames have spaces? To use find this way you would need to use find . -type f -print0 | xargs -0 mpvc -a but at that point you might as well just pipe directly to mpvc. Nothing is really gained by using the command line argument syntax here.

mpvc -a * will still work fine however.

feature request: --format

Just to put it on the radar, would be nice to have an equivalent to mpc --format with relevant options.

nice script :)

New release (June 2022)

Great project ! Love that it uses simple good old Unix tools and requires no complicated dependencies

I'm trying to test this on Archlinux. Unfortunately we currently only have a "mpvc-git" PKGBUILD recipee. It builds pulling from github master. And worse, it is currently broken, https://aur.archlinux.org/packages/mpvc-git.

I would like to test this with a proper "mpvc" PKGBUILD. Not a "mpvc-git" PKGBUILD. The last release is from 2020. And I see a lot of activity recently since last year.

Could you please tag and release a new one ?
Thanks in advance

#43

mpv --idle=once

What do you think about using --idle=once if an mpv process isn't found? Using the "once" parameter would allow mpv to stop after it finishes its work rather than continue to retain resources while not in use. I don't think the cost of starting up a new mpv process is very big. People that want the single long-lived mpv behaviour can still start it externally with --idle=yes.

feature request: subscribe

mpc has mpc idleloop, which will output mpd events as they happen - this is useful for acting as a trigger for say, panel mpd status updates - I would like the same to be possible with mpvc - maybe have it monitor for a change in the socket type of thing?

Random next track without changing playlist order.

Had this one in the mpc options section commented out for awhile to be implemented, but I talked to the one of the lead devs for mpv and he doesn't want to implement this option directly in mpv, so we'll have to fake do it in mpvc directly. Probably by storing a variable in a file somewhere.

formatPrint sed replacement error

If the file metadata contains '&', the %tag% will be inserted back like:
echo 'one %two% three' | sed 's#%two%#four&five#g'
would return:
'one four%two%five three' rather than 'one four&five three'

'&' will fix that behaviour but I'm not sure of an easy way to do that.

Weird terminal glitch

https://youtu.be/-RLFYJibT6k
So this is happening to me (xst - bash) and my friend (alacritty - mksh[?]). When you start the mpvc, looks like it make a glitch that begin to hidden/blend/mix(?) some words in a level that even make the terminal stop working of receivecommands.

Im using VoidLinux.
And thanks for the program!

--playnext inserts the track into the previous position

Describe the Issue
Using --playnext on a track when there is a queued playlist inserts the track into the previous position of the current track.

To Reproduce
Steps to reproduce the behavior:

  1. Load a playlist using mpv --input-ipc-server=/tmp/mpvsocket [playlist link]
  2. Insert a track using mpvc -A [video link]
  3. If the current track is, e.g. #โ€‹5 in queue, the new track is #โ€‹5 and the currently playing track is #โ€‹6.

Expected behavior
The current track stays in the same position and the new track is inserted into the next position.

feature request: add next / insert

I'm not knowledgeable enough to implement this myself, but an "insert" or "addnext" function like in mpc would be useful. All it does is add a song after the currently playing song in the queue.

Otherwise, I really like this script.

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.