Giter VIP home page Giter VIP logo

clerk's Introduction

clerk

MPD client using rofi or fzf

Screenshot (V4)

Screenshot

Features:

  • Play random album/tracks
  • Add/Replace albums/songs
  • Filter lists by rating
  • Customizable hotkeys
  • Rofi and fzf interfaces
  • Optional tmux interface for fzf mode
  • Rate albums/tracks
  • Optionally store ratings in file tags

Dependencies:

  • rofi (https://github.com/DaveDavenport/rofi)
  • fzf
  • tmux
  • perl-net-mpd
  • perl-data-messagepack
  • perl-data-section-simple
  • perl-file-slurper
  • perl-config-simple
  • perl-try-tiny
  • perl-ipc-run
  • perl-http-date

for the tagging_client:

  • metaflac (flac)
  • vorbiscomment (vorbis-tools)
  • mid3v2 (mutagen)

Installation

Arch Linux

Debian/Ubuntu

Others

For user only:

  • Install tmux, fzf and rofi
  • Install local::lib module (Most distributions should have it)
  • Install cpanm
  • Put eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib=~/perl5) to your shell config and restart your terminal
  • Clone this repository and change to clerk directory
  • Run cpanm --installdeps .
  • Move clerk.pl and clerk_rating_client to PATH

Globally:

  • Install cpanm
  • Clone this repository and change to clerk directory
  • Run cpanm --installdeps . as root
  • Move clerk.pl and clerk_rating_client to PATH

Ratings

Clerk can rate albums and tracks, which will be saved in MPDs sticker database as rating or albumrating. Track ratings should be compatible with all other MPD clients that support them. Albumratings are a unique feature to clerk, as far as I know.

clerk_rating_client

It's also possible to store ratings in file tags. Currently this is supported for flac, ogg and mp3 files. For this to work, simply set tagging=true in clerk.conf file and set your music_path.

It’s even possible to tag files not on the same machine (On MPD setups with remote clients). Simply copy your clerk.conf and clerk_rating_client to the machine hosting your audio files, edit music_path in config and start clerk_rating_client. A systemd user service is available.

For the moment I use metaflac, mid3v2 and vorbiscomment to tag files, because I haven't found a good perl library for this task.

Filtering

clerk integrates ratings fully into its database and exposes the ratings in track and album lists. To filter by a specific rating use r=n as part of your input. Sadly filtering for r=1 will also show r=10. in rofi interface you can work around this by filtering for r=1\s. in fzf interface r=1$ works.

If you don't like to see ratings in your track/album listings, simply increase the album_l setting in config.

Usage

Usage:
    clerk [command] [-f]

      Commands:
        -a           Add/Replace album(s) to queue.
        -l           Add/Replace album(s) to queue (sorted by mtime)
        -t           Add/Replace track(s) to queue.
        -p           Add stored playlist to queue
        -r [-A, -T]  Replace current playlist with random songs/album
        -u           Update caches

      Options:
        -f           Use fzf interface

      Without further arguments, clerk starts a tabbed tmux interface
      Hotkeys for tmux interface can be set in $HOME/.config/clerk/clerk.tmux

    clerk version 4.0

Hotkeys

Global

Tab:   select item(s)
Enter: perform action on item

Hotkeys for tmux interface

F1:    albums view
F2:    tracks view
F3:    albums view (sorted by mtime)
F4:    playlist view
F5:    queue view (uses ncmpcpp by default, can be changed in clerk.conf)
F10:   random pane
C-F5:  previous song
C-F6:  toggle playback
C-F7:  stop playback
C-F8:  next song
C-F1:  show hotkeys
C-q:   quit clerk tmux interface

All tmux hotkeys can be changed in clerk.tmux file.

Files and Variables

clerk uses $XDG_CONFIG_HOME and $XDG_DATA_HOME for its files. Both variables are usually unset and default to $HOME/.config and $HOME/.local/share. These files are stored by clerk:

XDG_CONFIG_HOME

  • clerk.conf: config file.
  • clerk.tmux: clerk's tmux config

XDG_DATA_HOME

  • database.mpk: clerk's local database

Use CLERK_CONF, CLERK_TMUX and CLERK_DATABASE variables to override file locations.

clerk's People

Contributors

carnager avatar fiete201 avatar iammrinal0 avatar jason-cooke avatar jpleau avatar nicodebo avatar rafi avatar seirdy 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  avatar

