#ifndef IMDB_HPP
#define IMDB_HPP

#include "imdb_movie.hpp"

#include <vector>
#include <string>

class CIMDBUrl
{
public:
  std::string m_strURL;
  std::string m_strTitle;
};
typedef std::vector<CIMDBUrl> IMDB_MOVIELIST;

class CIMDB
{
public:
  CIMDB();
  virtual ~CIMDB();

  bool FindMovie(const std::string& strMovie, IMDB_MOVIELIST& movielist);
  bool GetDetails(const CIMDBUrl& url, CIMDBMovie& movieDetails);
  void GetURL(const std::string& strMovie,std::string& strURL);
  // for downloading covers
  bool Download(const std::string& strURL, const std::string& strFileName); 
protected:
  void remove_newlines(std::string &url_text);
  void remove_links(std::string& url_text);
  void ParseAHREF(const char* ahref, std::string& strURL, std::string& strTitle);
  void ParseGenres(const char* ahref, std::string& strURL, std::string& strTitle);
  void ConvertHTMLToAnsi(const char* strHTML, std::string& strAnsi);
  bool Get(const std::string& url, std::string& content);
};

#endif
