README.md (2101B)
1  2 3 # MPC Bar 4 A Mac menu bar client for the [Music Player Daemon](https://www.musicpd.org). 5 6 ## Installation 7 If you have [Homebrew](https://brew.sh), you can simply run these 8 commands to install and launch MPC Bar: 9 10 ``` 11 brew install spnw/formulae/mpc-bar 12 brew services start spnw/formulae/mpc-bar 13 ``` 14 15 ## Configuration 16 MPC Bar is configured with a `~/.mpc-bar.ini` file. Below are the 17 default options. Note that `format` works just like `mpc -f`; see the 18 [mpc(1)](https://man.archlinux.org/man/mpc.1#f,) man page for more 19 information. Lines that are commented out in the example do not have 20 any default. 21 22 ``` 23 [connection] 24 host = localhost 25 port = 6600 26 # password = qwerty123 27 28 [display] 29 format = [%name%: &[[%artist%|%performer%|%composer%|%albumartist%] - ]%title%]|%name%|[[%artist%|%performer%|%composer%|%albumartist%] - ]%title%|%file% 30 idle_message = No song playing 31 show_queue = true # Show queue/position info while playing? (true/false) 32 show_queue_idle = (value of show_queue) # Show queue/position info while idle? (true/false) 33 # lua_filter = ~/.mpc-bar-filter.lua # Path to a Lua filter script 34 ``` 35 36 ## Lua filter 37 Sometimes, especially with Internet radio, your MPD status can end up 38 a lot longer than it needs to be. MPC Bar lets you write a filter 39 script in Lua to massage the status into a more manageable form. 40 Here's an example: 41 42 ```lua 43 local subs = 44 { 45 {"^Groove Salad: a nicely chilled plate of ambient beats and grooves.", "[Groove Salad]"}, 46 {"^Drone Zone: Atmospheric ambient space music. Serve Best Chilled. Safe with most medications.", "[Drone Zone]"}, 47 {" %[SomaFM%]:", ""}, 48 } 49 50 function filter(s) 51 for _, sub in ipairs(subs) do 52 s = s:gsub(sub[1], sub[2]) 53 end 54 return s 55 end 56 ``` 57 58 MPC Bar expects a global function called `filter`, which takes the 59 original MPD status and returns a new status to be used instead. 60 61 Currently there is no provision for error reporting. If your code has 62 an error, MPC Bar will just use the original status. You might want 63 to test on your own with the standalone `lua` interpreter.