diff --git a/mythtv/libs/libmythui/mythuiimage.cpp b/mythtv/libs/libmythui/mythuiimage.cpp
index 61af1d7..1b64666 100644
a
|
b
|
|
16 | 16 | #include <QRunnable> |
17 | 17 | #include <QEvent> |
18 | 18 | #include <QCoreApplication> |
| 19 | #include <QStringList> |
19 | 20 | |
20 | 21 | // libmythbase |
21 | 22 | #include "mythverbose.h" |
| 23 | #include "mythcorecontext.h" |
| 24 | #include "storagegroup.h" |
22 | 25 | |
23 | 26 | // Mythui |
24 | 27 | #include "mythpainter.h" |
… |
… |
bool MythUIImage::ParseElement( |
1041 | 1044 | if (element.tagName() == "filename") |
1042 | 1045 | { |
1043 | 1046 | m_OrigFilename = m_Filename = getFirstText(element); |
| 1047 | //Parse the artwork directories from the special tags |
| 1048 | QString artworkDir; |
| 1049 | if (m_Filename.startsWith("%SG_") && m_Filename.endsWith("%")) |
| 1050 | { |
| 1051 | QString host = gCoreContext->GetHostName(); |
| 1052 | QString group = m_Filename.mid(4,m_Filename.length()-5); |
| 1053 | QStringList sgEntries; |
| 1054 | StorageGroup sgroup(group, host); |
| 1055 | sgEntries = sgroup.GetFileList(""); |
| 1056 | if(sgEntries.size() > 0) { |
| 1057 | int sgEntry; |
| 1058 | int cnt = 0; |
| 1059 | while(!(m_Filename.endsWith(".png") || m_Filename.endsWith(".jpg") || m_Filename.endsWith(".gif")) && cnt < 10) |
| 1060 | { |
| 1061 | cnt += 1; |
| 1062 | sgEntry = rand() % sgEntries.size(); |
| 1063 | m_Filename = QString("myth://%1@%2:%3/%4") |
| 1064 | .arg(StorageGroup::GetGroupToUse(host, group)) |
| 1065 | .arg(gCoreContext->GetSettingOnHost("BackendServerIP", host)) |
| 1066 | .arg(gCoreContext->GetSettingOnHost("BackendServerPort", host)) |
| 1067 | .arg(sgEntries.at(sgEntry)); |
| 1068 | } |
| 1069 | if(cnt == 10) |
| 1070 | { |
| 1071 | VERBOSE(VB_GENERAL, QString("Could not find a valid image in storage group: %1").arg(group)); |
| 1072 | m_Filename = ""; |
| 1073 | } |
| 1074 | } |
| 1075 | else |
| 1076 | { |
| 1077 | VERBOSE(VB_GENERAL, QString("Could not find files in storage group: %1").arg(group)); |
| 1078 | m_Filename = ""; |
| 1079 | } |
| 1080 | } |
1044 | 1081 | if (m_Filename.endsWith('/')) |
1045 | 1082 | { |
1046 | 1083 | QDir imageDir(m_Filename); |