Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ffmpeg -i "`mocp -Q %file`" $HOME/.moc/current_album.png -y
- if [ $? -eq 1 ]; then
- cp $HOME/.moc/default_album.png $HOME/.moc/current_album.png
- fi
- command=`cat <<EOF
- local naughty = require("naughty")
- local awful = require("awful")
- local info = ""
- awful.spawn.easy_async({"bash", "-c", "mocp -i"},
- function(out)
- info = out
- local artist = string.gsub(string.match(info, "Artist: %C*"), "Artist: ","")
- local title = string.gsub(string.match(info, "SongTitle: %C*"), "SongTitle: ","")
- local album = string.gsub(string.match(info, "Album: %C*"), "Album: ","")
- local path = string.gsub(string.match(info, "File: %C*"), "File: ", "")
- local file = string.gsub(path, "^.*/","")
- artist = string.gsub(artist, "&", "&")
- title = string.gsub(title, "&", "&")
- album = string.gsub(album, "&", "&")
- file = string.gsub(file, "&", "&")
- if artist == "" or nil then
- artist = "unknown artist"
- end
- if title == "" or nil then
- title = file
- end
- naughty.destroy_all_notifications()
- naughty.notify({ timeout = 5, position = "bottom_right",
- icon = "$HOME/.moc/current_album.png",
- icon_size = 128,
- title = title,
- text = artist})
- awesome.emit_signal("music::changed")
- end)
- EOF
- `
- echo "${command}" | awesome-client
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement