summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--config.c27
-rw-r--r--config.h4
-rw-r--r--imagecache.c39
-rw-r--r--imageloader.c48
5 files changed, 93 insertions, 26 deletions
diff --git a/HISTORY b/HISTORY
index fa4ce67..2a50227 100644
--- a/HISTORY
+++ b/HISTORY
@@ -111,3 +111,4 @@ Version 1.1.0
- left / right scroll page up / down in recmenu result lists
- Improved favorites menu with whats on now / next and up to four user
defined times
+- also check default paths when images and icons are loaded
diff --git a/config.c b/config.c
index 243368c..313dda2 100644
--- a/config.c
+++ b/config.c
@@ -191,38 +191,47 @@ void cTvguideConfig::SetStyle(void) {
}
void cTvguideConfig::SetLogoPath(cString path) {
- logoPath = path;
+ logoPath = checkSlashAtEnd(*path);
logoPathSet = true;
esyslog("tvguide: Logo Path set to %s", *logoPath);
}
void cTvguideConfig::SetImagesPath(cString path) {
- epgImagePath = path;
+ epgImagePath = checkSlashAtEnd(*path);
imagesPathSet = true;
esyslog("tvguide: EPG Image Path set to %s", *epgImagePath);
}
void cTvguideConfig::SetIconsPath(cString path) {
- iconPath = path;
+ iconPath = checkSlashAtEnd(*path);
iconsPathSet = true;
esyslog("tvguide: Icon Path set to %s", *iconPath);
}
void cTvguideConfig::SetDefaultPathes(void) {
+ logoPathDefault = cString::sprintf("%s/logos/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
+ iconPathDefault = cString::sprintf("%s/icons/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
+ epgImagePathDefault = cString::sprintf("%s/epgimages/", cPlugin::CacheDirectory(PLUGIN_NAME_I18N));
+
if (!logoPathSet) {
- cString path = cString::sprintf("%s/channellogos/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
- SetLogoPath(path);
+ logoPath = logoPathDefault;
}
if (!imagesPathSet) {
- cString path = cString::sprintf("%s/epgimages/", cPlugin::CacheDirectory(PLUGIN_NAME_I18N));
- SetImagesPath(path);
+ epgImagePath = epgImagePathDefault;
}
if (!iconsPathSet) {
- cString path = cString::sprintf("%s/icons/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
- SetIconsPath(path);
+ iconPath = iconPathDefault;
}
}
+cString cTvguideConfig::checkSlashAtEnd(std::string path) {
+ try {
+ if (!(path.at(path.size()-1) == '/'))
+ return cString::sprintf("%s/", path.c_str());
+ } catch (...) {return path.c_str();}
+ return path.c_str();
+}
+
bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
if (strcmp(Name, "timeFormat") == 0) timeFormat = atoi(Value);
else if (strcmp(Name, "debugImageLoading") == 0) debugImageLoading = atoi(Value);
diff --git a/config.h b/config.h
index bb1c4b7..d4390cd 100644
--- a/config.h
+++ b/config.h
@@ -40,6 +40,7 @@ enum eBlueKeyMode {
class cTvguideConfig {
private:
+ cString checkSlashAtEnd(std::string path);
public:
cTvguideConfig();
~cTvguideConfig();
@@ -89,6 +90,9 @@ class cTvguideConfig {
int epgImageHeightLarge;
cString epgImagePath;
cString iconPath;
+ cString logoPathDefault;
+ cString iconPathDefault;
+ cString epgImagePathDefault;
int recMenuAskFolder;
int favWhatsOnNow;
int favWhatsOnNext;
diff --git a/imagecache.c b/imagecache.c
index 25d2662..eb3117c 100644
--- a/imagecache.c
+++ b/imagecache.c
@@ -548,14 +548,28 @@ void cImageCache::AddCornersGroupVertical(cImage *img) {
bool cImageCache::LoadIcon(std::string name) {
bool success = false;
- cString iconPathTheme = cString::sprintf("%s%s/", *tvguideConfig.iconPath, *tvguideConfig.themeName);
- success = LoadImage(name, *iconPathTheme, "png");
- if (success) {
- return true;
- } else {
- success = LoadImage(name, *tvguideConfig.iconPath, "png");
+ if (tvguideConfig.iconsPathSet) {
+ cString iconPathTheme = cString::sprintf("%s%s/", *tvguideConfig.iconPath, *tvguideConfig.themeName);
+ success = LoadImage(name, *iconPathTheme, "png");
if (success) {
return true;
+ } else {
+ success = LoadImage(name, *tvguideConfig.iconPath, "png");
+ if (success) {
+ return true;
+ }
+ }
+ }
+ if (!success) {
+ cString iconPathTheme = cString::sprintf("%s%s/", *tvguideConfig.iconPathDefault, *tvguideConfig.themeName);
+ success = LoadImage(name, *iconPathTheme, "png");
+ if (success) {
+ return true;
+ } else {
+ success = LoadImage(name, *tvguideConfig.iconPathDefault, "png");
+ if (success) {
+ return true;
+ }
}
}
return false;
@@ -573,10 +587,19 @@ bool cImageCache::LoadLogo(const cChannel *channel) {
} else if (tvguideConfig.logoExtension == 1) {
extension = "jpg";
}
- success = LoadImage(channelID.c_str(), *tvguideConfig.logoPath, *extension);
+
+ if (tvguideConfig.logoPathSet) {
+ success = LoadImage(channelID.c_str(), *tvguideConfig.logoPath, *extension);
+ if (success)
+ return true;
+ success = LoadImage(logoLower.c_str(), *tvguideConfig.logoPath, *extension);
+ if (success)
+ return true;
+ }
+ success = LoadImage(channelID.c_str(), *tvguideConfig.logoPathDefault, *extension);
if (success)
return true;
- success = LoadImage(logoLower.c_str(), *tvguideConfig.logoPath, *extension);
+ success = LoadImage(logoLower.c_str(), *tvguideConfig.logoPathDefault, *extension);
return success;
}
diff --git a/imageloader.c b/imageloader.c
index 3ad7ab6..6ca5d69 100644
--- a/imageloader.c
+++ b/imageloader.c
@@ -29,10 +29,16 @@ bool cImageLoader::LoadLogo(const cChannel *channel, int width, int height) {
extension = "jpg";
}
bool success = false;
- success = LoadImage(channelID.c_str(), *tvguideConfig.logoPath, *extension);
- if (!success) {
- success = LoadImage(logoLower.c_str(), *tvguideConfig.logoPath, *extension);
+ if (tvguideConfig.logoPathSet) {
+ success = LoadImage(channelID.c_str(), *tvguideConfig.logoPath, *extension);
+ if (!success) {
+ success = LoadImage(logoLower.c_str(), *tvguideConfig.logoPath, *extension);
+ }
}
+ if (!success)
+ success = LoadImage(channelID.c_str(), *tvguideConfig.logoPathDefault, *extension);
+ if (!success)
+ success = LoadImage(logoLower.c_str(), *tvguideConfig.logoPathDefault, *extension);
if (success)
buffer.sample(Geometry(width, height));
return success;
@@ -77,12 +83,22 @@ bool cImageLoader::LoadPoster(const char *poster, int width, int height) {
bool cImageLoader::LoadIcon(const char *cIcon, int size) {
if (size==0)
return false;
- cString iconPathTheme = cString::sprintf("%s%s/recmenuicons/", *tvguideConfig.iconPath, *tvguideConfig.themeName);
bool success = false;
- success = LoadImage(cIcon, *iconPathTheme, "png");
+ if (tvguideConfig.iconsPathSet) {
+ cString iconPathTheme = cString::sprintf("%s%s/recmenuicons/", *tvguideConfig.iconPath, *tvguideConfig.themeName);
+ success = LoadImage(cIcon, *iconPathTheme, "png");
+ if (!success) {
+ cString iconPath = cString::sprintf("%srecmenuicons/", *tvguideConfig.iconPath);
+ success = LoadImage(cIcon, *iconPath, "png");
+ }
+ }
if (!success) {
- cString iconPathdefault = cString::sprintf("%s/recmenuicons/", *tvguideConfig.iconPath);
- success = LoadImage(cIcon, *iconPathdefault, "png");
+ cString iconPathTheme = cString::sprintf("%s%s/recmenuicons/", *tvguideConfig.iconPathDefault, *tvguideConfig.themeName);
+ success = LoadImage(cIcon, *iconPathTheme, "png");
+ if (!success) {
+ cString iconPath = cString::sprintf("%srecmenuicons/", *tvguideConfig.iconPathDefault);
+ success = LoadImage(cIcon, *iconPath, "png");
+ }
}
if (!success)
return false;
@@ -94,8 +110,22 @@ bool cImageLoader::LoadOsdElement(cString name, int width, int height) {
if ((width == 0)||(height==0))
return false;
bool success = false;
- cString path = cString::sprintf("%s%s%s", *tvguideConfig.iconPath, *tvguideConfig.themeName, "/osdElements/");
- success = LoadImage(*name, *path, "png");
+ if (tvguideConfig.iconsPathSet) {
+ cString path = cString::sprintf("%s%s%s", *tvguideConfig.iconPath, *tvguideConfig.themeName, "/osdElements/");
+ success = LoadImage(*name, *path, "png");
+ if (!success) {
+ path = cString::sprintf("%s%s", *tvguideConfig.iconPath, "/osdElements/");
+ success = LoadImage(*name, *path, "png");
+ }
+ }
+ if (!success) {
+ cString path = cString::sprintf("%s%s%s", *tvguideConfig.iconPathDefault, *tvguideConfig.themeName, "/osdElements/");
+ success = LoadImage(*name, *path, "png");
+ }
+ if (!success) {
+ cString path = cString::sprintf("%s%s", *tvguideConfig.iconPathDefault, "/osdElements/");
+ success = LoadImage(*name, *path, "png");
+ }
if (!success)
return false;
Geometry size(width, height);