[mythtv] [PATCH] mythvideo - country and genre

MaxPower maxpower44 at tiscali.fr
Thu Nov 27 17:46:34 EST 2003


Thx to apply my french translation

I post an other path yesterday in a mail called "[mythtv] [Patch] 
mythvideo - french movie database".
Please don't apply this patch yet because something is wrong in the 
french movie database part.

I make a other patch that change 2 things :
The fisrt thing allow french user (user who choose french language in 
setting) to grab movie information from a french site.
This change affect only the videomanager.cpp file.
Cover files are now save as [number IMNB + extension file] to be sure 
that the cover file name is unique.
I transform type of plot (in videometadata) to varchar(128) to text

The second add two informations about a movie, the countries and the 
genres. For this moment the changes aren't visible for the user.
I have created two tables : videometadatagenre and videometadatacountry 
(see in patch.sql for details).
For example, if "The Pianist" is the intid 1 in videometadata, 
videomatadatagenre look like this
idvideo | genre
1 |  Drama
1 | War
and the videometadata look like this:
idvideo | country
1 | UK
1 | France
1 | Poland
...
I don't create a table genre and a table country because I don't know if 
i should ....
These informations are automatically grab  from IMDB (or french movie 
database site for french user).
These changes are made in videomanager.cpp, metadata.h and metadata.cpp
I don't made any change in the interface at the time (in my todo list).

For the sql change, I don't know if the patch.sql is correct or if I 
must made a "diff metadata.old.sql metadata.new.sql" ... ?

Thx to read me and please reply if not all are clear for you.


xavier
-------------- next part --------------
--- /usr/local/src/cvs/myth/mythvideo/mythvideo/metadata.cpp	2003-10-27 18:12:04.000000000 +0100
+++ mythvideo/metadata.cpp	2003-11-27 21:45:32.000000000 +0100
@@ -139,6 +139,22 @@
         childID = query.value(11).toUInt();
         browse = query.value(12).toBool();
         playcommand = query.value(13).toString();
+	// Genres
+	thequery.sprintf("SELECT genre FROM videometadata WHERE idvideo=%d",id);
+	query.exec(thequery);
+	if (!query.isActive()){
+	    while(query.next()){
+		genres.append(query.value(0).toString());
+	    }
+	}
+	//Countries
+	thequery.sprintf("SELECT country FROM videometadata WHERE idvideo=%d",id);
+	query.exec(thequery);
+	if (!query.isActive()){
+	    while(query.next()){
+		genres.append(query.value(0).toString());
+	    }
+	}
     }
 }
 
@@ -249,5 +265,38 @@
         
         cerr << "metadata.o: The following metadata update failed: " << thequery << endl;
     }
+    //Genres
+    //remove genre for this video
+    thequery.sprintf("DELETE FROM videometadatagenre where idvideo=%d",id);
+    a_query.exec(thequery);
+    if (!a_query.isActive()){
+	cerr << "metadata.o: The follwing metadata update failed: " << thequery << endl;
+    }
+    QStringList::Iterator genre;
+    for (genre = genres.begin() ; genre != genres.end() ; ++genre){
+	//Add one genre for this video
+	thequery.sprintf("INSERT INTO videometadatagenre (idvideo,genre) VALUES (%d,\"%s\")", id, (*genre).utf8().data());
+	a_query.exec(thequery);
+	if(!a_query.isActive()){
+		cerr << "metadata.o: The following metadata update failed :" << thequery << endl;
+	}
+    }
+
+    //Countries
+    //remove countries for this video
+    thequery.sprintf("DELETE FROM videometadatacountry where idvideo=%d",id);
+    a_query.exec(thequery);
+    if (!a_query.isActive()){
+	cerr << "metadata.o: The following metadata update failed :" << thequery << endl;
+    }
+    QStringList::Iterator country;
+    for (country = countries.begin() ; country != countries.end() ; ++country){
+	// add current country for this video
+	thequery.sprintf("INSERT INTO videometadatacountry (idvideo, country) VALUES (%d,\"%s\")",id, (*country).utf8().data());
+	a_query.exec(thequery);
+	if (!a_query.isActive()){
+	    cerr << "metadata.o: The following metadata update failed :" << thequery << endl;
+	}
+    }
 }
 
