Difference between revisions of "MOC"

From ArchWiki
Jump to: navigation, search
(rm temporary i18n template)
 
(76 intermediate revisions by 30 users not shown)
Line 1: Line 1:
[[Category:Audio/Video]]
+
[[Category:Music]]
 +
[[fa:Moc]]
 +
[[de:Moc]]
 
[[es:Moc]]
 
[[es:Moc]]
 
[[fr:Moc]]
 
[[fr:Moc]]
 +
[[ja:MOC]]
 +
[[pl:Moc]]
 
[[ro:Moc]]
 
[[ro:Moc]]
 +
[[ru:Moc]]
 
[[sr:Moc]]
 
[[sr:Moc]]
'''M'''usic '''O'''n '''C'''onsole is a lightweight music player. It consists of 2 parts, a server (Moc) and the player/interface (Mocp).
+
[https://moc.daper.net/ Music On Console] is a lightweight music player similar to [[MPD]], but unlike it, MOC comes with an interface and its server does not support remote access.
This is similar to [[mpd]], but unlike mpd, Moc comes with an interface.
 
  
==Installation==
+
== Installation ==
  
Sync and install with pacman:
+
[[Install]] the {{Pkg|moc}} package. The latest development version is available as {{AUR|moc-svn}}. For [[PulseAudio]] support install {{AUR|moc-pulse}} or {{AUR|moc-pulse-svn}} for the development version.
# pacman -S moc
 
  
==Configuration==
+
== Configuration ==
The package includes a sample configuration file at {{ic|/usr/share/doc/moc/config.example}}. To configure moc, copy this file to {{ic|~/.moc/config}} and edit it.
 
  
For instructions about customising the keybindings, read {{ic|/usr/share/doc/moc/keymap.example}}.
+
Sample configuration files can be found in {{ic|/usr/share/doc/moc/}}. On ''mocp'' first run the local {{ic|~/.moc/}} directory is created. To configure, copy the examples to it and edit accordingly.
 +
 
 +
Themes are stored in {{ic|/usr/share/moc/themes}} and can be set in {{ic|~/.moc/config}}. See {{ic|/usr/share/moc/themes/example_theme}} for more.
 +
 
 +
To change the default key bindings, see {{ic|/usr/share/doc/moc/keymap.example}}.
  
 
If you want to use Moc with [[OSS]] v4.1, see [[OSS#MOC]].
 
If you want to use Moc with [[OSS]] v4.1, see [[OSS#MOC]].
  
==Usage==
+
=== Lynx like navigation ===
 +
 
 +
To change directories with the arrow keys uncomment in {{ic|~/.moc/config}}:
 +
 
 +
Keymap = keymap
  
To start moc:
+
Edit the following in {{ic|~/.moc/keymap}}:
  
  $ mocp
+
  go    = ENTER RIGHT
 +
go_up = U LEFT
 +
#seek_forward  = RIGHT
 +
#seek_backward = LEFT
  
This will start the server and interface. You will enter player interface. Some useful shortcuts to use mocp (case sensitive):
+
== Usage ==
 +
 
 +
Run ''mocp'' to start the server and interface. Some useful default shortcuts (press {{ic|h}} for more):
  
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
| Start playing a track
+
| Start playing at this file or go to this directory
| Enter
+
| {{ic|Enter}}
 +
|-
 +
| Pause
 +
| {{ic|Space}} or {{ic|p}}
 +
|-
 +
| Play next file
 +
| {{ic|n}}
 +
|-
 +
| Play previous file
 +
| {{ic|b}}
 +
|-
 +
| Silent seek forward by 5s
 +
| {{ic|]}}
 
|-
 
|-
| Pause track
+
| Silent seek backward by 5s
| Space or p
+
| {{ic|[}}
|-
 
| Play next track
 
| n
 
 
|-
 
|-
| Play previous track
+
| Switch between playlist and file list
| b
+
| {{ic|Tab}}
 
|-
 
|-
| Switch from playlist browsing to filesystem browsing (and vice versa)
+
| Add a file/directory to the playlist
| tab
+
| {{ic|a}}
 
|-
 
|-
| Add one track to the playlist
+
| Add a directory recursively to the playlist
| a
+
| {{ic|A}}
 
|-
 
|-
| Remove track from playlist
+
| Delete an item from the playlist
| d
+
| {{ic|d}}
 
|-
 
|-
| Add a folder recursively to playlist
+
| Clear the playlist
| A
+
| {{ic|C}}
 
|-
 
|-
| Clear playlist
+
| Increase volume by 1%
| C
+
| {{ic|>}}
 
|-
 
|-
| Increase volume 5%
+
| Decrease volume by 1%
| . (dot)
+
| {{ic|<}}
 
|-
 
|-
| Decrease volume 5%
+
| Increase volume by 5%
| , (comma)
+
| {{ic|.}} (dot)
 
|-
 
|-
| Increase volume 1%
+
| Decrease volume by 5%
| >
+
| {{ic|,}} (comma)
 
|-
 
|-
| Decrease volume 1%
+
| Set volume to 10%
| <
+
| {{ic|Alt+1}}
 
|-
 
|-
| Change volume to 10%
+
| Set volume to 90%
| meta + 1
+
| {{ic|Alt+9}}
 
|-
 
|-
| Change volume to 20%
+
| Detach MOC from the server
| meta + 2
+
| {{ic|q}}
 
|-
 
|-
| Quit player
+
| Quit
| q
+
| {{ic|Q}}
 
|}
 
|}
  
NOTE: To shut down the server, use the shift (capital) Q key or:
+
To shut down the server, press {{ic|Shift+q}} or run the {{ic|mocp -x}} command.
$ mocp -x
+
 
 +
== Last.fm scrobbling ==
 +
 
 +
=== mocp-scrobbler ===
 +
 
 +
{{AUR|mocp-scrobbler}} is a Last.fm/Libre.fm scrobbler for MOC with support for now-playing notifications, daemonization and cache. It only depends on [[Python]] 3.
 +
 
 +
Copy the example file to your user config directory:
 +
 
 +
mkdir ~/.mocpscrob/
 +
cp /usr/share/doc/mocp-scrobbler/config.example  ~/.mocpscrob/config
 +
 
 +
Edit {{ic|~/.mocpscrob/config}} to add your login and password. The password variable will be replaced with {{ic|password_md5}} on the first run. Its value will be the original value hashed using MD5 algorithm. If you want to change password, just add again password with you new password, and {{ic|password_md5}} will be replaced.
 +
 
 +
To scrobble tracks, start ''mocp-scrobbler'' as daemon before ''mocp''. You can also use an [[alias]]:
 +
 
 +
alias mocp='/usr/bin/mocp-scrobbler.py -d; mocp'
 +
 
 +
In January of 2016 last.fm updated their password requirements, with all new and updated passwords requiring the inclusion of one of the following characters {{ic|<nowiki>!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~</nowiki>}}, or a space. This is known to cause an authentication error with mocpscrob configurations which specify passwords not conforming to these new specifications. Changing one's password and updating the {{ic|~/.mocpscrob/config}} password accordingly resolves this issue.
 +
 
 +
If you want to use Libre.fm instead of Last.fm it is important to change {{ic|hostname}} from {{ic|post.audioscrobbler.com}} to {{ic|turtle.libre.fm}}.
 +
 
 +
== Front-ends ==
 +
 
 +
* {{App|mocicon|GTK panel applet to control MOC|http://mocicon.sourceforge.net/|{{Aur|mocicon}}}}
 +
* {{App|moc-tray|Quick and easy access to mocp basic functions|https://code.google.com/p/moc-tray/|{{Pkg|moc-tray}}{{Broken package link|package not found}}}}
 +
* {{App|eXo|Qt frontend to MOC, supports scrobbling|https://bitbucket.org/blaze/exo/}}
 +
 
 +
== systemd service file ==
 +
 
 +
{{hc|/etc/systemd/system/moc@.service|<nowiki>
 +
[Unit]
 +
Description=MOC server
 +
ConditionPathExists=/usr/bin/mocp
 +
After=network.target sound.target
  
==Unstable versions==
+
[Service]
 +
RemainAfterExit=yes
 +
User=%I
 +
ExecStart=/usr/bin/mocp -S
 +
ExecStop=/usr/bin/mocp -x
 +
WorkingDirectory=/home/%I/
  
You can obtain these from the AUR. MOC 2.4.0 (stable) was released in 2006. Features since then are in 2.5, but are not yet blessed “stable” as of writing.
+
[Install]
 +
WantedBy=multi-user.target
 +
</nowiki>}}
  
* {{AUR|moc-svn}}
+
[[Enable]] this service for the respective user.
* {{AUR|moc-devel}} (alpha version for next release)
 
  
==MOC + last.fm==
+
== Troubleshooting ==
  
If you want scrobble songs to last.fm you need moc >= 2.5.0. See [[#Unstable versions]] above.
+
=== MOC fails to start ===
  
First install lastfmsubmitd. It is a daemon which is available in the "community" repository.  To install it, first edit {{ic|/etc/lastfmsubmitd.conf}} and add both {{Ic|lastfmsubmitd}} and {{Ic|lastmp}} to the {{Ic|DAEMONS}} array in {{ic|/etc/rc.conf}}.
+
If MOC fails to start, it is most probably because of something wrong in {{ic|~/.moc/}}. You can try to fix it, or simply delete the whole folder.
  
Now configure moc:
+
=== Strange characters ===
  
$ vim ~/.moc/config
+
If you see strange-like characters displayed in ''moc'' instead of the normal lines (vertical lines to separate space, etc.), you may have a font set incompatible to MOC. Either change the respective font, or edit {{ic|.moc/config}} to use ASCII for drawing lines:
add line:
 
OnSongChange = "/usr/lib/lastfmsubmitd/lastfmsubmit --artist %a --title %t --length %d --album %b"
 
  
change permission:
+
ASCIILines = no
  
$ sudo chmod -R 777 /var/spool/lastfm
+
=== FATAL_ERROR: Layout1 is malformed ===
  
thats all.
+
If MOC crashes with this error, try adding either line to {{ic|.moc/config}}:
 +
Layout1 = directory(0,0,50%,100%): playlist(50%,0,100%,100%)
 +
or
 +
Layout1 = directory(0,0,50%,100%): playlist(50%,0,FILL,100%)
  
==Frontends==
+
See [http://moc.daper.net/node/262 original report] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=485059 Debian bugs].
[https://aur.archlinux.org/packages.php?ID=39708 dmenu_mocp] is a dmenu frontend for moc
 
  
[https://aur.archlinux.org/packages.php?ID=24338 moc-tray] is a perl gtk dock that gives you access to moc functions
+
== See also ==
  
==Troubleshooting==
+
* [http://moc.daper.net/documentation Official documentation]
===moc fails to start===
 
If moc fails to start, it's most probably because of something wrong in {{ic|~/.moc/}}. You can try to fix it, or simply delete the folder {{ic|~/.moc/}}.
 

Latest revision as of 15:30, 21 June 2018

Music On Console is a lightweight music player similar to MPD, but unlike it, MOC comes with an interface and its server does not support remote access.

Installation

Install the moc package. The latest development version is available as moc-svnAUR. For PulseAudio support install moc-pulseAUR or moc-pulse-svnAUR for the development version.

Configuration

Sample configuration files can be found in /usr/share/doc/moc/. On mocp first run the local ~/.moc/ directory is created. To configure, copy the examples to it and edit accordingly.

Themes are stored in /usr/share/moc/themes and can be set in ~/.moc/config. See /usr/share/moc/themes/example_theme for more.

To change the default key bindings, see /usr/share/doc/moc/keymap.example.

If you want to use Moc with OSS v4.1, see OSS#MOC.

Lynx like navigation

To change directories with the arrow keys uncomment in ~/.moc/config:

Keymap = keymap

Edit the following in ~/.moc/keymap:

go    = ENTER RIGHT
go_up = U LEFT
#seek_forward  = RIGHT
#seek_backward = LEFT

Usage

Run mocp to start the server and interface. Some useful default shortcuts (press h for more):

Start playing at this file or go to this directory Enter
Pause Space or p
Play next file n
Play previous file b
Silent seek forward by 5s ]
Silent seek backward by 5s [
Switch between playlist and file list Tab
Add a file/directory to the playlist a
Add a directory recursively to the playlist A
Delete an item from the playlist d
Clear the playlist C
Increase volume by 1% >
Decrease volume by 1% <
Increase volume by 5% . (dot)
Decrease volume by 5% , (comma)
Set volume to 10% Alt+1
Set volume to 90% Alt+9
Detach MOC from the server q
Quit Q

To shut down the server, press Shift+q or run the mocp -x command.

Last.fm scrobbling

mocp-scrobbler

mocp-scrobblerAUR is a Last.fm/Libre.fm scrobbler for MOC with support for now-playing notifications, daemonization and cache. It only depends on Python 3.

Copy the example file to your user config directory:

mkdir ~/.mocpscrob/
cp /usr/share/doc/mocp-scrobbler/config.example  ~/.mocpscrob/config

Edit ~/.mocpscrob/config to add your login and password. The password variable will be replaced with password_md5 on the first run. Its value will be the original value hashed using MD5 algorithm. If you want to change password, just add again password with you new password, and password_md5 will be replaced.

To scrobble tracks, start mocp-scrobbler as daemon before mocp. You can also use an alias:

alias mocp='/usr/bin/mocp-scrobbler.py -d; mocp'

In January of 2016 last.fm updated their password requirements, with all new and updated passwords requiring the inclusion of one of the following characters !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~, or a space. This is known to cause an authentication error with mocpscrob configurations which specify passwords not conforming to these new specifications. Changing one's password and updating the ~/.mocpscrob/config password accordingly resolves this issue.

If you want to use Libre.fm instead of Last.fm it is important to change hostname from post.audioscrobbler.com to turtle.libre.fm.

Front-ends

  • mocicon — GTK panel applet to control MOC
http://mocicon.sourceforge.net/ || mociconAUR
  • moc-tray — Quick and easy access to mocp basic functions
https://code.google.com/p/moc-tray/ || moc-tray[broken link: package not found]
  • eXo — Qt frontend to MOC, supports scrobbling
https://bitbucket.org/blaze/exo/ || not packaged? search in AUR

systemd service file

/etc/systemd/system/moc@.service
[Unit]
Description=MOC server
ConditionPathExists=/usr/bin/mocp
After=network.target sound.target

[Service]
RemainAfterExit=yes
User=%I
ExecStart=/usr/bin/mocp -S
ExecStop=/usr/bin/mocp -x
WorkingDirectory=/home/%I/

[Install]
WantedBy=multi-user.target

Enable this service for the respective user.

Troubleshooting

MOC fails to start

If MOC fails to start, it is most probably because of something wrong in ~/.moc/. You can try to fix it, or simply delete the whole folder.

Strange characters

If you see strange-like characters displayed in moc instead of the normal lines (vertical lines to separate space, etc.), you may have a font set incompatible to MOC. Either change the respective font, or edit .moc/config to use ASCII for drawing lines:

ASCIILines = no

FATAL_ERROR: Layout1 is malformed

If MOC crashes with this error, try adding either line to .moc/config:

Layout1 = directory(0,0,50%,100%): playlist(50%,0,100%,100%)

or

Layout1 = directory(0,0,50%,100%): playlist(50%,0,FILL,100%)

See original report and Debian bugs.

See also