clerk's Issues

no track displayed

Hi,

Thanks for this great script.

It works quite fine playing random tracks with mpd but do not display any album nor track while trying to browse the library.

While it shows current queue when I choose to play random tracks. I couldn't find the reason.

Thanks for your help

Running slackware64-current
All dependencies met and up-to-date

The file clerk_rating_client.service is shipped marked as executable

The file clerk_rating_client.service is marked executable as shipped from the github repo

Got this from my system log,

Configuration file /usr/lib/systemd/user/clerk_rating_client.service is marked executable. Please remove executable permission bits. Proceeding anyway.

And indeed, installed on my system,

ls -l /usr/lib/systemd/user/clerk_rating_client.service

-rwxr-xr-x 1 root root 157 Sep 18 17:45 /usr/lib/systemd/user/clerk_rating_client.service

Of the many .service files there, clerk is the only one marked executable. All others are marked '-rw-r--r--'

Back option

I might be missing things, but I can't seem to find any way to go back to the previous menu after entering an album etc. Any help?

clerk won't launch rofi

How does clerk launch rofi? I see references to it in the code and i see the rvar{backend} = 'rofi' but there i can't get it to launch rofi.

Clerk doesn't grab information/Can't control MPD

When I use hotkey/rofi to directly start Clerk (read; run: clerk in rofi), it doesn't grab half the information from MPD, and I can't control anything. I can't change songs or outputs.

Any idea why? I like Clerk a lot.

Use rofi interface to find and play a given track

