/* rygel-media-export-extractor.c generated by valac 0.42.1.67-6c68, the Vala compiler
 * generated from rygel-media-export-extractor.vala, do not modify */

/*
 * Copyright (C) 2016 Jens Georg <mail@jensge.org>
 *
 * Author: Jens Georg <mail@jensge.org>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * Rygel 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <libsoup/soup.h>

#define RYGEL_MEDIA_EXPORT_TYPE_EXTRACTOR (rygel_media_export_extractor_get_type ())
#define RYGEL_MEDIA_EXPORT_EXTRACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_EXTRACTOR, RygelMediaExportExtractor))
#define RYGEL_MEDIA_EXPORT_EXTRACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_EXTRACTOR, RygelMediaExportExtractorClass))
#define RYGEL_MEDIA_EXPORT_IS_EXTRACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_EXTRACTOR))
#define RYGEL_MEDIA_EXPORT_IS_EXTRACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_EXTRACTOR))
#define RYGEL_MEDIA_EXPORT_EXTRACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_EXTRACTOR, RygelMediaExportExtractorClass))

typedef struct _RygelMediaExportExtractor RygelMediaExportExtractor;
typedef struct _RygelMediaExportExtractorClass RygelMediaExportExtractorClass;
typedef struct _RygelMediaExportExtractorPrivate RygelMediaExportExtractorPrivate;
enum  {
	RYGEL_MEDIA_EXPORT_EXTRACTOR_0_PROPERTY,
	RYGEL_MEDIA_EXPORT_EXTRACTOR_FILE_PROPERTY,
	RYGEL_MEDIA_EXPORT_EXTRACTOR_EXTRACT_METADATA_PROPERTY,
	RYGEL_MEDIA_EXPORT_EXTRACTOR_NUM_PROPERTIES
};
static GParamSpec* rygel_media_export_extractor_properties[RYGEL_MEDIA_EXPORT_EXTRACTOR_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_variant_dict_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_dict_unref (var), NULL)))

#define RYGEL_MEDIA_EXPORT_TYPE_DVD_PARSER (rygel_media_export_dvd_parser_get_type ())
#define RYGEL_MEDIA_EXPORT_DVD_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_DVD_PARSER, RygelMediaExportDVDParser))
#define RYGEL_MEDIA_EXPORT_DVD_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_DVD_PARSER, RygelMediaExportDVDParserClass))
#define RYGEL_MEDIA_EXPORT_IS_DVD_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_DVD_PARSER))
#define RYGEL_MEDIA_EXPORT_IS_DVD_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_DVD_PARSER))
#define RYGEL_MEDIA_EXPORT_DVD_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_DVD_PARSER, RygelMediaExportDVDParserClass))

typedef struct _RygelMediaExportDVDParser RygelMediaExportDVDParser;
typedef struct _RygelMediaExportDVDParserClass RygelMediaExportDVDParserClass;

#define RYGEL_MEDIA_EXPORT_TYPE_PLAYLIST_EXTRACTOR (rygel_media_export_playlist_extractor_get_type ())
#define RYGEL_MEDIA_EXPORT_PLAYLIST_EXTRACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_PLAYLIST_EXTRACTOR, RygelMediaExportPlaylistExtractor))
#define RYGEL_MEDIA_EXPORT_PLAYLIST_EXTRACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_PLAYLIST_EXTRACTOR, RygelMediaExportPlaylistExtractorClass))
#define RYGEL_MEDIA_EXPORT_IS_PLAYLIST_EXTRACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_PLAYLIST_EXTRACTOR))
#define RYGEL_MEDIA_EXPORT_IS_PLAYLIST_EXTRACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_PLAYLIST_EXTRACTOR))
#define RYGEL_MEDIA_EXPORT_PLAYLIST_EXTRACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_PLAYLIST_EXTRACTOR, RygelMediaExportPlaylistExtractorClass))

typedef struct _RygelMediaExportPlaylistExtractor RygelMediaExportPlaylistExtractor;
typedef struct _RygelMediaExportPlaylistExtractorClass RygelMediaExportPlaylistExtractorClass;

#define RYGEL_MEDIA_EXPORT_TYPE_IMAGE_EXTRACTOR (rygel_media_export_image_extractor_get_type ())
#define RYGEL_MEDIA_EXPORT_IMAGE_EXTRACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_IMAGE_EXTRACTOR, RygelMediaExportImageExtractor))
#define RYGEL_MEDIA_EXPORT_IMAGE_EXTRACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_IMAGE_EXTRACTOR, RygelMediaExportImageExtractorClass))
#define RYGEL_MEDIA_EXPORT_IS_IMAGE_EXTRACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_IMAGE_EXTRACTOR))
#define RYGEL_MEDIA_EXPORT_IS_IMAGE_EXTRACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_IMAGE_EXTRACTOR))
#define RYGEL_MEDIA_EXPORT_IMAGE_EXTRACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_IMAGE_EXTRACTOR, RygelMediaExportImageExtractorClass))

typedef struct _RygelMediaExportImageExtractor RygelMediaExportImageExtractor;
typedef struct _RygelMediaExportImageExtractorClass RygelMediaExportImageExtractorClass;

#define RYGEL_MEDIA_EXPORT_TYPE_GENERIC_EXTRACTOR (rygel_media_export_generic_extractor_get_type ())
#define RYGEL_MEDIA_EXPORT_GENERIC_EXTRACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_GENERIC_EXTRACTOR, RygelMediaExportGenericExtractor))
#define RYGEL_MEDIA_EXPORT_GENERIC_EXTRACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_GENERIC_EXTRACTOR, RygelMediaExportGenericExtractorClass))
#define RYGEL_MEDIA_EXPORT_IS_GENERIC_EXTRACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_GENERIC_EXTRACTOR))
#define RYGEL_MEDIA_EXPORT_IS_GENERIC_EXTRACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_GENERIC_EXTRACTOR))
#define RYGEL_MEDIA_EXPORT_GENERIC_EXTRACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_GENERIC_EXTRACTOR, RygelMediaExportGenericExtractorClass))

typedef struct _RygelMediaExportGenericExtractor RygelMediaExportGenericExtractor;
typedef struct _RygelMediaExportGenericExtractorClass RygelMediaExportGenericExtractorClass;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _RygelMediaExportExtractorRunData RygelMediaExportExtractorRunData;
#define __vala_SoupDate_free0(var) ((var == NULL) ? NULL : (var = (_vala_SoupDate_free (var), NULL)))
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_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 enum  {
	EXTRACTOR_ERROR_GENERAL,
	EXTRACTOR_ERROR_INVALID
} ExtractorError;
#define EXTRACTOR_ERROR extractor_error_quark ()
struct _RygelMediaExportExtractor {
	GObject parent_instance;
	RygelMediaExportExtractorPrivate * priv;
	GVariantDict* serialized_info;
};

struct _RygelMediaExportExtractorClass {
	GObjectClass parent_class;
	void (*run) (RygelMediaExportExtractor* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*run_finish) (RygelMediaExportExtractor* self, GAsyncResult* _res_, GError** error);
};

struct _RygelMediaExportExtractorPrivate {
	GFile* _file;
	gboolean _extract_metadata;
};

struct _RygelMediaExportExtractorRunData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	RygelMediaExportExtractor* self;
	GFileInfo* file_info;
	GFile* _tmp0_;
	GFileInfo* _tmp1_;
	gchar* display_name;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_;
	gchar* title;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	GVariantDict* _tmp7_;
	const gchar* _tmp8_;
	GVariantDict* _tmp9_;
	const gchar* _tmp10_;
	guint64 mtime;
	GVariantDict* _tmp11_;
	GTimeVal tv;
	GTimeVal _tmp12_;
	GVariantDict* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar* content_type;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	GVariantDict* _tmp18_;
	const gchar* _tmp19_;
	GVariantDict* _tmp20_;
	gchar* id;
	GFile* _tmp21_;
	gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	GVariantDict* _tmp26_;
	const gchar* _tmp27_;
	GVariantDict* _tmp28_;
	GFile* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	GError * _inner_error_;
};

static gint RygelMediaExportExtractor_private_offset;
static gpointer rygel_media_export_extractor_parent_class = NULL;
static GRegex* rygel_media_export_extractor_char_remove_regex;
static GRegex* rygel_media_export_extractor_char_remove_regex = NULL;
static GRegex* rygel_media_export_extractor_char_convert_regex;
static GRegex* rygel_media_export_extractor_char_convert_regex = NULL;
static GRegex* rygel_media_export_extractor_space_compress_regex;
static GRegex* rygel_media_export_extractor_space_compress_regex = NULL;
static GRegex** rygel_media_export_extractor_block_regexes;
static gint rygel_media_export_extractor_block_regexes_length1;
static GRegex** rygel_media_export_extractor_block_regexes = NULL;
static gint rygel_media_export_extractor_block_regexes_length1 = 0;
static gint _rygel_media_export_extractor_block_regexes_size_ = 0;
static GRegex** rygel_media_export_extractor_blacklist_regexes;
static gint rygel_media_export_extractor_blacklist_regexes_length1;
static GRegex** rygel_media_export_extractor_blacklist_regexes = NULL;
static gint rygel_media_export_extractor_blacklist_regexes_length1 = 0;
static gint _rygel_media_export_extractor_blacklist_regexes_size_ = 0;
static GRegex** rygel_media_export_extractor_video_suffix_regexes;
static gint rygel_media_export_extractor_video_suffix_regexes_length1;
static GRegex** rygel_media_export_extractor_video_suffix_regexes = NULL;
static gint rygel_media_export_extractor_video_suffix_regexes_length1 = 0;
static gint _rygel_media_export_extractor_video_suffix_regexes_size_ = 0;

GQuark extractor_error_quark (void);
GType rygel_media_export_extractor_get_type (void) G_GNUC_CONST;
#define RYGEL_MEDIA_EXPORT_EXTRACTOR_INVALID_CHARS "()[]<>{}!@#$^&*+=|\\/\"'?~"
#define RYGEL_MEDIA_EXPORT_EXTRACTOR_CONVERT_CHARS "\t_\\."
#define RYGEL_MEDIA_EXPORT_EXTRACTOR_BLOCK_PATTERN "%s[^%s]*%s"
RygelMediaExportExtractor* rygel_media_export_extractor_create_for_file (GFile* file,
                                                                         const gchar* content_type,
                                                                         gboolean extract_metadata);
static RygelMediaExportExtractor* rygel_media_export_extractor_new (GFile* file,
                                                             gboolean extract_metadata);
static RygelMediaExportExtractor* rygel_media_export_extractor_construct (GType object_type,
                                                                   GFile* file,
                                                                   gboolean extract_metadata);
RygelMediaExportDVDParser* rygel_media_export_dvd_parser_new (GFile* file);
RygelMediaExportDVDParser* rygel_media_export_dvd_parser_construct (GType object_type,
                                                                    GFile* file);
GType rygel_media_export_dvd_parser_get_type (void) G_GNUC_CONST;
RygelMediaExportPlaylistExtractor* rygel_media_export_playlist_extractor_new (GFile* file);
RygelMediaExportPlaylistExtractor* rygel_media_export_playlist_extractor_construct (GType object_type,
                                                                                    GFile* file);
GType rygel_media_export_playlist_extractor_get_type (void) G_GNUC_CONST;
RygelMediaExportImageExtractor* rygel_media_export_image_extractor_new (GFile* file);
RygelMediaExportImageExtractor* rygel_media_export_image_extractor_construct (GType object_type,
                                                                              GFile* file);
GType rygel_media_export_image_extractor_get_type (void) G_GNUC_CONST;
RygelMediaExportGenericExtractor* rygel_media_export_generic_extractor_new (GFile* file);
RygelMediaExportGenericExtractor* rygel_media_export_generic_extractor_construct (GType object_type,
                                                                                  GFile* file);
GType rygel_media_export_generic_extractor_get_type (void) G_GNUC_CONST;
static void rygel_media_export_extractor_real_constructed (GObject* base);
static void rygel_media_export_extractor_real_run_data_free (gpointer _data);
static void rygel_media_export_extractor_real_run_async_ready_wrapper (GObject *source_object,
                                                                GAsyncResult *res,
                                                                void *user_data);
static void rygel_media_export_extractor_real_run (RygelMediaExportExtractor* self,
                                            GAsyncReadyCallback _callback_,
                                            gpointer _user_data_);
void rygel_media_export_extractor_run (RygelMediaExportExtractor* self,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_);
void rygel_media_export_extractor_run_finish (RygelMediaExportExtractor* self,
                                              GAsyncResult* _res_,
                                              GError** error);
static gboolean rygel_media_export_extractor_real_run_co (RygelMediaExportExtractorRunData* _data_);
GFile* rygel_media_export_extractor_get_file (RygelMediaExportExtractor* self);
static void rygel_media_export_extractor_run_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_);
gboolean rygel_media_export_extractor_get_extract_metadata (RygelMediaExportExtractor* self);
static gchar* rygel_media_export_extractor_strip_invalid_entities (RygelMediaExportExtractor* self,
                                                            const gchar* original);
#define RYGEL_MEDIA_EXPORT_SERIALIZER_TITLE "Title"
#define RYGEL_MEDIA_EXPORT_SERIALIZER_MODIFIED "MTime"
#define RYGEL_MEDIA_EXPORT_SERIALIZER_DATE "Date"
#define RYGEL_MEDIA_EXPORT_SERIALIZER_MIME_TYPE "MimeType"
#define RYGEL_MEDIA_EXPORT_SERIALIZER_SIZE "Size"
#define RYGEL_MEDIA_EXPORT_SERIALIZER_ID "Id"
#define RYGEL_MEDIA_EXPORT_SERIALIZER_URI "Uri"
GVariant* rygel_media_export_extractor_get (RygelMediaExportExtractor* self);
static void _vala_SoupDate_free (SoupDate* self);
static void _vala_array_add1 (GRegex** * array,
                       int* length,
                       int* size,
                       GRegex* value);
static void _vala_array_add2 (GRegex** * array,
                       int* length,
                       int* size,
                       GRegex* value);
static void _vala_array_add3 (GRegex** * array,
                       int* length,
                       int* size,
                       GRegex* value);
void rygel_media_export_extractor_set_file (RygelMediaExportExtractor* self,
                                            GFile* value);
void rygel_media_export_extractor_set_extract_metadata (RygelMediaExportExtractor* self,
                                                        gboolean value);
static void rygel_media_export_extractor_finalize (GObject * obj);
static void _vala_rygel_media_export_extractor_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec);
static void _vala_rygel_media_export_extractor_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec);
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 const gchar* RYGEL_MEDIA_EXPORT_EXTRACTOR_BLOCKS[4] = {"()", "{}", "[]", "<>"};
static const gchar* RYGEL_MEDIA_EXPORT_EXTRACTOR_BLACKLIST[14] = {"720p", "1080p", "x264", "ws", "proper", "real.repack", "repack", "hdtv", "pdtv", "notv", "dsr", "DVDRip", "divx", "xvid"};
static const gchar* RYGEL_MEDIA_EXPORT_EXTRACTOR_VIDEO_SUFFIXES[21] = {"webm", "mkv", "flv", "ogv", "ogg", "avi", "mov", "wmv", "mp4", "m4v", "mpeg", "mpg", "iso", "mp3", "m4a", "png", "jpg", "jpeg", "ogv", "oga", "3gp"};

GQuark
extractor_error_quark (void)
{
	return g_quark_from_static_string ("extractor-error-quark");
}

static inline gpointer
rygel_media_export_extractor_get_instance_private (RygelMediaExportExtractor* self)
{
	return G_STRUCT_MEMBER_P (self, RygelMediaExportExtractor_private_offset);
}

/**
     * Factory method for creating specific extractors depending on the
     * content type of the file
     */
