From: Andreas Obergrusberger Date: Thu, 5 Oct 2006 18:19:46 +0000 (+0000) Subject: you can specify %shortalbum% for playlist song markup, parent directory is shown... X-Git-Tag: v0.12_alpha1~358 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bff18fcc0031584a43b271eba7bd6d538a1028c9;p=ncmpc.git you can specify %shortalbum% for playlist song markup, parent directory is shown in the browse screen title git-svn-id: https://svn.musicpd.org/ncmpc/branches/tradiaz@4871 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- diff --git a/ChangeLog b/ChangeLog index aa43350..554dcae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,17 @@ -2006-08.8 Andreas Obergrusberger +2006-10-5 Andreas Obergrusberger + * Daniel sent me patches that will show the parent + directory in the browse screen title + *...and a patch that allows the user to specify + shortened album names in for example the playlist screen + via %shortalbum% + +2006-08-8 Andreas Obergrusberger * Here it is! the splash screen. asking you for password everytime and featuring a nice animation :) * ncmpc will now always ask for a password when it's not permitted to execute a command -2006-08.8 Andreas Obergrusberger +2006-08-8 Andreas Obergrusberger * Avuton fixed some warning * fixed a bug that doubled empty lines when loading lyrics from hd diff --git a/src/screen_file.c b/src/screen_file.c index 2d8c1de..b2d320f 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -549,7 +549,20 @@ browse_close(void) static char * browse_title(char *str, size_t size) { - g_snprintf(str, size, _("Browse: %s"), basename(filelist->path)); + char *pathcopy; + char *parentdir; + pathcopy = strdup(filelist->path); + parentdir = dirname(pathcopy); + parentdir = basename(parentdir); + if( parentdir[0] == '.' && strlen(parentdir) == 1 ) + { + parentdir = NULL; + } + g_snprintf(str, size, _("Browse: %s%s%s"), + parentdir ? parentdir : "", + parentdir ? "/" : "", + basename(filelist->path)); + free(pathcopy); return str; } diff --git a/src/strfsong.c b/src/strfsong.c index 3f60875..287fcbd 100644 --- a/src/strfsong.c +++ b/src/strfsong.c @@ -170,6 +170,22 @@ _strfsong(gchar *s, temp = song->title ? utf8_to_locale(song->title) : NULL; else if (strncmp("%album%", p, n) == 0) temp = song->album ? utf8_to_locale(song->album) : NULL; + else if (strncmp("%shortalbum%", p, n) == 0) + { + temp = song->album ? utf8_to_locale(song->album) : NULL; + if (temp) + { + gchar *temp2 = g_strndup(temp, 25); + if (strlen(temp) > 25) + { + temp2[24] = '.'; + temp2[23] = '.'; + temp2[22] = '.'; + } + g_free(temp); + temp = temp2; + } + } else if (strncmp("%track%", p, n) == 0) temp = song->track ? utf8_to_locale(song->track) : NULL; else if (strncmp("%name%", p, n) == 0)