19
novembre
2012
Bibliothèque de vidéos web (Linux – C/Vala)
novembre
2012
Un article de Rachel
Pas de commentaires
Voici une nouvelle version de ma bibliothèque.
Plus légère, elle nécessite le dépendances suivantes :
gee-1.0 libsoup-2.4 json-glib-1.0
- Le code Vala :
using Soup;
using System.IO;
using System;
using Json;
using Gee;
namespace Media
{
public class Video
{
protected string json;
protected WebClient wc;
protected ArrayList urls;
protected ArrayList qualities;
string str;
Video(){
wc = new WebClient();
this.urls = new ArrayList();
this.qualities = new ArrayList();
}
public Video.with_url(string url){
this();
this.json = wc.download_string(url);
}
public Video.with_parameter(string url, string parameter){
this();
wc.download_file(url,"temp");
File file = File.new_for_path("temp");
var dis = new DataInputStream(file.read());
string str;
while((str = dis.read_line(null))!=null){
if(str.contains(parameter)){
string[] tab = str.split(" = ",0);
tab[1] = tab[1].replace(";","");
this.json = tab[1];
break;
}
}
}
public ArrayList Urls{
get{return this.urls;}
}
public ArrayList Qualities{
get{return this.qualities;}
}
}
public class Youtube : Video
{
public Youtube(string url)
{
base.with_parameter(url,"yt.playerConfig");
var parser = new Parser();
parser.load_from_data(this.json,-1);
var root_object = parser.get_root ().get_object ();
string url_encoded_fmt_stream_map = root_object.get_object_member("args").get_string_member("url_encoded_fmt_stream_map");
string[] table = url_encoded_fmt_stream_map.split("&url=",0);
for(int i = 1; i < table.length; i++)
this.urls.add(String.html_decode(table[i]).replace("&sig=","&signature="));
}
}
public class Dailymotion : Video
{
public Dailymotion(string url)
{
base.with_parameter(url,"var flashvars");
var parser = new Parser();
parser.load_from_data(this.json,-1);
var root_object = parser.get_root ().get_object ();
this.json = root_object.get_string_member("sequence");
this.json = String.html_decode(this.json);
parser.load_from_data(this.json,-1);
root_object = parser.get_root ().get_object ();
Json.Object param = root_object.get_array_member("sequence").get_object_element(0).get_array_member("layerList").get_object_element(0).get_array_member("sequenceList").get_object_element(1).get_array_member("layerList").get_object_element(2).get_object_member("param");
this.urls.add(param.get_string_member("ldURL"));
this.urls.add(param.get_string_member("sdURL"));
this.urls.add(param.get_string_member("hqURL"));
}
}
public class Hexaglobe : Video
{
public Hexaglobe(string url)
{
base();
this.json = this.wc.download_string(url);
}
}
public class Vimeo : Video
{
string signature;
int64 id;
int64 timestamp;
public Vimeo(string url)
{
base.with_url(url.replace("vimeo.com","player.vimeo.com/config"));
var parser = new Parser();
parser.load_from_data(this.json,-1);
var root_object = parser.get_root ().get_object ();
signature = root_object.get_object_member("request").get_string_member("signature");
timestamp = root_object.get_object_member("request").get_int_member("timestamp");
id = root_object.get_object_member("video").get_int_member("id");
this.urls.add("http://player.vimeo.com/play_redirect?clip_id=" + id.to_string() + "&sig=" + signature + "&time=" + timestamp.to_string()+"&quality=hd");
this.urls.add("http://player.vimeo.com/play_redirect?clip_id=" + id.to_string() + "&sig=" + signature + "&time=" + timestamp.to_string());
this.qualities.add("hd");
this.qualities.add("sd");
}
}
}
namespace System
{
public enum StringSplitOptions
{
RemoveEmptyEntries,
None
}
public class String
{
public static string[] split_with_strings(string raw_string, string[] delimiters, StringSplitOptions options)
{
ArrayList liste = new ArrayList();
ArrayList liste2 = new ArrayList();
liste.add(raw_string);
foreach(string delimiter in delimiters)
{
foreach(string item in liste)
{
string[] split = item.split(delimiter,0);
foreach(string s in split)
{
if(options == StringSplitOptions.RemoveEmptyEntries){
if(s!="")liste2.add(s);
}else{
liste2.add(s);
}
}
}
liste = liste2;
liste2 = new ArrayList();
}
string[] result = new string[liste.size];
for(int i=0; i<liste.size;i++)
result[i] = liste[i];
return result;
}
public static string html_decode(string raw_string)
{
return raw_string.replace("%5C","\\")
.replace("%3C","")
.replace("%5B","[")
.replace("%7B","{")
.replace("%5D","]")
.replace("%7D","}")
.replace("%3A",":")
.replace("%2F","/")
.replace("%3F","?")
.replace("%3D","=")
.replace("%26","&")
.replace("%22","\"")
.replace("%2C",",")
.replace("%3B",";")
.replace("%25","%");
}
}
namespace IO
{
public class WebClient
{
Session session;
Message message;
public WebClient()
{
session = new SessionAsync();
}
public void download_file(string uri, string filename)
{
if(FileUtils.test(filename,FileTest.EXISTS))
FileUtils.remove(filename);
FileUtils.set_data(filename,this.download_data(uri));
}
public uint8[] download_data(string uri)
{
message = new Message("GET",uri);
session.send_message(message);
return message.response_body.data;
}
public string download_string(string uri)
{
return (string)this.download_data(uri);
}
}
}
} - Le code C :
/* libmedia.c generated by valac 0.18.0, the Vala compiler
* generated from libmedia.vala, do not modify */
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include <gio/gio.h>
#include <json-glib/json-glib.h>
#include <libsoup/soup.h>
#include <glib/gstdio.h>
#include <gobject/gvaluecollector.h>
#define MEDIA_TYPE_VIDEO (media_video_get_type ())
#define MEDIA_VIDEO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MEDIA_TYPE_VIDEO, MediaVideo))
#define MEDIA_VIDEO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MEDIA_TYPE_VIDEO, MediaVideoClass))
#define MEDIA_IS_VIDEO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MEDIA_TYPE_VIDEO))
#define MEDIA_IS_VIDEO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MEDIA_TYPE_VIDEO))
#define MEDIA_VIDEO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MEDIA_TYPE_VIDEO, MediaVideoClass))
typedef struct _MediaVideo MediaVideo;
typedef struct _MediaVideoClass MediaVideoClass;
typedef struct _MediaVideoPrivate MediaVideoPrivate;
#define SYSTEM_IO_TYPE_WEB_CLIENT (system_io_web_client_get_type ())
#define SYSTEM_IO_WEB_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYSTEM_IO_TYPE_WEB_CLIENT, SystemIOWebClient))
#define SYSTEM_IO_WEB_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYSTEM_IO_TYPE_WEB_CLIENT, SystemIOWebClientClass))
#define SYSTEM_IO_IS_WEB_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYSTEM_IO_TYPE_WEB_CLIENT))
#define SYSTEM_IO_IS_WEB_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYSTEM_IO_TYPE_WEB_CLIENT))
#define SYSTEM_IO_WEB_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYSTEM_IO_TYPE_WEB_CLIENT, SystemIOWebClientClass))
typedef struct _SystemIOWebClient SystemIOWebClient;
typedef struct _SystemIOWebClientClass SystemIOWebClientClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _system_io_web_client_unref0(var) ((var == NULL) ? NULL : (var = (system_io_web_client_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _MediaParamSpecVideo MediaParamSpecVideo;
#define MEDIA_TYPE_YOUTUBE (media_youtube_get_type ())
#define MEDIA_YOUTUBE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MEDIA_TYPE_YOUTUBE, MediaYoutube))
#define MEDIA_YOUTUBE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MEDIA_TYPE_YOUTUBE, MediaYoutubeClass))
#define MEDIA_IS_YOUTUBE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MEDIA_TYPE_YOUTUBE))
#define MEDIA_IS_YOUTUBE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MEDIA_TYPE_YOUTUBE))
#define MEDIA_YOUTUBE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MEDIA_TYPE_YOUTUBE, MediaYoutubeClass))
typedef struct _MediaYoutube MediaYoutube;
typedef struct _MediaYoutubeClass MediaYoutubeClass;
typedef struct _MediaYoutubePrivate MediaYoutubePrivate;
#define __vala_JsonObject_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonObject_free (var), NULL)))
#define MEDIA_TYPE_DAILYMOTION (media_dailymotion_get_type ())
#define MEDIA_DAILYMOTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MEDIA_TYPE_DAILYMOTION, MediaDailymotion))
#define MEDIA_DAILYMOTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MEDIA_TYPE_DAILYMOTION, MediaDailymotionClass))
#define MEDIA_IS_DAILYMOTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MEDIA_TYPE_DAILYMOTION))
#define MEDIA_IS_DAILYMOTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MEDIA_TYPE_DAILYMOTION))
#define MEDIA_DAILYMOTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MEDIA_TYPE_DAILYMOTION, MediaDailymotionClass))
typedef struct _MediaDailymotion MediaDailymotion;
typedef struct _MediaDailymotionClass MediaDailymotionClass;
typedef struct _MediaDailymotionPrivate MediaDailymotionPrivate;
#define MEDIA_TYPE_HEXAGLOBE (media_hexaglobe_get_type ())
#define MEDIA_HEXAGLOBE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MEDIA_TYPE_HEXAGLOBE, MediaHexaglobe))
#define MEDIA_HEXAGLOBE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MEDIA_TYPE_HEXAGLOBE, MediaHexaglobeClass))
#define MEDIA_IS_HEXAGLOBE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MEDIA_TYPE_HEXAGLOBE))
#define MEDIA_IS_HEXAGLOBE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MEDIA_TYPE_HEXAGLOBE))
#define MEDIA_HEXAGLOBE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MEDIA_TYPE_HEXAGLOBE, MediaHexaglobeClass))
typedef struct _MediaHexaglobe MediaHexaglobe;
typedef struct _MediaHexaglobeClass MediaHexaglobeClass;
typedef struct _MediaHexaglobePrivate MediaHexaglobePrivate;
#define MEDIA_TYPE_VIMEO (media_vimeo_get_type ())
#define MEDIA_VIMEO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MEDIA_TYPE_VIMEO, MediaVimeo))
#define MEDIA_VIMEO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MEDIA_TYPE_VIMEO, MediaVimeoClass))
#define MEDIA_IS_VIMEO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MEDIA_TYPE_VIMEO))
#define MEDIA_IS_VIMEO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MEDIA_TYPE_VIMEO))
#define MEDIA_VIMEO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MEDIA_TYPE_VIMEO, MediaVimeoClass))
typedef struct _MediaVimeo MediaVimeo;
typedef struct _MediaVimeoClass MediaVimeoClass;
typedef struct _MediaVimeoPrivate MediaVimeoPrivate;
#define SYSTEM_TYPE_STRING_SPLIT_OPTIONS (system_string_split_options_get_type ())
#define SYSTEM_TYPE_STRING (system_string_get_type ())
#define SYSTEM_STRING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYSTEM_TYPE_STRING, SystemString))
#define SYSTEM_STRING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYSTEM_TYPE_STRING, SystemStringClass))
#define SYSTEM_IS_STRING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYSTEM_TYPE_STRING))
#define SYSTEM_IS_STRING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYSTEM_TYPE_STRING))
#define SYSTEM_STRING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYSTEM_TYPE_STRING, SystemStringClass))
typedef struct _SystemString SystemString;
typedef struct _SystemStringClass SystemStringClass;
typedef struct _SystemStringPrivate SystemStringPrivate;
typedef struct _SystemParamSpecString SystemParamSpecString;
typedef struct _SystemIOWebClientPrivate SystemIOWebClientPrivate;
typedef struct _SystemIOParamSpecWebClient SystemIOParamSpecWebClient;
struct _MediaVideo {
GTypeInstance parent_instance;
volatile int ref_count;
MediaVideoPrivate * priv;
gchar* json;
SystemIOWebClient* wc;
GeeArrayList* urls;
GeeArrayList* qualities;
};
struct _MediaVideoClass {
GTypeClass parent_class;
void (*finalize) (MediaVideo *self);
};
struct _MediaVideoPrivate {
gchar* str;
};
struct _MediaParamSpecVideo {
GParamSpec parent_instance;
};
struct _MediaYoutube {
MediaVideo parent_instance;
MediaYoutubePrivate * priv;
};
struct _MediaYoutubeClass {
MediaVideoClass parent_class;
};
struct _MediaDailymotion {
MediaVideo parent_instance;
MediaDailymotionPrivate * priv;
};
struct _MediaDailymotionClass {
MediaVideoClass parent_class;
};
struct _MediaHexaglobe {
MediaVideo parent_instance;
MediaHexaglobePrivate * priv;
};
struct _MediaHexaglobeClass {
MediaVideoClass parent_class;
};
struct _MediaVimeo {
MediaVideo parent_instance;
MediaVimeoPrivate * priv;
};
struct _MediaVimeoClass {
MediaVideoClass parent_class;
};
struct _MediaVimeoPrivate {
gchar* signature;
gint64 id;
gint64 timestamp;
};
typedef enum {
SYSTEM_STRING_SPLIT_OPTIONS_RemoveEmptyEntries,
SYSTEM_STRING_SPLIT_OPTIONS_None
} SystemStringSplitOptions;
struct _SystemString {
GTypeInstance parent_instance;
volatile int ref_count;
SystemStringPrivate * priv;
};
struct _SystemStringClass {
GTypeClass parent_class;
void (*finalize) (SystemString *self);
};
struct _SystemParamSpecString {
GParamSpec parent_instance;
};
struct _SystemIOWebClient {
GTypeInstance parent_instance;
volatile int ref_count;
SystemIOWebClientPrivate * priv;
};
struct _SystemIOWebClientClass {
GTypeClass parent_class;
void (*finalize) (SystemIOWebClient *self);
};
struct _SystemIOWebClientPrivate {
SoupSession* session;
SoupMessage* message;
};
struct _SystemIOParamSpecWebClient {
GParamSpec parent_instance;
};
static gpointer media_video_parent_class = NULL;
static gpointer media_youtube_parent_class = NULL;
static gpointer media_dailymotion_parent_class = NULL;
static gpointer media_hexaglobe_parent_class = NULL;
static gpointer media_vimeo_parent_class = NULL;
static gpointer system_string_parent_class = NULL;
static gpointer system_io_web_client_parent_class = NULL;
gpointer media_video_ref (gpointer instance);
void media_video_unref (gpointer instance);
GParamSpec* media_param_spec_video (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void media_value_set_video (GValue* value, gpointer v_object);
void media_value_take_video (GValue* value, gpointer v_object);
gpointer media_value_get_video (const GValue* value);
GType media_video_get_type (void) G_GNUC_CONST;
gpointer system_io_web_client_ref (gpointer instance);
void system_io_web_client_unref (gpointer instance);
GParamSpec* system_io_param_spec_web_client (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void system_io_value_set_web_client (GValue* value, gpointer v_object);
void system_io_value_take_web_client (GValue* value, gpointer v_object);
gpointer system_io_value_get_web_client (const GValue* value);
GType system_io_web_client_get_type (void) G_GNUC_CONST;
#define MEDIA_VIDEO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MEDIA_TYPE_VIDEO, MediaVideoPrivate))
enum {
MEDIA_VIDEO_DUMMY_PROPERTY
};
static MediaVideo* media_video_new (void);
static MediaVideo* media_video_construct (GType object_type);
SystemIOWebClient* system_io_web_client_new (void);
SystemIOWebClient* system_io_web_client_construct (GType object_type);
MediaVideo* media_video_new_with_url (const gchar* url);
MediaVideo* media_video_construct_with_url (GType object_type, const gchar* url);
gchar* system_io_web_client_download_string (SystemIOWebClient* self, const gchar* uri);
MediaVideo* media_video_new_with_parameter (const gchar* url, const gchar* parameter);
MediaVideo* media_video_construct_with_parameter (GType object_type, const gchar* url, const gchar* parameter);
void system_io_web_client_download_file (SystemIOWebClient* self, const gchar* uri, const gchar* filename);
GeeArrayList* media_video_get_Urls (MediaVideo* self);
GeeArrayList* media_video_get_Qualities (MediaVideo* self);
static void media_video_finalize (MediaVideo* obj);
GType media_youtube_get_type (void) G_GNUC_CONST;
enum {
MEDIA_YOUTUBE_DUMMY_PROPERTY
};
MediaYoutube* media_youtube_new (const gchar* url);
MediaYoutube* media_youtube_construct (GType object_type, const gchar* url);
static JsonObject* _vala_JsonObject_copy (JsonObject* self);
gchar* system_string_html_decode (const gchar* raw_string);
static void _vala_JsonObject_free (JsonObject* self);
GType media_dailymotion_get_type (void) G_GNUC_CONST;
enum {
MEDIA_DAILYMOTION_DUMMY_PROPERTY
};
MediaDailymotion* media_dailymotion_new (const gchar* url);
MediaDailymotion* media_dailymotion_construct (GType object_type, const gchar* url);
GType media_hexaglobe_get_type (void) G_GNUC_CONST;
enum {
MEDIA_HEXAGLOBE_DUMMY_PROPERTY
};
MediaHexaglobe* media_hexaglobe_new (const gchar* url);
MediaHexaglobe* media_hexaglobe_construct (GType object_type, const gchar* url);
GType media_vimeo_get_type (void) G_GNUC_CONST;
#define MEDIA_VIMEO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MEDIA_TYPE_VIMEO, MediaVimeoPrivate))
enum {
MEDIA_VIMEO_DUMMY_PROPERTY
};
MediaVimeo* media_vimeo_new (const gchar* url);
MediaVimeo* media_vimeo_construct (GType object_type, const gchar* url);
static void media_vimeo_finalize (MediaVideo* obj);
GType system_string_split_options_get_type (void) G_GNUC_CONST;
gpointer system_string_ref (gpointer instance);
void system_string_unref (gpointer instance);
GParamSpec* system_param_spec_string (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void system_value_set_string (GValue* value, gpointer v_object);
void system_value_take_string (GValue* value, gpointer v_object);
gpointer system_value_get_string (const GValue* value);
GType system_string_get_type (void) G_GNUC_CONST;
enum {
SYSTEM_STRING_DUMMY_PROPERTY
};
gchar** system_string_split_with_strings (const gchar* raw_string, gchar** delimiters, int delimiters_length1, SystemStringSplitOptions options, int* result_length1);
SystemString* system_string_new (void);
SystemString* system_string_construct (GType object_type);
static void system_string_finalize (SystemString* obj);
#define SYSTEM_IO_WEB_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SYSTEM_IO_TYPE_WEB_CLIENT, SystemIOWebClientPrivate))
enum {
SYSTEM_IO_WEB_CLIENT_DUMMY_PROPERTY
};
guint8* system_io_web_client_download_data (SystemIOWebClient* self, const gchar* uri, int* result_length1);
static guint8* _vala_array_dup1 (guint8* self, int length);
static void system_io_web_client_finalize (SystemIOWebClient* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);
static MediaVideo* media_video_construct (GType object_type) {
MediaVideo* self = NULL;
SystemIOWebClient* _tmp0_;
GeeArrayList* _tmp1_;
GeeArrayList* _tmp2_;
self = (MediaVideo*) g_type_create_instance (object_type);
_tmp0_ = system_io_web_client_new ();
_system_io_web_client_unref0 (self->wc);
self->wc = _tmp0_;
_tmp1_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
_g_object_unref0 (self->urls);
self->urls = _tmp1_;
_tmp2_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
_g_object_unref0 (self->qualities);
self->qualities = _tmp2_;
return self;
}
static MediaVideo* media_video_new (void) {
return media_video_construct (MEDIA_TYPE_VIDEO);
}
MediaVideo* media_video_construct_with_url (GType object_type, const gchar* url) {
MediaVideo* self = NULL;
SystemIOWebClient* _tmp0_;
const gchar* _tmp1_;
gchar* _tmp2_ = NULL;
g_return_val_if_fail (url != NULL, NULL);
self = (MediaVideo*) g_type_create_instance (object_type);
self = (MediaVideo*) media_video_construct (object_type);
_tmp0_ = self->wc;
_tmp1_ = url;
_tmp2_ = system_io_web_client_download_string (_tmp0_, _tmp1_);
_g_free0 (self->json);
self->json = _tmp2_;
return self;
}
MediaVideo* media_video_new_with_url (const gchar* url) {
return media_video_construct_with_url (MEDIA_TYPE_VIDEO, url);
}
static gboolean string_contains (const gchar* self, const gchar* needle) {
gboolean result = FALSE;
const gchar* _tmp0_;
gchar* _tmp1_ = NULL;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (needle != NULL, FALSE);
_tmp0_ = needle;
_tmp1_ = strstr ((gchar*) self, (gchar*) _tmp0_);
result = _tmp1_ != NULL;
return result;
}
static gchar* string_replace (const gchar* self, const gchar* old, const gchar* replacement) {
gchar* result = NULL;
GError * _inner_error_ = NULL;
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (old != NULL, NULL);
g_return_val_if_fail (replacement != NULL, NULL);
{
const gchar* _tmp0_;
gchar* _tmp1_ = NULL;
gchar* _tmp2_;
GRegex* _tmp3_;
GRegex* _tmp4_;
GRegex* regex;
GRegex* _tmp5_;
const gchar* _tmp6_;
gchar* _tmp7_ = NULL;
gchar* _tmp8_;
_tmp0_ = old;
_tmp1_ = g_regex_escape_string (_tmp0_, -1);
_tmp2_ = _tmp1_;
_tmp3_ = g_regex_new (_tmp2_, 0, 0, &_inner_error_);
_tmp4_ = _tmp3_;
_g_free0 (_tmp2_);
regex = _tmp4_;
if (_inner_error_ != NULL) {
if (_inner_error_->domain == G_REGEX_ERROR) {
goto __catch0_g_regex_error;
}
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
return NULL;
}
_tmp5_ = regex;
_tmp6_ = replacement;
_tmp7_ = g_regex_replace_literal (_tmp5_, self, (gssize) (-1), 0, _tmp6_, 0, &_inner_error_);
_tmp8_ = _tmp7_;
if (_inner_error_ != NULL) {
_g_regex_unref0 (regex);
if (_inner_error_->domain == G_REGEX_ERROR) {
goto __catch0_g_regex_error;
}
_g_regex_unref0 (regex);
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
return NULL;
}
result = _tmp8_;
_g_regex_unref0 (regex);
return result;
}
goto __finally0;
__catch0_g_regex_error:
{
GError* e = NULL;
e = _inner_error_;
_inner_error_ = NULL;
g_assert_not_reached ();
_g_error_free0 (e);
}
__finally0:
if (_inner_error_ != NULL) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
return NULL;
}
}
MediaVideo* media_video_construct_with_parameter (GType object_type, const gchar* url, const gchar* parameter) {
MediaVideo* self = NULL;
SystemIOWebClient* _tmp0_;
const gchar* _tmp1_;
GFile* _tmp2_ = NULL;
GFile* file;
GFile* _tmp3_;
GFileInputStream* _tmp4_ = NULL;
GFileInputStream* _tmp5_;
GFileInputStream* _tmp6_;
GDataInputStream* _tmp7_;
GDataInputStream* _tmp8_;
GDataInputStream* dis;
gchar* str = NULL;
GError * _inner_error_ = NULL;
g_return_val_if_fail (url != NULL, NULL);
g_return_val_if_fail (parameter != NULL, NULL);
self = (MediaVideo*) g_type_create_instance (object_type);
self = (MediaVideo*) media_video_construct (object_type);
_tmp0_ = self->wc;
_tmp1_ = url;
system_io_web_client_download_file (_tmp0_, _tmp1_, "temp");
_tmp2_ = g_file_new_for_path ("temp");
file = _tmp2_;
_tmp3_ = file;
_tmp4_ = g_file_read (_tmp3_, NULL, &_inner_error_);
_tmp5_ = _tmp4_;
if (_inner_error_ != NULL) {
_g_object_unref0 (file);
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
return NULL;
}
_tmp6_ = _tmp5_;
_tmp7_ = g_data_input_stream_new ((GInputStream*) _tmp6_);
_tmp8_ = _tmp7_;
_g_object_unref0 (_tmp6_);
dis = _tmp8_;
while (TRUE) {
GDataInputStream* _tmp9_;
gchar* _tmp10_ = NULL;
gchar* _tmp11_;
const gchar* _tmp12_;
const gchar* _tmp13_;
const gchar* _tmp14_;
gboolean _tmp15_ = FALSE;
_tmp9_ = dis;
_tmp10_ = g_data_input_stream_read_line (_tmp9_, NULL, NULL, &_inner_error_);
_tmp11_ = _tmp10_;
if (_inner_error_ != NULL) {
_g_free0 (str);
_g_object_unref0 (dis);
_g_object_unref0 (file);
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
return NULL;
}
_g_free0 (str);
str = _tmp11_;
_tmp12_ = str;
if (!(_tmp12_ != NULL)) {
break;
}
_tmp13_ = str;
_tmp14_ = parameter;
_tmp15_ = string_contains (_tmp13_, _tmp14_);
if (_tmp15_) {
const gchar* _tmp16_;
gchar** _tmp17_;
gchar** _tmp18_ = NULL;
gchar** tab;
gint tab_length1;
gint _tab_size_;
gchar** _tmp19_;
gint _tmp19__length1;
gchar** _tmp20_;
gint _tmp20__length1;
const gchar* _tmp21_;
gchar* _tmp22_ = NULL;
gchar* _tmp23_;
gchar** _tmp24_;
gint _tmp24__length1;
const gchar* _tmp25_;
gchar* _tmp26_;
_tmp16_ = str;
_tmp18_ = _tmp17_ = g_strsplit (_tmp16_, " = ", 0);
tab = _tmp18_;
tab_length1 = _vala_array_length (_tmp17_);
_tab_size_ = tab_length1;
_tmp19_ = tab;
_tmp19__length1 = tab_length1;
_tmp20_ = tab;
_tmp20__length1 = tab_length1;
_tmp21_ = _tmp20_[1];
_tmp22_ = string_replace (_tmp21_, ";", "");
_g_free0 (_tmp19_[1]);
_tmp19_[1] = _tmp22_;
_tmp23_ = _tmp19_[1];
_tmp24_ = tab;
_tmp24__length1 = tab_length1;
_tmp25_ = _tmp24_[1];
_tmp26_ = g_strdup (_tmp25_);
_g_free0 (self->json);
self->json = _tmp26_;
tab = (_vala_array_free (tab, tab_length1, (GDestroyNotify) g_free), NULL);
break;
}
}
_g_free0 (str);
_g_object_unref0 (dis);
_g_object_unref0 (file);
return self;
}
MediaVideo* media_video_new_with_parameter (const gchar* url, const gchar* parameter) {
return media_video_construct_with_parameter (MEDIA_TYPE_VIDEO, url, parameter);
}
GeeArrayList* media_video_get_Urls (MediaVideo* self) {
GeeArrayList* result;
GeeArrayList* _tmp0_;
g_return_val_if_fail (self != NULL, NULL);
_tmp0_ = self->urls;
result = _tmp0_;
return result;
}
GeeArrayList* media_video_get_Qualities (MediaVideo* self) {
GeeArrayList* result;
GeeArrayList* _tmp0_;
g_return_val_if_fail (self != NULL, NULL);
_tmp0_ = self->qualities;
result = _tmp0_;
return result;
}
static void media_value_video_init (GValue* value) {
value->data[0].v_pointer = NULL;
}
static void media_value_video_free_value (GValue* value) {
if (value->data[0].v_pointer) {
media_video_unref (value->data[0].v_pointer);
}
}
static void media_value_video_copy_value (const GValue* src_value, GValue* dest_value) {
if (src_value->data[0].v_pointer) {
dest_value->data[0].v_pointer = media_video_ref (src_value->data[0].v_pointer);
} else {
dest_value->data[0].v_pointer = NULL;
}
}
static gpointer media_value_video_peek_pointer (const GValue* value) {
return value->data[0].v_pointer;
}
static gchar* media_value_video_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
if (collect_values[0].v_pointer) {
MediaVideo* object;
object = collect_values[0].v_pointer;
if (object->parent_instance.g_class == NULL) {
return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
}
value->data[0].v_pointer = media_video_ref (object);
} else {
value->data[0].v_pointer = NULL;
}
return NULL;
}
static gchar* media_value_video_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
MediaVideo** object_p;
object_p = collect_values[0].v_pointer;
if (!object_p) {
return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
}
if (!value->data[0].v_pointer) {
*object_p = NULL;
} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
*object_p = value->data[0].v_pointer;
} else {
*object_p = media_video_ref (value->data[0].v_pointer);
}
return NULL;
}
GParamSpec* media_param_spec_video (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
MediaParamSpecVideo* spec;
g_return_val_if_fail (g_type_is_a (object_type, MEDIA_TYPE_VIDEO), NULL);
spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
G_PARAM_SPEC (spec)->value_type = object_type;
return G_PARAM_SPEC (spec);
}
gpointer media_value_get_video (const GValue* value) {
g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MEDIA_TYPE_VIDEO), NULL);
return value->data[0].v_pointer;
}
void media_value_set_video (GValue* value, gpointer v_object) {
MediaVideo* old;
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MEDIA_TYPE_VIDEO));
old = value->data[0].v_pointer;
if (v_object) {
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, MEDIA_TYPE_VIDEO));
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
value->data[0].v_pointer = v_object;
media_video_ref (value->data[0].v_pointer);
} else {
value->data[0].v_pointer = NULL;
}
if (old) {
media_video_unref (old);
}
}
void media_value_take_video (GValue* value, gpointer v_object) {
MediaVideo* old;
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, MEDIA_TYPE_VIDEO));
old = value->data[0].v_pointer;
if (v_object) {
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, MEDIA_TYPE_VIDEO));
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
value->data[0].v_pointer = v_object;
} else {
value->data[0].v_pointer = NULL;
}
if (old) {
media_video_unref (old);
}
}
static void media_video_class_init (MediaVideoClass * klass) {
media_video_parent_class = g_type_class_peek_parent (klass);
MEDIA_VIDEO_CLASS (klass)->finalize = media_video_finalize;
g_type_class_add_private (klass, sizeof (MediaVideoPrivate));
}
static void media_video_instance_init (MediaVideo * self) {
self->priv = MEDIA_VIDEO_GET_PRIVATE (self);
self->ref_count = 1;
}
static void media_video_finalize (MediaVideo* obj) {
MediaVideo * self;
self = G_TYPE_CHECK_INSTANCE_CAST (obj, MEDIA_TYPE_VIDEO, MediaVideo);
_g_free0 (self->json);
_system_io_web_client_unref0 (self->wc);
_g_object_unref0 (self->urls);
_g_object_unref0 (self->qualities);
_g_free0 (self->priv->str);
}
GType media_video_get_type (void) {
static volatile gsize media_video_type_id__volatile = 0;
if (g_once_init_enter (&media_video_type_id__volatile)) {
static const GTypeValueTable g_define_type_value_table = { media_value_video_init, media_value_video_free_value, media_value_video_copy_value, media_value_video_peek_pointer, "p", media_value_video_collect_value, "p", media_value_video_lcopy_value };
static const GTypeInfo g_define_type_info = { sizeof (MediaVideoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) media_video_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MediaVideo), 0, (GInstanceInitFunc) media_video_instance_init, &g_define_type_value_table };
static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
GType media_video_type_id;
media_video_type_id = g_type_register_fundamental (g_type_fundamental_next (), "MediaVideo", &g_define_type_info, &g_define_type_fundamental_info, 0);
g_once_init_leave (&media_video_type_id__volatile, media_video_type_id);
}
return media_video_type_id__volatile;
}
gpointer media_video_ref (gpointer instance) {
MediaVideo* self;
self = instance;
g_atomic_int_inc (&self->ref_count);
return instance;
}
void media_video_unref (gpointer instance) {
MediaVideo* self;
self = instance;
if (g_atomic_int_dec_and_test (&self->ref_count)) {
MEDIA_VIDEO_GET_CLASS (self)->finalize (self);
g_type_free_instance ((GTypeInstance *) self);
}
}
static JsonObject* _vala_JsonObject_copy (JsonObject* self) {
return g_boxed_copy (json_object_get_type (), self);
}
static gpointer __vala_JsonObject_copy0 (gpointer self) {
return self ? _vala_JsonObject_copy (self) : NULL;
}
static void _vala_JsonObject_free (JsonObject* self) {
g_boxed_free (json_object_get_type (), self);
}
MediaYoutube* media_youtube_construct (GType object_type, const gchar* url) {
MediaYoutube* self = NULL;
const gchar* _tmp0_;
JsonParser* _tmp1_;
JsonParser* parser;
const gchar* _tmp2_;
JsonNode* _tmp3_ = NULL;
JsonObject* _tmp4_ = NULL;
JsonObject* _tmp5_;
JsonObject* root_object;
JsonObject* _tmp6_;
JsonObject* _tmp7_ = NULL;
const gchar* _tmp8_ = NULL;
gchar* _tmp9_;
gchar* url_encoded_fmt_stream_map;
const gchar* _tmp10_;
gchar** _tmp11_;
gchar** _tmp12_ = NULL;
gchar** table;
gint table_length1;
gint _table_size_;
GError * _inner_error_ = NULL;
g_return_val_if_fail (url != NULL, NULL);
_tmp0_ = url;
self = (MediaYoutube*) media_video_construct_with_parameter (object_type, _tmp0_, "yt.playerConfig");
_tmp1_ = json_parser_new ();
parser = _tmp1_;
_tmp2_ = ((MediaVideo*) self)->json;
json_parser_load_from_data (parser, _tmp2_, (gssize) (-1), &_inner_error_);
if (_inner_error_ != NULL) {
_g_object_unref0 (parser);
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
return NULL;
}
_tmp3_ = json_parser_get_root (parser);
_tmp4_ = json_node_get_object (_tmp3_);
_tmp5_ = __vala_JsonObject_copy0 (_tmp4_);
root_object = _tmp5_;
_tmp6_ = root_object;
_tmp7_ = json_object_get_object_member (_tmp6_, "args");
_tmp8_ = json_object_get_string_member (_tmp7_, "url_encoded_fmt_stream_map");
_tmp9_ = g_strdup (_tmp8_);
url_encoded_fmt_stream_map = _tmp9_;
_tmp10_ = url_encoded_fmt_stream_map;
_tmp12_ = _tmp11_ = g_strsplit (_tmp10_, "&url=", 0);
table = _tmp12_;
table_length1 = _vala_array_length (_tmp11_);
_table_size_ = table_length1;
{
gint i;
i = 1;
{
gboolean _tmp13_;
_tmp13_ = TRUE;
while (TRUE) {
gboolean _tmp14_;
gint _tmp16_;
gchar** _tmp17_;
gint _tmp17__length1;
GeeArrayList* _tmp18_;
gchar** _tmp19_;
gint _tmp19__length1;
gint _tmp20_;
const gchar* _tmp21_;
gchar* _tmp22_ = NULL;
gchar* _tmp23_;
gchar* _tmp24_ = NULL;
gchar* _tmp25_;
_tmp14_ = _tmp13_;
if (!_tmp14_) {
gint _tmp15_;
_tmp15_ = i;
i = _tmp15_ + 1;
}
_tmp13_ = FALSE;
_tmp16_ = i;
_tmp17_ = table;
_tmp17__length1 = table_length1;
if (!(_tmp16_ urls;
_tmp19_ = table;
_tmp19__length1 = table_length1;
_tmp20_ = i;
_tmp21_ = _tmp19_[_tmp20_];
_tmp22_ = system_string_html_decode (_tmp21_);
_tmp23_ = _tmp22_;
_tmp24_ = string_replace (_tmp23_, "&sig=", "&signature=");
_tmp25_ = _tmp24_;
gee_abstract_collection_add ((GeeAbstractCollection*) _tmp18_, _tmp25_);
_g_free0 (_tmp25_);
_g_free0 (_tmp23_);
}
}
}
table = (_vala_array_free (table, table_length1, (GDestroyNotify) g_free), NULL);
_g_free0 (url_encoded_fmt_stream_map);
__vala_JsonObject_free0 (root_object);
_g_object_unref0 (parser);
return self;
}
MediaYoutube* media_youtube_new (const gchar* url) {
return media_youtube_construct (MEDIA_TYPE_YOUTUBE, url);
}
static void media_youtube_class_init (MediaYoutubeClass * klass) {
media_youtube_parent_class = g_type_class_peek_parent (klass);
}
static void media_youtube_instance_init (MediaYoutube * self) {
}
GType media_youtube_get_type (void) {
static volatile gsize media_youtube_type_id__volatile = 0;
if (g_once_init_enter (&media_youtube_type_id__volatile)) {
static const GTypeInfo g_define_type_info = { sizeof (MediaYoutubeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) media_youtube_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MediaYoutube), 0, (GInstanceInitFunc) media_youtube_instance_init, NULL };
GType media_youtube_type_id;
media_youtube_type_id = g_type_register_static (MEDIA_TYPE_VIDEO, "MediaYoutube", &g_define_type_info, 0);
g_once_init_leave (&media_youtube_type_id__volatile, media_youtube_type_id);
}
return media_youtube_type_id__volatile;
}
MediaDailymotion* media_dailymotion_construct (GType object_type, const gchar* url) {
MediaDailymotion* self = NULL;
const gchar* _tmp0_;
JsonParser* _tmp1_;
JsonParser* parser;
JsonParser* _tmp2_;
const gchar* _tmp3_;
JsonParser* _tmp4_;
JsonNode* _tmp5_ = NULL;
JsonObject* _tmp6_ = NULL;
JsonObject* _tmp7_;
JsonObject* root_object;
JsonObject* _tmp8_;
const gchar* _tmp9_ = NULL;
gchar* _tmp10_;
const gchar* _tmp11_;
gchar* _tmp12_ = NULL;
JsonParser* _tmp13_;
const gchar* _tmp14_;
JsonParser* _tmp15_;
JsonNode* _tmp16_ = NULL;
JsonObject* _tmp17_ = NULL;
JsonObject* _tmp18_;
JsonObject* _tmp19_;
JsonArray* _tmp20_ = NULL;
JsonObject* _tmp21_ = NULL;
JsonArray* _tmp22_ = NULL;
JsonObject* _tmp23_ = NULL;
JsonArray* _tmp24_ = NULL;
JsonObject* _tmp25_ = NULL;
JsonArray* _tmp26_ = NULL;
JsonObject* _tmp27_ = NULL;
JsonObject* _tmp28_ = NULL;
JsonObject* _tmp29_;
JsonObject* param;
GeeArrayList* _tmp30_;
JsonObject* _tmp31_;
const gchar* _tmp32_ = NULL;
GeeArrayList* _tmp33_;
JsonObject* _tmp34_;
const gchar* _tmp35_ = NULL;
GeeArrayList* _tmp36_;
JsonObject* _tmp37_;
const gchar* _tmp38_ = NULL;
GError * _inner_error_ = NULL;
g_return_val_if_fail (url != NULL, NULL);
_tmp0_ = url;
self = (MediaDailymotion*) media_video_construct_with_parameter (object_type, _tmp0_, "var flashvars");
_tmp1_ = json_parser_new ();
parser = _tmp1_;
_tmp2_ = parser;
_tmp3_ = ((MediaVideo*) self)->json;
json_parser_load_from_data (_tmp2_, _tmp3_, (gssize) (-1), &_inner_error_);
if (_inner_error_ != NULL) {
_g_object_unref0 (parser);
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
return NULL;
}
_tmp4_ = parser;
_tmp5_ = json_parser_get_root (_tmp4_);
_tmp6_ = json_node_get_object (_tmp5_);
_tmp7_ = __vala_JsonObject_copy0 (_tmp6_);
root_object = _tmp7_;
_tmp8_ = root_object;
_tmp9_ = json_object_get_string_member (_tmp8_, "sequence");
_tmp10_ = g_strdup (_tmp9_);
_g_free0 (((MediaVideo*) self)->json);
((MediaVideo*) self)->json = _tmp10_;
_tmp11_ = ((MediaVideo*) self)->json;
_tmp12_ = system_string_html_decode (_tmp11_);
_g_free0 (((MediaVideo*) self)->json);
((MediaVideo*) self)->json = _tmp12_;
_tmp13_ = parser;
_tmp14_ = ((MediaVideo*) self)->json;
json_parser_load_from_data (_tmp13_, _tmp14_, (gssize) (-1), &_inner_error_);
if (_inner_error_ != NULL) {
__vala_JsonObject_free0 (root_object);
_g_object_unref0 (parser);
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
return NULL;
}
_tmp15_ = parser;
_tmp16_ = json_parser_get_root (_tmp15_);
_tmp17_ = json_node_get_object (_tmp16_);
_tmp18_ = __vala_JsonObject_copy0 (_tmp17_);
__vala_JsonObject_free0 (root_object);
root_object = _tmp18_;
_tmp19_ = root_object;
_tmp20_ = json_object_get_array_member (_tmp19_, "sequence");
_tmp21_ = json_array_get_object_element (_tmp20_, (guint) 0);
_tmp22_ = json_object_get_array_member (_tmp21_, "layerList");
_tmp23_ = json_array_get_object_element (_tmp22_, (guint) 0);
_tmp24_ = json_object_get_array_member (_tmp23_, "sequenceList");
_tmp25_ = json_array_get_object_element (_tmp24_, (guint) 1);
_tmp26_ = json_object_get_array_member (_tmp25_, "layerList");
_tmp27_ = json_array_get_object_element (_tmp26_, (guint) 2);
_tmp28_ = json_object_get_object_member (_tmp27_, "param");
_tmp29_ = __vala_JsonObject_copy0 (_tmp28_);
param = _tmp29_;
_tmp30_ = ((MediaVideo*) self)->urls;
_tmp31_ = param;
_tmp32_ = json_object_get_string_member (_tmp31_, "ldURL");
gee_abstract_collection_add ((GeeAbstractCollection*) _tmp30_, _tmp32_);
_tmp33_ = ((MediaVideo*) self)->urls;
_tmp34_ = param;
_tmp35_ = json_object_get_string_member (_tmp34_, "sdURL");
gee_abstract_collection_add ((GeeAbstractCollection*) _tmp33_, _tmp35_);
_tmp36_ = ((MediaVideo*) self)->urls;
_tmp37_ = param;
_tmp38_ = json_object_get_string_member (_tmp37_, "hqURL");
gee_abstract_collection_add ((GeeAbstractCollection*) _tmp36_, _tmp38_);
__vala_JsonObject_free0 (param);
__vala_JsonObject_free0 (root_object);
_g_object_unref0 (parser);
return self;
}
MediaDailymotion* media_dailymotion_new (const gchar* url) {
return media_dailymotion_construct (MEDIA_TYPE_DAILYMOTION, url);
}
static void media_dailymotion_class_init (MediaDailymotionClass * klass) {
media_dailymotion_parent_class = g_type_class_peek_parent (klass);
}
static void media_dailymotion_instance_init (MediaDailymotion * self) {
}
GType media_dailymotion_get_type (void) {
static volatile gsize media_dailymotion_type_id__volatile = 0;
if (g_once_init_enter (&media_dailymotion_type_id__volatile)) {
static const GTypeInfo g_define_type_info = { sizeof (MediaDailymotionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) media_dailymotion_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MediaDailymotion), 0, (GInstanceInitFunc) media_dailymotion_instance_init, NULL };
GType media_dailymotion_type_id;
media_dailymotion_type_id = g_type_register_static (MEDIA_TYPE_VIDEO, "MediaDailymotion", &g_define_type_info, 0);
g_once_init_leave (&media_dailymotion_type_id__volatile, media_dailymotion_type_id);
}
return media_dailymotion_type_id__volatile;
}
MediaHexaglobe* media_hexaglobe_construct (GType object_type, const gchar* url) {
MediaHexaglobe* self = NULL;
SystemIOWebClient* _tmp0_;
const gchar* _tmp1_;
gchar* _tmp2_ = NULL;
g_return_val_if_fail (url != NULL, NULL);
self = (MediaHexaglobe*) media_video_construct (object_type);
_tmp0_ = ((MediaVideo*) self)->wc;
_tmp1_ = url;
_tmp2_ = system_io_web_client_download_string (_tmp0_, _tmp1_);
_g_free0 (((MediaVideo*) self)->json);
((MediaVideo*) self)->json = _tmp2_;
return self;
}
MediaHexaglobe* media_hexaglobe_new (const gchar* url) {
return media_hexaglobe_construct (MEDIA_TYPE_HEXAGLOBE, url);
}
static void media_hexaglobe_class_init (MediaHexaglobeClass * klass) {
media_hexaglobe_parent_class = g_type_class_peek_parent (klass);
}
static void media_hexaglobe_instance_init (MediaHexaglobe * self) {
}
GType media_hexaglobe_get_type (void) {
static volatile gsize media_hexaglobe_type_id__volatile = 0;
if (g_once_init_enter (&media_hexaglobe_type_id__volatile)) {
static const GTypeInfo g_define_type_info = { sizeof (MediaHexaglobeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) media_hexaglobe_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MediaHexaglobe), 0, (GInstanceInitFunc) media_hexaglobe_instance_init, NULL };
GType media_hexaglobe_type_id;
media_hexaglobe_type_id = g_type_register_static (MEDIA_TYPE_VIDEO, "MediaHexaglobe", &g_define_type_info, 0);
g_once_init_leave (&media_hexaglobe_type_id__volatile, media_hexaglobe_type_id);
}
return media_hexaglobe_type_id__volatile;
}
MediaVimeo* media_vimeo_construct (GType object_type, const gchar* url) {
MediaVimeo* self = NULL;
const gchar* _tmp0_;
gchar* _tmp1_ = NULL;
gchar* _tmp2_;
JsonParser* _tmp3_;
JsonParser* parser;
const gchar* _tmp4_;
JsonNode* _tmp5_ = NULL;
JsonObject* _tmp6_ = NULL;
JsonObject* _tmp7_;
JsonObject* root_object;
JsonObject* _tmp8_;
JsonObject* _tmp9_ = NULL;
const gchar* _tmp10_ = NULL;
gchar* _tmp11_;
JsonObject* _tmp12_;
JsonObject* _tmp13_ = NULL;
gint64 _tmp14_ = 0LL;
JsonObject* _tmp15_;
JsonObject* _tmp16_ = NULL;
gint64 _tmp17_ = 0LL;
GeeArrayList* _tmp18_;
gint64 _tmp19_;
gchar* _tmp20_ = NULL;
gchar* _tmp21_;
gchar* _tmp22_;
gchar* _tmp23_;
gchar* _tmp24_;
gchar* _tmp25_;
const gchar* _tmp26_;
gchar* _tmp27_;
gchar* _tmp28_;
gchar* _tmp29_;
gchar* _tmp30_;
gint64 _tmp31_;
gchar* _tmp32_ = NULL;
gchar* _tmp33_;
gchar* _tmp34_;
gchar* _tmp35_;
gchar* _tmp36_;
gchar* _tmp37_;
GeeArrayList* _tmp38_;
gint64 _tmp39_;
gchar* _tmp40_ = NULL;
gchar* _tmp41_;
gchar* _tmp42_;
gchar* _tmp43_;
gchar* _tmp44_;
gchar* _tmp45_;
const gchar* _tmp46_;
gchar* _tmp47_;
gchar* _tmp48_;
gchar* _tmp49_;
gchar* _tmp50_;
gint64 _tmp51_;
gchar* _tmp52_ = NULL;
gchar* _tmp53_;
gchar* _tmp54_;
gchar* _tmp55_;
GeeArrayList* _tmp56_;
GeeArrayList* _tmp57_;
GError * _inner_error_ = NULL;
g_return_val_if_fail (url != NULL, NULL);
_tmp0_ = url;
_tmp1_ = string_replace (_tmp0_, "vimeo.com", "player.vimeo.com/config");
_tmp2_ = _tmp1_;
self = (MediaVimeo*) media_video_construct_with_url (object_type, _tmp2_);
_g_free0 (_tmp2_);
_tmp3_ = json_parser_new ();
parser = _tmp3_;
_tmp4_ = ((MediaVideo*) self)->json;
json_parser_load_from_data (parser, _tmp4_, (gssize) (-1), &_inner_error_);
if (_inner_error_ != NULL) {
_g_object_unref0 (parser);
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
return NULL;
}
_tmp5_ = json_parser_get_root (parser);
_tmp6_ = json_node_get_object (_tmp5_);
_tmp7_ = __vala_JsonObject_copy0 (_tmp6_);
root_object = _tmp7_;
_tmp8_ = root_object;
_tmp9_ = json_object_get_object_member (_tmp8_, "request");
_tmp10_ = json_object_get_string_member (_tmp9_, "signature");
_tmp11_ = g_strdup (_tmp10_);
_g_free0 (self->priv->signature);
self->priv->signature = _tmp11_;
_tmp12_ = root_object;
_tmp13_ = json_object_get_object_member (_tmp12_, "request");
_tmp14_ = json_object_get_int_member (_tmp13_, "timestamp");
self->priv->timestamp = _tmp14_;
_tmp15_ = root_object;
_tmp16_ = json_object_get_object_member (_tmp15_, "video");
_tmp17_ = json_object_get_int_member (_tmp16_, "id");
self->priv->id = _tmp17_;
_tmp18_ = ((MediaVideo*) self)->urls;
_tmp19_ = self->priv->id;
_tmp20_ = g_strdup_printf ("%" G_GINT64_FORMAT, _tmp19_);
_tmp21_ = _tmp20_;
_tmp22_ = g_strconcat ("http://player.vimeo.com/play_redirect?clip_id=", _tmp21_, NULL);
_tmp23_ = _tmp22_;
_tmp24_ = g_strconcat (_tmp23_, "&sig=", NULL);
_tmp25_ = _tmp24_;
_tmp26_ = self->priv->signature;
_tmp27_ = g_strconcat (_tmp25_, _tmp26_, NULL);
_tmp28_ = _tmp27_;
_tmp29_ = g_strconcat (_tmp28_, "&time=", NULL);
_tmp30_ = _tmp29_;
_tmp31_ = self->priv->timestamp;
_tmp32_ = g_strdup_printf ("%" G_GINT64_FORMAT, _tmp31_);
_tmp33_ = _tmp32_;
_tmp34_ = g_strconcat (_tmp30_, _tmp33_, NULL);
_tmp35_ = _tmp34_;
_tmp36_ = g_strconcat (_tmp35_, "&quality=hd", NULL);
_tmp37_ = _tmp36_;
gee_abstract_collection_add ((GeeAbstractCollection*) _tmp18_, _tmp37_);
_g_free0 (_tmp37_);
_g_free0 (_tmp35_);
_g_free0 (_tmp33_);
_g_free0 (_tmp30_);
_g_free0 (_tmp28_);
_g_free0 (_tmp25_);
_g_free0 (_tmp23_);
_g_free0 (_tmp21_);
_tmp38_ = ((MediaVideo*) self)->urls;
_tmp39_ = self->priv->id;
_tmp40_ = g_strdup_printf ("%" G_GINT64_FORMAT, _tmp39_);
_tmp41_ = _tmp40_;
_tmp42_ = g_strconcat ("http://player.vimeo.com/play_redirect?clip_id=", _tmp41_, NULL);
_tmp43_ = _tmp42_;
_tmp44_ = g_strconcat (_tmp43_, "&sig=", NULL);
_tmp45_ = _tmp44_;
_tmp46_ = self->priv->signature;
_tmp47_ = g_strconcat (_tmp45_, _tmp46_, NULL);
_tmp48_ = _tmp47_;
_tmp49_ = g_strconcat (_tmp48_, "&time=", NULL);
_tmp50_ = _tmp49_;
_tmp51_ = self->priv->timestamp;
_tmp52_ = g_strdup_printf ("%" G_GINT64_FORMAT, _tmp51_);
_tmp53_ = _tmp52_;
_tmp54_ = g_strconcat (_tmp50_, _tmp53_, NULL);
_tmp55_ = _tmp54_;
gee_abstract_collection_add ((GeeAbstractCollection*) _tmp38_, _tmp55_);
_g_free0 (_tmp55_);
_g_free0 (_tmp53_);
_g_free0 (_tmp50_);
_g_free0 (_tmp48_);
_g_free0 (_tmp45_);
_g_free0 (_tmp43_);
_g_free0 (_tmp41_);
_tmp56_ = ((MediaVideo*) self)->qualities;
gee_abstract_collection_add ((GeeAbstractCollection*) _tmp56_, "hd");
_tmp57_ = ((MediaVideo*) self)->qualities;
gee_abstract_collection_add ((GeeAbstractCollection*) _tmp57_, "sd");
__vala_JsonObject_free0 (root_object);
_g_object_unref0 (parser);
return self;
}
MediaVimeo* media_vimeo_new (const gchar* url) {
return media_vimeo_construct (MEDIA_TYPE_VIMEO, url);
}
static void media_vimeo_class_init (MediaVimeoClass * klass) {
media_vimeo_parent_class = g_type_class_peek_parent (klass);
MEDIA_VIDEO_CLASS (klass)->finalize = media_vimeo_finalize;
g_type_class_add_private (klass, sizeof (MediaVimeoPrivate));
}
static void media_vimeo_instance_init (MediaVimeo * self) {
self->priv = MEDIA_VIMEO_GET_PRIVATE (self);
}
static void media_vimeo_finalize (MediaVideo* obj) {
MediaVimeo * self;
self = G_TYPE_CHECK_INSTANCE_CAST (obj, MEDIA_TYPE_VIMEO, MediaVimeo);
_g_free0 (self->priv->signature);
MEDIA_VIDEO_CLASS (media_vimeo_parent_class)->finalize (obj);
}
GType media_vimeo_get_type (void) {
static volatile gsize media_vimeo_type_id__volatile = 0;
if (g_once_init_enter (&media_vimeo_type_id__volatile)) {
static const GTypeInfo g_define_type_info = { sizeof (MediaVimeoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) media_vimeo_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (MediaVimeo), 0, (GInstanceInitFunc) media_vimeo_instance_init, NULL };
GType media_vimeo_type_id;
media_vimeo_type_id = g_type_register_static (MEDIA_TYPE_VIDEO, "MediaVimeo", &g_define_type_info, 0);
g_once_init_leave (&media_vimeo_type_id__volatile, media_vimeo_type_id);
}
return media_vimeo_type_id__volatile;
}
GType system_string_split_options_get_type (void) {
static volatile gsize system_string_split_options_type_id__volatile = 0;
if (g_once_init_enter (&system_string_split_options_type_id__volatile)) {
static const GEnumValue values[] = {{SYSTEM_STRING_SPLIT_OPTIONS_RemoveEmptyEntries, "SYSTEM_STRING_SPLIT_OPTIONS_RemoveEmptyEntries", "removeemptyentries"}, {SYSTEM_STRING_SPLIT_OPTIONS_None, "SYSTEM_STRING_SPLIT_OPTIONS_None", "none"}, {0, NULL, NULL}};
GType system_string_split_options_type_id;
system_string_split_options_type_id = g_enum_register_static ("SystemStringSplitOptions", values);
g_once_init_leave (&system_string_split_options_type_id__volatile, system_string_split_options_type_id);
}
return system_string_split_options_type_id__volatile;
}
static gpointer _g_object_ref0 (gpointer self) {
return self ? g_object_ref (self) : NULL;
}
gchar** system_string_split_with_strings (const gchar* raw_string, gchar** delimiters, int delimiters_length1, SystemStringSplitOptions options, int* result_length1) {
gchar** result = NULL;
GeeArrayList* _tmp0_;
GeeArrayList* liste;
GeeArrayList* _tmp1_;
GeeArrayList* liste2;
GeeArrayList* _tmp2_;
const gchar* _tmp3_;
gchar** _tmp4_;
gint _tmp4__length1;
GeeArrayList* _tmp32_;
gint _tmp33_;
gint _tmp34_;
gchar** _tmp35_ = NULL;
gchar** _result_;
gint _result__length1;
gint __result__size_;
gchar** _tmp49_;
gint _tmp49__length1;
g_return_val_if_fail (raw_string != NULL, NULL);
_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
liste = _tmp0_;
_tmp1_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
liste2 = _tmp1_;
_tmp2_ = liste;
_tmp3_ = raw_string;
gee_abstract_collection_add ((GeeAbstractCollection*) _tmp2_, _tmp3_);
_tmp4_ = delimiters;
_tmp4__length1 = delimiters_length1;
{
gchar** delimiter_collection = NULL;
gint delimiter_collection_length1 = 0;
gint _delimiter_collection_size_ = 0;
gint delimiter_it = 0;
delimiter_collection = _tmp4_;
delimiter_collection_length1 = _tmp4__length1;
for (delimiter_it = 0; delimiter_it < _tmp4__length1; delimiter_it = delimiter_it + 1) {
gchar* _tmp5_;
gchar* delimiter = NULL;
_tmp5_ = g_strdup (delimiter_collection[delimiter_it]);
delimiter = _tmp5_;
{
GeeArrayList* _tmp29_;
GeeArrayList* _tmp30_;
GeeArrayList* _tmp31_;
{
GeeArrayList* _tmp6_;
GeeArrayList* _tmp7_;
GeeArrayList* _item_list;
GeeArrayList* _tmp8_;
gint _tmp9_;
gint _tmp10_;
gint _item_size;
gint _item_index;
_tmp6_ = liste;
_tmp7_ = _g_object_ref0 (_tmp6_);
_item_list = _tmp7_;
_tmp8_ = _item_list;
_tmp9_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp8_);
_tmp10_ = _tmp9_;
_item_size = _tmp10_;
_item_index = -1;
while (TRUE) {
gint _tmp11_;
gint _tmp12_;
gint _tmp13_;
GeeArrayList* _tmp14_;
gint _tmp15_;
gpointer _tmp16_ = NULL;
gchar* item;
const gchar* _tmp17_;
const gchar* _tmp18_;
gchar** _tmp19_;
gchar** _tmp20_ = NULL;
gchar** split;
gint split_length1;
gint _split_size_;
gchar** _tmp21_;
gint _tmp21__length1;
_tmp11_ = _item_index;
_item_index = _tmp11_ + 1;
_tmp12_ = _item_index;
_tmp13_ = _item_size;
if (!(_tmp12_ < _tmp13_)) {
break;
}
_tmp14_ = _item_list;
_tmp15_ = _item_index;
_tmp16_ = gee_abstract_list_get ((GeeAbstractList*) _tmp14_, _tmp15_);
item = (gchar*) _tmp16_;
_tmp17_ = item;
_tmp18_ = delimiter;
_tmp20_ = _tmp19_ = g_strsplit (_tmp17_, _tmp18_, 0);
split = _tmp20_;
split_length1 = _vala_array_length (_tmp19_);
_split_size_ = split_length1;
_tmp21_ = split;
_tmp21__length1 = split_length1;
{
gchar** s_collection = NULL;
gint s_collection_length1 = 0;
gint _s_collection_size_ = 0;
gint s_it = 0;
s_collection = _tmp21_;
s_collection_length1 = _tmp21__length1;
for (s_it = 0; s_it < _tmp21__length1; s_it = s_it + 1) {
gchar* _tmp22_;
gchar* s = NULL;
_tmp22_ = g_strdup (s_collection[s_it]);
s = _tmp22_;
{
SystemStringSplitOptions _tmp23_;
_tmp23_ = options;
if (_tmp23_ == SYSTEM_STRING_SPLIT_OPTIONS_RemoveEmptyEntries) {
const gchar* _tmp24_;
_tmp24_ = s;
if (g_strcmp0 (_tmp24_, "") != 0) {
GeeArrayList* _tmp25_;
const gchar* _tmp26_;
_tmp25_ = liste2;
_tmp26_ = s;
gee_abstract_collection_add ((GeeAbstractCollection*) _tmp25_, _tmp26_);
}
} else {
GeeArrayList* _tmp27_;
const gchar* _tmp28_;
_tmp27_ = liste2;
_tmp28_ = s;
gee_abstract_collection_add ((GeeAbstractCollection*) _tmp27_, _tmp28_);
}
_g_free0 (s);
}
}
}
split = (_vala_array_free (split, split_length1, (GDestroyNotify) g_free), NULL);
_g_free0 (item);
}
_g_object_unref0 (_item_list);
}
_tmp29_ = liste2;
_tmp30_ = _g_object_ref0 (_tmp29_);
_g_object_unref0 (liste);
liste = _tmp30_;
_tmp31_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
_g_object_unref0 (liste2);
liste2 = _tmp31_;
_g_free0 (delimiter);
}
}
}
_tmp32_ = liste;
_tmp33_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp32_);
_tmp34_ = _tmp33_;
_tmp35_ = g_new0 (gchar*, _tmp34_ + 1);
_result_ = _tmp35_;
_result__length1 = _tmp34_;
__result__size_ = _result__length1;
{
gint i;
i = 0;
{
gboolean _tmp36_;
_tmp36_ = TRUE;
while (TRUE) {
gboolean _tmp37_;
gint _tmp39_;
GeeArrayList* _tmp40_;
gint _tmp41_;
gint _tmp42_;
gchar** _tmp43_;
gint _tmp43__length1;
gint _tmp44_;
GeeArrayList* _tmp45_;
gint _tmp46_;
gpointer _tmp47_ = NULL;
gchar* _tmp48_;
_tmp37_ = _tmp36_;
if (!_tmp37_) {
gint _tmp38_;
_tmp38_ = i;
i = _tmp38_ + 1;
}
_tmp36_ = FALSE;
_tmp39_ = i;
_tmp40_ = liste;
_tmp41_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp40_);
_tmp42_ = _tmp41_;
if (!(_tmp39_ < _tmp42_)) {
break;
}
_tmp43_ = _result_;
_tmp43__length1 = _result__length1;
_tmp44_ = i;
_tmp45_ = liste;
_tmp46_ = i;
_tmp47_ = gee_abstract_list_get ((GeeAbstractList*) _tmp45_, _tmp46_);
_g_free0 (_tmp43_[_tmp44_]);
_tmp43_[_tmp44_] = (gchar*) _tmp47_;
_tmp48_ = _tmp43_[_tmp44_];
}
}
}
_tmp49_ = _result_;
_tmp49__length1 = _result__length1;
if (result_length1) {
*result_length1 = _tmp49__length1;
}
result = _tmp49_;
_g_object_unref0 (liste2);
_g_object_unref0 (liste);
return result;
}
gchar* system_string_html_decode (const gchar* raw_string) {
gchar* result = NULL;
const gchar* _tmp0_;
gchar* _tmp1_ = NULL;
gchar* _tmp2_;
gchar* _tmp3_ = NULL;
gchar* _tmp4_;
gchar* _tmp5_ = NULL;
gchar* _tmp6_;
gchar* _tmp7_ = NULL;
gchar* _tmp8_;
gchar* _tmp9_ = NULL;
gchar* _tmp10_;
gchar* _tmp11_ = NULL;
gchar* _tmp12_;
gchar* _tmp13_ = NULL;
gchar* _tmp14_;
gchar* _tmp15_ = NULL;
gchar* _tmp16_;
gchar* _tmp17_ = NULL;
gchar* _tmp18_;
gchar* _tmp19_ = NULL;
gchar* _tmp20_;
gchar* _tmp21_ = NULL;
gchar* _tmp22_;
gchar* _tmp23_ = NULL;
gchar* _tmp24_;
gchar* _tmp25_ = NULL;
gchar* _tmp26_;
gchar* _tmp27_ = NULL;
gchar* _tmp28_;
gchar* _tmp29_ = NULL;
gchar* _tmp30_;
gchar* _tmp31_ = NULL;
gchar* _tmp32_;
g_return_val_if_fail (raw_string != NULL, NULL);
_tmp0_ = raw_string;
_tmp1_ = string_replace (_tmp0_, "%5C", "\\");
_tmp2_ = _tmp1_;
_tmp3_ = string_replace (_tmp2_, "%3C", "");
_tmp6_ = _tmp5_;
_tmp7_ = string_replace (_tmp6_, "%5B", "[");
_tmp8_ = _tmp7_;
_tmp9_ = string_replace (_tmp8_, "%7B", "{");
_tmp10_ = _tmp9_;
_tmp11_ = string_replace (_tmp10_, "%5D", "]");
_tmp12_ = _tmp11_;
_tmp13_ = string_replace (_tmp12_, "%7D", "}");
_tmp14_ = _tmp13_;
_tmp15_ = string_replace (_tmp14_, "%3A", ":");
_tmp16_ = _tmp15_;
_tmp17_ = string_replace (_tmp16_, "%2F", "/");
_tmp18_ = _tmp17_;
_tmp19_ = string_replace (_tmp18_, "%3F", "?");
_tmp20_ = _tmp19_;
_tmp21_ = string_replace (_tmp20_, "%3D", "=");
_tmp22_ = _tmp21_;
_tmp23_ = string_replace (_tmp22_, "%26", "&");
_tmp24_ = _tmp23_;
_tmp25_ = string_replace (_tmp24_, "%22", "\"");
_tmp26_ = _tmp25_;
_tmp27_ = string_replace (_tmp26_, "%2C", ",");
_tmp28_ = _tmp27_;
_tmp29_ = string_replace (_tmp28_, "%3B", ";");
_tmp30_ = _tmp29_;
_tmp31_ = string_replace (_tmp30_, "%25", "%");
_tmp32_ = _tmp31_;
_g_free0 (_tmp30_);
_g_free0 (_tmp28_);
_g_free0 (_tmp26_);
_g_free0 (_tmp24_);
_g_free0 (_tmp22_);
_g_free0 (_tmp20_);
_g_free0 (_tmp18_);
_g_free0 (_tmp16_);
_g_free0 (_tmp14_);
_g_free0 (_tmp12_);
_g_free0 (_tmp10_);
_g_free0 (_tmp8_);
_g_free0 (_tmp6_);
_g_free0 (_tmp4_);
_g_free0 (_tmp2_);
result = _tmp32_;
return result;
}
SystemString* system_string_construct (GType object_type) {
SystemString* self = NULL;
self = (SystemString*) g_type_create_instance (object_type);
return self;
}
SystemString* system_string_new (void) {
return system_string_construct (SYSTEM_TYPE_STRING);
}
static void system_value_string_init (GValue* value) {
value->data[0].v_pointer = NULL;
}
static void system_value_string_free_value (GValue* value) {
if (value->data[0].v_pointer) {
system_string_unref (value->data[0].v_pointer);
}
}
static void system_value_string_copy_value (const GValue* src_value, GValue* dest_value) {
if (src_value->data[0].v_pointer) {
dest_value->data[0].v_pointer = system_string_ref (src_value->data[0].v_pointer);
} else {
dest_value->data[0].v_pointer = NULL;
}
}
static gpointer system_value_string_peek_pointer (const GValue* value) {
return value->data[0].v_pointer;
}
static gchar* system_value_string_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
if (collect_values[0].v_pointer) {
SystemString* object;
object = collect_values[0].v_pointer;
if (object->parent_instance.g_class == NULL) {
return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
}
value->data[0].v_pointer = system_string_ref (object);
} else {
value->data[0].v_pointer = NULL;
}
return NULL;
}
static gchar* system_value_string_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
SystemString** object_p;
object_p = collect_values[0].v_pointer;
if (!object_p) {
return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
}
if (!value->data[0].v_pointer) {
*object_p = NULL;
} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
*object_p = value->data[0].v_pointer;
} else {
*object_p = system_string_ref (value->data[0].v_pointer);
}
return NULL;
}
GParamSpec* system_param_spec_string (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
SystemParamSpecString* spec;
g_return_val_if_fail (g_type_is_a (object_type, SYSTEM_TYPE_STRING), NULL);
spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
G_PARAM_SPEC (spec)->value_type = object_type;
return G_PARAM_SPEC (spec);
}
gpointer system_value_get_string (const GValue* value) {
g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, SYSTEM_TYPE_STRING), NULL);
return value->data[0].v_pointer;
}
void system_value_set_string (GValue* value, gpointer v_object) {
SystemString* old;
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, SYSTEM_TYPE_STRING));
old = value->data[0].v_pointer;
if (v_object) {
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, SYSTEM_TYPE_STRING));
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
value->data[0].v_pointer = v_object;
system_string_ref (value->data[0].v_pointer);
} else {
value->data[0].v_pointer = NULL;
}
if (old) {
system_string_unref (old);
}
}
void system_value_take_string (GValue* value, gpointer v_object) {
SystemString* old;
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, SYSTEM_TYPE_STRING));
old = value->data[0].v_pointer;
if (v_object) {
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, SYSTEM_TYPE_STRING));
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
value->data[0].v_pointer = v_object;
} else {
value->data[0].v_pointer = NULL;
}
if (old) {
system_string_unref (old);
}
}
static void system_string_class_init (SystemStringClass * klass) {
system_string_parent_class = g_type_class_peek_parent (klass);
SYSTEM_STRING_CLASS (klass)->finalize = system_string_finalize;
}
static void system_string_instance_init (SystemString * self) {
self->ref_count = 1;
}
static void system_string_finalize (SystemString* obj) {
SystemString * self;
self = G_TYPE_CHECK_INSTANCE_CAST (obj, SYSTEM_TYPE_STRING, SystemString);
}
GType system_string_get_type (void) {
static volatile gsize system_string_type_id__volatile = 0;
if (g_once_init_enter (&system_string_type_id__volatile)) {
static const GTypeValueTable g_define_type_value_table = { system_value_string_init, system_value_string_free_value, system_value_string_copy_value, system_value_string_peek_pointer, "p", system_value_string_collect_value, "p", system_value_string_lcopy_value };
static const GTypeInfo g_define_type_info = { sizeof (SystemStringClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) system_string_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SystemString), 0, (GInstanceInitFunc) system_string_instance_init, &g_define_type_value_table };
static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
GType system_string_type_id;
system_string_type_id = g_type_register_fundamental (g_type_fundamental_next (), "SystemString", &g_define_type_info, &g_define_type_fundamental_info, 0);
g_once_init_leave (&system_string_type_id__volatile, system_string_type_id);
}
return system_string_type_id__volatile;
}
gpointer system_string_ref (gpointer instance) {
SystemString* self;
self = instance;
g_atomic_int_inc (&self->ref_count);
return instance;
}
void system_string_unref (gpointer instance) {
SystemString* self;
self = instance;
if (g_atomic_int_dec_and_test (&self->ref_count)) {
SYSTEM_STRING_GET_CLASS (self)->finalize (self);
g_type_free_instance ((GTypeInstance *) self);
}
}
SystemIOWebClient* system_io_web_client_construct (GType object_type) {
SystemIOWebClient* self = NULL;
SoupSessionAsync* _tmp0_;
self = (SystemIOWebClient*) g_type_create_instance (object_type);
_tmp0_ = (SoupSessionAsync*) soup_session_async_new ();
_g_object_unref0 (self->priv->session);
self->priv->session = (SoupSession*) _tmp0_;
return self;
}
SystemIOWebClient* system_io_web_client_new (void) {
return system_io_web_client_construct (SYSTEM_IO_TYPE_WEB_CLIENT);
}
void system_io_web_client_download_file (SystemIOWebClient* self, const gchar* uri, const gchar* filename) {
const gchar* _tmp0_;
gboolean _tmp1_ = FALSE;
const gchar* _tmp3_;
const gchar* _tmp4_;
gint _tmp5_ = 0;
guint8* _tmp6_ = NULL;
guint8* _tmp7_;
gint _tmp7__length1;
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
g_return_if_fail (uri != NULL);
g_return_if_fail (filename != NULL);
_tmp0_ = filename;
_tmp1_ = g_file_test (_tmp0_, G_FILE_TEST_EXISTS);
if (_tmp1_) {
const gchar* _tmp2_;
_tmp2_ = filename;
g_remove (_tmp2_);
}
_tmp3_ = filename;
_tmp4_ = uri;
_tmp6_ = system_io_web_client_download_data (self, _tmp4_, &_tmp5_);
_tmp7_ = _tmp6_;
_tmp7__length1 = _tmp5_;
g_file_set_contents (_tmp3_, (const char*) _tmp7_, (size_t) _tmp5_, &_inner_error_);
_tmp7_ = (g_free (_tmp7_), NULL);
if (_inner_error_ != NULL) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
return;
}
}
static guint8* _vala_array_dup1 (guint8* self, int length) {
return g_memdup (self, length * sizeof (guint8));
}
guint8* system_io_web_client_download_data (SystemIOWebClient* self, const gchar* uri, int* result_length1) {
guint8* result = NULL;
const gchar* _tmp0_;
SoupMessage* _tmp1_;
SoupSession* _tmp2_;
SoupMessage* _tmp3_;
SoupMessage* _tmp4_;
SoupMessageBody* _tmp5_;
guint8* _tmp6_;
gint _tmp6__length1;
guint8* _tmp7_;
gint _tmp7__length1;
guint8* _tmp8_;
gint _tmp8__length1;
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (uri != NULL, NULL);
_tmp0_ = uri;
_tmp1_ = soup_message_new ("GET", _tmp0_);
_g_object_unref0 (self->priv->message);
self->priv->message = _tmp1_;
_tmp2_ = self->priv->session;
_tmp3_ = self->priv->message;
soup_session_send_message (_tmp2_, _tmp3_);
_tmp4_ = self->priv->message;
_tmp5_ = _tmp4_->response_body;
_tmp6_ = _tmp5_->data;
_tmp6__length1 = (gint) _tmp5_->length;
_tmp7_ = (_tmp6_ != NULL) ? _vala_array_dup1 (_tmp6_, _tmp6__length1) : ((gpointer) _tmp6_);
_tmp7__length1 = _tmp6__length1;
_tmp8_ = _tmp7_;
_tmp8__length1 = _tmp7__length1;
if (result_length1) {
*result_length1 = _tmp8__length1;
}
result = _tmp8_;
return result;
}
gchar* system_io_web_client_download_string (SystemIOWebClient* self, const gchar* uri) {
gchar* result = NULL;
const gchar* _tmp0_;
gint _tmp1_ = 0;
guint8* _tmp2_ = NULL;
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (uri != NULL, NULL);
_tmp0_ = uri;
_tmp2_ = system_io_web_client_download_data (self, _tmp0_, &_tmp1_);
result = (gchar*) _tmp2_;
return result;
}
static void system_io_value_web_client_init (GValue* value) {
value->data[0].v_pointer = NULL;
}
static void system_io_value_web_client_free_value (GValue* value) {
if (value->data[0].v_pointer) {
system_io_web_client_unref (value->data[0].v_pointer);
}
}
static void system_io_value_web_client_copy_value (const GValue* src_value, GValue* dest_value) {
if (src_value->data[0].v_pointer) {
dest_value->data[0].v_pointer = system_io_web_client_ref (src_value->data[0].v_pointer);
} else {
dest_value->data[0].v_pointer = NULL;
}
}
static gpointer system_io_value_web_client_peek_pointer (const GValue* value) {
return value->data[0].v_pointer;
}
static gchar* system_io_value_web_client_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
if (collect_values[0].v_pointer) {
SystemIOWebClient* object;
object = collect_values[0].v_pointer;
if (object->parent_instance.g_class == NULL) {
return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
}
value->data[0].v_pointer = system_io_web_client_ref (object);
} else {
value->data[0].v_pointer = NULL;
}
return NULL;
}
static gchar* system_io_value_web_client_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
SystemIOWebClient** object_p;
object_p = collect_values[0].v_pointer;
if (!object_p) {
return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
}
if (!value->data[0].v_pointer) {
*object_p = NULL;
} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
*object_p = value->data[0].v_pointer;
} else {
*object_p = system_io_web_client_ref (value->data[0].v_pointer);
}
return NULL;
}
GParamSpec* system_io_param_spec_web_client (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
SystemIOParamSpecWebClient* spec;
g_return_val_if_fail (g_type_is_a (object_type, SYSTEM_IO_TYPE_WEB_CLIENT), NULL);
spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
G_PARAM_SPEC (spec)->value_type = object_type;
return G_PARAM_SPEC (spec);
}
gpointer system_io_value_get_web_client (const GValue* value) {
g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, SYSTEM_IO_TYPE_WEB_CLIENT), NULL);
return value->data[0].v_pointer;
}
void system_io_value_set_web_client (GValue* value, gpointer v_object) {
SystemIOWebClient* old;
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, SYSTEM_IO_TYPE_WEB_CLIENT));
old = value->data[0].v_pointer;
if (v_object) {
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, SYSTEM_IO_TYPE_WEB_CLIENT));
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
value->data[0].v_pointer = v_object;
system_io_web_client_ref (value->data[0].v_pointer);
} else {
value->data[0].v_pointer = NULL;
}
if (old) {
system_io_web_client_unref (old);
}
}
void system_io_value_take_web_client (GValue* value, gpointer v_object) {
SystemIOWebClient* old;
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, SYSTEM_IO_TYPE_WEB_CLIENT));
old = value->data[0].v_pointer;
if (v_object) {
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, SYSTEM_IO_TYPE_WEB_CLIENT));
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
value->data[0].v_pointer = v_object;
} else {
value->data[0].v_pointer = NULL;
}
if (old) {
system_io_web_client_unref (old);
}
}
static void system_io_web_client_class_init (SystemIOWebClientClass * klass) {
system_io_web_client_parent_class = g_type_class_peek_parent (klass);
SYSTEM_IO_WEB_CLIENT_CLASS (klass)->finalize = system_io_web_client_finalize;
g_type_class_add_private (klass, sizeof (SystemIOWebClientPrivate));
}
static void system_io_web_client_instance_init (SystemIOWebClient * self) {
self->priv = SYSTEM_IO_WEB_CLIENT_GET_PRIVATE (self);
self->ref_count = 1;
}
static void system_io_web_client_finalize (SystemIOWebClient* obj) {
SystemIOWebClient * self;
self = G_TYPE_CHECK_INSTANCE_CAST (obj, SYSTEM_IO_TYPE_WEB_CLIENT, SystemIOWebClient);
_g_object_unref0 (self->priv->session);
_g_object_unref0 (self->priv->message);
}
GType system_io_web_client_get_type (void) {
static volatile gsize system_io_web_client_type_id__volatile = 0;
if (g_once_init_enter (&system_io_web_client_type_id__volatile)) {
static const GTypeValueTable g_define_type_value_table = { system_io_value_web_client_init, system_io_value_web_client_free_value, system_io_value_web_client_copy_value, system_io_value_web_client_peek_pointer, "p", system_io_value_web_client_collect_value, "p", system_io_value_web_client_lcopy_value };
static const GTypeInfo g_define_type_info = { sizeof (SystemIOWebClientClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) system_io_web_client_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SystemIOWebClient), 0, (GInstanceInitFunc) system_io_web_client_instance_init, &g_define_type_value_table };
static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
GType system_io_web_client_type_id;
system_io_web_client_type_id = g_type_register_fundamental (g_type_fundamental_next (), "SystemIOWebClient", &g_define_type_info, &g_define_type_fundamental_info, 0);
g_once_init_leave (&system_io_web_client_type_id__volatile, system_io_web_client_type_id);
}
return system_io_web_client_type_id__volatile;
}
gpointer system_io_web_client_ref (gpointer instance) {
SystemIOWebClient* self;
self = instance;
g_atomic_int_inc (&self->ref_count);
return instance;
}
void system_io_web_client_unref (gpointer instance) {
SystemIOWebClient* self;
self = instance;
if (g_atomic_int_dec_and_test (&self->ref_count)) {
SYSTEM_IO_WEB_CLIENT_GET_CLASS (self)->finalize (self);
g_type_free_instance ((GTypeInstance *) self);
}
}
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
if ((array != NULL) && (destroy_func != NULL)) {
int i;
for (i = 0; i < array_length; i = i + 1) {
if (((gpointer*) array)[i] != NULL) {
destroy_func (((gpointer*) array)[i]);
}
}
}
}
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
_vala_array_destroy (array, array_length, destroy_func);
g_free (array);
}
static gint _vala_array_length (gpointer array) {
int length;
length = 0;
if (array) {
while (((gpointer*) array)[length]) {
length++;
}
}
return length;
} - L’en-tête .h
/* libmedia.h generated by valac 0.18.0, the Vala compiler, do not modify */
#ifndef __LIBMEDIA_H__
#define __LIBMEDIA_H__
#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
G_BEGIN_DECLS
#define MEDIA_TYPE_VIDEO (media_video_get_type ())
#define MEDIA_VIDEO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MEDIA_TYPE_VIDEO, MediaVideo))
#define MEDIA_VIDEO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MEDIA_TYPE_VIDEO, MediaVideoClass))
#define MEDIA_IS_VIDEO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MEDIA_TYPE_VIDEO))
#define MEDIA_IS_VIDEO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MEDIA_TYPE_VIDEO))
#define MEDIA_VIDEO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MEDIA_TYPE_VIDEO, MediaVideoClass))
typedef struct _MediaVideo MediaVideo;
typedef struct _MediaVideoClass MediaVideoClass;
typedef struct _MediaVideoPrivate MediaVideoPrivate;
#define SYSTEM_IO_TYPE_WEB_CLIENT (system_io_web_client_get_type ())
#define SYSTEM_IO_WEB_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYSTEM_IO_TYPE_WEB_CLIENT, SystemIOWebClient))
#define SYSTEM_IO_WEB_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYSTEM_IO_TYPE_WEB_CLIENT, SystemIOWebClientClass))
#define SYSTEM_IO_IS_WEB_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYSTEM_IO_TYPE_WEB_CLIENT))
#define SYSTEM_IO_IS_WEB_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYSTEM_IO_TYPE_WEB_CLIENT))
#define SYSTEM_IO_WEB_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYSTEM_IO_TYPE_WEB_CLIENT, SystemIOWebClientClass))
typedef struct _SystemIOWebClient SystemIOWebClient;
typedef struct _SystemIOWebClientClass SystemIOWebClientClass;
#define MEDIA_TYPE_YOUTUBE (media_youtube_get_type ())
#define MEDIA_YOUTUBE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MEDIA_TYPE_YOUTUBE, MediaYoutube))
#define MEDIA_YOUTUBE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MEDIA_TYPE_YOUTUBE, MediaYoutubeClass))
#define MEDIA_IS_YOUTUBE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MEDIA_TYPE_YOUTUBE))
#define MEDIA_IS_YOUTUBE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MEDIA_TYPE_YOUTUBE))
#define MEDIA_YOUTUBE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MEDIA_TYPE_YOUTUBE, MediaYoutubeClass))
typedef struct _MediaYoutube MediaYoutube;
typedef struct _MediaYoutubeClass MediaYoutubeClass;
typedef struct _MediaYoutubePrivate MediaYoutubePrivate;
#define MEDIA_TYPE_DAILYMOTION (media_dailymotion_get_type ())
#define MEDIA_DAILYMOTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MEDIA_TYPE_DAILYMOTION, MediaDailymotion))
#define MEDIA_DAILYMOTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MEDIA_TYPE_DAILYMOTION, MediaDailymotionClass))
#define MEDIA_IS_DAILYMOTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MEDIA_TYPE_DAILYMOTION))
#define MEDIA_IS_DAILYMOTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MEDIA_TYPE_DAILYMOTION))
#define MEDIA_DAILYMOTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MEDIA_TYPE_DAILYMOTION, MediaDailymotionClass))
typedef struct _MediaDailymotion MediaDailymotion;
typedef struct _MediaDailymotionClass MediaDailymotionClass;
typedef struct _MediaDailymotionPrivate MediaDailymotionPrivate;
#define MEDIA_TYPE_HEXAGLOBE (media_hexaglobe_get_type ())
#define MEDIA_HEXAGLOBE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MEDIA_TYPE_HEXAGLOBE, MediaHexaglobe))
#define MEDIA_HEXAGLOBE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MEDIA_TYPE_HEXAGLOBE, MediaHexaglobeClass))
#define MEDIA_IS_HEXAGLOBE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MEDIA_TYPE_HEXAGLOBE))
#define MEDIA_IS_HEXAGLOBE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MEDIA_TYPE_HEXAGLOBE))
#define MEDIA_HEXAGLOBE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MEDIA_TYPE_HEXAGLOBE, MediaHexaglobeClass))
typedef struct _MediaHexaglobe MediaHexaglobe;
typedef struct _MediaHexaglobeClass MediaHexaglobeClass;
typedef struct _MediaHexaglobePrivate MediaHexaglobePrivate;
#define MEDIA_TYPE_VIMEO (media_vimeo_get_type ())
#define MEDIA_VIMEO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MEDIA_TYPE_VIMEO, MediaVimeo))
#define MEDIA_VIMEO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MEDIA_TYPE_VIMEO, MediaVimeoClass))
#define MEDIA_IS_VIMEO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MEDIA_TYPE_VIMEO))
#define MEDIA_IS_VIMEO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MEDIA_TYPE_VIMEO))
#define MEDIA_VIMEO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MEDIA_TYPE_VIMEO, MediaVimeoClass))
typedef struct _MediaVimeo MediaVimeo;
typedef struct _MediaVimeoClass MediaVimeoClass;
typedef struct _MediaVimeoPrivate MediaVimeoPrivate;
#define SYSTEM_TYPE_STRING_SPLIT_OPTIONS (system_string_split_options_get_type ())
#define SYSTEM_TYPE_STRING (system_string_get_type ())
#define SYSTEM_STRING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SYSTEM_TYPE_STRING, SystemString))
#define SYSTEM_STRING_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SYSTEM_TYPE_STRING, SystemStringClass))
#define SYSTEM_IS_STRING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SYSTEM_TYPE_STRING))
#define SYSTEM_IS_STRING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SYSTEM_TYPE_STRING))
#define SYSTEM_STRING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SYSTEM_TYPE_STRING, SystemStringClass))
typedef struct _SystemString SystemString;
typedef struct _SystemStringClass SystemStringClass;
typedef struct _SystemStringPrivate SystemStringPrivate;
typedef struct _SystemIOWebClientPrivate SystemIOWebClientPrivate;
struct _MediaVideo {
GTypeInstance parent_instance;
volatile int ref_count;
MediaVideoPrivate * priv;
gchar* json;
SystemIOWebClient* wc;
GeeArrayList* urls;
GeeArrayList* qualities;
};
struct _MediaVideoClass {
GTypeClass parent_class;
void (*finalize) (MediaVideo *self);
};
struct _MediaYoutube {
MediaVideo parent_instance;
MediaYoutubePrivate * priv;
};
struct _MediaYoutubeClass {
MediaVideoClass parent_class;
};
struct _MediaDailymotion {
MediaVideo parent_instance;
MediaDailymotionPrivate * priv;
};
struct _MediaDailymotionClass {
MediaVideoClass parent_class;
};
struct _MediaHexaglobe {
MediaVideo parent_instance;
MediaHexaglobePrivate * priv;
};
struct _MediaHexaglobeClass {
MediaVideoClass parent_class;
};
struct _MediaVimeo {
MediaVideo parent_instance;
MediaVimeoPrivate * priv;
};
struct _MediaVimeoClass {
MediaVideoClass parent_class;
};
typedef enum {
SYSTEM_STRING_SPLIT_OPTIONS_RemoveEmptyEntries,
SYSTEM_STRING_SPLIT_OPTIONS_None
} SystemStringSplitOptions;
struct _SystemString {
GTypeInstance parent_instance;
volatile int ref_count;
SystemStringPrivate * priv;
};
struct _SystemStringClass {
GTypeClass parent_class;
void (*finalize) (SystemString *self);
};
struct _SystemIOWebClient {
GTypeInstance parent_instance;
volatile int ref_count;
SystemIOWebClientPrivate * priv;
};
struct _SystemIOWebClientClass {
GTypeClass parent_class;
void (*finalize) (SystemIOWebClient *self);
};
gpointer media_video_ref (gpointer instance);
void media_video_unref (gpointer instance);
GParamSpec* media_param_spec_video (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void media_value_set_video (GValue* value, gpointer v_object);
void media_value_take_video (GValue* value, gpointer v_object);
gpointer media_value_get_video (const GValue* value);
GType media_video_get_type (void) G_GNUC_CONST;
gpointer system_io_web_client_ref (gpointer instance);
void system_io_web_client_unref (gpointer instance);
GParamSpec* system_io_param_spec_web_client (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void system_io_value_set_web_client (GValue* value, gpointer v_object);
void system_io_value_take_web_client (GValue* value, gpointer v_object);
gpointer system_io_value_get_web_client (const GValue* value);
GType system_io_web_client_get_type (void) G_GNUC_CONST;
MediaVideo* media_video_new_with_url (const gchar* url);
MediaVideo* media_video_construct_with_url (GType object_type, const gchar* url);
MediaVideo* media_video_new_with_parameter (const gchar* url, const gchar* parameter);
MediaVideo* media_video_construct_with_parameter (GType object_type, const gchar* url, const gchar* parameter);
GeeArrayList* media_video_get_Urls (MediaVideo* self);
GeeArrayList* media_video_get_Qualities (MediaVideo* self);
GType media_youtube_get_type (void) G_GNUC_CONST;
MediaYoutube* media_youtube_new (const gchar* url);
MediaYoutube* media_youtube_construct (GType object_type, const gchar* url);
GType media_dailymotion_get_type (void) G_GNUC_CONST;
MediaDailymotion* media_dailymotion_new (const gchar* url);
MediaDailymotion* media_dailymotion_construct (GType object_type, const gchar* url);
GType media_hexaglobe_get_type (void) G_GNUC_CONST;
MediaHexaglobe* media_hexaglobe_new (const gchar* url);
MediaHexaglobe* media_hexaglobe_construct (GType object_type, const gchar* url);
GType media_vimeo_get_type (void) G_GNUC_CONST;
MediaVimeo* media_vimeo_new (const gchar* url);
MediaVimeo* media_vimeo_construct (GType object_type, const gchar* url);
GType system_string_split_options_get_type (void) G_GNUC_CONST;
gpointer system_string_ref (gpointer instance);
void system_string_unref (gpointer instance);
GParamSpec* system_param_spec_string (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void system_value_set_string (GValue* value, gpointer v_object);
void system_value_take_string (GValue* value, gpointer v_object);
gpointer system_value_get_string (const GValue* value);
GType system_string_get_type (void) G_GNUC_CONST;
gchar** system_string_split_with_strings (const gchar* raw_string, gchar** delimiters, int delimiters_length1, SystemStringSplitOptions options, int* result_length1);
gchar* system_string_html_decode (const gchar* raw_string);
SystemString* system_string_new (void);
SystemString* system_string_construct (GType object_type);
SystemIOWebClient* system_io_web_client_new (void);
SystemIOWebClient* system_io_web_client_construct (GType object_type);
void system_io_web_client_download_file (SystemIOWebClient* self, const gchar* uri, const gchar* filename);
guint8* system_io_web_client_download_data (SystemIOWebClient* self, const gchar* uri, int* result_length1);
gchar* system_io_web_client_download_string (SystemIOWebClient* self, const gchar* uri);
G_END_DECLS
#endif