My Clerk installation went after an update from 3.2.1.1 to 4.0.5 (ArchLinux). I used clerk to find a track (clerk --queue show) and quickly launch it (ie: type a few letters, hit Enter, it plays, it's way more efficient than launching ncmpcpp and finding a track).

I read the changelog and saw the great revamp of the interface but I only see commands to Add/Insert/Replace a track or an album. I do not want to change the playing queue, just to navigate inside it, in a rofi-way. Is it possible?

Edit: I found issue #24 , where you mention that the main playback queue interface may be removed, you probably did. I would welcome a work around, but that's OK if there's none. Thanks for your great work!

Overwrite Rofi width and height

I try to overwrite my default width and height for rofi which i set in Xresources. But there doesn't seem to be an option for that anymore. Is that still possible? Otherwise the rofi frontend will be useless for me.

License?

Is there a license for this project?

(if not, may I recommend MIT, like what rofi is licensed as?)

"Too many errors" when starting clerk

I'm on MacOS 10.12.6 and installed clerk as user following the instructions. I get the following errors when launching clerk (I'm planning on using via tmux-fzf, not rofi, which I haven't tried to install).

➜  ~ clerk.pl
"my" variable %rvar masks earlier declaration in same scope at /Users/hgv/bin/clerk.pl line 281.
Use of my $_ is experimental at /Users/hgv/bin/clerk.pl line 291.
Use of my $_ is experimental at /Users/hgv/bin/clerk.pl line 307.
"my" variable @_ masks earlier declaration in same scope at /Users/hgv/bin/clerk.pl line 307.
"my" variable $out masks earlier declaration in same scope at /Users/hgv/bin/clerk.pl line 310.
syntax error at /Users/hgv/bin/clerk.pl line 271, near "->%"
syntax error at /Users/hgv/bin/clerk.pl line 272, near "}"
Global symbol "@db" requires explicit package name at /Users/hgv/bin/clerk.pl line 272.
Global symbol "@filtered" requires explicit package name at /Users/hgv/bin/clerk.pl line 273.
syntax error at /Users/hgv/bin/clerk.pl line 274, near "}"
syntax error at /Users/hgv/bin/clerk.pl line 288, near "}"
syntax error at /Users/hgv/bin/clerk.pl line 304, near "}"
Global symbol "$filtered_db" requires explicit package name at /Users/hgv/bin/clerk.pl line 308.
syntax error at /Users/hgv/bin/clerk.pl line 313, near "}"
syntax error at /Users/hgv/bin/clerk.pl line 320, near "}"
/Users/hgv/bin/clerk.pl has too many errors.

Based on #2, it seems like at least someone got clerk working on macos/osx (though maybe that was the earlier, pre-perl version?). Maybe I need to install a different version of perl? I'm using the macos version, which is 5.18.2 (homebrew has a more recent version, but wanted to check here first as dealing with multiple versions can be a pain).

I was using clerk on arch before I recently switched back; would love to keep using it. Thanks!

Error while fetching lyrics

Hi all,
I don't know if that is new since I do not use very often this feature but I have erros on fetching well known lyrics with decent tags. I'm quite sure it has worked well...

Shall I correct my tags in some way ? Check for the version of dependencies that might have change their syntax ?

Thanks for every advice (I can't use another music player !)

Regards

socket error

Hi,
I have no idea what happened but since a few days I have this message when typing "clerk" on the terminal:

"Error reading line from socket at /usr/bin/clerk line 268."

playing/pausing with mpc works fine.

selection dosent color selected items in clerk-git

selection dosent color selected items in clerk-git

rofi colors






! -- Rofi settings -- !
rofi.padding: 3
rofi.opacity: 90
rofi.fixed-num-lines: true
rofi.disable-history: false
rofi.levenshtein-sort: false
rofi.terminal: x-terminal-emulator


!!!! Rofi Themes
rofi.color-enabled:         true
rofi.borderwidth:        1

!!!! HoneyComb  theme
! rofi.color-normal:          #000000,#A0A0A0,#000000,#0C73C2,#FFFFFF
! rofi.color-urgent:          #000000,#FFB2B2,#000000,#0C73C2,#FFFFFF
! rofi.color-active:          #000000,#C272C1,#000000,#FFFFFF,#000000
! rofi.color-window:          #000000,#0C73C2

!!!! Solarized light theme
rofi.color-normal:                   #fdf6e3,#002b36,#eee8d5,#586e75,#eee8d5
rofi.color-urgent:                   #fdf6e3,#dc322f,#eee8d5,#dc322f,#fdf6e3
rofi.color-active:                   #fdf6e3,#268bd2,#eee8d5,#268bd2,#fdf6e3
rofi.color-window:                   #002b36,#002b36


!!!! rasi theme
!rofi.color-normal:          #000000,#A0A0A0,#000000,#0C73C2,#FFFFFF
!rofi.color-urgent:          #000000,#FFB2B2,#000000,#0C73C2,#FFFFFF
!rofi.color-active:          #000000,#C272C1,#000000,#FFFFFF,#000000
!rofi.color-window:          #000000,#0C73C2


!font
!rofi.font:                  Pragmata Pro 14
!rofi.font:                  ubuntu mono 14
rofi.font:                  fira mono 14

Hyper modifier is not recognised?

I would like to bind some controls to the Hyper key. I have remapped my keyboard to have one, and I use Hyper keybinds outside of clerk to send mpc commands (highly recommended!)

I've tried mapping a few random commands to Hyper keybinds, and clerk starts without error (indeed, the error screen says that Hyper is a valid key), and it shows up in the command hints.

"Hyper+r: Add + play"

which I specified with addplay="Hyper+x" in ~/.config/clerk/config

When I try these keybinds, though, it just types the letters in the search field as if I weren't holding the Hyper modifier.

I have the key mapped as Hyper_L (keysym 0xffed), and I tried remapping it to be Hyper_R (keysym 0xffee), but I get the same result.

I also tried addplay="Hyper_L+r" and addplay="Hyper_R+r" with each of the different key mappings, and none of the configurations work.

Is this a bug, or do I need to change something in my configuration?

Can't find queue window

Hi,
Awesome work with fzf and tmux, looks great ! I was used to rofi but will certainly switch soon.

I'm discovering tmux and might have missed something but I can't show the current queue : I've got a message that says "can't find window queue" (and it isn't showing next to albums, traks, playlists).

I'm running Slackware-current and use i3wm.

Btw, when I need the help window... I don't know how to hide it afterwards ! And a small tuto on how to use would have be a bit time saving, I didn't know how to launch at first (tmux -c './clerk.pl -f' if someone needs...)

Anyway, awesome work, Thank you very much !

Noisy stdout output

Could you silence these message outputs?

$ clerk --random track
slmenu
volume: 87%   repeat: off   random: off   single: off   consume: off
Battles feat. Matias Aguayo - Ice Cream
[playing] #1/1   0:00/4:37 (0%)
volume: 87%   repeat: off   random: off   single: off   consume: off
Battles feat. Matias Aguayo - Ice Cream
[playing] #1/51   0:03/4:37 (1%)
volume: 87%   repeat: off   random: off   single: off   consume: off

$ clerk --random album
slmenu
volume: 87%   repeat: off   random: off   single: off   consume: off
Alla Rakha & Zakir Hussain - Dhamar
[playing] #1/4   0:00/24:43 (0%)
volume: 87%   repeat: off   random: off   single: off   consume: off

$ clerk  # With no file caches
slmenu
cat: /Users/rafi/.config/clerk/album.cache: No such file or directory
cat: /Users/rafi/.config/clerk/tracks.cache: No such file or directory
cat: /Users/rafi/.config/clerk/last.cache: No such file or directory
  MPD Menu >
  Q  Exit Clerk
  ---
  1  Play random Album
  2  Play random Songs
  ---
  3  Current Artist
  4  Current Queue
  5  Browse Library
  6  Manage Playlists
  ---
  7  Options
  8  Ratings
  9  Lookup
  0  Playback

$ clerk --update
slmenu

Next tagged release

The last tagged release was over a year and a half ago, with 80 commits since then. Any chance of a new one? Main reason is for packaging. I just submitted this to be added to xbps for void linux, and they, like many, only use tagged releases.

Deeper Usage Example

Any chance you could outline the workflow you use clerk in, what keybinds, how it integrates with your WM, etc? I'm a bit lost myself, and just ended up binding mod+m to exec clerk...

fails on debian jessie with column issues

i get this on first run:

$ ./clerk
./clerk: ligne 208: /home/anarcat/.config/clerk/.lastupdate: Aucun fichier ou dossier de ce type
column : option invalide -- 'o'
usage: column [-tx] [-c columns] [-s sep] [file ...]
gawk: ligne de commande:28: (FILENAME=- FNR=1) fatal : strftime: second argument négatif ou trop grand pour time_t
column : option invalide -- 'o'
usage: column [-tx] [-c columns] [-s sep] [file ...]
column : option invalide -- 'o'
usage: column [-tx] [-c columns] [-s sep] [file ...]

pardon my french, translations:

  • Aucun fichier ou dossier de ce type: "no such file or directory"
  • second argument négatif ou trop grand pour time_t: "second argument negative or too large for time_t"
  • option invalide: "invalid option"

not sure what i did wrong. running clerk again doesn't reproduce the issue, but the display is garbled..

Suspend

When a queue is playing the clerk -suspend does not stop play.

I am assuming this would be the equivalent of pause as I do not see any option relating to that.

By the way, great work on this. It is a great way to manage music, fits very nicely into my current workflow.

Tagging: follow the Free Media Player Specification

Players such as Clementine, Yarock, XMMS2, and VLC parse/write rating tags by looking for the "Fmps Rating" tag in accordance with the XDG FMPS specification; however, clerk_rating_client uses the "Rating" tag. Using the "Fmps Rating" tag would improve compatibility with other players.

Cantata, for instance, writes MPD rating stickers to the "Fmps Rating" tag.

error when rofi related variables are not set in clerk.conf

Hi,

After updating clerk-git from the aur, launching rofi interface (for exemple $ clerk -a) returned the following error:

Use of uninitialized value $rvar{"rofi_theme"} in string ne at /usr/bin/clerk line 312, <GEN0> line 29.
undef passed at /usr/share/perl5/vendor_perl/IPC/Run.pm line 1272, <GEN0> line 29.
	IPC::Run::_exec("/usr/bin/rofi", "-matching", "regex", "-dmenu", "-kb-row-tab", "", "-kb-move-word-forward", "", ...) called at /usr/share/perl5/vendor_perl/IPC/Run.pm line 2615
	eval {...} called at /usr/share/perl5/vendor_perl/IPC/Run.pm line 2493
	IPC::Run::_do_kid_and_exit(IPC::Run=HASH(0x564298838fd8), HASH(0x56429889b7a8)) called at /usr/share/perl5/vendor_perl/IPC/Run.pm line 1380
	IPC::Run::_spawn(IPC::Run=HASH(0x564298838fd8), HASH(0x56429889b7a8)) called at /usr/share/perl5/vendor_perl/IPC/Run.pm line 2768
	eval {...} called at /usr/share/perl5/vendor_perl/IPC/Run.pm line 2765
	IPC::Run::start(ARRAY(0x5642988ce608), SCALAR(0x564296f57598), SCALAR(0x564296f575b0)) called at /usr/bin/clerk line 317
	main::backend_call(ARRAY(0x564296f67828), "1,2,3,4") called at /usr/bin/clerk line 494
	main::ask_to_pick_albums() called at /usr/bin/clerk line 224
	main::__ANON__() called at /usr/bin/clerk line 53
	main::main() called at /usr/bin/clerk line 726
 at /usr/bin/clerk line 317.

I had to manually add the rofi variables as explained in #37. The issue is fixed but wouldn't a less verbose error output be better ? Or maybe fallback values to rofi_width and rofi_theme so that clerk does not break after updating ?

Have a nice day.

Can't find a way to rate albums nor songs

Hi,
I believe I've read the whole documentation but still can't find how to use the clerk_rating_client...
I saw the service file : is it because my distribution do not ship systemd thing ?
Sorry if the answer is obvious but I feel lost with this !

Daemon mode

Nice work!
How can I use in daemon mode like rofi?

Add documentation and tag new release

Hi

Would you explain the recent changes in clerk.pl ? I can't figure :-\
I'm also curious about the 'musiclist' file and how to use it :)

Last but not least, could you tag a new release ? I plan to maintain a build script for Slackware (SlackBuild) and need an up-to-date tarball to download.

Thanks again for clerk, it's still my favorite !

Terminal filled with warnings

hi,
I've just switched to clerk v4 and the new interface looks great. Thanks.
I used the AUR package to install clerk.

However, when I start clerk in "album" or "sorted album" views, my terminal is filled with the following message:

Use of uninitialized value in join or string at /usr/bin/clerk line 368, <GEN0> line 29.

Question: Spotifyd via Clerk?

I don't like the spotify interface and was looking for a spotify CLI, and then came across a Spotify daemon project (https://github.com/Spotifyd/spotifyd). In browsing the issues, looking for relevant CLI clients, I saw an issue from @carnager: Spotifyd/spotifyd#76.

Did you attempt to get spotifyd to work as a source for Clerk? Looking through spotifyd, it seems like the project routinely has lots of issues, so I imagine getting it to be a source for Clerk would be difficult. But did you have any luck? Any future plans? I really love clerk and now find all other interfaces clumsy, so spotifyd via clerk would be great.

Compilation Albums?

When I browse the library by album, compilation albums are split up into individual "albums" based on the artist, despite all of the files being tagged correctly.

It seems that the album search is considering the artist as well as the album when searching albums.

The issue is not present in ncmpcpp.

Is there a configuration option that I could change, or is this a current limitation of the program?

mpd error: Connection closed by the server

Hi,

I was getting this error when updating the cache. I found a solution by increasing max_output_buffer_size in my mpd.conf in the FAQ. Default is 8192 according to the doc, and I set it to be 262144 (because I have about 45k music in my MPD library and I increased max_playlist_length by a factor 16 to be in range).

However, even after such increase, I still get three mpd error: Connection closed by the server when updating the cache.

% ls .config/clerk -alh   
total 5,1M
drwxr-xr-x  2 phyks phyks 4,0K 10 févr. 17:46 ./
drwxr-xr-x 53 phyks phyks 4,0K 10 févr. 17:10 ../
-rw-r--r--  1 phyks phyks  92K 10 févr. 17:46 albums.cache
-rw-r--r--  1 phyks phyks 1,5K 10 févr. 17:28 config
-rw-r--r--  1 phyks phyks   39 10 févr. 17:39 .lastupdate
-rw-r--r--  1 phyks phyks  95K 10 févr. 17:45 latest.cache
-rw-r--r--  1 phyks phyks 4,9M 10 févr. 17:47 tracks.cache

shows me that the cache has been, at least partially, built, however. But it may be incomplete.

Do you know what is happening exactly and how to fix it? My value for max_output_buffer_size corresponds to more than 200Mo if I am correct, which seems to be really a lot and much more than what could potentially be needed. I did not see anything special in the logs or by running mpd --verbose.

Thanks

EDIT: I never saw such error with mpc (basic usage) or gmpc / ario.

Infinite random mode

Hi,

Are there any plans (or are you interested in) putting an "infinite random" mode, playing random songs continuously, feeding new songs in the playlist when it is exhausted?

Thanks

Error output to file?

When I hit enter on an album or track, in order to add to queue, a bunch of errors show up, before the next add,replace,etc. screen shows up quickly, disappearing the errors. I'm pretty sure this means there are missing tags, but I'd like to know which tags. I've opened some of those files in Picard, and it seems as if no tags are missing. Is there any way to pipe the error output to a file or view it in Clerk?

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.