-------------- next part --------------
--- /usr/local/src/cvs/myth/mythvideo/mythvideo/metadata.h	2003-10-27 18:12:04.000000000 +0100
+++ mythvideo/metadata.h	2003-11-27 02:43:08.000000000 +0100
@@ -16,7 +16,9 @@
              QString ldirector = "", QString lplot = "", 
              float luserrating = 0.0, QString lrating = "", int llength = 0, 
              int lid = 0, int lshowlevel = 1, unsigned int lchildID = 0,
-             bool lbrowse = true, QString lplaycommand = "")
+             bool lbrowse = true, QString lplaycommand = "",
+ 	     QStringList lgenres = QStringList(),
+	     QStringList lcountries = QStringList())
     {
         filename = lfilename;
         coverfile = lcoverfile;
@@ -33,6 +35,8 @@
         childID = lchildID;
         browse = lbrowse;
         playcommand = lplaycommand;
+	genres = lgenres;
+	countries = lcountries;
     }
 
     Metadata(const Metadata &other) 
@@ -52,6 +56,8 @@
         childID = other.childID;
         browse = other.browse;
         playcommand = other.playcommand;
+	genres = other.genres;
+	countries = other.countries;
     }
 
    ~Metadata() {}
@@ -101,6 +107,12 @@
     QString CoverFile() const { return coverfile; }
     void setCoverFile(QString &lcoverfile) { coverfile = lcoverfile; }
 
+    QStringList Genres() const { return genres; }
+    void setGenres(QStringList &lgenres){genres = lgenres;}
+
+    QStringList Countries() const { return countries;}
+    void setCountries(QStringList & lcountries){countries = lcountries;}
+
     void guessTitle();
     void setField(QString field, QString data);
     void dumpToDatabase(QSqlDatabase *db);
@@ -121,6 +133,8 @@
     int showlevel;
     bool browse;
     QString playcommand;
+    QStringList genres;
+    QStringList countries;
 
     unsigned int id;
     
-------------- next part --------------
USE mythconverg;
ALTER TABLE videometadata CHANGE plot plot TEXT;

CREATE TABLE IF NOT EXISTS videometadatacountry
(
	idvideo INT UNSIGNED NOT NULL,
	country VARCHAR(128) NOT NULL,
	INDEX (idvideo),
	INDEX (country)
);

