totem-plugin-arte-3.2.1/0000755000175000017500000000000012217613113014123 5ustar simonsimontotem-plugin-arte-3.2.1/README0000644000175000017500000000142612217613113015006 0ustar simonsimonThe Arte Totem plugin allows you to watch video streams from the Franco-German TV Channel Arte. http://plus7.arte.tv/ Sadly, this service is only available for IPs within Austria, France, Germany, Belgium and Switzerland. --------------- Dependencies: --------------- Totem >= 3.6 libpeas >= 1.2.0 Vala >= 0.15.0 Gtk+-3.0 libsoup2.4 libglib >= 2.25.15 libjson-glib gstreamer-plugins-bad >= 0.10.20 gsettings-desktop-schemas Network-Manager (optional) On Debian or Ubuntu: # aptitude install valac-0.16 libgtk-3-dev libtotem-dev libpeas-dev \ libsoup2.4-dev gettext gstreamer0.10-plugins-bad gsettings-desktop-schemas \ libjson-glib-dev --------------- Installation: --------------- Install the plugin (with root access) to $(DESTDIR)/usr/lib/totem/plugins/ $ make $ sudo make install totem-plugin-arte-3.2.1/video.vala0000644000175000017500000000664512217613113016111 0ustar simonsimon/* * Totem Arte Plugin allows you to watch streams from arte.tv * Copyright (C) 2010, 2011, 2012 Simon Wenner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * The Totem Arte Plugin project hereby grants permission for non-GPL compatible * GStreamer plugins to be used and distributed together with GStreamer, Totem * and Totem Arte Plugin. This permission is above and beyond the permissions * granted by the GPL license by which Totem Arte Plugin is covered. * If you modify this code, you may extend this exception to your version of the * code, but you are not obligated to do so. If you do not wish to do so, * delete this exception statement from your version. * */ using GLib; public interface Serializable : GLib.Object { public abstract string serialize (); public abstract bool deserialize (string data); } public class Video : Serializable, GLib.Object { public string title = null; public string page_url = null; public string image_url = null; public string desc = null; public GLib.TimeVal publication_date; public GLib.TimeVal offline_date; private string uuid = null; const string VERSION = "1.0"; // serialization file version const string CLASS_NAME = "Video"; public Video() { publication_date.tv_sec = 0; offline_date.tv_sec = 0; } public void print () { stdout.printf ("Video: %s: %s, %s, %s\n", title, publication_date.to_iso8601 (), offline_date.to_iso8601 (), page_url); } public string get_uuid () { if (uuid == null) uuid = Checksum.compute_for_string (ChecksumType.MD5, page_url); return uuid; } public string serialize () { string res; // Video, Version, Title, PageURL, ImageURL, Description, PubDate, OfflineDate res = "%s\n%s\n%s\n%s\n%s\n%s\n%ld\n%ld".printf (CLASS_NAME, VERSION, title, page_url, image_url, desc, publication_date.tv_sec, offline_date.tv_sec); return res; } public bool deserialize (string data) { // updates all unknown fields of a video object string[] str = data.split("\n"); if (CLASS_NAME != str[0] || VERSION != str[1]) return false; if (title == null) title = str[2]; if (page_url == null) { page_url = str[3]; // reset uuid uuid = null; } if (image_url == null) image_url = str[4]; if (desc == null) desc = str[5]; if (publication_date.tv_sec == 0) publication_date.tv_sec = long.parse(str[6]); if (offline_date.tv_sec == 0) offline_date.tv_sec = long.parse(str[7]); return true; } } totem-plugin-arte-3.2.1/Makefile0000644000175000017500000000456712217613113015577 0ustar simonsimonDESTDIR= VERSION=3.2.1 NAME=totem-plugin-arte PACKAGE=$(NAME)-$(VERSION) VALAC=valac VALA_DEPS=--pkg Totem-1.0 --pkg PeasGtk-1.0 --pkg libsoup-2.4 --pkg gtk+-3.0 --pkg gio-2.0 --pkg json-glib-1.0 CC_ARGS=-X -fPIC -X -shared --Xcc="-D GETTEXT_PACKAGE=\"totem-arte\"" VALA_ARGS=-D DEBUG_MESSAGES $(CC_ARGS) -g VALA_SOURCE=\ arteplus7.vala \ arteparser.vala \ cache.vala \ url-extractor.vala \ video.vala \ cell-renderer-video.vala \ video-list-view.vala \ connection-status.vala EXTRA_DIST=\ arteplus7.plugin \ arteplus7-default.png \ org.gnome.totem.plugins.arteplus7.gschema.xml \ Makefile README AUTHORS COPYING NEWS ChangeLog all: $(VALAC) --library=arteplus7 $(VALA_SOURCE) $(VALA_DEPS) $(VALA_ARGS) -o libarteplus7.so msgfmt --output-file=po/de.mo po/de.po msgfmt --output-file=po/fr.mo po/fr.po install: mkdir -p $(DESTDIR)/usr/lib/totem/plugins/arteplus7 $(DESTDIR)/usr/share/totem/plugins/arteplus7 cp -f arteplus7.plugin $(DESTDIR)/usr/lib/totem/plugins/arteplus7 cp -f libarteplus7.so $(DESTDIR)/usr/lib/totem/plugins/arteplus7 cp -f arteplus7-default.png $(DESTDIR)/usr/share/totem/plugins/arteplus7 mkdir -p $(DESTDIR)/usr/share/glib-2.0/schemas cp -f org.gnome.totem.plugins.arteplus7.gschema.xml $(DESTDIR)/usr/share/glib-2.0/schemas ifeq ($(DISABLE_SCHEMAS_COMPILE),) glib-compile-schemas $(DESTDIR)/usr/share/glib-2.0/schemas/ endif mkdir -p $(DESTDIR)/usr/share/locale/de/LC_MESSAGES mkdir -p $(DESTDIR)/usr/share/locale/fr/LC_MESSAGES cp -f po/de.mo $(DESTDIR)/usr/share/locale/de/LC_MESSAGES/totem-arte.mo cp -f po/fr.mo $(DESTDIR)/usr/share/locale/fr/LC_MESSAGES/totem-arte.mo uninstall: rm -r $(DESTDIR)/usr/lib/totem/plugins/arteplus7 $(DESTDIR)/usr/share/totem/plugins/arteplus7 rm $(DESTDIR)/usr/share/glib-2.0/schemas/org.gnome.totem.plugins.arteplus7.gschema.xml glib-compile-schemas $(DESTDIR)/usr/share/glib-2.0/schemas/ rm $(DESTDIR)/usr/share/locale/de/LC_MESSAGES/totem-arte.mo rm $(DESTDIR)/usr/share/locale/fr/LC_MESSAGES/totem-arte.mo clean: rm -f arteplus7.c cache.c url-extractor.c libarteplus7.so rm -f arteplus7.vapi rm -f po/*mo dist: rm -f ChangeLog git log --pretty=short > ChangeLog mkdir $(PACKAGE) mkdir $(PACKAGE)/po cp -f $(VALA_SOURCE) $(PACKAGE)/ cp -f $(EXTRA_DIST) $(PACKAGE)/ cp -f po/POTFILES.in po/POTFILES.skip po/arte-totem.pot po/de.po po/fr.po $(PACKAGE)/po/ tar -pczf $(PACKAGE).tar.gz $(PACKAGE)/ rm -rf $(PACKAGE) totem-plugin-arte-3.2.1/arteplus7.vala0000644000175000017500000005121312217613113016720 0ustar simonsimon/* * Totem Arte Plugin allows you to watch streams from arte.tv * Copyright (C) 2009, 2010, 2011, 2012 Simon Wenner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * The Totem Arte Plugin project hereby grants permission for non-GPL compatible * GStreamer plugins to be used and distributed together with GStreamer, Totem * and Totem Arte Plugin. This permission is above and beyond the permissions * granted by the GPL license by which Totem Arte Plugin is covered. * If you modify this code, you may extend this exception to your version of the * code, but you are not obligated to do so. If you do not wish to do so, * delete this exception statement from your version. * */ using GLib; using Soup; using Totem; using Gtk; using Peas; using PeasGtk; public enum VideoQuality { UNKNOWN = 0, MEDIUM, HIGH, LOW } public enum Language { UNKNOWN = 0, FRENCH, GERMAN } public string USER_AGENT; private const string USER_AGENT_TMPL = "Mozilla/5.0 (X11; Linux x86_64; rv:%d.0) Gecko/20100101 Firefox/%d.0"; public const string DCONF_ID = "org.gnome.Totem.arteplus7"; public const string DCONF_HTTP_PROXY = "org.gnome.system.proxy.http"; public const string CACHE_PATH_SUFFIX = "/totem/plugins/arteplus7/"; public const int THUMBNAIL_WIDTH = 160; public const string DEFAULT_THUMBNAIL = "/usr/share/totem/plugins/arteplus7/arteplus7-default.png"; public bool use_proxy = false; public Soup.URI proxy_uri; public string proxy_username; public string proxy_password; public static Soup.SessionAsync create_session () { Soup.SessionAsync session; if (use_proxy) { session = new Soup.SessionAsync.with_options ( Soup.SESSION_USER_AGENT, USER_AGENT, Soup.SESSION_PROXY_URI, proxy_uri, null); session.authenticate.connect((sess, msg, auth, retrying) => { /* check if authentication is needed */ if (!retrying) { auth.authenticate (proxy_username, proxy_password); } else { GLib.warning ("Proxy authentication failed!\n"); } }); } else { session = new Soup.SessionAsync.with_options ( Soup.SESSION_USER_AGENT, USER_AGENT, null); } session.timeout = 10; /* 10 seconds timeout, until we give up and show an error message */ return session; } public void debug (string format, ...) { #if DEBUG_MESSAGES var args = va_list (); GLib.logv ("TotemArte", GLib.LogLevelFlags.LEVEL_DEBUG, format, args); #endif } class ArtePlugin : Peas.Activatable, PeasGtk.Configurable, Peas.ExtensionBase { public GLib.Object object { owned get; construct; } private Totem.Object t; private Gtk.Entry search_entry; /* search field with buttons inside */ private VideoListView tree_view; /* list of movie thumbnails */ private ArteParser parsers[3]; /* array of parsers */ private GLib.Settings settings; private GLib.Settings proxy_settings; private Cache cache; /* image thumbnail cache */ private Language language; private VideoQuality quality; private ConnectionStatus cs; private delegate void VoidFunction (); public ArtePlugin () { /* constructor chain up hint */ GLib.Object (); } construct { /* Debug log handling */ #if DEBUG_MESSAGES GLib.Log.set_handler ("TotemArte", GLib.LogLevelFlags.LEVEL_DEBUG, (domain, levels, msg) => { stdout.printf ("%s-DEBUG: %s\n", domain, msg); }); #endif this.settings = new GLib.Settings (DCONF_ID); this.proxy_settings = new GLib.Settings (DCONF_HTTP_PROXY); load_properties (); } /* Gir doesn't allow marking functions as non-abstract */ public void update_state () {} public void activate () { this.cs = new ConnectionStatus (); /* Generate the user-agent */ TimeVal tv = TimeVal (); tv.get_current_time (); /* First, we need to compute the number of weeks since Epoch */ int weeks = (int) tv.tv_sec / ( 60 * 60 * 24 * 7 ); /* We know there is a new Firefox release each 6 weeks. And we know Firefox 11.0 was released the 03/13/2012, which corresponds to 2201 weeks after Epoch. We add a 3 weeks margin and then we can compute the version number! */ int version = 11 + (weeks - (2201 + 3)) / 6; USER_AGENT = USER_AGENT_TMPL.printf(version, version); debug (USER_AGENT); settings.changed.connect ((key) => { on_settings_changed (key); }); proxy_settings.changed.connect ((key) => { on_settings_changed (key); }); t = object as Totem.Object; cache = new Cache (Environment.get_user_cache_dir () + CACHE_PATH_SUFFIX); parsers[0] = new ArteJSONParser (); parsers[1] = new ArteXMLParser (); parsers[2] = new ArteRSSParser (); tree_view = new VideoListView (cache); tree_view.video_selected.connect (callback_video_selected); var scroll_win = new Gtk.ScrolledWindow (null, null); scroll_win.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC); scroll_win.set_shadow_type (ShadowType.IN); scroll_win.add (tree_view); /* add a search entry with a refresh and a cleanup icon */ search_entry = new Gtk.Entry (); search_entry.set_icon_from_stock (Gtk.EntryIconPosition.PRIMARY, Gtk.Stock.REFRESH); search_entry.set_icon_tooltip_text (Gtk.EntryIconPosition.PRIMARY, _("Reload feed")); search_entry.set_icon_from_stock (Gtk.EntryIconPosition.SECONDARY, Gtk.Stock.CLEAR); search_entry.set_icon_tooltip_text (Gtk.EntryIconPosition.SECONDARY, _("Clear the search text")); search_entry.set_icon_sensitive (Gtk.EntryIconPosition.SECONDARY, false); /* search as you type */ search_entry.changed.connect ((widget) => { Gtk.Entry entry = (Gtk.Entry) widget; entry.set_icon_sensitive (Gtk.EntryIconPosition.SECONDARY, (entry.get_text () != "")); var filter = entry.get_text ().down (); tree_view.set_filter(filter); }); /* set focus to the first video on return */ search_entry.activate.connect ((entry) => { tree_view.set_cursor(new TreePath.first (), null, false); tree_view.grab_focus (); }); /* cleanup or refresh on click */ search_entry.icon_press.connect ((entry, position, event) => { if (position == Gtk.EntryIconPosition.PRIMARY) callback_refresh_rss_feed (); else entry.set_text (""); }); var main_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 4); main_box.pack_start (search_entry, false, false, 0); main_box.pack_start (scroll_win, true, true, 0); main_box.show_all (); t.add_sidebar_page ("arte", _("Arte+7"), main_box); GLib.Idle.add (refresh_rss_feed); /* delete outdated files in the cache */ GLib.Idle.add (() => { cache.delete_cruft (); return false; }); /* Refresh the feed on pressing 'F5' */ var window = t.get_main_window (); window.key_press_event.connect (callback_F5_pressed); /* refresh the feed if we were offline and it has not been loaded */ this.cs.status_changed.connect ((is_online) => { debug ("ConnectionStatus changed: is_online = %d", (int)is_online); if (is_online && tree_view.get_size () < 2) { // delay it by 3 seconds to avoid timing issues GLib.Timeout.add_seconds (3, refresh_rss_feed); } }); } public void deactivate () { /* Disable connection updates */ this.cs = null; /* Remove the 'F5' key event handler */ var window = t.get_main_window (); window.key_press_event.disconnect (callback_F5_pressed); /* Remove the plugin tab */ t.remove_sidebar_page ("arte"); } /* This code must be independent from the rest of the plugin */ public Gtk.Widget create_configure_widget () { var langs = new Gtk.ComboBoxText (); langs.append_text (_("French")); langs.append_text (_("German")); if (language == Language.GERMAN) langs.set_active (1); else langs.set_active (0); langs.changed.connect (() => { Language last = language; if (langs.get_active () == 1) { language = Language.GERMAN; } else { language = Language.FRENCH; } if (last != language) { if (!settings.set_enum ("language", (int) language)) GLib.warning ("Storing the language setting failed."); }; }); settings.changed["language"].connect (() => { var l = settings.get_enum ("language"); if (l == Language.GERMAN) { language = Language.GERMAN; langs.set_active (1); } else { language = Language.FRENCH; langs.set_active (0); } }); var quali_radio_low = new Gtk.RadioButton.with_mnemonic (null, _("l_ow")); var quali_radio_medium = new Gtk.RadioButton.with_mnemonic_from_widget ( quali_radio_low, _("_medium")); var quali_radio_high = new Gtk.RadioButton.with_mnemonic_from_widget ( quali_radio_medium, _("_high")); switch (quality) { case VideoQuality.LOW: quali_radio_low.set_active (true); break; case VideoQuality.MEDIUM: quali_radio_medium.set_active (true); break; default: quali_radio_high.set_active (true); break; } /* reusable lambda function */ VoidFunction quality_toggle_clicked = () => { VideoQuality last = this.quality; if (quali_radio_low.get_active ()) this.quality = VideoQuality.LOW; else if (quali_radio_medium.get_active ()) this.quality = VideoQuality.MEDIUM; else this.quality = VideoQuality.HIGH; if (last != this.quality) { if (!settings.set_enum ("quality", (int) this.quality)) GLib.warning ("Storing the quality setting failed."); } }; quali_radio_low.toggled.connect (() => { quality_toggle_clicked(); }); quali_radio_medium.toggled.connect (() => { quality_toggle_clicked(); }); quali_radio_high.toggled.connect (() => { quality_toggle_clicked(); }); settings.changed["quality"].connect (() => { var q = settings.get_enum ("quality"); if (q == VideoQuality.LOW) { quality = VideoQuality.LOW; quali_radio_low.set_active (true); } else if (q == VideoQuality.MEDIUM) { quality = VideoQuality.MEDIUM; quali_radio_medium.set_active (true); } else { quality = VideoQuality.HIGH; quali_radio_high.set_active (true); } }); var langs_label = new Gtk.Label.with_mnemonic (_("_Language:")); langs_label.set_mnemonic_widget (langs); langs.mnemonic_activate.connect (() => { langs.popup(); return true; }); var langs_box = new Box (Gtk.Orientation.HORIZONTAL, 20); langs_box.pack_start (langs_label, false, true, 0); langs_box.pack_start (langs, true, true, 0); var quali_label = new Gtk.Label (_("Video quality:")); var quali_box = new Box (Gtk.Orientation.HORIZONTAL, 20); quali_box.pack_start (quali_label, false, true, 0); quali_box.pack_start (quali_radio_low, false, true, 0); quali_box.pack_start (quali_radio_medium, false, true, 0); quali_box.pack_start (quali_radio_high, true, true, 0); var vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 20); vbox.pack_start (langs_box, false, true, 0); vbox.pack_start (quali_box, false, true, 0); return vbox; } private bool refresh_rss_feed () { if (!this.cs.is_online) { // display offline message tree_view.display_message (_("No internet connection.")); // invalidate all existing videos tree_view.clear (); return false; } uint parse_errors = 0; uint network_errors = 0; uint error_threshold = 0; search_entry.set_sensitive (false); debug ("Refreshing Video Feed..."); /* display loading message */ tree_view.display_message (_("Loading...")); /* remove all existing videos */ tree_view.clear (); // download and parse the XML feed, the default feed for (int i=0; i videos = p.parse (language); // add videos to the list tree_view.add_videos (videos); } catch (MarkupError e) { parse_errors++; GLib.critical ("XML Parse Error: %s", e.message); } catch (IOError e) { network_errors++; GLib.critical ("Network problems: %s", e.message); } // request the next chunk of data p.advance (); // leave the loop if we got too many errors if (parse_errors >= error_threshold || network_errors >= error_threshold) break; } // the RSS feeds have duplicates and no image urls if (p.has_duplicates ()) tree_view.check_and_remove_duplicates (); if (!p.has_image_urls ()) tree_view.check_and_download_missing_image_urls (); // leave the loop if we got enought videos if (parse_errors < error_threshold && network_errors < error_threshold) break; } /* while parsing we only used images from the cache */ tree_view.check_and_download_missing_thumbnails (); debug ("Video Feed loaded, video count: %u", tree_view.get_size ()); // show user visible error messages if (parse_errors > error_threshold) { t.action_error (_("Markup Parser Error"), _("Sorry, the plugin could not parse the Arte video feed.")); } else if (network_errors > error_threshold) { t.action_error (_("Network problem"), _("Sorry, the plugin could not download the Arte video feed.\nPlease verify your network settings and (if any) your proxy settings.")); } search_entry.set_sensitive (true); search_entry.grab_focus (); return false; } /* loads properties from dconf */ private void load_properties () { string parsed_proxy_uri = ""; int proxy_port; quality = (VideoQuality) settings.get_enum ("quality"); language = (Language) settings.get_enum ("language"); use_proxy = proxy_settings.get_boolean ("enabled"); if (use_proxy) { parsed_proxy_uri = proxy_settings.get_string ("host"); proxy_port = proxy_settings.get_int ("port"); if (parsed_proxy_uri == "") { use_proxy = false; /* necessary to prevent a crash in this case */ } else { proxy_uri = new Soup.URI ("http://" + parsed_proxy_uri + ":" + proxy_port.to_string()); debug ("Using proxy: %s", proxy_uri.to_string (false)); proxy_username = proxy_settings.get_string ("authentication-user"); proxy_password = proxy_settings.get_string ("authentication-password"); } } if (language == Language.UNKNOWN) { /* Try to guess user prefer language at first run */ var env_lang = Environment.get_variable ("LANG"); if (env_lang != null && env_lang.substring (0,2) == "de") { language = Language.GERMAN; } else { language = Language.FRENCH; /* Otherwise, French is the default language */ } if (!settings.set_enum ("language", (int) language)) GLib.warning ("Storing the language setting failed."); } if (quality == VideoQuality.UNKNOWN) { quality = VideoQuality.HIGH; // default quality if (!settings.set_enum ("quality", (int) quality)) GLib.warning ("Storing the quality setting failed."); } } private void on_settings_changed (string key) { if (key == "quality") load_properties (); else { /* Reload the feed if the language or proxy settings changed */ load_properties (); GLib.Idle.add (refresh_rss_feed); } } private void callback_video_selected (string url, string title) { string stream_url = null; try { stream_url = get_stream_url (url, quality, language); } catch (ExtractionError e) { if(e is ExtractionError.ACCESS_RESTRICTED) { /* This video access is restricted */ t.action_error (_("This video access is restricted"), _("It seems that, because of its content, this video can only be watched in a precise time interval.\n\nYou may retry later, for example between 11 PM and 5 AM.")); } else if(e is ExtractionError.STREAM_NOT_READY) { /* The video is part of the XML/RSS feed but no stream is available yet */ t.action_error (_("This video is not available yet"), _("Sorry, the plugin could not find any stream URL.\nIt seems that this video is not available yet, even on the Arte web-player.\n\nPlease retry later.")); } else if (e is ExtractionError.DOWNLOAD_FAILED) { /* Network problems */ t.action_error (_("Video URL Extraction Error"), _("Sorry, the plugin could not extract a valid stream URL.\nPlease verify your network settings and (if any) your proxy settings.")); } else { /* ExtractionError.EXTRACTION_ERROR or an unspecified error */ t.action_error (_("Video URL Extraction Error"), _("Sorry, the plugin could not extract a valid stream URL.\nPerhaps this stream is not yet available, you may retry in a few minutes.\n\nBe aware that this service is only available for IPs within Austria, Belgium, Germany, France and Switzerland.")); } return; } t.add_to_playlist_and_play (stream_url, title); } private void callback_refresh_rss_feed () { GLib.Idle.add (refresh_rss_feed); } private bool callback_F5_pressed (Gdk.EventKey event) { string key = Gdk.keyval_name (event.keyval); if (key == "F5") callback_refresh_rss_feed (); /* propagate the signal to the next handler */ return false; } private string get_stream_url (string page_url, VideoQuality q, Language lang) throws ExtractionError { var extractor = new RTMPStreamUrlExtractor (); return extractor.get_url (q, lang, page_url); } } [ModuleInit] public void peas_register_types (GLib.TypeModule module) { var objmodule = module as Peas.ObjectModule; objmodule.register_extension_type (typeof(Peas.Activatable), typeof(ArtePlugin)); objmodule.register_extension_type (typeof(PeasGtk.Configurable), typeof(ArtePlugin)); } totem-plugin-arte-3.2.1/NEWS0000644000175000017500000000747312217613113014635 0ustar simonsimon2013 September 22th - Totem Arte Plugin 3.2.1 Changes since 3.2.0: * Fixed the extraction of https video links * Fixed preferences mnemonics in English 2013 September 10th - Totem Arte Plugin 3.2.0 Changes since 3.1.3: * Fix stream extraction from the new Arte website * Reimplementation of the removed Totem.CellRenderVideo * New and more efficient primary video feed source (JSON) * Support for low quality streams * Minor bug fixes and translation updates 2012 December 9th - Totem Arte Plugin 3.1.3 Changes since 3.1.2: * Fix compilation with Vala 0.18 and Totem 3.6.0 2012 September 15th - Totem Arte Plugin 3.1.2 Changes since 3.1.1: * Update video feed URLs * Minor bugfix for the user agent generator 2012 May 6th - Totem Arte Plugin 3.1.1 Changes since 3.1.0: * Translation updates * Automatic user agent generator * Minor bugfixes All contributors to this release: * Nicolas Delvaux * Simon Wenner 2012 May 1st - Totem Arte Plugin 3.1.0 Changes since 3.0.1: * Network-Manager integration * Improved thumbnail cache handling * Fix compilation with Vala 0.16 * Many bugfixes All contributors to this release: * Simon Wenner * Nicolas Delvaux 2012 January 22th - Totem Arte Plugin 3.0.1 Changes since 3.0.0: * Fix compilation with Vala 0.14.1 and 0.15.0 * Replace deprecated GTK+ symbols * Minor bugfixes and improvements All contributors to this release: * Nicolas Delvaux * Simon Wenner 2011 July 3th - Totem Arte Plugin 3.0.0 Changes since 0.9.2: * Port to Totem 3.0 (GtK+ 3.0 and Libpeas) * Port from Gconf to Gsettings (Dconf) * Rewrite parsing and handling of multiple video feeds * Improve the robustness and quality of all video feeds * Many bugfixes All contributors to this release: * Simon Wenner * Nicolas Delvaux * Stefan Kirrmann 2010 September - Totem Arte Plugin 0.9.2 * Bugfix: Fallback to the rss feed on IO errors too * Bugfix: Arte changed the XML feed url * Make debug messages conditional at compiletime (-D DEBUG_MESSAGES) 2010 September - Totem Arte Plugin 0.9.1 * Asynchronous thumbnail download to speedup the startup time (Nicolas Delvaux) * Display a default thumbnail if none is available * Installation into the home directory is no longer suported * Minor bugfixes 2010 September - Totem Arte Plugin 0.9.0 * Proxy support using the GNOME proxy settings (Nicolas Delvaux) * The plugin tries to guess the user language at the first run (Nicolas Delvaux) * Add an RTMP stream extractor, remove the deprecated WMV extractor (Nicolas Delvaux) * Improved fetching of the XML feed * Minor bugfixes 2010 May - Totem Arte Plugin 0.8.4 * Arte changed their video service * Use the new RSS and XML feeds * Use a new extraction scheme to get to the WMV stream * Improved error dialogues * Add a ChangeLog file 2010 April - Totem Arte Plugin 0.8.3 * Add Totem's license files and Totem's additional license exception clause * Redesigned search bar * Pressing F5 refreshes the video feed * Better handling of Gconf errors (Nicolas Delvaux) * Minor bugfixes and translation updates 2010 March - Totem Arte Plugin 0.8.2 * Remove the libgee dependency * Bugfix: Delayed appearance of the loading message * Minor code cleanup 2010 February - Totem Arte Plugin 0.8.1 * Fix the creation of the cache directory * Update installation instructions 2010 February - Totem Arte Plugin 0.8.0 * First official release * Preferences are hidden in the preference dialogue and stored in gconf * Streams can be searched * Stream thumbnail images are cached to improve the start-up time * I18n support (Nicolas Delvaux) * German and French localization (Nicolas Delvaux) totem-plugin-arte-3.2.1/url-extractor.vala0000644000175000017500000001504712217613113017612 0ustar simonsimon/* * Totem Arte Plugin allows you to watch streams from arte.tv * Copyright (C) 2010, 2011, 2012 Simon Wenner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * The Totem Arte Plugin project hereby grants permission for non-GPL compatible * GStreamer plugins to be used and distributed together with GStreamer, Totem * and Totem Arte Plugin. This permission is above and beyond the permissions * granted by the GPL license by which Totem Arte Plugin is covered. * If you modify this code, you may extend this exception to your version of the * code, but you are not obligated to do so. If you do not wish to do so, * delete this exception statement from your version. * */ using GLib; using Soup; using Json; public errordomain ExtractionError { DOWNLOAD_FAILED, EXTRACTION_FAILED, STREAM_NOT_READY, ACCESS_RESTRICTED } public interface UrlExtractor : GLib.Object { public abstract string get_url (VideoQuality q, Language lang, string page_url) throws ExtractionError; } public class IndirectUrlExtractor : GLib.Object { protected Soup.SessionAsync session; public IndirectUrlExtractor() { session = create_session (); } protected string extract_string_from_page (string url, string regexp) throws ExtractionError { /* Download */ var msg = new Soup.Message ("GET", url); this.session.send_message(msg); if (msg.response_body.data == null) throw new ExtractionError.DOWNLOAD_FAILED ("Video URL Extraction Error"); /* Extract */ string res = null; try { MatchInfo match; var regex = new Regex (regexp); regex.match((string) msg.response_body.flatten ().data, 0, out match); res = match.fetch(1); } catch (RegexError e) { GLib.warning ("%s", e.message); throw new ExtractionError.EXTRACTION_FAILED (e.message); } return res; } } public class RTMPStreamUrlExtractor : IndirectUrlExtractor, UrlExtractor { public string get_url (VideoQuality q, Language lang, string page_url) throws ExtractionError { string regexp; debug ("Initial Page URL:\t\t'%s'", page_url); /* JSON uri */ regexp = "arte_vp_url=\"(https?://.*.json)\">"; var json_uri = extract_string_from_page (page_url, regexp); debug ("Extract JSON URI:\t'%s'", json_uri); if (json_uri == null) throw new ExtractionError.EXTRACTION_FAILED ("Video URL Extraction Error"); /* download and parse the main JSON file */ var message = new Soup.Message ("GET", json_uri); this.session.send_message (message); string rtmp_uri = null; // TODO detect if a video is only availabe after 23:00 try { var parser = new Json.Parser (); parser.load_from_data ((string) message.response_body.flatten ().data, -1); var root_object = parser.get_root ().get_object (); var player_object = root_object.get_object_member ("videoJsonPlayer"); var streams_object = player_object.get_object_member ("VSR"); Json.Object video_object; switch (q) { case VideoQuality.LOW: video_object = streams_object.get_object_member ("RTMP_LQ_1"); break; case VideoQuality.HIGH: video_object = streams_object.get_object_member ("RTMP_SQ_1"); break; default: // MEDIUM is the default video_object = streams_object.get_object_member ("RTMP_MQ_1"); // or "RTMP_EQ_1" ? break; } string streamer = video_object.get_string_member ("streamer"); string url = video_object.get_string_member ("url"); debug ("Streamer base:\t'%s'", streamer); debug ("Streamer path:\t'%s'", url); rtmp_uri = streamer + "mp4:" + url; } catch (Error e) { throw new ExtractionError.EXTRACTION_FAILED ("Video URL Extraction Error"); } // Try to figure out the player URI string player_uri; try { regexp = "content=\"(http.*.swf)\\?"; var embeded_uri = "http://player.arte.tv/v2/index.php?json_url=" + json_uri + "&config=arte_tvguide"; player_uri = extract_string_from_page (embeded_uri, regexp); debug ("Extract player URI:\t'%s'", player_uri); if (player_uri == null) { throw new ExtractionError.EXTRACTION_FAILED ("Player URL Extraction Error"); } } catch (Error e) { // Do not abort and try to play the video with a known old player URI. // The server does not seems to always check the player validity, so it may work anyway. debug ("Failed to extract the flash player URI! Trying to fallback..."); player_uri = "http://www.arte.tv/playerv2/jwplayer5/mediaplayer.5.7.1894.swf"; } string stream_uri = rtmp_uri + " swfVfy=1 swfUrl=" + player_uri; debug ("Build stream URI:\t\t'%s'", stream_uri); return stream_uri; } } public class ImageUrlExtractor : IndirectUrlExtractor, UrlExtractor { public string get_url (VideoQuality q, Language lang, string page_url) throws ExtractionError { // takes a video page url and returns the image url // Example: string regexp, image_url; regexp = ""; image_url = extract_string_from_page (page_url, regexp); if (image_url == null) throw new ExtractionError.EXTRACTION_FAILED ("Image URL Extraction Error"); return image_url; } } totem-plugin-arte-3.2.1/COPYING0000644000175000017500000004421712217613113015166 0ustar simonsimon# This GPL license have a exception clause added, see at the bottom of file # for details. GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. The Totem Arte Plugin project hereby grants permission for non-GPL compatible GStreamer plugins to be used and distributed together with GStreamer, Totem and Totem Arte Plugin. This permission is above and beyond the permissions granted by the GPL license by which Totem Arte Plugin is covered. If you modify this code, you may extend this exception to your version of the code, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. totem-plugin-arte-3.2.1/cache.vala0000644000175000017500000001727612217613113016050 0ustar simonsimon/* * Totem Arte Plugin allows you to watch streams from arte.tv * Copyright (C) 2010, 2011 Simon Wenner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * The Totem Arte Plugin project hereby grants permission for non-GPL compatible * GStreamer plugins to be used and distributed together with GStreamer, Totem * and Totem Arte Plugin. This permission is above and beyond the permissions * granted by the GPL license by which Totem Arte Plugin is covered. * If you modify this code, you may extend this exception to your version of the * code, but you are not obligated to do so. If you do not wish to do so, * delete this exception statement from your version. * */ using GLib; using Gtk; using Soup; public class Cache : GLib.Object { private Soup.SessionAsync session; public string cache_path {get; set;} public Gdk.Pixbuf default_thumbnail {get; private set;} public Cache (string path) { cache_path = path; session = create_session (); /* create the caching directory */ var dir = GLib.File.new_for_path (cache_path); if (!dir.query_exists (null)) { try { dir.make_directory_with_parents (null); debug ("Directory '%s' created", dir.get_path ()); } catch (Error e) { GLib.error ("Could not create caching directory."); } } /* load the default thumbnail */ try { default_thumbnail = new Gdk.Pixbuf.from_file (DEFAULT_THUMBNAIL); } catch (Error e) { GLib.critical ("%s", e.message); } } public bool get_video (ref Video v) { bool success = false; // check the cache string file_path = cache_path + v.get_uuid () + ".video"; var file = GLib.File.new_for_path (file_path); if (file.query_exists (null)) { uint8[] data; try { file.load_contents (null, out data, null); success = v.deserialize ((string) data); } catch (Error e) { GLib.error ("%s", e.message); } if (success) return true; } // download it var extractor = new ImageUrlExtractor (); debug ("Extract missing image url: %s", v.title); try { v.image_url = extractor.get_url (VideoQuality.UNKNOWN, Language.UNKNOWN, v.page_url); // write to cache var file_stream = file.create (GLib.FileCreateFlags.REPLACE_DESTINATION); var data_stream = new DataOutputStream (file_stream); data_stream.put_string (v.serialize ()); // set the last modification to the video publication date set_file_modification_date_to_publication_date (file, v.publication_date); } catch (ExtractionError e) { GLib.critical ("Image url extraction failed: %s", e.message); return false; } catch (Error e) { GLib.critical ("Caching video object failed: %s", e.message); return false; } return true; } public Gdk.Pixbuf load_pixbuf (string? url) { if (url == null) { return default_thumbnail; } /* check if file exists in cache */ string file_path = cache_path + Checksum.compute_for_string (ChecksumType.MD5, url); Gdk.Pixbuf pb = null; var file = GLib.File.new_for_path (file_path); if (file.query_exists (null)) { try { pb = new Gdk.Pixbuf.from_file (file_path); } catch (Error e) { GLib.critical ("%s", e.message); return default_thumbnail; } return pb; } /* otherwise, use the default thumbnail */ return default_thumbnail; } public Gdk.Pixbuf download_pixbuf (string? url, TimeVal pub_date) { if (url == null) { return default_thumbnail; } string file_path = cache_path + Checksum.compute_for_string (ChecksumType.MD5, url); Gdk.Pixbuf pb = null; /* get file from the net */ var msg = new Soup.Message ("GET", url); session.send_message (msg); if (msg.response_body.data == null) { return default_thumbnail; } /* rescale it */ var img_stream = new MemoryInputStream.from_data (msg.response_body.data, null); try { /* original size: 720px × 406px */ pb = new Gdk.Pixbuf.from_stream_at_scale (img_stream, THUMBNAIL_WIDTH, -1, true, null); } catch (GLib.Error e) { GLib.critical ("%s", e.message); return default_thumbnail; } /* store the file on disk as PNG */ try { pb.save (file_path, "png", null); } catch (Error e) { GLib.critical ("%s", e.message); } /* set the last modification to the video publication date */ GLib.File file = File.new_for_path (file_path); set_file_modification_date_to_publication_date (file, pub_date); return pb; } /* Delete outdated files (we set modification dates to relative videos publication dates). */ public void delete_cruft () { debug ("Cache: Delete outdated files."); GLib.TimeVal time = TimeVal (); GLib.TimeVal mod_time; time.get_current_time (); /* Subtract 7 days and 2 hours (because videos are not removed immediately) */ time.tv_sec -= (7*24*60*60 + 2*60*60); uint deleted_file_count = 0; var directory = File.new_for_path (cache_path); try { var enumerator = directory.enumerate_children ( GLib.FileAttribute.TIME_MODIFIED + "," + GLib.FileAttribute.STANDARD_NAME, GLib.FileQueryInfoFlags.NONE, null); GLib.FileInfo file_info; while ((file_info = enumerator.next_file (null)) != null) { mod_time = file_info.get_modification_time (); if (mod_time.tv_sec < time.tv_sec) { var file = File.new_for_path (cache_path + file_info.get_name ()); file.delete (null); deleted_file_count++; } } enumerator.close (null); } catch (Error e) { GLib.critical ("%s", e.message); } debug ("Cache: Deleted %u files.", deleted_file_count); } private static void set_file_modification_date_to_publication_date ( GLib.File file, TimeVal pub_date) { if (pub_date.tv_sec != 0) { try { GLib.FileInfo fi = file.query_info (GLib.FileAttribute.TIME_MODIFIED, GLib.FileQueryInfoFlags.NONE, null); fi.set_modification_time (pub_date); file.set_attributes_from_info (fi, GLib.FileQueryInfoFlags.NONE, null); } catch (Error e) { GLib.critical ("%s", e.message); } } } } totem-plugin-arte-3.2.1/connection-status.vala0000644000175000017500000001040112217613113020444 0ustar simonsimon/* * Totem Arte Plugin allows you to watch streams from arte.tv * Copyright (C) 2012 Simon Wenner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * The Totem Arte Plugin project hereby grants permission for non-GPL compatible * GStreamer plugins to be used and distributed together with GStreamer, Totem * and Totem Arte Plugin. This permission is above and beyond the permissions * granted by the GPL license by which Totem Arte Plugin is covered. * If you modify this code, you may extend this exception to your version of the * code, but you are not obligated to do so. If you do not wish to do so, * delete this exception statement from your version. * */ using GLib; // unused because GLib.Bus.get_proxy crashes totem (Vala 0.15.2) [DBus (name = "org.freedesktop.NetworkManager")] interface NetworkManagerDBus : GLib.Object { [DBus (name = "state")] //public abstract uint32 state () throws IOError; public signal void state_changed (uint32 state); } public class ConnectionStatus : GLib.Object { // Source: // http://projects.gnome.org/NetworkManager/developers/api/09/spec.html#type-NM_STATE private enum NMState { UNKNOWN = 0, ASLEEP = 10, DISCONNECTED = 20, DISCONNECTING = 30, CONNECTING = 40, CONNECTED_LOCAL = 50, CONNECTED_SITE = 60, CONNECTED_GLOBAL = 70 } //private NetworkManagerDBus nm; private GLib.DBusProxy NMProxy; private const string NM_SERVICE = "org.freedesktop.NetworkManager"; private const string NM_IFACE = "org.freedesktop.NetworkManager"; private const string NM_OBJECT_PATH = "/org/freedesktop/NetworkManager"; public bool is_online { private set; public get; default = true; } public ConnectionStatus () { GLib.Bus.watch_name (GLib.BusType.SYSTEM, NM_SERVICE, GLib.BusNameWatcherFlags.NONE, name_appeared_cb, name_vanished_cb); } private void name_appeared_cb (GLib.DBusConnection connection, string name, string name_owner) { try { // nicer solutions, but all crash (Vala 0.15.2): //this.nm = GLib.Bus.get_proxy_sync (GLib.BusType.SYSTEM, NM_IFACE, NM_OBJECT_PATH); //this.nm = connection.get_proxy_sync (name, NM_OBJECT_PATH, 0); //this.nm.state_changed.connect ((state) => { stdout.printf ("state: %u\n", state); }); //int32 state = nm.state (); this.NMProxy = new GLib.DBusProxy.sync (connection, 0, null, NM_IFACE, NM_OBJECT_PATH, name); Variant variant = this.NMProxy.get_cached_property ("State"); uint32 state = variant.get_uint32 (); this.is_online = (state == NMState.CONNECTED_GLOBAL); this.NMProxy.g_signal.connect (proxy_signal_cb); } catch (GLib.Error e) { this.is_online = true; // online by default GLib.warning ("%s", e.message); } } private void name_vanished_cb (GLib.DBusConnection connection, string name) { // delete the proxy this.NMProxy = null; this.is_online = true; // online by default } private void proxy_signal_cb (GLib.DBusProxy obj, string? sender_name, string signal_name, Variant parameters) { if (signal_name == "StateChanged") { uint32 state = parameters.get_child_value (0).get_uint32 (); this.is_online = (state == NMState.CONNECTED_GLOBAL); // emit signal status_changed (this.is_online); } } public signal void status_changed (bool is_online); } totem-plugin-arte-3.2.1/po/0000755000175000017500000000000012217613113014541 5ustar simonsimontotem-plugin-arte-3.2.1/po/arte-totem.pot0000644000175000017500000000704412217613113017353 0ustar simonsimon# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-09-20 19:28+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: ../arteplus7.vala:176 msgid "Reload feed" msgstr "" #: ../arteplus7.vala:180 msgid "Clear the search text" msgstr "" #: ../arteplus7.vala:209 msgid "Arte+7" msgstr "" #: ../arteplus7.vala:247 msgid "French" msgstr "" #: ../arteplus7.vala:248 msgid "German" msgstr "" #: ../arteplus7.vala:278 msgid "l_ow" msgstr "" #: ../arteplus7.vala:280 msgid "_medium" msgstr "" #: ../arteplus7.vala:282 msgid "_high" msgstr "" #: ../arteplus7.vala:329 msgid "_Language:" msgstr "" #: ../arteplus7.vala:337 msgid "Video quality:" msgstr "" #. display offline message #: ../arteplus7.vala:355 msgid "No internet connection." msgstr "" #. display loading message #: ../arteplus7.vala:372 msgid "Loading..." msgstr "" #: ../arteplus7.vala:431 msgid "Markup Parser Error" msgstr "" #: ../arteplus7.vala:432 msgid "Sorry, the plugin could not parse the Arte video feed." msgstr "" #: ../arteplus7.vala:434 msgid "Network problem" msgstr "" #: ../arteplus7.vala:435 msgid "" "Sorry, the plugin could not download the Arte video feed.\n" "Please verify your network settings and (if any) your proxy settings." msgstr "" #. This video access is restricted #: ../arteplus7.vala:503 msgid "This video access is restricted" msgstr "" #: ../arteplus7.vala:504 msgid "" "It seems that, because of its content, this video can only be watched in a " "precise time interval.\n" "\n" "You may retry later, for example between 11 PM and 5 AM." msgstr "" #. The video is part of the XML/RSS feed but no stream is available yet #: ../arteplus7.vala:507 msgid "This video is not available yet" msgstr "" #: ../arteplus7.vala:508 msgid "" "Sorry, the plugin could not find any stream URL.\n" "It seems that this video is not available yet, even on the Arte web-player.\n" "\n" "Please retry later." msgstr "" #. Network problems #. ExtractionError.EXTRACTION_ERROR or an unspecified error #: ../arteplus7.vala:511 ../arteplus7.vala:515 msgid "Video URL Extraction Error" msgstr "" #: ../arteplus7.vala:512 msgid "" "Sorry, the plugin could not extract a valid stream URL.\n" "Please verify your network settings and (if any) your proxy settings." msgstr "" #: ../arteplus7.vala:516 msgid "" "Sorry, the plugin could not extract a valid stream URL.\n" "Perhaps this stream is not yet available, you may retry in a few minutes.\n" "\n" "Be aware that this service is only available for IPs within Austria, " "Belgium, Germany, France and Switzerland." msgstr "" #: ../video-list-view.vala:139 msgid "Less than 1 minute until removal" msgstr "" #: ../video-list-view.vala:141 #, c-format msgid "Less than %.0f minutes until removal" msgstr "" #: ../video-list-view.vala:144 msgid "Less than 1 hour until removal" msgstr "" #: ../video-list-view.vala:146 #, c-format msgid "Less than %.0f hours until removal" msgstr "" #: ../video-list-view.vala:148 msgid "1 day until removal" msgstr "" #: ../video-list-view.vala:150 #, c-format msgid "%.0f days until removal" msgstr "" #: ../video-list-view.vala:281 msgid "_Open in Web Browser" msgstr "" totem-plugin-arte-3.2.1/po/fr.po0000644000175000017500000001232012217613113015506 0ustar simonsimon# I18n file for Arte+7 totem plugin # Copyright (C) 2013 Simon Wenner # This file is distributed under the same license as the Totem Arte Plugin package. # This file was first created by Nicolas Delvaux , 2010. # msgid "" msgstr "" "Project-Id-Version: 3.2.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-09-20 19:28+0200\n" "PO-Revision-Date: 2013-09-10 22:44+0200\n" "Last-Translator: Nicolas Delvaux \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../arteplus7.vala:176 msgid "Reload feed" msgstr "Recharger la liste des vidéos" #: ../arteplus7.vala:180 msgid "Clear the search text" msgstr "Effacer le texte recherché" #: ../arteplus7.vala:209 msgid "Arte+7" msgstr "Arte+7" #: ../arteplus7.vala:247 msgid "French" msgstr "Français" #: ../arteplus7.vala:248 msgid "German" msgstr "Allemand" #: ../arteplus7.vala:278 msgid "l_ow" msgstr "_basse" #: ../arteplus7.vala:280 msgid "_medium" msgstr "_moyenne" #: ../arteplus7.vala:282 msgid "_high" msgstr "_haute" #: ../arteplus7.vala:329 msgid "_Language:" msgstr "_Langage :" #: ../arteplus7.vala:337 msgid "Video quality:" msgstr "Qualité vidéo :" #. display offline message #: ../arteplus7.vala:355 msgid "No internet connection." msgstr "Pas de connexion Internet." #. display loading message #: ../arteplus7.vala:372 msgid "Loading..." msgstr "Chargement..." #: ../arteplus7.vala:431 msgid "Markup Parser Error" msgstr "Erreur de l'analyseur syntaxique" #: ../arteplus7.vala:432 msgid "Sorry, the plugin could not parse the Arte video feed." msgstr "Désolé, le greffon n'a pas pu analyser le flux vidéo Arte." #: ../arteplus7.vala:434 msgid "Network problem" msgstr "Problème réseau" #: ../arteplus7.vala:435 msgid "" "Sorry, the plugin could not download the Arte video feed.\n" "Please verify your network settings and (if any) your proxy settings." msgstr "" "Désolé, le greffon n'a pas pu télécharger le flux vidéo Arte.\n" "Veuillez vérifier les paramètres de votre connexion et (si besoin) les " "paramètres de votre proxy." #. This video access is restricted #: ../arteplus7.vala:503 msgid "This video access is restricted" msgstr "L'accès à cette vidéo est restreint" #: ../arteplus7.vala:504 msgid "" "It seems that, because of its content, this video can only be watched in a " "precise time interval.\n" "\n" "You may retry later, for example between 11 PM and 5 AM." msgstr "" "Il semble que, en raison de son contenu, cette vidéo ne puisse être vue qu'à " "certains moments de la journée.\n" "\n" "Vous pouvez réessayer plus tard, par exemple entre 23h et 5h." #. The video is part of the XML/RSS feed but no stream is available yet #: ../arteplus7.vala:507 msgid "This video is not available yet" msgstr "Cette vidéo n'est pas encore disponible" #: ../arteplus7.vala:508 msgid "" "Sorry, the plugin could not find any stream URL.\n" "It seems that this video is not available yet, even on the Arte web-player.\n" "\n" "Please retry later." msgstr "" "Désolé, le greffon n'a pas pu trouver la moindre adresse de flux.\n" "Il semble que cette vidéo ne soit pas encore disponible, même depuis le " "lecteur du site de Arte !\n" "\n" "Réessayez plus tard." #. Network problems #. ExtractionError.EXTRACTION_ERROR or an unspecified error #: ../arteplus7.vala:511 ../arteplus7.vala:515 msgid "Video URL Extraction Error" msgstr "Erreur d'extraction de l'URL de la vidéo" #: ../arteplus7.vala:512 msgid "" "Sorry, the plugin could not extract a valid stream URL.\n" "Please verify your network settings and (if any) your proxy settings." msgstr "" "Désolé, le greffon n'a pas pu extraire une adresse de flux valide.\n" "Veuillez vérifier les paramètres de votre connexion et (si besoin) les " "paramètres de votre proxy." #: ../arteplus7.vala:516 msgid "" "Sorry, the plugin could not extract a valid stream URL.\n" "Perhaps this stream is not yet available, you may retry in a few minutes.\n" "\n" "Be aware that this service is only available for IPs within Austria, " "Belgium, Germany, France and Switzerland." msgstr "" "Désolé, le greffon n'a pas pu extraire une adresse de flux valide.\n" "Il est possible que le flux ne soit pas encore disponible, vous pouvez " "réessayer dans quelques minutes.\n" "\n" "Notez que ce service n'est disponible que si votre IP est allemande, " "autrichienne, belge, française ou encore suisse." #: ../video-list-view.vala:139 msgid "Less than 1 minute until removal" msgstr "Moins de 1 minute avant suppression" #: ../video-list-view.vala:141 #, c-format msgid "Less than %.0f minutes until removal" msgstr "Moins de %.0f minutes avant suppression" #: ../video-list-view.vala:144 msgid "Less than 1 hour until removal" msgstr "Moins de 1 heure avant suppression" #: ../video-list-view.vala:146 #, c-format msgid "Less than %.0f hours until removal" msgstr "Moins de %.0f heures avant suppression" #: ../video-list-view.vala:148 msgid "1 day until removal" msgstr "1 jour avant suppression" #: ../video-list-view.vala:150 #, c-format msgid "%.0f days until removal" msgstr "%.0f jours avant suppression" #: ../video-list-view.vala:281 msgid "_Open in Web Browser" msgstr "_Ouvrir dans le navigateur Web" totem-plugin-arte-3.2.1/po/POTFILES.skip0000644000175000017500000000003612217613113016655 0ustar simonsimonarteplus7.c video-list-view.c totem-plugin-arte-3.2.1/po/de.po0000644000175000017500000001210612217613113015471 0ustar simonsimon# I18n file for Arte+7 totem plugin # Copyright (C) 2013 Simon Wenner # This file is distributed under the same license as the Totem Arte Plugin package. # This file was first created by Nicolas Delvaux , 2010. # msgid "" msgstr "" "Project-Id-Version: 3.2.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-09-20 19:28+0200\n" "PO-Revision-Date: 2012-05-02 22:51+0200\n" "Last-Translator: Nicolas Delvaux \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: ../arteplus7.vala:176 msgid "Reload feed" msgstr "Videos aktualisieren" #: ../arteplus7.vala:180 msgid "Clear the search text" msgstr "Suchtext löschen" #: ../arteplus7.vala:209 msgid "Arte+7" msgstr "Arte+7" #: ../arteplus7.vala:247 msgid "French" msgstr "Französisch" #: ../arteplus7.vala:248 msgid "German" msgstr "Deutsch" #: ../arteplus7.vala:278 msgid "l_ow" msgstr "_niedrig" #: ../arteplus7.vala:280 msgid "_medium" msgstr "_mittel" #: ../arteplus7.vala:282 msgid "_high" msgstr "_hoch" #: ../arteplus7.vala:329 msgid "_Language:" msgstr "_Sprache:" #: ../arteplus7.vala:337 msgid "Video quality:" msgstr "Videoqualität:" #. display offline message #: ../arteplus7.vala:355 msgid "No internet connection." msgstr "Keine Internetverbindung." #. display loading message #: ../arteplus7.vala:372 msgid "Loading..." msgstr "Lade..." #: ../arteplus7.vala:431 msgid "Markup Parser Error" msgstr "Markup Lesefehler" #: ../arteplus7.vala:432 msgid "Sorry, the plugin could not parse the Arte video feed." msgstr "Entschuldigung, das Plugin konnte den Arte-Videofeed nicht lesen." #: ../arteplus7.vala:434 msgid "Network problem" msgstr "Verbindungsproblem" #: ../arteplus7.vala:435 msgid "" "Sorry, the plugin could not download the Arte video feed.\n" "Please verify your network settings and (if any) your proxy settings." msgstr "" "Entschuldigung, das Plugin konnte den Arte-Videofeed nicht herunterladen.\n" "Bitte überprüfen sie Ihre Netzwerk- und (falls vorhanden) Proxy-" "Einstellungen." #. This video access is restricted #: ../arteplus7.vala:503 msgid "This video access is restricted" msgstr "Dieses Video ist nur eingeschränkt verfügbar" #: ../arteplus7.vala:504 msgid "" "It seems that, because of its content, this video can only be watched in a " "precise time interval.\n" "\n" "You may retry later, for example between 11 PM and 5 AM." msgstr "" "Es scheint, dass aufgrund des Inhalts, dieses Videos nur in einem gewissen " "Zeitfenster verfügbar ist.\n" "\n" "Versuchen sie es erneut, z.B. zwischen 23:00 und 5:00 Uhr." #. The video is part of the XML/RSS feed but no stream is available yet #: ../arteplus7.vala:507 msgid "This video is not available yet" msgstr "Video ist nocht nicht verfügbar" #: ../arteplus7.vala:508 msgid "" "Sorry, the plugin could not find any stream URL.\n" "It seems that this video is not available yet, even on the Arte web-player.\n" "\n" "Please retry later." msgstr "" "Entschuldigung, das Plugin konnte keine Stream URL finden.\n" "Es scheint als ob dieses Video noch nicht Verfügbar ist, auch nicht im Arte " "Web-Player.\n" "\n" "Bitte versuche es später nochmals." #. Network problems #. ExtractionError.EXTRACTION_ERROR or an unspecified error #: ../arteplus7.vala:511 ../arteplus7.vala:515 msgid "Video URL Extraction Error" msgstr "Video URL Extraktionsfehler" #: ../arteplus7.vala:512 msgid "" "Sorry, the plugin could not extract a valid stream URL.\n" "Please verify your network settings and (if any) your proxy settings." msgstr "" "Entschuldigung, das Plugin konnte keine gültige Stream URL extrahieren.\n" "Bitte überprüfen sie Ihre Netzwerk- und (falls vorhanden) Proxy-" "Einstellungen." #: ../arteplus7.vala:516 msgid "" "Sorry, the plugin could not extract a valid stream URL.\n" "Perhaps this stream is not yet available, you may retry in a few minutes.\n" "\n" "Be aware that this service is only available for IPs within Austria, " "Belgium, Germany, France and Switzerland." msgstr "" "Entschuldigung, das Plugin konnte keine gültige Stream URL extrahieren.\n" "Vielleicht ist der Stream noch nicht verfügbar, versuche es später " "nochmals.\n" "\n" "Bedenke, dass dieser Service nur für IPs aus Österreich, Belgien, " "Deutschland, Frankreich und der Schweiz verfügbar ist." #: ../video-list-view.vala:139 msgid "Less than 1 minute until removal" msgstr "Weniger als eine Minute verfügbar" #: ../video-list-view.vala:141 #, c-format msgid "Less than %.0f minutes until removal" msgstr "Weniger als %.0f Minuten verfügbar" #: ../video-list-view.vala:144 msgid "Less than 1 hour until removal" msgstr "Weniger als eine Stunde verfügbar" #: ../video-list-view.vala:146 #, c-format msgid "Less than %.0f hours until removal" msgstr "Weniger als %.0f Stunden verfügbar" #: ../video-list-view.vala:148 msgid "1 day until removal" msgstr "Noch einen Tag verfügbar" #: ../video-list-view.vala:150 #, c-format msgid "%.0f days until removal" msgstr "Noch %.0f Tage verfügbar" #: ../video-list-view.vala:281 msgid "_Open in Web Browser" msgstr "Link im Browser ö_ffnen" totem-plugin-arte-3.2.1/po/POTFILES.in0000644000175000017500000000004412217613113016314 0ustar simonsimonarteplus7.vala video-list-view.vala totem-plugin-arte-3.2.1/org.gnome.totem.plugins.arteplus7.gschema.xml0000644000175000017500000000166412217613113024711 0ustar simonsimon 'Medium' Quality The video stream quality. 'Unknown' Language The language of the video stream (French or German). totem-plugin-arte-3.2.1/cell-renderer-video.vala0000644000175000017500000001065412217613113020625 0ustar simonsimon/* * Totem Arte Plugin allows you to watch streams from arte.tv * Copyright (C) 2013 Nicolas Delvaux * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * The Totem Arte Plugin project hereby grants permission for non-GPL compatible * GStreamer plugins to be used and distributed together with GStreamer, Totem * and Totem Arte Plugin. This permission is above and beyond the permissions * granted by the GPL license by which Totem Arte Plugin is covered. * If you modify this code, you may extend this exception to your version of the * code, but you are not obligated to do so. If you do not wish to do so, * delete this exception statement from your version. * */ using Gtk; public class CellRendererVideo : Gtk.CellRenderer /** * This is a simple re-implementation of "Totem.CellRendererVideo". * The original widget was removed from Totem since the 3.8 version. */ { public Gdk.Pixbuf thumbnail { get; set; } public string title { get; set; } public override void get_size (Widget widget, Gdk.Rectangle? cell_area, out int x_offset, out int y_offset, out int width, out int height) { x_offset = 0; y_offset = 0; if (this.thumbnail != null) { width = this.thumbnail.width; height = this.thumbnail.height + 30; } else { // This is initialization time, nothing to draw // These values have no importance width = 30; height = 30; } } public override void render (Cairo.Context ctx, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, CellRendererState flags) { if (this.thumbnail == null) { // This is initialization time, nothing to draw return; } Gtk.StateFlags state; /* Sort out the state (used to draw the title) */ if (!this.get_sensitive ()) { state = Gtk.StateFlags.INSENSITIVE; } else if ((flags & Gtk.CellRendererState.SELECTED) == Gtk.CellRendererState.SELECTED) { if (widget.has_focus) state = Gtk.StateFlags.SELECTED; else state = Gtk.StateFlags.ACTIVE; } else if ((flags & Gtk.CellRendererState.PRELIT) == Gtk.CellRendererState.PRELIT && widget.get_state_flags () == Gtk.StateFlags.PRELIGHT) { state = Gtk.StateFlags.PRELIGHT; } else { if (widget.get_state_flags () == Gtk.StateFlags.INSENSITIVE) state = Gtk.StateFlags.INSENSITIVE; else state = Gtk.StateFlags.NORMAL; } /* Draw the title */ StyleContext context = widget.get_style_context (); Pango.Layout layout = widget.create_pango_layout (this.title); Pango.FontDescription desc = context.get_font (state); desc.set_weight (Pango.Weight.BOLD); layout.set_font_description (desc); layout.set_ellipsize (Pango.EllipsizeMode.END); layout.set_width (cell_area.width * Pango.SCALE); layout.set_alignment (Pango.Alignment.CENTER); context.set_state (state); context.render_layout (ctx, background_area.x, background_area.y + this.thumbnail.height + 8, layout); /* Draw the thumbnail */ Gdk.cairo_set_source_pixbuf (ctx, this.thumbnail, (background_area.width - this.thumbnail.width) / 2, cell_area.y + 3); Gdk.cairo_rectangle (ctx, cell_area); ctx.fill (); } } totem-plugin-arte-3.2.1/arteparser.vala0000644000175000017500000004275412217613113017154 0ustar simonsimon/* * Totem Arte Plugin allows you to watch streams from arte.tv * Copyright (C) 2009, 2010, 2011, 2012 Simon Wenner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * The Totem Arte Plugin project hereby grants permission for non-GPL compatible * GStreamer plugins to be used and distributed together with GStreamer, Totem * and Totem Arte Plugin. This permission is above and beyond the permissions * granted by the GPL license by which Totem Arte Plugin is covered. * If you modify this code, you may extend this exception to your version of the * code, but you are not obligated to do so. If you do not wish to do so, * delete this exception statement from your version. * */ using GLib; using Soup; using Json; public abstract class ArteParser : GLib.Object { public bool has_data { get; protected set; default = false; } // more data available protected string xml_fr; protected string xml_de; protected GLib.SList