Difference between revisions of "Moc"

From ArchWiki
Jump to: navigation, search
m
(mocp-scrobbler)
 
(40 intermediate revisions by 15 users not shown)
Line 1: Line 1:
[[Category:Player]]
+
[[Category:Multimedia players]]
 
[[de: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).  
+
'''M'''usic '''O'''n '''C'''onsole is a lightweight music player which consists of 2 parts, a server (Moc) and a player/interface (Mocp). This is similar to [[mpd]], but unlike ''mpd'', Moc comes with an interface. Its server does not support remote access.
This is similar to [[mpd]], but unlike mpd, Moc comes with an interface, although its server doesn't support access through net.
+
  
 
== Installation ==
 
== Installation ==
  
[[pacman|Install]] {{Pkg|moc}} from the [[official repositories]].
+
[[Install]] the {{Pkg|moc}} package. The latest development version is available as {{AUR|moc-svn}}.
  
==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.
+
 
 +
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 customizing the keybindings, read {{ic|/usr/share/doc/moc/keymap.example}}.
 
For instructions about customizing the keybindings, read {{ic|/usr/share/doc/moc/keymap.example}}.
Line 19: Line 22:
 
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==
+
== Usage ==
  
To start moc:
+
Start ''moc'':
  
 
  $ mocp
 
  $ mocp
  
This will start the server and interface. You will enter player interface. Some useful shortcuts to use mocp (case sensitive):
+
This will start the server and interface. Some useful shortcuts (case sensitive):
  
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
| Start playing a track
 
| Start playing a track
| Enter
+
| {{ic|Enter}}
 +
|-
 +
| Pause track
 +
| {{ic|Space}} or {{ic|p}}
 
|-
 
|-
| Pause track
 
| Space or p
 
|-
 
 
| Play next track
 
| Play next track
| n
+
| {{ic|n}}
 
|-
 
|-
 
| Play previous track
 
| Play previous track
| b
+
| {{ic|b}}
 
|-
 
|-
 
| Switch from playlist browsing to<br/> filesystem browsing (and vice versa)
 
| Switch from playlist browsing to<br/> filesystem browsing (and vice versa)
| tab
+
| {{ic|Tab}}
 
|-
 
|-
 
| Add one track to the playlist
 
| Add one track to the playlist
| a
+
| {{ic|a}}
 
|-
 
|-
 
| Remove track from playlist
 
| Remove track from playlist
| d
+
| {{ic|d}}
 
|-
 
|-
 
| Add a folder recursively to playlist
 
| Add a folder recursively to playlist
| A
+
| {{ic|Shift+a}}
 
|-
 
|-
 
| Clear playlist
 
| Clear playlist
| C
+
| {{ic|Shift+c}}
 
|-
 
|-
 
| Increase volume 5%
 
| Increase volume 5%
| . (dot)
+
| {{ic|.}} (dot)
 
|-
 
|-
 
| Decrease volume 5%
 
| Decrease volume 5%
| , (comma)
+
| {{ic|,}} (comma)
 
|-
 
|-
 
| Increase volume 1%
 
| Increase volume 1%
| >
+
| {{ic|>}}
 
|-
 
|-
 
| Decrease volume 1%
 
| Decrease volume 1%
| <
+
| {{ic|<}}
 
|-
 
|-
 
| Change volume to 10%
 
| Change volume to 10%
| meta + 1
+
| {{ic|meta+1}}
 
|-
 
|-
 
| Change volume to 20%
 
| Change volume to 20%
| meta + 2
+
| {{ic|meta+2}}
 
|-
 
|-
 
| Quit player
 
| Quit player
| q
+
| {{ic|q}}
 
|}
 
|}
  
NOTE: To shut down the server, use the shift (capital) Q key or:
+
{{Note|To shut down the server, use {{ic|Shift+q}} or:
 
  $ mocp -x
 
  $ mocp -x
 +
}}
  
==Development versions==
+
== Last.fm scrobbling ==
  
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.
+
=== mocp-scrobbler ===
  
