mirror of
https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
synced 2023-10-05 15:01:48 +02:00
also check default paths when images and icons are loaded
This commit is contained in:
parent
0cbc226651
commit
2a3eecd99e
1
HISTORY
1
HISTORY
@ -111,3 +111,4 @@ Version 1.1.0
|
|||||||
- left / right scroll page up / down in recmenu result lists
|
- left / right scroll page up / down in recmenu result lists
|
||||||
- Improved favorites menu with whats on now / next and up to four user
|
- Improved favorites menu with whats on now / next and up to four user
|
||||||
defined times
|
defined times
|
||||||
|
- also check default paths when images and icons are loaded
|
||||||
|
27
config.c
27
config.c
@ -191,38 +191,47 @@ void cTvguideConfig::SetStyle(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void cTvguideConfig::SetLogoPath(cString path) {
|
void cTvguideConfig::SetLogoPath(cString path) {
|
||||||
logoPath = path;
|
logoPath = checkSlashAtEnd(*path);
|
||||||
logoPathSet = true;
|
logoPathSet = true;
|
||||||
esyslog("tvguide: Logo Path set to %s", *logoPath);
|
esyslog("tvguide: Logo Path set to %s", *logoPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cTvguideConfig::SetImagesPath(cString path) {
|
void cTvguideConfig::SetImagesPath(cString path) {
|
||||||
epgImagePath = path;
|
epgImagePath = checkSlashAtEnd(*path);
|
||||||
imagesPathSet = true;
|
imagesPathSet = true;
|
||||||
esyslog("tvguide: EPG Image Path set to %s", *epgImagePath);
|
esyslog("tvguide: EPG Image Path set to %s", *epgImagePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cTvguideConfig::SetIconsPath(cString path) {
|
void cTvguideConfig::SetIconsPath(cString path) {
|
||||||
iconPath = path;
|
iconPath = checkSlashAtEnd(*path);
|
||||||
iconsPathSet = true;
|
iconsPathSet = true;
|
||||||
esyslog("tvguide: Icon Path set to %s", *iconPath);
|
esyslog("tvguide: Icon Path set to %s", *iconPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cTvguideConfig::SetDefaultPathes(void) {
|
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) {
|
if (!logoPathSet) {
|
||||||
cString path = cString::sprintf("%s/channellogos/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
|
logoPath = logoPathDefault;
|
||||||
SetLogoPath(path);
|
|
||||||
}
|
}
|
||||||
if (!imagesPathSet) {
|
if (!imagesPathSet) {
|
||||||
cString path = cString::sprintf("%s/epgimages/", cPlugin::CacheDirectory(PLUGIN_NAME_I18N));
|
epgImagePath = epgImagePathDefault;
|
||||||
SetImagesPath(path);
|
|
||||||
}
|
}
|
||||||
if (!iconsPathSet) {
|
if (!iconsPathSet) {
|
||||||
cString path = cString::sprintf("%s/icons/", cPlugin::ResourceDirectory(PLUGIN_NAME_I18N));
|
iconPath = iconPathDefault;
|
||||||
SetIconsPath(path);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
|
||||||
if (strcmp(Name, "timeFormat") == 0) timeFormat = atoi(Value);
|
if (strcmp(Name, "timeFormat") == 0) timeFormat = atoi(Value);
|
||||||
else if (strcmp(Name, "debugImageLoading") == 0) debugImageLoading = atoi(Value);
|
else if (strcmp(Name, "debugImageLoading") == 0) debugImageLoading = atoi(Value);
|
||||||
|
4
config.h
4
config.h
@ -40,6 +40,7 @@ enum eBlueKeyMode {
|
|||||||
|
|
||||||
class cTvguideConfig {
|
class cTvguideConfig {
|
||||||
private:
|
private:
|
||||||
|
cString checkSlashAtEnd(std::string path);
|
||||||
public:
|
public:
|
||||||
cTvguideConfig();
|
cTvguideConfig();
|
||||||
~cTvguideConfig();
|
~cTvguideConfig();
|
||||||
@ -89,6 +90,9 @@ class cTvguideConfig {
|
|||||||
int epgImageHeightLarge;
|
int epgImageHeightLarge;
|
||||||
cString epgImagePath;
|
cString epgImagePath;
|
||||||
cString iconPath;
|
cString iconPath;
|
||||||
|
cString logoPathDefault;
|
||||||
|
cString iconPathDefault;
|
||||||
|
cString epgImagePathDefault;
|
||||||
int recMenuAskFolder;
|
int recMenuAskFolder;
|
||||||
int favWhatsOnNow;
|
int favWhatsOnNow;
|
||||||
int favWhatsOnNext;
|
int favWhatsOnNext;
|
||||||
|
39
imagecache.c
39
imagecache.c
@ -548,14 +548,28 @@ void cImageCache::AddCornersGroupVertical(cImage *img) {
|
|||||||
|
|
||||||
bool cImageCache::LoadIcon(std::string name) {
|
bool cImageCache::LoadIcon(std::string name) {
|
||||||
bool success = false;
|
bool success = false;
|
||||||
cString iconPathTheme = cString::sprintf("%s%s/", *tvguideConfig.iconPath, *tvguideConfig.themeName);
|
if (tvguideConfig.iconsPathSet) {
|
||||||
success = LoadImage(name, *iconPathTheme, "png");
|
cString iconPathTheme = cString::sprintf("%s%s/", *tvguideConfig.iconPath, *tvguideConfig.themeName);
|
||||||
if (success) {
|
success = LoadImage(name, *iconPathTheme, "png");
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
success = LoadImage(name, *tvguideConfig.iconPath, "png");
|
|
||||||
if (success) {
|
if (success) {
|
||||||
return true;
|
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;
|
return false;
|
||||||
@ -573,10 +587,19 @@ bool cImageCache::LoadLogo(const cChannel *channel) {
|
|||||||
} else if (tvguideConfig.logoExtension == 1) {
|
} else if (tvguideConfig.logoExtension == 1) {
|
||||||
extension = "jpg";
|
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)
|
if (success)
|
||||||
return true;
|
return true;
|
||||||
success = LoadImage(logoLower.c_str(), *tvguideConfig.logoPath, *extension);
|
success = LoadImage(logoLower.c_str(), *tvguideConfig.logoPathDefault, *extension);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,10 +29,16 @@ bool cImageLoader::LoadLogo(const cChannel *channel, int width, int height) {
|
|||||||
extension = "jpg";
|
extension = "jpg";
|
||||||
}
|
}
|
||||||
bool success = false;
|
bool success = false;
|
||||||
success = LoadImage(channelID.c_str(), *tvguideConfig.logoPath, *extension);
|
if (tvguideConfig.logoPathSet) {
|
||||||
if (!success) {
|
success = LoadImage(channelID.c_str(), *tvguideConfig.logoPath, *extension);
|
||||||
success = LoadImage(logoLower.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)
|
if (success)
|
||||||
buffer.sample(Geometry(width, height));
|
buffer.sample(Geometry(width, height));
|
||||||
return success;
|
return success;
|
||||||
@ -77,12 +83,22 @@ bool cImageLoader::LoadPoster(const char *poster, int width, int height) {
|
|||||||
bool cImageLoader::LoadIcon(const char *cIcon, int size) {
|
bool cImageLoader::LoadIcon(const char *cIcon, int size) {
|
||||||
if (size==0)
|
if (size==0)
|
||||||
return false;
|
return false;
|
||||||
cString iconPathTheme = cString::sprintf("%s%s/recmenuicons/", *tvguideConfig.iconPath, *tvguideConfig.themeName);
|
|
||||||
bool success = false;
|
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) {
|
if (!success) {
|
||||||
cString iconPathdefault = cString::sprintf("%s/recmenuicons/", *tvguideConfig.iconPath);
|
cString iconPathTheme = cString::sprintf("%s%s/recmenuicons/", *tvguideConfig.iconPathDefault, *tvguideConfig.themeName);
|
||||||
success = LoadImage(cIcon, *iconPathdefault, "png");
|
success = LoadImage(cIcon, *iconPathTheme, "png");
|
||||||
|
if (!success) {
|
||||||
|
cString iconPath = cString::sprintf("%srecmenuicons/", *tvguideConfig.iconPathDefault);
|
||||||
|
success = LoadImage(cIcon, *iconPath, "png");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!success)
|
if (!success)
|
||||||
return false;
|
return false;
|
||||||
@ -94,8 +110,22 @@ bool cImageLoader::LoadOsdElement(cString name, int width, int height) {
|
|||||||
if ((width == 0)||(height==0))
|
if ((width == 0)||(height==0))
|
||||||
return false;
|
return false;
|
||||||
bool success = false;
|
bool success = false;
|
||||||
cString path = cString::sprintf("%s%s%s", *tvguideConfig.iconPath, *tvguideConfig.themeName, "/osdElements/");
|
if (tvguideConfig.iconsPathSet) {
|
||||||
success = LoadImage(*name, *path, "png");
|
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)
|
if (!success)
|
||||||
return false;
|
return false;
|
||||||
Geometry size(width, height);
|
Geometry size(width, height);
|
||||||
|
Loading…
Reference in New Issue
Block a user