Skip to content

Commit

Permalink
Merge pull request #1922 from ace20022/browse_for_art_music
Browse files Browse the repository at this point in the history
[art] Add the album/song path to the get thumb "browse for art" dialog
  • Loading branch information
MartijnKaijser committed Jan 29, 2013
2 parents fbfe5ee + 3389c1d commit f8bdd1b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
19 changes: 19 additions & 0 deletions xbmc/music/dialogs/GUIDialogMusicInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "utils/StringUtils.h"
#include "TextureCache.h"
#include "music/MusicThumbLoader.h"
#include "filesystem/Directory.h"

using namespace std;
using namespace XFILE;
Expand Down Expand Up @@ -416,6 +417,7 @@ void CGUIDialogMusicInfo::OnGetThumb()
CStdString result;
bool flip=false;
VECSOURCES sources(g_settings.m_musicSources);
AddItemPathToFileBrowserSources(sources, *m_albumItem);
g_mediaManager.GetLocalDrives(sources);
if (!CGUIDialogFileBrowser::ShowAndGetImage(items, sources, g_localizeStrings.Get(1030), result, &flip))
return; // user cancelled
Expand Down Expand Up @@ -578,3 +580,20 @@ CFileItemPtr CGUIDialogMusicInfo::GetCurrentListItem(int offset)
return m_albumItem;
}

void CGUIDialogMusicInfo::AddItemPathToFileBrowserSources(VECSOURCES &sources, const CFileItem &item)
{
CStdString itemDir;

if (item.HasMusicInfoTag() && item.GetMusicInfoTag()->GetType() == "song")
itemDir = URIUtils::GetParentPath(item.GetMusicInfoTag()->GetURL());
else
itemDir = item.GetPath();

if (!itemDir.IsEmpty() && CDirectory::Exists(itemDir))
{
CMediaSource itemSource;
itemSource.strName = g_localizeStrings.Get(36041);
itemSource.strPath = itemDir;
sources.push_back(itemSource);
}
}
2 changes: 2 additions & 0 deletions xbmc/music/dialogs/GUIDialogMusicInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "music/Song.h"
#include "music/Artist.h"
#include "music/Album.h"
#include "FileItem.h"

class CFileItem;
class CFileItemList;
Expand All @@ -44,6 +45,7 @@ class CGUIDialogMusicInfo :
virtual bool HasListItems() const { return true; };
virtual CFileItemPtr GetCurrentListItem(int offset = 0);
const CFileItemList& CurrentDirectory() const { return *m_albumSongs; };
static void AddItemPathToFileBrowserSources(VECSOURCES &sources, const CFileItem &item);
protected:
virtual void OnInitWindow();
void Update();
Expand Down
7 changes: 6 additions & 1 deletion xbmc/music/dialogs/GUIDialogSongInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#include "guilib/LocalizeStrings.h"
#include "TextureCache.h"
#include "music/Album.h"
#include "storage/MediaManager.h"
#include "GUIDialogMusicInfo.h"

using namespace XFILE;

Expand Down Expand Up @@ -286,7 +288,10 @@ void CGUIDialogSongInfo::OnGetThumb()
}

CStdString result;
if (!CGUIDialogFileBrowser::ShowAndGetImage(items, g_settings.m_musicSources, g_localizeStrings.Get(1030), result))
VECSOURCES sources(g_settings.m_musicSources);
CGUIDialogMusicInfo::AddItemPathToFileBrowserSources(sources, *m_song);
g_mediaManager.GetLocalDrives(sources);
if (!CGUIDialogFileBrowser::ShowAndGetImage(items, sources, g_localizeStrings.Get(1030), result))
return; // user cancelled

if (result == "thumb://Current")
Expand Down

0 comments on commit f8bdd1b

Please sign in to comment.