Skip to content
This repository
Browse code

Merge pull request #1922 from ace20022/browse_for_art_music

[art] Add the album/song path to the get thumb "browse for art" dialog
  • Loading branch information...
commit f8bdd1bbd25cf8869671ffe3d42175b0bc708447 2 parents fbfe5ee + 3389c1d
Martijn Kaijser authored January 29, 2013
19  xbmc/music/dialogs/GUIDialogMusicInfo.cpp
@@ -40,6 +40,7 @@
40 40
 #include "utils/StringUtils.h"
41 41
 #include "TextureCache.h"
42 42
 #include "music/MusicThumbLoader.h"
  43
+#include "filesystem/Directory.h"
43 44
 
44 45
 using namespace std;
45 46
 using namespace XFILE;
@@ -416,6 +417,7 @@ void CGUIDialogMusicInfo::OnGetThumb()
416 417
   CStdString result;
417 418
   bool flip=false;
418 419
   VECSOURCES sources(g_settings.m_musicSources);
  420
+  AddItemPathToFileBrowserSources(sources, *m_albumItem);
419 421
   g_mediaManager.GetLocalDrives(sources);
420 422
   if (!CGUIDialogFileBrowser::ShowAndGetImage(items, sources, g_localizeStrings.Get(1030), result, &flip))
421 423
     return;   // user cancelled
@@ -578,3 +580,20 @@ CFileItemPtr CGUIDialogMusicInfo::GetCurrentListItem(int offset)
578 580
   return m_albumItem;
579 581
 }
580 582
 
  583
+void CGUIDialogMusicInfo::AddItemPathToFileBrowserSources(VECSOURCES &sources, const CFileItem &item)
  584
+{
  585
+  CStdString itemDir;
  586
+
  587
+  if (item.HasMusicInfoTag() && item.GetMusicInfoTag()->GetType() == "song")
  588
+    itemDir = URIUtils::GetParentPath(item.GetMusicInfoTag()->GetURL());
  589
+  else
  590
+    itemDir = item.GetPath();
  591
+
  592
+  if (!itemDir.IsEmpty() && CDirectory::Exists(itemDir))
  593
+  {
  594
+    CMediaSource itemSource;
  595
+    itemSource.strName = g_localizeStrings.Get(36041);
  596
+    itemSource.strPath = itemDir;
  597
+    sources.push_back(itemSource);
  598
+  }
  599
+}
2  xbmc/music/dialogs/GUIDialogMusicInfo.h
@@ -24,6 +24,7 @@
24 24
 #include "music/Song.h"
25 25
 #include "music/Artist.h"
26 26
 #include "music/Album.h"
  27
+#include "FileItem.h"
27 28
 
28 29
 class CFileItem;
29 30
 class CFileItemList;
@@ -44,6 +45,7 @@ class CGUIDialogMusicInfo :
44 45
   virtual bool HasListItems() const { return true; };
45 46
   virtual CFileItemPtr GetCurrentListItem(int offset = 0);
46 47
   const CFileItemList& CurrentDirectory() const { return *m_albumSongs; };
  48
+  static void AddItemPathToFileBrowserSources(VECSOURCES &sources, const CFileItem &item);
47 49
 protected:
48 50
   virtual void OnInitWindow();
49 51
   void Update();
7  xbmc/music/dialogs/GUIDialogSongInfo.cpp
@@ -37,6 +37,8 @@
37 37
 #include "guilib/LocalizeStrings.h"
38 38
 #include "TextureCache.h"
39 39
 #include "music/Album.h"
  40
+#include "storage/MediaManager.h"
  41
+#include "GUIDialogMusicInfo.h"
40 42
 
41 43
 using namespace XFILE;
42 44
 
@@ -286,7 +288,10 @@ void CGUIDialogSongInfo::OnGetThumb()
286 288
   }
287 289
 
288 290
   CStdString result;
289  
-  if (!CGUIDialogFileBrowser::ShowAndGetImage(items, g_settings.m_musicSources, g_localizeStrings.Get(1030), result))
  291
+  VECSOURCES sources(g_settings.m_musicSources);
  292
+  CGUIDialogMusicInfo::AddItemPathToFileBrowserSources(sources, *m_song);
  293
+  g_mediaManager.GetLocalDrives(sources);
  294
+  if (!CGUIDialogFileBrowser::ShowAndGetImage(items, sources, g_localizeStrings.Get(1030), result))
290 295
     return;   // user cancelled
291 296
 
292 297
   if (result == "thumb://Current")

0 notes on commit f8bdd1b

Please sign in to comment.
Something went wrong with that request. Please try again.