* {{AUR|moc-svn}} (latest development code)
+
{{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.
* {{AUR|moc-devel}} (old alpha version for next release)
+
  
==last.fm support==
+
Copy the example file to your user config directory:
  
If you want scrobble songs to last.fm (moc >= 2.5.0 needed), install {{pkg|lastfmsubmitd}}. It is a daemon which is available in the "community" repository. First edit {{ic|/etc/lastfmsubmitd.conf}} and enable both services {{Ic|lastfmsubmitd}} and {{Ic|lastmp}} with {{Ic|systemctl}}.
+
mkdir ~/.mocpscrob/
 +
cp /usr/share/doc/mocp-scrobbler/config.example  ~/.mocpscrob/config
  
If services do not exists create them first:
+
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.
  
create {{Ic|/etc/systemd/system/lastmp.service}} file and add following in it:
+
To scrobble tracks, start ''mocp-scrobbler'' as daemon before ''mocp''. You can also use an [[alias]]:
  
{{bc|[Unit]
+
alias mocp='/usr/bin/mocp-scrobbler.py -d; mocp'
Description&#61;LastMP
+
After&#61;mpd.service
+
  
[Service]
+
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 <nowiki>!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~, or a space"</nowiki>. 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.
ExecStart&#61;/usr/bin/lastmp --no-daemon
+
  
[Install]
+
== Front-ends ==
WantedBy&#61;multi-user.target}}
+
  
create {{Ic|/etc/systemd/system/lastfmsubmitd.service}} file and add following in it:
+
* {{App|dmenu_mocp|Dmenu frontend to MOC|https://github.com/mutantturkey/mocicon|{{Aur|dmenu_mocp}}{{Broken package link|{{aur-mirror|dmenu_mocp}}}}}}
 +
* {{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}}}}
 +
* {{App|eXo|Qt frontend to MOC, supports scrobbling|https://bitbucket.org/blaze/exo/|{{AUR?|exo}}}}
  
{{bc|[Unit]
+
== systemd service file ==
Description&#61;LastFM Submit daemon
+
 
After&#61;network.target
+
{{hc|/etc/systemd/system/moc@.service|<nowiki>
 +
[Unit]
 +
Description=MOC server
 +
ConditionPathExists=/usr/bin/mocp
 +
After=network.target sound.target
  
 
[Service]
 
[Service]
ExecStart&#61;/usr/bin/lastfmsubmitd --no-daemon
+
RemainAfterExit=yes
 +
User=%I
 +
ExecStart=/usr/bin/mocp -S
 +
ExecStop=/usr/bin/mocp -x
 +
WorkingDirectory=/home/%I/
  
 
[Install]
 
[Install]
WantedBy&#61;multi-user.target}}
+
WantedBy=multi-user.target
 +
</nowiki>}}
 +
 
 +
[[Enable]] this service for the respective user.
 +
 
 +
== Troubleshooting ==
  
 +
=== MOC fails to start ===
  
Now add the following line to the moc configuration file:
+
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.
  
{{hc|~/.moc/config|OnSongChange &#61; "/usr/lib/lastfmsubmitd/lastfmsubmit --artist %a --title %t --length %d --album %r"}}
+
=== Strange characters ===
  
change permission:
+
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:
  
  $ sudo chmod -R 777 /var/spool/lastfm
+
  ASCIILines = no
  
that's all.
+
=== FATAL_ERROR: Layout1 is malformed ===
  
==Front-ends==
+
If MOC crashes with this error, try adding either line to {{ic|.moc/config}}:
* {{AUR|dmenu_mocp}} is a dmenu frontend for moc
+
Layout1 = directory(0,0,50%,100%): playlist(50%,0,100%,100%)
* {{AUR|mocicon}} GTK panel applet
+
or
* {{Pkg|moc-tray}} is a perl GTK dock that gives you access to moc functions
+
Layout1 = directory(0,0,50%,100%): playlist(50%,0,FILL,100%)
  
==Troubleshooting==
+
See [http://moc.daper.net/node/262 original report] and [https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=485059 Debian bugs].
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 whole folder.
+
  
If you see strange-like characters displayed in moc instead of the normal lines (vertical lines to separate space, etc.) likely you've a font set which MOC doesn't play nice with. You can either change the font you have selected for your terminal or edit the MOC config file (search config file for something about use ASII only).
+
== See also ==
  
==Additional resources==
 
 
* [http://moc.daper.net/documentation Official documentation]
 
* [http://moc.daper.net/documentation Official documentation]

Latest revision as of 00:45, 20 February 2016

Music On Console is a lightweight music player which consists of 2 parts, a server (Moc) and a player/interface (Mocp). This is similar to mpd, but unlike mpd, Moc comes with an interface. Its server does not support remote access.

Installation

Install the moc package. The latest development version is available as moc-svnAUR.

Configuration

The package includes a sample configuration file at /usr/share/doc/moc/config.example. To configure moc, copy this file to ~/.moc/config and edit it.

For instructions about customizing the keybindings, read /usr/share/doc/moc/keymap.example.

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

Usage

Start moc:

$ mocp

This will start the server and interface. Some useful shortcuts (case sensitive):

Start playing a track Enter
Pause track Space or p
Play next track n
Play previous track b
Switch from playlist browsing to
filesystem browsing (and vice versa)
Tab
Add one track to the playlist a
Remove track from playlist d
Add a folder recursively to playlist Shift+a
Clear playlist Shift+c
Increase volume 5% . (dot)
Decrease volume 5% , (comma)
Increase volume 1% >
Decrease volume 1% <
Change volume to 10% meta+1
Change volume to 20% meta+2
Quit player q
Note: To shut down the server, use Shift+q or:
$ mocp -x

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.

Front-ends

  • dmenu_mocp — Dmenu frontend to MOC
https://github.com/mutantturkey/mocicon || dmenu_mocpAUR[broken link: archived in aur-mirror]
  • 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
  • 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