mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
imdb.cpp: cleanup before download and reduce timeouts
Origin commit data
------------------
Branch: ni/coolstream
Commit: 1b5b6f4cb2
Author: FlatTV <FlatTV@gmx.de>
Date: 2016-07-09 (Sat, 09 Jul 2016)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -223,6 +223,11 @@ std::string CIMDB::googleIMDb(std::string searchStr)
|
|||||||
std::string httpString = "imdb+";
|
std::string httpString = "imdb+";
|
||||||
char* searchStr_ = (char*) searchStr.c_str();
|
char* searchStr_ = (char*) searchStr.c_str();
|
||||||
|
|
||||||
|
m.clear();
|
||||||
|
unlink(soutfile.c_str());
|
||||||
|
unlink(IMDbAPI.c_str());
|
||||||
|
unlink(posterfile.c_str());
|
||||||
|
|
||||||
while (*searchStr_!=0)
|
while (*searchStr_!=0)
|
||||||
{
|
{
|
||||||
if ( (*searchStr_==' ') )
|
if ( (*searchStr_==' ') )
|
||||||
@@ -293,7 +298,7 @@ int CIMDB::getIMDb(const std::string& epgTitle)
|
|||||||
|
|
||||||
std::string url = IMDburl + imdb_ID;
|
std::string url = IMDburl + imdb_ID;
|
||||||
|
|
||||||
if(httpTool.downloadFile(url, IMDbAPI.c_str()))
|
if(httpTool.downloadFile(url, IMDbAPI.c_str(), -1, /*connecttimeout*/2, /*timeout*/5))
|
||||||
{
|
{
|
||||||
initMap(m);
|
initMap(m);
|
||||||
|
|
||||||
@@ -306,13 +311,17 @@ int CIMDB::getIMDb(const std::string& epgTitle)
|
|||||||
// std::cout << it->first << " => " << it->second << '\n';
|
// std::cout << it->first << " => " << it->second << '\n';
|
||||||
|
|
||||||
//download Poster
|
//download Poster
|
||||||
if(httpTool.downloadFile(m["Poster"], posterfile.c_str()))
|
if(m["Poster"] != "N/A")
|
||||||
ret = 2;
|
{
|
||||||
else {
|
if(httpTool.downloadFile(m["Poster"], posterfile.c_str()))
|
||||||
ret = 1;
|
return 2;
|
||||||
if (access(posterfile.c_str(), F_OK) == 0)
|
else {
|
||||||
unlink(posterfile.c_str());
|
return 1;
|
||||||
|
if (access(posterfile.c_str(), F_OK) == 0)
|
||||||
|
unlink(posterfile.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
ret=2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -328,6 +337,9 @@ void CIMDB::getIMDbData(std::string& txt)
|
|||||||
txt += "Regisseur: "+m["Director"]+"\n";
|
txt += "Regisseur: "+m["Director"]+"\n";
|
||||||
txt += "Drehbuch: "+m["Writer"]+"\n\n";
|
txt += "Drehbuch: "+m["Writer"]+"\n\n";
|
||||||
txt += "Darsteller: "+m["Actors"]+"\n";
|
txt += "Darsteller: "+m["Actors"]+"\n";
|
||||||
|
|
||||||
|
if(m["imdbID"].empty() || m["Response"]!="True")
|
||||||
|
txt = "Keine Daten gefunden";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CIMDB::getFilename(CZapitChannel * channel, uint64_t id)
|
std::string CIMDB::getFilename(CZapitChannel * channel, uint64_t id)
|
||||||
|
Reference in New Issue
Block a user