RygelMediaExportExtractor*
rygel_media_export_extractor_create_for_file (GFile* file,
                                              const gchar* content_type,
                                              gboolean extract_metadata)
{
	RygelMediaExportExtractor* result = NULL;
	gboolean _tmp1_ = FALSE;
	gboolean is_text = FALSE;
	gboolean _tmp4_ = FALSE;
	RygelMediaExportGenericExtractor* _tmp6_;
	g_return_val_if_fail (file != NULL, NULL);
	g_return_val_if_fail (content_type != NULL, NULL);
	if (!extract_metadata) {
		RygelMediaExportExtractor* _tmp0_;
		_tmp0_ = rygel_media_export_extractor_new (file, FALSE);
		result = _tmp0_;
		return result;
	}
	if (g_str_has_prefix (content_type, "text/")) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = g_str_has_suffix (content_type, "xml");
	}
	is_text = _tmp1_;
	if (g_strcmp0 (content_type, "application/x-cd-image") == 0) {
		RygelMediaExportDVDParser* _tmp2_;
		_tmp2_ = rygel_media_export_dvd_parser_new (file);
		result = (RygelMediaExportExtractor*) _tmp2_;
		return result;
	}
	if (is_text) {
		RygelMediaExportPlaylistExtractor* _tmp3_;
		_tmp3_ = rygel_media_export_playlist_extractor_new (file);
		result = (RygelMediaExportExtractor*) _tmp3_;
		return result;
	}
	if (g_strcmp0 (content_type, "image/jpeg") == 0) {
		_tmp4_ = TRUE;
	} else {
		_tmp4_ = g_strcmp0 (content_type, "image/png") == 0;
	}
	if (_tmp4_) {
		RygelMediaExportImageExtractor* _tmp5_;
		_tmp5_ = rygel_media_export_image_extractor_new (file);
		result = (RygelMediaExportExtractor*) _tmp5_;
		return result;
	}
	_tmp6_ = rygel_media_export_generic_extractor_new (file);
	result = (RygelMediaExportExtractor*) _tmp6_;
	return result;
}

