return (count ("Plots") > 0);
}
+ public string get_plot (string title) {
+ string sql = "SELECT Plot FROM Plots WHERE rowid in (SELECT rowid FROM Movies WHERE Title=\"%s\")".printf (title);
+ Statement stmt;
+ int rc;
+ int count = 0;
+
+ rc = db.prepare_v2 (sql, -1, out stmt);
+ if (rc != Sqlite.OK) {
+ stderr.printf ("SQL error: %d, %s\n", rc, db.errmsg ());
+ db.progress_handler (0, null);
+ return "";
+ }
+
+ do {
+ rc = stmt.step ();
+ if (rc == Sqlite.ROW) {
+ return stmt.column_text (0);
+ }
+ } while (rc == Sqlite.ROW);
+
+ return "";
+ }
+
public int clear () {
int rc;
}
}
+class IMDbMovie : Movie {
+ public override string get_plot () {
+ var sqlite = new IMDbSqlite (Path.build_filename (Environment.get_user_cache_dir (),
+ "cinaest", "imdb.db", null));
+ print ("IMDb get_plot(\"%s (%d)\")\n", title, year);
+ return sqlite.get_plot ("%s (%d)".printf (title, year));
+ }
+}
+
class IMDBSource : MovieSource {
public override bool active { get; set construct; }
}
private void receive_movie (string title, string? aka, int year, int rating, int genres) {
- Movie movie = new Movie ();
+ var movie = new IMDbMovie ();
movie.title = title;
movie.year = year;
movie.rating = rating;