- audioplayer: show cover from id3-tag or folder.jpg in header

if exist a file called folder.jpg in same dir as the audiofile
  or a audiocover is defined in id3-tag it will be displayed in header.

  cover in tag is preferred.

  ported from mohusch. original patch by tangocash. thx!
This commit is contained in:
svenhoefer
2013-11-09 18:34:09 +01:00
parent 1e8764be2e
commit fe07423ad1
5 changed files with 103 additions and 3 deletions

View File

@@ -66,6 +66,7 @@
#include <gui/widget/stringinput_ext.h>
#include "gui/pictureviewer.h"
extern CPictureViewer * g_PicViewer;
#include <system/settings.h>
#include <system/helpers.h>
@@ -2169,6 +2170,25 @@ void CAudioPlayerGui::updateMetaData(bool screen_saver)
m_curr_audiofile.MetaData.album = meta.sc_station;
updateLcd = true;
}
std::string cover = m_curr_audiofile.Filename.substr(0, m_curr_audiofile.Filename.rfind('/')) + "/folder.jpg";
if (!meta.cover.empty())
cover = "/tmp/cover.jpg";
if ((access(cover.c_str(), F_OK) == 0) && !screen_saver)
{
g_PicViewer->DisplayImage(cover, m_x + 2, m_y + 2, m_title_height - 14, m_title_height - 14, m_frameBuffer->TM_NONE);
if(g_settings.rounded_corners)
{
//repaint frame to cover up the corners of the cover; FIXME
if (!m_show_playlist)
m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height - 10 - m_fheight, 2, COL_MENUCONTENT_PLUS_6, RADIUS_MID);
else
m_frameBuffer->paintBoxFrame(m_x, m_y, m_width, m_title_height - 10, 2, COL_MENUCONTENT_PLUS_6, RADIUS_MID);
}
}
}
//if (CAudioPlayer::getInstance()->getScBuffered() != 0)
if (CAudioPlayer::getInstance()->hasMetaDataChanged() != 0)
@@ -2183,8 +2203,7 @@ void CAudioPlayerGui::updateMetaData(bool screen_saver)
if (updateMeta || updateScreen)
{
m_frameBuffer->paintBoxRel(m_x + 10, m_y + 4 + 2*m_fheight, m_width - 20,
m_sheight, COL_MENUCONTENTSELECTED_PLUS_0);
m_frameBuffer->paintBoxRel(m_x + 10 + m_title_height, m_y + 4 + 2*m_fheight, m_width - 20 - m_title_height, m_sheight, COL_MENUCONTENTSELECTED_PLUS_0);
int xstart = ((m_width - 20 - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(m_metainfo))/2)+10;
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]
->RenderString(m_x + xstart, m_y + 4 + 2*m_fheight + m_sheight,