static RygelMediaExportExtractor*
rygel_media_export_extractor_construct (GType object_type,
                                        GFile* file,
                                        gboolean extract_metadata)
{
	RygelMediaExportExtractor * self = NULL;
	g_return_val_if_fail (file != NULL, NULL);
	self = (RygelMediaExportExtractor*) g_object_new (object_type, "file", file, "extract-metadata", extract_metadata, NULL);
	return self;
}

static RygelMediaExportExtractor*
rygel_media_export_extractor_new (GFile* file,
                                  gboolean extract_metadata)
{
	return rygel_media_export_extractor_construct (RYGEL_MEDIA_EXPORT_TYPE_EXTRACTOR, file, extract_metadata);
}

static void
rygel_media_export_extractor_real_constructed (GObject* base)
{
	RygelMediaExportExtractor * self;
	GVariantDict* _tmp0_;
	self = (RygelMediaExportExtractor*) base;
	_tmp0_ = g_variant_dict_new (NULL);
	_g_variant_dict_unref0 (self->serialized_info);
	self->serialized_info = _tmp0_;
}

static void
rygel_media_export_extractor_real_run_data_free (gpointer _data)
{
	RygelMediaExportExtractorRunData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelMediaExportExtractorRunData, _data_);
}

static void
rygel_media_export_extractor_real_run_async_ready_wrapper (GObject *source_object,
                                                           GAsyncResult *res,
                                                           void *user_data)
{
	RygelMediaExportExtractorRunData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
rygel_media_export_extractor_real_run (RygelMediaExportExtractor* self,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	RygelMediaExportExtractorRunData* _data_;
	RygelMediaExportExtractor* _tmp0_;
	_data_ = g_slice_new0 (RygelMediaExportExtractorRunData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, rygel_media_export_extractor_real_run_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, rygel_media_export_extractor_real_run_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	rygel_media_export_extractor_real_run_co (_data_);
}

static void
rygel_media_export_extractor_real_run_finish (RygelMediaExportExtractor* self,
                                              GAsyncResult* _res_,
                                              GError** error)
{
	RygelMediaExportExtractorRunData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}

static void
rygel_media_export_extractor_run_ready (GObject* source_object,
                                        GAsyncResult* _res_,
                                        gpointer _user_data_)
{
	RygelMediaExportExtractorRunData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	rygel_media_export_extractor_real_run_co (_data_);
}

static gboolean
rygel_media_export_extractor_real_run_co (RygelMediaExportExtractorRunData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->_file;
	_data_->_state_ = 1;
	g_file_query_info_async (_data_->_tmp0_, G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "," G_FILE_ATTRIBUTE_STANDARD_SIZE "," G_FILE_ATTRIBUTE_TIME_MODIFIED "," G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, NULL, rygel_media_export_extractor_run_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp1_ = g_file_query_info_finish (_data_->_tmp0_, _data_->_res_, &_data_->_inner_error_);
	_data_->file_info = _data_->_tmp1_;
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp2_ = g_file_info_get_display_name (_data_->file_info);
	_data_->_tmp3_ = g_strdup (_data_->_tmp2_);
	_data_->display_name = _data_->_tmp3_;
	_data_->_tmp4_ = _data_->self->priv->_extract_metadata;
	if (_data_->_tmp4_) {
		_data_->_tmp5_ = _data_->display_name;
		_data_->_tmp6_ = rygel_media_export_extractor_strip_invalid_entities (_data_->self, _data_->_tmp5_);
		_data_->title = _data_->_tmp6_;
		_data_->_tmp7_ = _data_->self->serialized_info;
		_data_->_tmp8_ = _data_->title;
		g_variant_dict_insert (_data_->_tmp7_, RYGEL_MEDIA_EXPORT_SERIALIZER_TITLE, "s", _data_->_tmp8_, NULL);
		_g_free0 (_data_->title);
	} else {
		_data_->_tmp9_ = _data_->self->serialized_info;
		_data_->_tmp10_ = _data_->display_name;
		g_variant_dict_insert (_data_->_tmp9_, RYGEL_MEDIA_EXPORT_SERIALIZER_TITLE, "s", _data_->_tmp10_, NULL);
	}
	_data_->mtime = g_file_info_get_attribute_uint64 (_data_->file_info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
	_data_->_tmp11_ = _data_->self->serialized_info;
	g_variant_dict_insert (_data_->_tmp11_, RYGEL_MEDIA_EXPORT_SERIALIZER_MODIFIED, "t", _data_->mtime, NULL);
	memset (&_data_->_tmp12_, 0, sizeof (GTimeVal));
	_data_->_tmp12_.tv_sec = (glong) _data_->mtime;
	_data_->_tmp12_.tv_usec = (glong) 0;
	_data_->tv = _data_->_tmp12_;
	_data_->_tmp13_ = _data_->self->serialized_info;
	_data_->_tmp14_ = g_time_val_to_iso8601 (&_data_->tv);
	_data_->_tmp15_ = _data_->_tmp14_;
	g_variant_dict_insert (_data_->_tmp13_, RYGEL_MEDIA_EXPORT_SERIALIZER_DATE, "s", _data_->_tmp15_, NULL);
	_g_free0 (_data_->_tmp15_);
	_data_->_tmp16_ = g_file_info_get_content_type (_data_->file_info);
	_data_->_tmp17_ = g_content_type_get_mime_type (_data_->_tmp16_);
	_data_->content_type = _data_->_tmp17_;
	_data_->_tmp18_ = _data_->self->serialized_info;
	_data_->_tmp19_ = _data_->content_type;
	g_variant_dict_insert (_data_->_tmp18_, RYGEL_MEDIA_EXPORT_SERIALIZER_MIME_TYPE, "s", _data_->_tmp19_, NULL);
	_data_->_tmp20_ = _data_->self->serialized_info;
	g_variant_dict_insert (_data_->_tmp20_, RYGEL_MEDIA_EXPORT_SERIALIZER_SIZE, "t", g_file_info_get_size (_data_->file_info), NULL);
	_data_->_tmp21_ = _data_->self->priv->_file;
	_data_->_tmp22_ = g_file_get_uri (_data_->_tmp21_);
	_data_->_tmp23_ = _data_->_tmp22_;
	_data_->_tmp24_ = g_compute_checksum_for_string (G_CHECKSUM_MD5, _data_->_tmp23_, (gsize) -1);
	_data_->_tmp25_ = _data_->_tmp24_;
	_g_free0 (_data_->_tmp23_);
	_data_->id = _data_->_tmp25_;
	_data_->_tmp26_ = _data_->self->serialized_info;
	_data_->_tmp27_ = _data_->id;
	g_variant_dict_insert (_data_->_tmp26_, RYGEL_MEDIA_EXPORT_SERIALIZER_ID, "s", _data_->_tmp27_, NULL);
	_data_->_tmp28_ = _data_->self->serialized_info;
	_data_->_tmp29_ = _data_->self->priv->_file;
	_data_->_tmp30_ = g_file_get_uri (_data_->_tmp29_);
	_data_->_tmp31_ = _data_->_tmp30_;
	g_variant_dict_insert (_data_->_tmp28_, RYGEL_MEDIA_EXPORT_SERIALIZER_URI, "s", _data_->_tmp31_, NULL);
	_g_free0 (_data_->_tmp31_);
	_g_free0 (_data_->id);
	_g_free0 (_data_->content_type);
	_g_free0 (_data_->display_name);
	_g_object_unref0 (_data_->file_info);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
rygel_media_export_extractor_run (RygelMediaExportExtractor* self,
                                  GAsyncReadyCallback _callback_,
                                  gpointer _user_data_)
{
	RYGEL_MEDIA_EXPORT_EXTRACTOR_GET_CLASS (self)->run (self, _callback_, _user_data_);
}

void
rygel_media_export_extractor_run_finish (RygelMediaExportExtractor* self,
                                         GAsyncResult* _res_,
                                         GError** error)
{
	RYGEL_MEDIA_EXPORT_EXTRACTOR_GET_CLASS (self)->run_finish (self, _res_, error);
}

static gboolean
string_contains (const gchar* self,
                 const gchar* needle)
{
	gboolean result = FALSE;
	gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = strstr ((gchar*) self, (gchar*) needle);
	result = _tmp0_ != NULL;
	return result;
}

static void
_vala_SoupDate_free (SoupDate* self)
{
	g_boxed_free (soup_date_get_type (), self);
}

GVariant*
rygel_media_export_extractor_get (RygelMediaExportExtractor* self)
{
	GVariant* result = NULL;
	GVariant* date = NULL;
	GVariantDict* _tmp0_;
	const GVariantType* _tmp1_;
	GVariant* _tmp2_;
	GVariant* _tmp3_;
	const gchar* _tmp4_;
	GVariantDict* _tmp12_;
	GVariant* _tmp13_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->serialized_info;
	_tmp1_ = G_VARIANT_TYPE_STRING;
	_tmp2_ = g_variant_dict_lookup_value (_tmp0_, RYGEL_MEDIA_EXPORT_SERIALIZER_DATE, _tmp1_);
	date = _tmp2_;
	_tmp3_ = date;
	_tmp4_ = g_variant_get_string (_tmp3_, NULL);
	if (string_contains (_tmp4_, "T")) {
		SoupDate* fixed_date = NULL;
		GVariant* _tmp5_;
		const gchar* _tmp6_;
		SoupDate* _tmp7_;
		gchar* new_date = NULL;
		SoupDate* _tmp8_;
		gchar* _tmp9_;
		GVariantDict* _tmp10_;
		const gchar* _tmp11_;
		_tmp5_ = date;
		_tmp6_ = g_variant_get_string (_tmp5_, NULL);
		_tmp7_ = soup_date_new_from_string (_tmp6_);
		fixed_date = _tmp7_;
		_tmp8_ = fixed_date;
		_tmp9_ = soup_date_to_string (_tmp8_, SOUP_DATE_ISO8601_FULL);
		new_date = _tmp9_;
		_tmp10_ = self->serialized_info;
		_tmp11_ = new_date;
		g_variant_dict_insert (_tmp10_, RYGEL_MEDIA_EXPORT_SERIALIZER_DATE, "s", _tmp11_, NULL);
		_g_free0 (new_date);
		__vala_SoupDate_free0 (fixed_date);
	}
	_tmp12_ = self->serialized_info;
	_tmp13_ = g_variant_dict_end (_tmp12_);
	g_variant_ref_sink (_tmp13_);
	result = _tmp13_;
	_g_variant_unref0 (date);
	return result;
}

static gchar
string_get (const gchar* self,
            glong index)
{
	gchar result = '\0';
	gchar _tmp0_;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = ((gchar*) self)[index];
	result = _tmp0_;
	return result;
}

static void
_vala_array_add1 (GRegex** * array,
                  int* length,
                  int* size,
                  GRegex* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GRegex*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static void
_vala_array_add2 (GRegex** * array,
                  int* length,
                  int* size,
                  GRegex* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GRegex*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static gpointer
_g_regex_ref0 (gpointer self)
{
	return self ? g_regex_ref (self) : NULL;
}

static void
_vala_array_add3 (GRegex** * array,
                  int* length,
                  int* size,
                  GRegex* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (GRegex*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}

static gchar*
rygel_media_export_extractor_strip_invalid_entities (RygelMediaExportExtractor* self,
                                                     const gchar* original)
{
	gchar* result = NULL;
	GRegex* _tmp0_;
	gchar* p = NULL;
	gchar* _tmp59_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (original != NULL, NULL);
	_tmp0_ = rygel_media_export_extractor_char_remove_regex;
	if (_tmp0_ == NULL) {
		{
			gchar* regex_string = NULL;
			gchar* _tmp1_;
			GRegex* _tmp2_ = NULL;
			const gchar* _tmp3_;
			gchar* _tmp4_;
			gchar* _tmp5_;
			GRegex* _tmp6_;
			GRegex* _tmp7_;
			GRegex* _tmp8_;
			gchar* _tmp9_;
			GRegex* _tmp10_ = NULL;
			const gchar* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			GRegex* _tmp14_;
			GRegex* _tmp15_;
			GRegex* _tmp16_;
			GRegex* _tmp17_ = NULL;
			GRegex* _tmp18_;
			GRegex* _tmp19_;
			GRegex** _tmp20_;
			_tmp1_ = g_regex_escape_string (RYGEL_MEDIA_EXPORT_EXTRACTOR_INVALID_CHARS, -1);
			regex_string = _tmp1_;
			_tmp3_ = regex_string;
			_tmp4_ = g_strdup_printf ("[%s]", _tmp3_);
			_tmp5_ = _tmp4_;
			_tmp6_ = g_regex_new (_tmp5_, 0, 0, &_inner_error_);
			_tmp7_ = _tmp6_;
			_g_free0 (_tmp5_);
			_tmp2_ = _tmp7_;
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				_g_free0 (regex_string);
				if (_inner_error_->domain == G_REGEX_ERROR) {
					goto __catch7_g_regex_error;
				}
				_g_free0 (regex_string);
				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;
			}
			_tmp8_ = _tmp2_;
			_tmp2_ = NULL;
			_g_regex_unref0 (rygel_media_export_extractor_char_remove_regex);
			rygel_media_export_extractor_char_remove_regex = _tmp8_;
			_tmp9_ = g_regex_escape_string (RYGEL_MEDIA_EXPORT_EXTRACTOR_CONVERT_CHARS, -1);
			_g_free0 (regex_string);
			regex_string = _tmp9_;
			_tmp11_ = regex_string;
			_tmp12_ = g_strdup_printf ("[%s]", _tmp11_);
			_tmp13_ = _tmp12_;
			_tmp14_ = g_regex_new (_tmp13_, 0, 0, &_inner_error_);
			_tmp15_ = _tmp14_;
			_g_free0 (_tmp13_);
			_tmp10_ = _tmp15_;
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				_g_regex_unref0 (_tmp2_);
				_g_free0 (regex_string);
				if (_inner_error_->domain == G_REGEX_ERROR) {
					goto __catch7_g_regex_error;
				}
				_g_regex_unref0 (_tmp2_);
				_g_free0 (regex_string);
				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;
			}
			_tmp16_ = _tmp10_;
			_tmp10_ = NULL;
			_g_regex_unref0 (rygel_media_export_extractor_char_convert_regex);
			rygel_media_export_extractor_char_convert_regex = _tmp16_;
			_tmp18_ = g_regex_new ("\\s+", 0, 0, &_inner_error_);
			_tmp17_ = _tmp18_;
			if (G_UNLIKELY (_inner_error_ != NULL)) {
				_g_regex_unref0 (_tmp10_);
				_g_regex_unref0 (_tmp2_);
				_g_free0 (regex_string);
				if (_inner_error_->domain == G_REGEX_ERROR) {
					goto __catch7_g_regex_error;
				}
				_g_regex_unref0 (_tmp10_);
				_g_regex_unref0 (_tmp2_);
				_g_free0 (regex_string);
				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;
			}
			_tmp19_ = _tmp17_;
			_tmp17_ = NULL;
			_g_regex_unref0 (rygel_media_export_extractor_space_compress_regex);
			rygel_media_export_extractor_space_compress_regex = _tmp19_;
			_tmp20_ = g_new0 (GRegex*, 0 + 1);
			rygel_media_export_extractor_block_regexes = (_vala_array_free (rygel_media_export_extractor_block_regexes, rygel_media_export_extractor_block_regexes_length1, (GDestroyNotify) g_regex_unref), NULL);
			rygel_media_export_extractor_block_regexes = _tmp20_;
			rygel_media_export_extractor_block_regexes_length1 = 0;
			_rygel_media_export_extractor_block_regexes_size_ = rygel_media_export_extractor_block_regexes_length1;
			{
				const gchar** block_collection = NULL;
				gint block_collection_length1 = 0;
				gint _block_collection_size_ = 0;
				gint block_it = 0;
				block_collection = RYGEL_MEDIA_EXPORT_EXTRACTOR_BLOCKS;
				block_collection_length1 = G_N_ELEMENTS (RYGEL_MEDIA_EXPORT_EXTRACTOR_BLOCKS);
				for (block_it = 0; block_it < G_N_ELEMENTS (RYGEL_MEDIA_EXPORT_EXTRACTOR_BLOCKS); block_it = block_it + 1) {
					const gchar* block = NULL;
					block = block_collection[block_it];
					{
						gchar* block_re = NULL;
						const gchar* _tmp21_;
						gchar* _tmp22_;
						gchar* _tmp23_;
						gchar* _tmp24_;
						gchar* _tmp25_;
						const gchar* _tmp26_;
						gchar* _tmp27_;
						gchar* _tmp28_;
						gchar* _tmp29_;
						gchar* _tmp30_;
						const gchar* _tmp31_;
						gchar* _tmp32_;
						gchar* _tmp33_;
						gchar* _tmp34_;
						gchar* _tmp35_;
						gchar* _tmp36_;
						gchar* _tmp37_;
						GRegex* _tmp38_ = NULL;
						const gchar* _tmp39_;
						GRegex* _tmp40_;
						GRegex** _tmp41_;
						gint _tmp41__length1;
						GRegex* _tmp42_;
						_tmp21_ = block;
						_tmp22_ = g_strdup_printf ("%C", string_get (_tmp21_, (glong) 0));
						_tmp23_ = _tmp22_;
						_tmp24_ = g_regex_escape_string (_tmp23_, -1);
						_tmp25_ = _tmp24_;
						_tmp26_ = block;
						_tmp27_ = g_strdup_printf ("%C", string_get (_tmp26_, (glong) 1));
						_tmp28_ = _tmp27_;
						_tmp29_ = g_regex_escape_string (_tmp28_, -1);
						_tmp30_ = _tmp29_;
						_tmp31_ = block;
						_tmp32_ = g_strdup_printf ("%C", string_get (_tmp31_, (glong) 1));
						_tmp33_ = _tmp32_;
						_tmp34_ = g_regex_escape_string (_tmp33_, -1);
						_tmp35_ = _tmp34_;
						_tmp36_ = g_strdup_printf (RYGEL_MEDIA_EXPORT_EXTRACTOR_BLOCK_PATTERN, _tmp25_, _tmp30_, _tmp35_);
						_tmp37_ = _tmp36_;
						_g_free0 (_tmp35_);
						_g_free0 (_tmp33_);
						_g_free0 (_tmp30_);
						_g_free0 (_tmp28_);
						_g_free0 (_tmp25_);
						_g_free0 (_tmp23_);
						block_re = _tmp37_;
						_tmp39_ = block_re;
						_tmp40_ = g_regex_new (_tmp39_, 0, 0, &_inner_error_);
						_tmp38_ = _tmp40_;
						if (G_UNLIKELY (_inner_error_ != NULL)) {
							_g_free0 (block_re);
							_g_regex_unref0 (_tmp17_);
							_g_regex_unref0 (_tmp10_);
							_g_regex_unref0 (_tmp2_);
							_g_free0 (regex_string);
							if (_inner_error_->domain == G_REGEX_ERROR) {
								goto __catch7_g_regex_error;
							}
							_g_free0 (block_re);
							_g_regex_unref0 (_tmp17_);
							_g_regex_unref0 (_tmp10_);
							_g_regex_unref0 (_tmp2_);
							_g_free0 (regex_string);
							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;
						}
						_tmp41_ = rygel_media_export_extractor_block_regexes;
						_tmp41__length1 = rygel_media_export_extractor_block_regexes_length1;
						_tmp42_ = _tmp38_;
						_tmp38_ = NULL;
						_vala_array_add1 (&rygel_media_export_extractor_block_regexes, &rygel_media_export_extractor_block_regexes_length1, &_rygel_media_export_extractor_block_regexes_size_, _tmp42_);
						_g_regex_unref0 (_tmp38_);
						_g_free0 (block_re);
					}
				}
			}
			{
				const gchar** blacklist_collection = NULL;
				gint blacklist_collection_length1 = 0;
				gint _blacklist_collection_size_ = 0;
				gint blacklist_it = 0;
				blacklist_collection = RYGEL_MEDIA_EXPORT_EXTRACTOR_BLACKLIST;
				blacklist_collection_length1 = G_N_ELEMENTS (RYGEL_MEDIA_EXPORT_EXTRACTOR_BLACKLIST);
				for (blacklist_it = 0; blacklist_it < G_N_ELEMENTS (RYGEL_MEDIA_EXPORT_EXTRACTOR_BLACKLIST); blacklist_it = blacklist_it + 1) {
					const gchar* blacklist = NULL;
					blacklist = blacklist_collection[blacklist_it];
					{
						GRegex* _tmp43_ = NULL;
						const gchar* _tmp44_;
						gchar* _tmp45_;
						gchar* _tmp46_;
						GRegex* _tmp47_;
						GRegex* _tmp48_;
						GRegex** _tmp49_;
						gint _tmp49__length1;
						GRegex* _tmp50_;
						_tmp44_ = blacklist;
						_tmp45_ = g_regex_escape_string (_tmp44_, -1);
						_tmp46_ = _tmp45_;
						_tmp47_ = g_regex_new (_tmp46_, 0, 0, &_inner_error_);
						_tmp48_ = _tmp47_;
						_g_free0 (_tmp46_);
						_tmp43_ = _tmp48_;
						if (G_UNLIKELY (_inner_error_ != NULL)) {
							_g_regex_unref0 (_tmp17_);
							_g_regex_unref0 (_tmp10_);
							_g_regex_unref0 (_tmp2_);
							_g_free0 (regex_string);
							if (_inner_error_->domain == G_REGEX_ERROR) {
								goto __catch7_g_regex_error;
							}
							_g_regex_unref0 (_tmp17_);
							_g_regex_unref0 (_tmp10_);
							_g_regex_unref0 (_tmp2_);
							_g_free0 (regex_string);
							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;
						}
						_tmp49_ = rygel_media_export_extractor_blacklist_regexes;
						_tmp49__length1 = rygel_media_export_extractor_blacklist_regexes_length1;
						_tmp50_ = _tmp43_;
						_tmp43_ = NULL;
						_vala_array_add2 (&rygel_media_export_extractor_blacklist_regexes, &rygel_media_export_extractor_blacklist_regexes_length1, &_rygel_media_export_extractor_blacklist_regexes_size_, _tmp50_);
						_g_regex_unref0 (_tmp43_);
					}
				}
			}
			{
				const gchar** suffix_collection = NULL;
				gint suffix_collection_length1 = 0;
				gint _suffix_collection_size_ = 0;
				gint suffix_it = 0;
				suffix_collection = RYGEL_MEDIA_EXPORT_EXTRACTOR_VIDEO_SUFFIXES;
				suffix_collection_length1 = G_N_ELEMENTS (RYGEL_MEDIA_EXPORT_EXTRACTOR_VIDEO_SUFFIXES);
				for (suffix_it = 0; suffix_it < G_N_ELEMENTS (RYGEL_MEDIA_EXPORT_EXTRACTOR_VIDEO_SUFFIXES); suffix_it = suffix_it + 1) {
					const gchar* suffix = NULL;
					suffix = suffix_collection[suffix_it];
					{
						GRegex* regex = NULL;
						const gchar* _tmp51_;
						gchar* _tmp52_;
						gchar* _tmp53_;
						GRegex* _tmp54_;
						GRegex* _tmp55_;
						GRegex** _tmp56_;
						gint _tmp56__length1;
						GRegex* _tmp57_;
						GRegex* _tmp58_;
						_tmp51_ = suffix;
						_tmp52_ = g_regex_escape_string (_tmp51_, -1);
						_tmp53_ = _tmp52_;
						_tmp54_ = g_regex_new (_tmp53_, G_REGEX_CASELESS, 0, &_inner_error_);
						_tmp55_ = _tmp54_;
						_g_free0 (_tmp53_);
						regex = _tmp55_;
						if (G_UNLIKELY (_inner_error_ != NULL)) {
							_g_regex_unref0 (_tmp17_);
							_g_regex_unref0 (_tmp10_);
							_g_regex_unref0 (_tmp2_);
							_g_free0 (regex_string);
							if (_inner_error_->domain == G_REGEX_ERROR) {
								goto __catch7_g_regex_error;
							}
							_g_regex_unref0 (_tmp17_);
							_g_regex_unref0 (_tmp10_);
							_g_regex_unref0 (_tmp2_);
							_g_free0 (regex_string);
							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;
						}
						_tmp56_ = rygel_media_export_extractor_video_suffix_regexes;
						_tmp56__length1 = rygel_media_export_extractor_video_suffix_regexes_length1;
						_tmp57_ = regex;
						_tmp58_ = _g_regex_ref0 (_tmp57_);
						_vala_array_add3 (&rygel_media_export_extractor_video_suffix_regexes, &rygel_media_export_extractor_video_suffix_regexes_length1, &_rygel_media_export_extractor_video_suffix_regexes_size_, _tmp58_);
						_g_regex_unref0 (regex);
					}
				}
			}
			_g_regex_unref0 (_tmp17_);
			_g_regex_unref0 (_tmp10_);
			_g_regex_unref0 (_tmp2_);
			_g_free0 (regex_string);
		}
		goto __finally7;
		__catch7_g_regex_error:
		{
			GError* _error_ = NULL;
			_error_ = _inner_error_;
			_inner_error_ = NULL;
			g_assert_not_reached ();
			_g_error_free0 (_error_);
		}
		__finally7:
		if (G_UNLIKELY (_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;
		}
	}
	_tmp59_ = g_strdup (original);
	_g_free0 (p);
	p = _tmp59_;
	{
		GRegex** _tmp60_;
		gint _tmp60__length1;
		GRegex** _tmp67_;
		gint _tmp67__length1;
		GRegex** _tmp74_;
		gint _tmp74__length1;
		gchar* _tmp81_ = NULL;
		GRegex* _tmp82_;
		const gchar* _tmp83_;
		gchar* _tmp84_;
		gchar* _tmp85_;
		gchar* _tmp86_ = NULL;
		GRegex* _tmp87_;
		const gchar* _tmp88_;
		gchar* _tmp89_;
		gchar* _tmp90_;
		gchar* _tmp91_ = NULL;
		GRegex* _tmp92_;
		const gchar* _tmp93_;
		gchar* _tmp94_;
		gchar* _tmp95_;
		const gchar* _tmp96_;
		_tmp60_ = rygel_media_export_extractor_blacklist_regexes;
		_tmp60__length1 = rygel_media_export_extractor_blacklist_regexes_length1;
		{
			GRegex** re_collection = NULL;
			gint re_collection_length1 = 0;
			gint _re_collection_size_ = 0;
			gint re_it = 0;
			re_collection = _tmp60_;
			re_collection_length1 = _tmp60__length1;
			for (re_it = 0; re_it < _tmp60__length1; re_it = re_it + 1) {
				GRegex* _tmp61_;
				GRegex* re = NULL;
				_tmp61_ = _g_regex_ref0 (re_collection[re_it]);
				re = _tmp61_;
				{
					gchar* _tmp62_ = NULL;
					GRegex* _tmp63_;
					const gchar* _tmp64_;
					gchar* _tmp65_;
					gchar* _tmp66_;
					_tmp63_ = re;
					_tmp64_ = p;
					_tmp65_ = g_regex_replace_literal (_tmp63_, _tmp64_, (gssize) -1, 0, "", 0, &_inner_error_);
					_tmp62_ = _tmp65_;
					if (G_UNLIKELY (_inner_error_ != NULL)) {
						_g_regex_unref0 (re);
						if (_inner_error_->domain == G_REGEX_ERROR) {
							goto __catch8_g_regex_error;
						}
						_g_regex_unref0 (re);
						_g_free0 (p);
						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;
					}
					_tmp66_ = _tmp62_;
					_tmp62_ = NULL;
					_g_free0 (p);
					p = _tmp66_;
					_g_free0 (_tmp62_);
					_g_regex_unref0 (re);
				}
			}
		}
		_tmp67_ = rygel_media_export_extractor_video_suffix_regexes;
		_tmp67__length1 = rygel_media_export_extractor_video_suffix_regexes_length1;
		{
			GRegex** re_collection = NULL;
			gint re_collection_length1 = 0;
			gint _re_collection_size_ = 0;
			gint re_it = 0;
			re_collection = _tmp67_;
			re_collection_length1 = _tmp67__length1;
			for (re_it = 0; re_it < _tmp67__length1; re_it = re_it + 1) {
				GRegex* _tmp68_;
				GRegex* re = NULL;
				_tmp68_ = _g_regex_ref0 (re_collection[re_it]);
				re = _tmp68_;
				{
					gchar* _tmp69_ = NULL;
					GRegex* _tmp70_;
					const gchar* _tmp71_;
					gchar* _tmp72_;
					gchar* _tmp73_;
					_tmp70_ = re;
					_tmp71_ = p;
					_tmp72_ = g_regex_replace_literal (_tmp70_, _tmp71_, (gssize) -1, 0, "", 0, &_inner_error_);
					_tmp69_ = _tmp72_;
					if (G_UNLIKELY (_inner_error_ != NULL)) {
						_g_regex_unref0 (re);
						if (_inner_error_->domain == G_REGEX_ERROR) {
							goto __catch8_g_regex_error;
						}
						_g_regex_unref0 (re);
						_g_free0 (p);
						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;
					}
					_tmp73_ = _tmp69_;
					_tmp69_ = NULL;
					_g_free0 (p);
					p = _tmp73_;
					_g_free0 (_tmp69_);
					_g_regex_unref0 (re);
				}
			}
		}
		_tmp74_ = rygel_media_export_extractor_block_regexes;
		_tmp74__length1 = rygel_media_export_extractor_block_regexes_length1;
		{
			GRegex** re_collection = NULL;
			gint re_collection_length1 = 0;
			gint _re_collection_size_ = 0;
			gint re_it = 0;
			re_collection = _tmp74_;
			re_collection_length1 = _tmp74__length1;
			for (re_it = 0; re_it < _tmp74__length1; re_it = re_it + 1) {
				GRegex* _tmp75_;
				GRegex* re = NULL;
				_tmp75_ = _g_regex_ref0 (re_collection[re_it]);
				re = _tmp75_;
				{
					gchar* _tmp76_ = NULL;
					GRegex* _tmp77_;
					const gchar* _tmp78_;
					gchar* _tmp79_;
					gchar* _tmp80_;
					_tmp77_ = re;
					_tmp78_ = p;
					_tmp79_ = g_regex_replace_literal (_tmp77_, _tmp78_, (gssize) -1, 0, "", 0, &_inner_error_);
					_tmp76_ = _tmp79_;
					if (G_UNLIKELY (_inner_error_ != NULL)) {
						_g_regex_unref0 (re);
						if (_inner_error_->domain == G_REGEX_ERROR) {
							goto __catch8_g_regex_error;
						}
						_g_regex_unref0 (re);
						_g_free0 (p);
						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;
					}
					_tmp80_ = _tmp76_;
					_tmp76_ = NULL;
					_g_free0 (p);
					p = _tmp80_;
					_g_free0 (_tmp76_);
					_g_regex_unref0 (re);
				}
			}
		}
		_tmp82_ = rygel_media_export_extractor_char_remove_regex;
		_tmp83_ = p;
		_tmp84_ = g_regex_replace_literal (_tmp82_, _tmp83_, (gssize) -1, 0, "", 0, &_inner_error_);
		_tmp81_ = _tmp84_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch8_g_regex_error;
			}
			_g_free0 (p);
			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;
		}
		_tmp85_ = _tmp81_;
		_tmp81_ = NULL;
		_g_free0 (p);
		p = _tmp85_;
		_tmp87_ = rygel_media_export_extractor_char_convert_regex;
		_tmp88_ = p;
		_tmp89_ = g_regex_replace_literal (_tmp87_, _tmp88_, (gssize) -1, 0, " ", 0, &_inner_error_);
		_tmp86_ = _tmp89_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_free0 (_tmp81_);
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch8_g_regex_error;
			}
			_g_free0 (_tmp81_);
			_g_free0 (p);
			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;
		}
		_tmp90_ = _tmp86_;
		_tmp86_ = NULL;
		_g_free0 (p);
		p = _tmp90_;
		_tmp92_ = rygel_media_export_extractor_space_compress_regex;
		_tmp93_ = p;
		_tmp94_ = g_regex_replace_literal (_tmp92_, _tmp93_, (gssize) -1, 0, " ", 0, &_inner_error_);
		_tmp91_ = _tmp94_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_free0 (_tmp86_);
			_g_free0 (_tmp81_);
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch8_g_regex_error;
			}
			_g_free0 (_tmp86_);
			_g_free0 (_tmp81_);
			_g_free0 (p);
			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;
		}
		_tmp95_ = _tmp91_;
		_tmp91_ = NULL;
		_g_free0 (p);
		p = _tmp95_;
		_tmp96_ = p;
		g_strstrip (_tmp96_);
		result = p;
		_g_free0 (_tmp91_);
		_g_free0 (_tmp86_);
		_g_free0 (_tmp81_);
		return result;
	}
	goto __finally8;
	__catch8_g_regex_error:
	{
		GError* _error_ = NULL;
		_error_ = _inner_error_;
		_inner_error_ = NULL;
		g_assert_not_reached ();
		_g_error_free0 (_error_);
	}
	__finally8:
	_g_free0 (p);
	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;
}

GFile*
rygel_media_export_extractor_get_file (RygelMediaExportExtractor* self)
{
	GFile* result;
	GFile* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_file;
	result = _tmp0_;
	return result;
}

void
rygel_media_export_extractor_set_file (RygelMediaExportExtractor* self,
                                       GFile* value)
{
	g_return_if_fail (self != NULL);
	if (rygel_media_export_extractor_get_file (self) != value) {
		GFile* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_file);
		self->priv->_file = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, rygel_media_export_extractor_properties[RYGEL_MEDIA_EXPORT_EXTRACTOR_FILE_PROPERTY]);
	}
}

