documentation
This commit is contained in:
parent
b6afb44256
commit
74fab844a8
|
@ -6,71 +6,100 @@ let config = if ($configPath | path exists) { open $configPath }
|
||||||
let mpdHost = $config.noise.host? | default 'localhost:6600'
|
let mpdHost = $config.noise.host? | default 'localhost:6600'
|
||||||
let current = mpc --host $mpdHost current
|
let current = mpc --host $mpdHost current
|
||||||
|
|
||||||
def notify [message: string] {
|
def notify [message: string, display_icon:bool] {
|
||||||
|
match $display_icon {
|
||||||
|
true => {
|
||||||
do { mpc --host $mpdHost -f "%file%" current | xargs -I{} mpc --host $mpdHost albumart {} } | save -f /tmp/mpc_current.png
|
do { mpc --host $mpdHost -f "%file%" current | xargs -I{} mpc --host $mpdHost albumart {} } | save -f /tmp/mpc_current.png
|
||||||
notify-send "Noise" $"($message)" -i /tmp/mpc_current.png
|
notify-send "Noise" $"($message)" -i /tmp/mpc_current.png
|
||||||
|
}
|
||||||
|
false => {
|
||||||
|
notify-send "Noise" $"($message)"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Displays the currently playing song
|
# Displays the currently playing song
|
||||||
def main [] {
|
def main [--no-icon(-n) # Disables icon in notification
|
||||||
|
] {
|
||||||
mpc --host $mpdHost
|
mpc --host $mpdHost
|
||||||
notify $current
|
notify $current (not $no_icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Lists currently playing son
|
# Displays the currently playing song and only the current song
|
||||||
|
def "main current" [--no-icon(-n) # Disables icon in notification
|
||||||
|
] {
|
||||||
|
mpc --host $mpdHost current
|
||||||
|
notify $current (not $no_icon)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Lists currently playing song
|
||||||
def "main tail" [] {
|
def "main tail" [] {
|
||||||
while true { mpc --host $mpdHost idle player | ignore; mpc --host partitacastellum current}
|
while true { mpc --host $mpdHost idle player | ignore; mpc --host partitacastellum current}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Skips to next song
|
# Skips to next song
|
||||||
def "main next" [] {
|
def "main next" [--no-icon(-n) # Disables icon in notification
|
||||||
|
] {
|
||||||
mpc --host $mpdHost next
|
mpc --host $mpdHost next
|
||||||
notify $"Switching to:\n($current)"
|
notify $"Switching to:\n($current)" (not $no_icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Moves back a song in the que
|
# Moves back a song in the que
|
||||||
def "main prev" [] {
|
def "main prev" [--no-icon(-n) # Disables icon in notification
|
||||||
|
] {
|
||||||
mpc --host $mpdHost prev
|
mpc --host $mpdHost prev
|
||||||
notify $"Switching to:\n($current)"
|
notify $"Switching to:\n($current)" (not $no_icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Shuffles the current que
|
# Shuffles the current que
|
||||||
def "main shuffle" [] {
|
def "main shuffle" [--no-icon(-n) # Disables icon in notification
|
||||||
|
] {
|
||||||
mpc --host $mpdHost shuffle
|
mpc --host $mpdHost shuffle
|
||||||
notify $"Shuffling que..."
|
notify $"Shuffling que..." (not $no_icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stops playing the current que
|
# Stops playing the current que
|
||||||
def "main stop" [] {
|
def "main stop" [--no-icon(-n) # Disables icon in notification
|
||||||
|
] {
|
||||||
mpc --host $mpdHost stop
|
mpc --host $mpdHost stop
|
||||||
notify $"Stopping playback of:\n(mpc --host $mpdHost toggle)"
|
notify $"Stopping playback of:\n(mpc --host $mpdHost toggle)" (not $no_icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Starts playing the current que
|
# Starts playing the current que
|
||||||
def "main start" [] {
|
def "main start" [--no-icon(-n) # Disables icon in notification
|
||||||
|
] {
|
||||||
mpc --host $mpdHost start
|
mpc --host $mpdHost start
|
||||||
notify $"Starting playback of:\n(mpc --host $mpdHost toggle)"
|
notify $"Starting playback of:\n(mpc --host $mpdHost toggle)" (not $no_icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
# Toggles playback of the current que
|
# Toggles playback of the current que
|
||||||
def "main toggle" [] {
|
def "main toggle" [--no-icon(-n) # Disables icon in notification
|
||||||
|
] {
|
||||||
mpc --host $mpdHost toggle
|
mpc --host $mpdHost toggle
|
||||||
notify $"Toggling playback of:\n($current)"
|
notify $"Toggling playback of:\n($current)" (not $no_icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
def "main search" [...query: string] {
|
# Searches 'mpd' database querying all fields by default
|
||||||
mpc --host $mpdHost search any $"(echo ...$query | str join ' ')"
|
def "main search" [--field(-f): string=any # Field to query
|
||||||
|
, ...query: string # Search query
|
||||||
|
] {
|
||||||
|
mpc --host $mpdHost search ($field) $"(echo ...$query | str join ' ')"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Insert uri after currently playing song
|
||||||
def "main insert" [] {
|
def "main insert" [] {
|
||||||
$in | mpc insert --host $mpdHost
|
$in | mpc insert --host $mpdHost
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Adds uri to the end of current que
|
||||||
def "main add" [] {
|
def "main add" [] {
|
||||||
$in | mpc add --host $mpdHost
|
$in | mpc add --host $mpdHost
|
||||||
}
|
}
|
||||||
|
|
||||||
def "main crossfade" [ time?: int ] {
|
# Direct wrapper around 'mpc crossfade'
|
||||||
|
def "main crossfade" [ time?: int # Time in seconds
|
||||||
|
] {
|
||||||
match ($time | is-empty) {
|
match ($time | is-empty) {
|
||||||
true => { mpc --host $mpdHost crossfade }
|
true => { mpc --host $mpdHost crossfade }
|
||||||
false => { mpc --host $mpdHost crossfade $time }
|
false => { mpc --host $mpdHost crossfade $time }
|
||||||
|
|
Loading…
Reference in a new issue