c4a3f01883d5970b0276652d72b69769c059c107
[cinaest] / src / plugins / imdb-plugin.vala
1 /* This file is part of Cinaest.
2  *
3  * Copyright (C) 2009 Philipp Zabel
4  *
5  * Cinaest is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * Cinaest is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with Cinaest. If not, see <http://www.gnu.org/licenses/>.
17  */
18
19 using Hildon;
20
21 class IMDbPlugin : Plugin {
22         public override void hello (Gtk.Window window) {
23                 string filename = Path.build_filename (Environment.get_user_cache_dir(),
24                                                        "cinaest", "imdb.db", null);
25                 stdout.printf ("IMDb Plugin Loaded. Cache Db: %s\n", filename);
26
27                 if (!FileUtils.test (filename, FileTest.EXISTS)) {
28                         var note = new Note.confirmation (window, "There is no local copy of the Internet Movie Database (IMDb). Download it now?\n\nThis can be started later from the Settings dialog.");
29
30                         note.run ();
31                         note.destroy ();
32                 }
33         }
34
35         public override void get_movies (string filter, Plugin.ReceiveMovieFunction callback, int limit) {
36         }
37
38         public override void add_movie (Movie movie) {
39         }
40 }
41
42 [ModuleInit]
43 public Type register_plugin () {
44         // types are registered automatically
45         return typeof (IMDbPlugin);
46 }