gboolean
rygel_media_export_extractor_get_extract_metadata (RygelMediaExportExtractor* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_extract_metadata;
	return result;
}

void
rygel_media_export_extractor_set_extract_metadata (RygelMediaExportExtractor* self,
                                                   gboolean value)
{
	g_return_if_fail (self != NULL);
	if (rygel_media_export_extractor_get_extract_metadata (self) != value) {
		self->priv->_extract_metadata = value;
		g_object_notify_by_pspec ((GObject *) self, rygel_media_export_extractor_properties[RYGEL_MEDIA_EXPORT_EXTRACTOR_EXTRACT_METADATA_PROPERTY]);
	}
}

static void
rygel_media_export_extractor_class_init (RygelMediaExportExtractorClass * klass)
{
	rygel_media_export_extractor_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &RygelMediaExportExtractor_private_offset);
	((GObjectClass *) klass)->constructed = (void (*) (GObject*)) rygel_media_export_extractor_real_constructed;
	((RygelMediaExportExtractorClass *) klass)->run = (void (*) (RygelMediaExportExtractor*, GAsyncReadyCallback, gpointer)) rygel_media_export_extractor_real_run;
	((RygelMediaExportExtractorClass *) klass)->run_finish = (void (*) (RygelMediaExportExtractor*, GAsyncResult*, GError**)) rygel_media_export_extractor_real_run_finish;
	G_OBJECT_CLASS (klass)->get_property = _vala_rygel_media_export_extractor_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_rygel_media_export_extractor_set_property;
	G_OBJECT_CLASS (klass)->finalize = rygel_media_export_extractor_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_MEDIA_EXPORT_EXTRACTOR_FILE_PROPERTY, rygel_media_export_extractor_properties[RYGEL_MEDIA_EXPORT_EXTRACTOR_FILE_PROPERTY] = g_param_spec_object ("file", "file", "file", g_file_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
	g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_MEDIA_EXPORT_EXTRACTOR_EXTRACT_METADATA_PROPERTY, rygel_media_export_extractor_properties[RYGEL_MEDIA_EXPORT_EXTRACTOR_EXTRACT_METADATA_PROPERTY] = g_param_spec_boolean ("extract-metadata", "extract-metadata", "extract-metadata", TRUE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}

static void
rygel_media_export_extractor_instance_init (RygelMediaExportExtractor * self)
{
	self->priv = rygel_media_export_extractor_get_instance_private (self);
	self->priv->_extract_metadata = TRUE;
}

static void
rygel_media_export_extractor_finalize (GObject * obj)
{
	RygelMediaExportExtractor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_MEDIA_EXPORT_TYPE_EXTRACTOR, RygelMediaExportExtractor);
	_g_object_unref0 (self->priv->_file);
	_g_variant_dict_unref0 (self->serialized_info);
	G_OBJECT_CLASS (rygel_media_export_extractor_parent_class)->finalize (obj);
}

