mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-01 09:51:22 +02:00
CIMDB: clean up
- fix license text - move unused include unistd.h into cpp file - scope of the variable 'line' reduced. - remove variable 'pos_firstline', its value was never used. - remove unused variable: search - remove variables 'pos_search1', 'pos_search2'... values never used. - add member variable 'CIMDB::acc' into constructor, was not initialized - move include for cc.h into cpp file
This commit is contained in:
@@ -17,8 +17,7 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -35,7 +34,7 @@
|
|||||||
#include <system/helpers.h>
|
#include <system/helpers.h>
|
||||||
#include <system/helpers-json.h>
|
#include <system/helpers-json.h>
|
||||||
#include <eitd/sectionsd.h>
|
#include <eitd/sectionsd.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <json/json.h>
|
#include <json/json.h>
|
||||||
|
|
||||||
#include "imdb.h"
|
#include "imdb.h"
|
||||||
@@ -50,6 +49,8 @@ CIMDB::CIMDB()
|
|||||||
imdb_outfile = "/tmp/imdb.json";
|
imdb_outfile = "/tmp/imdb.json";
|
||||||
omdb_apikey = "";
|
omdb_apikey = "";
|
||||||
posterfile = "/tmp/imdb.jpg";
|
posterfile = "/tmp/imdb.jpg";
|
||||||
|
|
||||||
|
acc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CIMDB::~CIMDB()
|
CIMDB::~CIMDB()
|
||||||
@@ -86,8 +87,8 @@ std::string CIMDB::utf82url(std::string s)
|
|||||||
std::string CIMDB::parseString(std::string search1, std::string search2, std::string str)
|
std::string CIMDB::parseString(std::string search1, std::string search2, std::string str)
|
||||||
{
|
{
|
||||||
std::string ret, search;
|
std::string ret, search;
|
||||||
size_t pos_wildcard, pos_firstline, pos_search1, pos_search2;
|
size_t pos_wildcard, pos_search1, pos_search2;
|
||||||
pos_wildcard = pos_firstline = pos_search1 = pos_search2 = std::string::npos;
|
pos_wildcard = pos_search1 = pos_search2 = std::string::npos;
|
||||||
|
|
||||||
if((pos_wildcard = search1.find('*')) != std::string::npos)
|
if((pos_wildcard = search1.find('*')) != std::string::npos)
|
||||||
{
|
{
|
||||||
@@ -156,12 +157,12 @@ std::string CIMDB::parseString(std::string search1, std::string search2, std::st
|
|||||||
|
|
||||||
std::string CIMDB::parseFile(std::string search1, std::string search2, const char* file, std::string firstline, int line_offset)
|
std::string CIMDB::parseFile(std::string search1, std::string search2, const char* file, std::string firstline, int line_offset)
|
||||||
{
|
{
|
||||||
int line = 0;
|
|
||||||
acc = 0;
|
acc = 0;
|
||||||
std::ifstream fh;
|
std::ifstream fh;
|
||||||
std::string str, ret, search;
|
std::string str, ret;
|
||||||
size_t pos_firstline, pos_search1, pos_search2;
|
size_t pos_firstline;
|
||||||
pos_firstline = pos_search1 = pos_search2 = std::string::npos;
|
pos_firstline = std::string::npos;
|
||||||
|
|
||||||
if(firstline.empty())
|
if(firstline.empty())
|
||||||
pos_firstline = 0;
|
pos_firstline = 0;
|
||||||
@@ -169,6 +170,7 @@ std::string CIMDB::parseFile(std::string search1, std::string search2, const cha
|
|||||||
fh.open(file, std::ios::in);
|
fh.open(file, std::ios::in);
|
||||||
if(fh.is_open())
|
if(fh.is_open())
|
||||||
{
|
{
|
||||||
|
int line = 0;
|
||||||
while (!fh.eof())
|
while (!fh.eof())
|
||||||
{
|
{
|
||||||
getline(fh, str);
|
getline(fh, str);
|
||||||
@@ -473,3 +475,8 @@ void CIMDB::cleanup()
|
|||||||
if (access(posterfile.c_str(), F_OK) == 0)
|
if (access(posterfile.c_str(), F_OK) == 0)
|
||||||
unlink(posterfile.c_str());
|
unlink(posterfile.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CIMDB::gotPoster()
|
||||||
|
{
|
||||||
|
return (access(posterfile.c_str(), F_OK) == 0);
|
||||||
|
}
|
||||||
|
@@ -17,17 +17,15 @@
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __imdb__
|
#ifndef __imdb__
|
||||||
#define __imdb__
|
#define __imdb__
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <gui/components/cc.h>
|
|
||||||
#include <zapit/zapit.h>
|
#include <zapit/zapit.h>
|
||||||
|
|
||||||
class CIMDB
|
class CIMDB
|
||||||
@@ -50,7 +48,7 @@ class CIMDB
|
|||||||
|
|
||||||
void getIMDbData(std::string& txt);
|
void getIMDbData(std::string& txt);
|
||||||
|
|
||||||
bool gotPoster() { return (access(posterfile.c_str(), F_OK) == 0); };
|
bool gotPoster();
|
||||||
|
|
||||||
bool checkIMDbElement(std::string element);
|
bool checkIMDbElement(std::string element);
|
||||||
//FIXME: what if m[element] doesn't exist?
|
//FIXME: what if m[element] doesn't exist?
|
||||||
|
Reference in New Issue
Block a user