summaryrefslogtreecommitdiff
path: root/README.md
blob: d0fbfc817c136f9a47818d1d316672a98e68faf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# clerk

MPD client using rofi or fzf

## Screenshot (V4)
![Screenshot](https://pic.53280.de/clerk.png)

## 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

* install [clerk-git from AUR](https://aur.archlinux.org/packages/clerk-git/)

### Debian/Ubuntu

* install deb package from [release page](https://github.com/carnager/clerk/releases)

### 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 usally 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.