GType
rygel_media_export_extractor_get_type (void)
{
	static volatile gsize rygel_media_export_extractor_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_media_export_extractor_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelMediaExportExtractorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_media_export_extractor_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelMediaExportExtractor), 0, (GInstanceInitFunc) rygel_media_export_extractor_instance_init, NULL };
		GType rygel_media_export_extractor_type_id;
		rygel_media_export_extractor_type_id = g_type_register_static (G_TYPE_OBJECT, "RygelMediaExportExtractor", &g_define_type_info, 0);
		RygelMediaExportExtractor_private_offset = g_type_add_instance_private (rygel_media_export_extractor_type_id, sizeof (RygelMediaExportExtractorPrivate));
		g_once_init_leave (&rygel_media_export_extractor_type_id__volatile, rygel_media_export_extractor_type_id);
	}
	return rygel_media_export_extractor_type_id__volatile;
}

static void
_vala_rygel_media_export_extractor_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec)
{
	RygelMediaExportExtractor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_MEDIA_EXPORT_TYPE_EXTRACTOR, RygelMediaExportExtractor);
	switch (property_id) {
		case RYGEL_MEDIA_EXPORT_EXTRACTOR_FILE_PROPERTY:
		g_value_set_object (value, rygel_media_export_extractor_get_file (self));
		break;
		case RYGEL_MEDIA_EXPORT_EXTRACTOR_EXTRACT_METADATA_PROPERTY:
		g_value_set_boolean (value, rygel_media_export_extractor_get_extract_metadata (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_rygel_media_export_extractor_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec)
{
	RygelMediaExportExtractor * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_MEDIA_EXPORT_TYPE_EXTRACTOR, RygelMediaExportExtractor);
	switch (property_id) {
		case RYGEL_MEDIA_EXPORT_EXTRACTOR_FILE_PROPERTY:
		rygel_media_export_extractor_set_file (self, g_value_get_object (value));
		break;
		case RYGEL_MEDIA_EXPORT_EXTRACTOR_EXTRACT_METADATA_PROPERTY:
		rygel_media_export_extractor_set_extract_metadata (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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);
}

