mirror of https://github.com/lcpz/lain.git
mpd: default art added
This commit is contained in:
parent
c2d27aec72
commit
f31c5cc856
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# Dependencies: imagemagick.
|
# Dependencies: imagemagick.
|
||||||
#
|
#
|
||||||
# Usage: mpdcover <music_directory> <song_file> <default_art>
|
# Usage: mpdcover <music_directory> <song_file> <cover_resize> <default_art>
|
||||||
|
|
||||||
# Configuration-------------------------------------------------------
|
# Configuration-------------------------------------------------------
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ MUSIC_DIR=$1
|
||||||
file=$2
|
file=$2
|
||||||
|
|
||||||
# Regex expression used for image search
|
# Regex expression used for image search
|
||||||
IMG_REG="(front|cover|art|Folder|folder)\.(jpg|jpeg|png|gif)$"
|
IMG_REG="(Front|front|Cover|cover|Art|art|Folder|folder)\.(jpg|jpeg|png|gif)$"
|
||||||
|
|
||||||
# Path of temporary resized cover
|
# Path of temporary resized cover
|
||||||
TEMP_PATH="/tmp/mpdcover.png"
|
TEMP_PATH="/tmp/mpdcover.png"
|
||||||
|
@ -34,6 +34,9 @@ if [ $COVER_RESIZE == "x" ]; then
|
||||||
COVER_RESIZE="100x100"
|
COVER_RESIZE="100x100"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# The default cover to use (optional)
|
||||||
|
DEFAULT_ART=$4
|
||||||
|
|
||||||
# Thumbnail background (transparent)
|
# Thumbnail background (transparent)
|
||||||
COVER_BACKGROUND="none"
|
COVER_BACKGROUND="none"
|
||||||
|
|
||||||
|
@ -49,6 +52,9 @@ art="$MUSIC_DIR/${file%/*}"
|
||||||
# cover.
|
# cover.
|
||||||
cover="$(find "$art/" -maxdepth 1 -type f | egrep -i -m1 "$IMG_REG")"
|
cover="$(find "$art/" -maxdepth 1 -type f | egrep -i -m1 "$IMG_REG")"
|
||||||
|
|
||||||
|
# when no cover is found, use DEFAULT_ART as cover
|
||||||
|
cover="${cover:=$DEFAULT_ART}"
|
||||||
|
|
||||||
# check if art is available
|
# check if art is available
|
||||||
if [[ -n $cover ]]; then
|
if [[ -n $cover ]]; then
|
||||||
if [[ -n $COVER_RESIZE ]]; then
|
if [[ -n $COVER_RESIZE ]]; then
|
||||||
|
|
|
@ -33,6 +33,7 @@ local function worker(args)
|
||||||
local port = args.port or "6600"
|
local port = args.port or "6600"
|
||||||
local music_dir = args.music_dir or os.getenv("HOME") .. "/Music"
|
local music_dir = args.music_dir or os.getenv("HOME") .. "/Music"
|
||||||
local cover_size = args.cover_size or 100
|
local cover_size = args.cover_size or 100
|
||||||
|
local default_art = args.default_art or ""
|
||||||
local settings = args.settings or function() end
|
local settings = args.settings or function() end
|
||||||
|
|
||||||
local mpdcover = helpers.scripts_dir .. "mpdcover"
|
local mpdcover = helpers.scripts_dir .. "mpdcover"
|
||||||
|
@ -85,8 +86,8 @@ local function worker(args)
|
||||||
then
|
then
|
||||||
helpers.set_map("current mpd track", mpd_now.title)
|
helpers.set_map("current mpd track", mpd_now.title)
|
||||||
|
|
||||||
os.execute(string.format("%s %q %q %d", mpdcover, music_dir,
|
os.execute(string.format("%s %q %q %d %q", mpdcover, music_dir,
|
||||||
mpd_now.file, cover_size))
|
mpd_now.file, cover_size, default_art))
|
||||||
|
|
||||||
mpd.id = naughty.notify({
|
mpd.id = naughty.notify({
|
||||||
preset = mpd_notification_preset,
|
preset = mpd_notification_preset,
|
||||||
|
|
Loading…
Reference in New Issue