diff options
-rw-r--r-- | media_player.c | 27 | ||||
-rw-r--r-- | tools/playlist.c | 27 | ||||
-rw-r--r-- | tools/playlist.h | 3 |
3 files changed, 31 insertions, 26 deletions
diff --git a/media_player.c b/media_player.c index 36d04aa1..2b5f674a 100644 --- a/media_player.c +++ b/media_player.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: media_player.c,v 1.41 2008-01-10 23:32:18 phelin Exp $ + * $Id: media_player.c,v 1.42 2008-01-10 23:37:35 phelin Exp $ * */ @@ -402,18 +402,7 @@ void cPlaylistMenu::Set(bool setCurrentPlaying) int j = 0; for(cPlaylistItem *i = m_Playlist.First(); i; i = m_Playlist.Next(i), j++) { - cString Title; - if(*i->Artist || *i->Album) - Title = cString::sprintf("%c\t%s\t(%s%s%s)", - j==currentPlaying ? '*':' ', - *i->Title, - *i->Artist ?: "", - *i->Artist ? ": " : "", - *i->Album ?: ""); - else - Title = cString::sprintf("%c\t%s", - j==currentPlaying ? '*':' ', - *i->Title); + cString Title = cPlaylist::GetEntry(i, true, j==currentPlaying); Add(new cOsdItem( ic.Translate(Title), (eOSState)(os_User + j))); } @@ -540,17 +529,7 @@ void cXinelibPlayerControl::Show() Total = (m_CurrentLen + 500) / 1000; // ms --> s Current = (m_CurrentPos + 500) / 1000; - cString Title = m_Player->Playlist().Current()->Title; - if(*m_Player->Playlist().Current()->Artist || - *m_Player->Playlist().Current()->Album) - Title = cString::sprintf("%s (%s%s%s)", *Title, - *m_Player->Playlist().Current()->Artist ?: "", - *m_Player->Playlist().Current()->Artist ? ": " : "", - *m_Player->Playlist().Current()->Album ?: ""); - else if (cXinelibDevice::Instance().GetMetaInfo(miTitle)[0]) - Title = cString::sprintf("%s (%s)", *Title, - cXinelibDevice::Instance().GetMetaInfo(miTitle)); - + cString Title = cPlaylist::GetEntry(m_Player->Playlist().Current()); cIConv ic; m_DisplayReplay->SetTitle(ic.Translate(Title)); 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); }; |