Compare commits
No commits in common. "0b62b2a788e4773a0be03e5b10c86f553efa5117" and "61fac878add8392928c46a750cbd1efce0d0982e" have entirely different histories.
0b62b2a788
...
61fac878ad
2
LICENSE
2
LICENSE
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2016 - 2023, Přemysl Eric Janouch <p@janouch.name>
|
Copyright (c) 2016 - 2022, Přemysl Eric Janouch <p@janouch.name>
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
purpose with or without fee is hereby granted.
|
purpose with or without fee is hereby granted.
|
||||||
|
6
NEWS
6
NEWS
@ -3,11 +3,7 @@ Unreleased
|
|||||||
* Added ability to look up song lyrics,
|
* Added ability to look up song lyrics,
|
||||||
using a new scriptable extension interface for the Info tab
|
using a new scriptable extension interface for the Info tab
|
||||||
|
|
||||||
* Improved song information shown in the window header
|
* Made the X11 interface support italic fonts
|
||||||
|
|
||||||
* X11: added italic font support
|
|
||||||
|
|
||||||
* X11: fixed rendering of overflowing, partially visible list items
|
|
||||||
|
|
||||||
* Added Readline-like M-u, M-l, M-c editor bindings
|
* Added Readline-like M-u, M-l, M-c editor bindings
|
||||||
|
|
||||||
|
47
nncmpp.c
47
nncmpp.c
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* nncmpp -- the MPD client you never knew you needed
|
* nncmpp -- the MPD client you never knew you needed
|
||||||
*
|
*
|
||||||
* Copyright (c) 2016 - 2023, Přemysl Eric Janouch <p@janouch.name>
|
* Copyright (c) 2016 - 2022, Přemysl Eric Janouch <p@janouch.name>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
* purpose with or without fee is hereby granted.
|
* purpose with or without fee is hereby granted.
|
||||||
@ -1838,24 +1838,10 @@ app_layout_song_info (void)
|
|||||||
|
|
||||||
chtype attrs[2] = { APP_ATTR (NORMAL), APP_ATTR (HIGHLIGHT) };
|
chtype attrs[2] = { APP_ATTR (NORMAL), APP_ATTR (HIGHLIGHT) };
|
||||||
|
|
||||||
// Split the path for files lying within MPD's "music_directory".
|
char *title;
|
||||||
const char *file = compact_map_find (map, "file");
|
|
||||||
const char *subroot_basename = NULL;
|
|
||||||
if (file && *file != '/' && !strstr (file, "://"))
|
|
||||||
{
|
|
||||||
const char *last_slash = strrchr (file, '/');
|
|
||||||
if (last_slash)
|
|
||||||
subroot_basename = last_slash + 1;
|
|
||||||
else
|
|
||||||
subroot_basename = file;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *title = NULL;
|
|
||||||
const char *name = compact_map_find (map, "name");
|
|
||||||
if ((title = compact_map_find (map, "title"))
|
if ((title = compact_map_find (map, "title"))
|
||||||
|| (title = name)
|
|| (title = compact_map_find (map, "name"))
|
||||||
|| (title = subroot_basename)
|
|| (title = compact_map_find (map, "file")))
|
||||||
|| (title = file))
|
|
||||||
{
|
{
|
||||||
struct layout l = {};
|
struct layout l = {};
|
||||||
app_push (&l, g.ui->padding (attrs[0], 0.25, 1));
|
app_push (&l, g.ui->padding (attrs[0], 0.25, 1));
|
||||||
@ -1865,15 +1851,14 @@ app_layout_song_info (void)
|
|||||||
app_flush_layout (&l);
|
app_flush_layout (&l);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Showing a blank line is better than having the controls jump around
|
char *artist = compact_map_find (map, "artist");
|
||||||
// while switching between files that we do and don't have enough data for.
|
char *album = compact_map_find (map, "album");
|
||||||
|
if (!artist && !album)
|
||||||
|
return;
|
||||||
|
|
||||||
struct layout l = {};
|
struct layout l = {};
|
||||||
app_push (&l, g.ui->padding (attrs[0], 0.25, 1));
|
app_push (&l, g.ui->padding (attrs[0], 0.25, 1));
|
||||||
|
|
||||||
char *artist = compact_map_find (map, "artist");
|
|
||||||
char *album = compact_map_find (map, "album");
|
|
||||||
if (artist || album)
|
|
||||||
{
|
|
||||||
if (artist)
|
if (artist)
|
||||||
{
|
{
|
||||||
app_push (&l, g.ui->label (attrs[0], "by "));
|
app_push (&l, g.ui->label (attrs[0], "by "));
|
||||||
@ -1884,20 +1869,6 @@ app_layout_song_info (void)
|
|||||||
app_push (&l, g.ui->label (attrs[0], &" from "[!artist]));
|
app_push (&l, g.ui->label (attrs[0], &" from "[!artist]));
|
||||||
app_push (&l, g.ui->label (attrs[1], album));
|
app_push (&l, g.ui->label (attrs[1], album));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (subroot_basename && subroot_basename != file)
|
|
||||||
{
|
|
||||||
char *parent = xstrndup (file, subroot_basename - file - 1);
|
|
||||||
app_push (&l, g.ui->label (attrs[0], "in "));
|
|
||||||
app_push (&l, g.ui->label (attrs[1], parent));
|
|
||||||
free (parent);
|
|
||||||
}
|
|
||||||
else if (file && *file != '/' && strstr (file, "://")
|
|
||||||
&& name && name != title)
|
|
||||||
{
|
|
||||||
// This is likely to contain the name of an Internet radio.
|
|
||||||
app_push (&l, g.ui->label (attrs[1], name));
|
|
||||||
}
|
|
||||||
|
|
||||||
app_push_fill (&l, g.ui->padding (attrs[0], 0, 1));
|
app_push_fill (&l, g.ui->padding (attrs[0], 0, 1));
|
||||||
app_push (&l, g.ui->padding (attrs[0], 0.25, 1));
|
app_push (&l, g.ui->padding (attrs[0], 0.25, 1));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user