CREATE TABLE IF NOT EXISTS videometadatagenre
(
	idvideo INT UNSIGNED NOT NULL,
	genre VARCHAR(128) NOT NULL,
	INDEX (idvideo),
	INDEX (genre)
);
-------------- next part --------------
--- /usr/local/src/cvs/myth/mythvideo/mythvideo/videomanager.cpp	2003-09-24 05:09:58.000000000 +0200
+++ mythvideo/videomanager.cpp	2003-11-27 22:53:29.000000000 +0100
@@ -323,8 +323,15 @@
 QMap<QString, QString> VideoManager::parseMovieList(QString data)
 {
     QMap<QString, QString> listing;
-    QString beg = "<A HREF=\"/Title";
-    QString end = "</A>";
+    QString beg = "";
+    QString end = "";
+    if (gContext->GetSetting("Language").left(2).lower()=="fr"){
+        beg = "<A HREF=\"/film/fichefilm_gen_cfilm=";
+	end = "</TD></TR>";
+    }else{
+        beg = "<A HREF=\"/Title";
+        end = "</A>";
+    };
     QString ret = "";
 
     QString movieNumber = "";
@@ -344,12 +351,18 @@
     while (start != ((int)beg.length() - 1))
     {
         ret = data.mid(start, endint - start);
-  
-	int fnd = ret.find("title/tt") + 4; 
-        movieNumber = ret.mid(fnd, ret.find("/\">") - fnd);
+  	if (gContext->GetSetting("Language").left(2).lower()=="fr"){
+	    movieNumber = ret.mid(0,ret.find(".html\"><FONT color=#003399>"));
+	    movieTitle = ret.right(ret.length()-ret.find("<FONT color=#003399>")-20);
+	    movieTitle.remove("<B>");
+	    movieTitle.remove("</B>");
+	    movieTitle.replace("</FONT></A>", " - ");
+	}else{
+   	    int fnd = ret.find("title/tt") + 4; 
+            movieNumber = ret.mid(fnd, ret.find("/\">") - fnd);
 	
-        movieTitle = ret.right(ret.length() - ret.find("\">") - 2);
-
+            movieTitle = ret.right(ret.length() - ret.find("\">") - 2);
+	};
         listing[movieNumber] = movieTitle;
   
         data = data.right(data.length() - endint);
@@ -404,11 +417,19 @@
     if (movieNum == "Local")
         return(QString("<NULL>"));
 
-    QString host = "www.imdb.com";
-    QString path = "";
-
-    QUrl url("http://" + host + "/title/tt" + movieNum + "/posters");
+    QUrl url;
+    QString host = "<NULL>";
+    QString path ="<NULL>";
+    if (gContext->GetSetting("Language").left(2).lower()=="fr"){
+	host = "www.allocine.fr";
+
+	url = "http://" + host + "/film/galerie_gen_cfilm=" + movieNum + "&big=1&page=1.html";
+    }else{
+        host = "www.imdb.com";
+        path = "";
 
+	url = "http://" + host + "/title/tt" + movieNum + "/posters";
+    };
     //cout << "Grabbing Poster HTML From: " << url.toString() << endl;
 
     if (httpGrabber)
@@ -431,63 +452,76 @@
 
     QString beg, end, filename = "<NULL>";
 
-    // Check for posters on impawards.com first, since their posters
-    // are usually much better quality
-
-    beg = "Posters on other sites</h2></p>\n<ul>\n<li><a href=\"";
-    end = "\">http://www.impawards.com";
-    QString impsite = parseDataAnchorEnd(res, beg, end);
-    if (impsite != "<NULL>")
-    {
-
-	//cout << "Retreiving poster from " << impsite << endl; 
+    if (gContext->GetSetting("Language").left(2).lower()=="fr"){
+        beg="<A HREF=\"/film/galerie_gen_cfilm="+movieNum+".html\" target=\"\"><IMG border=0 src=\"";
+	end = "\" Zalt";
+	filename = parseData(res,beg,end);
+	filename.remove("http://");
+	host = filename.left(filename.find("/"));
+	filename.remove(host);
+	path = filename.left(filename.findRev("/")+1);
+	filename = filename.right(filename.length()-filename.findRev("/")-1);
+    }else{
+        // Check for posters on impawards.com first, since their posters
+        // are usually much better quality
+
+        beg = "Posters on other sites</h2></p>\n<ul>\n<li><a href=\"";
+        end = "\">http://www.impawards.com";
+        QString impsite = parseDataAnchorEnd(res, beg, end);
+        if (impsite != "<NULL>")
+        {
+    
+       	    //cout << "Retreiving poster from " << impsite << endl; 
 	    
-        QUrl impurl(impsite);
+            QUrl impurl(impsite);
 
-        //cout << "Grabbing Poster HTML From: " << url.toString() << endl;
+            //cout << "Grabbing Poster HTML From: " << url.toString() << endl;
 
-        if (httpGrabber)
-        {
-            httpGrabber->stop();
-            delete httpGrabber;
-        }
+            if (httpGrabber)
+            {
+                httpGrabber->stop();
+                delete httpGrabber;
+            }
 
-        httpGrabber = new HttpComms(impurl);
+            httpGrabber = new HttpComms(impurl);
 
-        while (!httpGrabber->isDone())
-        {
-            qApp->processEvents();
-            usleep(10000);
-        }
+            while (!httpGrabber->isDone())
+            {
+                qApp->processEvents();
+                usleep(10000);
+            }
 
-	QString impres;
+	    QString impres;
 	
-        impres = httpGrabber->getData();
-        beg = "<img SRC=\"posters/";
-	end = "\" ALT";
-
-	filename = parseData(impres, beg, end);
-	//cout << "Imp found: " << filename << endl;
-
-	host = parseData(impsite, "//", "/");
-	path = impsite.replace(QRegExp("http://" + host), QString(""));
-	path = path.left(impsite.findRev("/") + 1) + "posters/";
-    }
+            impres = httpGrabber->getData();
+            beg = "<img SRC=\"posters/";
+	    end = "\" ALT";
+
+	    filename = parseData(impres, beg, end);
+	    //cout << "Imp found: " << filename << endl;
+
+	    host = parseData(impsite, "//", "/");
+	    path = impsite.replace(QRegExp("http://" + host), QString(""));
+	    path = path.left(impsite.findRev("/") + 1) + "posters/";
+        }
 
-    // If the impawards site failed or wasn't available
-    // just grab the poster from imdb
-    if (filename == "<NULL>")
-    {
-        host = "posters.imdb.com";
-	path = "/posters/";
+        // If the impawards site failed or wasn't available
+        // just grab the poster from imdb
+       if (filename == "<NULL>")
+       {
+            host = "posters.imdb.com";
+	    path = "/posters/";
 
-	//cout << "Retreiving poster from imdb.com" << endl;
-        beg = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" "
+	    //cout << "Retreiving poster from imdb.com" << endl;
+            beg = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" "
                   "background=\"http://posters.imdb.com/posters/";
-        end = "\"><td><td><a href=\"";
+            end = "\"><td><td><a href=\"";
 
-	filename = parseData(res, beg, end);
+	    filename = parseData(res, beg, end);
+       }
     }
+
+    //cout << "IMDB"<< host << " - " << path <<" - " << filename << endl;
     
     if (filename == "<NULL>")
     {
@@ -508,14 +542,15 @@
     if (!dir.exists())
         dir.mkdir(fileprefix);
 
-    //cout << "Copying (" << filename << ")...";
+    cout << "Copying (" << filename << ")...";
     QUrlOperator *op = new QUrlOperator();
-    op->copy(QString("http://" + host + path + filename),
-             "file:" + fileprefix);
+
     //cout << "Done.\n";
+    fileprefix = fileprefix + "/" + movieNum + filename.right(filename.length()-filename.findRev("."));
 
-    filename = filename.right(filename.length() - filename.findRev("/") - 1);
-    fileprefix = fileprefix + "/" + filename;
+   op->copy(QString("http://" + host + path + filename),
+		"file:"+fileprefix,false,false);
+    
 
     return fileprefix;
 
@@ -524,9 +559,15 @@
 void VideoManager::GetMovieData(QString movieNum)
 {
     movieNumber = movieNum;
-    QString host = "www.imdb.com";
-
-    QUrl url("http://" + host + "/title/tt" + movieNum + "/");
+    QUrl url;
+    QString host ="<NULL>";
+    if (gContext->GetSetting("Language").left(2).lower()=="fr"){
+        host = "www.allocine.fr";
+        url = "http://" + host + "/film/fichefilm_gen_cfilm=" + movieNum + ".html";
+    }else{
+        host = "www.imdb.com";
+        url = "http://" + host + "/title/tt" + movieNum + "/";
+    }
 
     //cout << "Grabbing Data From: " << url.toString() << endl;
 
@@ -555,13 +596,23 @@
 int VideoManager::GetMovieListing(QString movieName)
 {
     int ret = -1;
-    QString host = "us.imdb.com";
-    theMovieName = movieName;
+    QString host = "<NULL>";
+    QUrl url;
 
-    QUrl url("http://" + host + "/Tsearch?title=" + movieName + 
-             "&type=fuzzy&from_year=1890" +
-             "&to_year=2010&sort=smart&tv=off&x=12&y=14");
+    //cout << "Language " << gContext->GetSetting("Language").left(2).lower() << endl;
+    if(gContext->GetSetting("Language").left(2).lower()=="fr"){
+	host = "www.allocine.fr";
+	theMovieName = movieName;
+	
+	url = "http://" + host + "/recherche/rubrique.html?typerecherche=3&motcle="+movieName;
+    }else{
+        host = "us.imdb.com";
+        theMovieName = movieName;
 
+        url = "http://" + host + "/Tsearch?title=" + movieName + 
+             "&type=fuzzy&from_year=1890" +
+             "&to_year=2010&sort=smart&tv=off&x=12&y=14";
+    };
     //cout << "Grabbing Listing From: " << url.toString() << endl;
 
     if (httpGrabber)
@@ -588,9 +639,13 @@
 
     QString res;
     res = httpGrabber->getData();
-
-    QString movies = parseData(res, "<A NAME=\"mov\">Movies</A></H2>", "</TABLE>");
-
+    QString movies = "<NULL>";
+    if (gContext->GetSetting("Language").left(2).lower()=="fr"){
+        movies = parseData (res,"<TABLE width=96% cellPadding=0 cellSpacing=2 border=0>","</TABLE>");
+	//cout << movies << endl;
+    }else{
+        movies = parseData(res, "<A NAME=\"mov\">Movies</A></H2>", "</TABLE>");
+    }
     movieList.clear();
 
     if (movies != "<NULL>")
@@ -619,42 +674,147 @@
     movieList["reset"] = tr("Reset Entry");
     movieList["cancel"] = tr("Cancel");
     ret = 2;
-
     return ret;
 }
 
 void VideoManager::ParseMovieData(QString data)
 {
-    movieTitle = parseData(data, "<title>", "(");
-    QString mYear = parseData(data, "(", ")");
-    if (mYear.find("/") > 0)
-        movieYear = mYear.left(mYear.find("/")).toInt();
-    else 
-        movieYear = mYear.toInt();
+    if (gContext->GetSetting("Language").left(2).lower()=="fr"){
+	//cout << data << endl;
+	movieTitle = parseData(data,"<FONT Class=\"titrePage\">","</FONT>");
+	movieTitle.remove("<font >");
+	QString tmpData = parseData(data,"<TD><font >","</font>.");
+	QString mYear = parseData(tmpData,"<font >(",")");
+	movieYear = mYear.toInt();
+	int movieLevel;
+	QString level = parseData(data,"Interdit aux moins de ","ans");
+	if (level != "<NULL>"){
+	    switch (level.toInt()){
+	        case 18:movieLevel=4;break;
+		case 16:movieLevel=3;break;
+		case 12:movieLevel=2;break;
+	    }
+	}
+	movieDirector=parseData(data," par&nbsp;</FONT>","</TD></TR>");
+	cout << movieDirector << endl;
+	QString tmpdirector = ""; //parseData(movieDirector,"<A Href","Class=\"link1\">");
+	while (tmpdirector != "<NULL>"){
+		movieDirector.remove("<A Href" + tmpdirector + "Class=\"link1\">");
+		tmpdirector = parseData(movieDirector,"<A Href","Class=\"link1\">");
+	};
+	movieDirector.remove("</A>");
+	movieDirector.replace("&nbsp;"," ");
+
+	moviePlot = parseData(data,"<DIV Align='Justify'><FONT class=\"size2\">","</FONT></DIV>");
+	moviePlot.replace("<BR>","\n");
+	moviePlot.remove("<br>");
+	
+	QString rating = parseData(data,"Presse","</TABLE>");
+	int nbvote = 0;
+	float sommevote = 0;
+	rating = parseData(rating,"etoile_",".gif");
+	if (rating !="<NULL>"){
+	    sommevote = rating.toInt();
+	    nbvote ++;
+	}
+	rating = parseData(data,"Spectateurs","</TABLE>");
+	rating = parseData(rating,"etoile_",".gif");
+	if (rating != "<NULL>"){
+		sommevote += rating.toInt();
+		nbvote ++;
+	}
+	if (nbvote>0){movieUserRating=sommevote/nbvote;};
+
+	movieRating = parseData(data,"<TD><font >","<font >(");
+	QString mR = parseData(data,")</font>. <FONT Class=\"size2\">","<FONT Class=\"size2\">Du");
+	movieRating = movieRating + "\n" + mR;
+	movieRating.remove("</font>");
+	movieRating.remove("</FONT>");
+	movieRating.remove("<FONT Class=\"size2\">");
+	movieRating.replace("&nbsp;"," ");
+
+	//movieGenres
+	movieGenres.clear();
+	QString genres = parseData(data,")</font>. ",". <FONT Class=\"size2\">Dur");
+	cout << genres << endl;
+	QString genre = parseData(genres,"<FONT Class=\"size2\">","</FONT>");
+	while (genre != "<NULL>") {
+		movieGenres.append(genre);
+		genres.remove("<FONT Class=\"size2\">" + genre + "</FONT>");
+		genre = parseData(genres,"<FONT Class=\"size2\">","</FONT>");
+	}
+	//movieGenre
+	//movieCountries
+	movieCountries.clear();
+	QString countries = parseData(data,"</font>&nbsp;"," <font >(");
+	cout << countries << endl;
+	QString country = parseData (countries,"<FONT Class=\"size2\">","</FONT>");
+	while (country != "<NULL>"){
+		movieCountries.append(country);
+		countries.remove("<FONT Class=\"size2\">" + country + "</FONT>");
+		country = parseData(countries,"<FONT Class=\"size2\">","</FONT>");
+	}
+	//movieCountries
+
+		QString movieRuntimetmp = parseData(data,">Dur","</FONT>");
+		movieRuntime = parseData(movieRuntimetmp,"e&nbsp;:&nbsp;","h").toInt()*60+parseData(movieRuntimetmp,"h","mn.").toInt();
+
+	    }else{
+		movieTitle = parseData(data, "<title>", "(");
+		QString mYear = parseData(data, "(", ")");
+		if (mYear.find("/") > 0)
+            movieYear = mYear.left(mYear.find("/")).toInt();
+        else 
+            movieYear = mYear.toInt();
  
-    movieDirector = parseData(data, ">Directed by</b><br>\n<a href=\"/name/nm", "</a><br>");
-    if (movieDirector != "<NULL>")
-        movieDirector = movieDirector.right(movieDirector.length() - movieDirector.find("\">") - 2);
-    moviePlot = parseData(data, "<b class=\"ch\">Plot Outline:</b> ", "<a href=\"");
-    if (moviePlot == "<NULL>")
-        moviePlot = parseData(data, "<b class=\"ch\">Plot Summary:</b> ", "<a href=\"");
-
-    QString rating = parseData(data, "<b class=\"ch\">User Rating:</b>", " (");
-    rating = parseData(rating, "<b>", "/");
-    movieUserRating = rating.toFloat();
-
-    movieRating = parseData(data, "<b class=\"ch\"><a href=\"/mpaa\">MPAA</a>:</b> ", "<br>");
-    if (movieRating == "<NULL>")
-    {
-        movieRating = parseData(data, "<b class=\"ch\">Certification:</b>", "<br>");
-        movieRating = parseData(movieRating, "<a href=\"/List?certificates=" + ratingCountry, "/a>");
-        movieRating = parseData(movieRating, "\">", "<");
+        movieDirector = parseData(data, ">Directed by</b><br>\n<a href=\"/name/nm", "</a><br>");
+        if (movieDirector != "<NULL>")
+            movieDirector = movieDirector.right(movieDirector.length() - movieDirector.find("\">") - 2);
+        moviePlot = parseData(data, "<b class=\"ch\">Plot Outline:</b> ", "<a href=\"");
+        if (moviePlot == "<NULL>")
+            moviePlot = parseData(data, "<b class=\"ch\">Plot Summary:</b> ", "<a href=\"");
+
+        QString rating = parseData(data, "<b class=\"ch\">User Rating:</b>", " (");
+        rating = parseData(rating, "<b>", "/");
+        movieUserRating = rating.toFloat();
+
+        movieRating = parseData(data, "<b class=\"ch\"><a href=\"/mpaa\">MPAA</a>:</b> ", "<br>");
+        if (movieRating == "<NULL>")
+        {
+            movieRating = parseData(data, "<b class=\"ch\">Certification:</b>", "<br>");
+            movieRating = parseData(movieRating, "<a href=\"/List?certificates=" + ratingCountry, "/a>");
+            movieRating = parseData(movieRating, "\">", "<");
+        }
+        movieRuntime = parseData(data, "<b class=\"ch\">Runtime:</b>", " min").toInt();
+	//movieGenres
+	movieGenres.clear();
+	QString genres = parseData(data,"<b class=\"ch\">Genre:</b>","<a href=\"keywords\">(more)</a>");
+	QString tmpgenre = parseData(genres,"<a href=\"/Sections/","</a>");
+	QString genre = tmpgenre.right(tmpgenre.length() - tmpgenre.findRev(">")-1);
+	while ( tmpgenre != "<NULL>" && genre != ""){
+		movieGenres.append(genre);
+		genres.remove("<a href=\"/Sections/" + tmpgenre + "</a>");
+		tmpgenre = parseData(genres,"<a href=\"/Sections/","</a>");
+		genre = tmpgenre.right(tmpgenre.length() - tmpgenre.findRev(">")-1);
+	}
+
+	//movieCountries
+	movieCountries.clear();
+	QString countries = parseData(data,"<b class=\"ch\">Country:</b>","<br>");
+	QString tmpcountry = parseData(countries,"<a href=\"/Sections/","</a>");
+	QString country = tmpcountry.right(tmpcountry.length() - tmpcountry.findRev(">")-1);
+	cout << country << endl;
+	while ( tmpcountry != "<NULL>" && country != ""){
+		movieCountries.append(country);
+		countries.remove("<a href=\"/Sections/" + tmpcountry + "</a>");
+		tmpcountry = parseData(countries,"<a href=\"/Sections/","</a>");
+		country = tmpcountry.right(tmpcountry.length() - tmpcountry.findRev(">")-1);
+	}
     }
-    movieRuntime = parseData(data, "<b class=\"ch\">Runtime:</b>", " min").toInt();
     QString movieCoverFile = "";
     movieCoverFile = GetMoviePoster(movieNumber);
 
-    /*
+   /* 
     cout << "      Title:\t" << movieTitle << endl;
     cout << "       Year:\t" << movieYear << endl;
     cout << "   Director:\t" << movieDirector << endl;
@@ -663,7 +823,7 @@
     cout << "     Rating:\t" << movieRating << endl;
     cout << "    Runtime:\t" << movieRuntime << endl;
     cout << " Cover File:\t" << movieCoverFile << endl;
-    */
+   */
 
     if (movieTitle == "<NULL>")
         ResetCurrentItem();
@@ -678,6 +838,8 @@
        curitem->setLength(movieRuntime);
        curitem->setInetRef(movieNumber);
        curitem->setCoverFile(movieCoverFile);
+       curitem->setGenres(movieGenres);      
+       curitem->setCountries(movieCountries);
     }
     curitem->updateDatabase(db);
     RefreshMovieList();


More information about the mythtv-dev mailing list