diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/playlist.c | 27 | ||||
-rw-r--r-- | tools/playlist.h | 3 |
2 files changed, 28 insertions, 2 deletions
diff --git a/tools/playlist.c b/tools/playlist.c index e1f7d0d2..80fecdfa 100644 --- a/tools/playlist.c +++ b/tools/playlist.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: playlist.c,v 1.11 2008-01-10 23:36:06 phelin Exp $ + * $Id: playlist.c,v 1.12 2008-01-10 23:37:36 phelin Exp $ * */ @@ -928,3 +928,28 @@ cString cPlaylist::EscapeMrl(const char *mrl) return cString((const char*)buf, true); } +cString cPlaylist::GetEntry(cPlaylistItem *i, bool isPlaylist, bool isCurrent) +{ + + cString Entry = ""; + if (*i->Artist && xc.playlist_artist || *i->Album && xc.playlist_album) { + Entry = cString::sprintf("%s%s%s%s%s%s(%s%s%s)", + isPlaylist ? (isCurrent ? "*" : " ") : "", + isPlaylist ? "\t" : " ", + xc.playlist_tracknumber ? (*i->Tracknumber ?: "") : "", + xc.playlist_tracknumber ? (*i->Tracknumber ? " - " : "") : "", + *i->Title, + isPlaylist ? "\t" : " ", + xc.playlist_artist ? (*i->Artist ?: "") : "", + xc.playlist_artist && xc.playlist_album ? (*i->Artist && *i->Album ? ":" : "") : "", + xc.playlist_album ? (*i->Album ?: "") : ""); + } else { + Entry = cString::sprintf("%s%s%s%s%s", + isPlaylist ? (isCurrent ? "*" : " ") : "", + isPlaylist ? "\t" : " ", + xc.playlist_tracknumber ? (*i->Tracknumber ?: "") : "", + xc.playlist_tracknumber ? (*i->Tracknumber ? " - " : "") : "", + *i->Title); + } + return Entry; +} diff --git a/tools/playlist.h b/tools/playlist.h index f86dbfb1..4f36b415 100644 --- a/tools/playlist.h +++ b/tools/playlist.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: playlist.h,v 1.6 2008-01-10 23:32:18 phelin Exp $ + * $Id: playlist.h,v 1.7 2008-01-10 23:37:36 phelin Exp $ * */ @@ -124,6 +124,7 @@ class cPlaylist : protected cList<cPlaylistItem> cPlaylistItem *Prev(void); static cString EscapeMrl(const char *name); + static cString GetEntry(cPlaylistItem *i, bool isPlaylist = false, bool isCurrent = false); }; |