Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -u ../rygel-0.36.2.5-orig/src/plugins/media-export/rygel-media-export-extractor.vala src/plugins/media-export/rygel-media-export-extractor.vala
- --- ../rygel-0.36.2.5-orig/src/plugins/media-export/rygel-media-export-extractor.vala 2018-09-05 03:28:36.000000000 +0800
- +++ src/plugins/media-export/rygel-media-export-extractor.vala 2020-05-29 18:41:32.086350939 +0800
- @@ -26,30 +26,34 @@
- }
- public class Rygel.MediaExport.Extractor : Object {
- - private const string INVALID_CHARS = "()[]<>{}!@#$^&*+=|\\/\"'?~";
- - private const string CONVERT_CHARS = "\t_\\.";
- - private const string BLOCK_PATTERN = "%s[^%s]*%s";
- + private const string INVALID_CHARS = "()[]<>{}!@#$^&*+=|\\/\"'?~;._-";
- + private const string BLOCK_PATTERN = "%s[^%s%s]*%s";
- private const string[] BLOCKS = { "()", "{}", "[]", "<>" };
- private const string[] BLACKLIST = {
- - "720p", "1080p", "x264", "ws", "proper", "real.repack", "repack",
- - "hdtv", "pdtv", "notv", "dsr", "DVDRip", "divx", "xvid"
- + "1080p", "480p", "720p", "AC3", "AMZN"
- + , "BD Remux", "BDRip", "Blu Ray", "BLURAY"
- + , "DD5 1", "divx", "dsr", "dsrip", "DUB", "DVDRip", "eng", "EniaHD"
- + , "h 264", "h264", "h 265", "h265", "HD1080p", "HDCLUB", "HDR1080p"
- + , "hdtv", "HDTVRip", "HDwebrip", "HEVC", "HR", "HQ Edition"
- + , "Fre", "MP3", "notv", "OM", "pdtv", "proper"
- + , "real repack", "Remux", "repack", "rus", "to4ka", "TV"
- + , "web dl", "WEB DLRip", "web rip", "webdl", "webrip","ws"
- + , "x 264", "x264", "x 265", "x265", "xvid"
- };
- private const string[] VIDEO_SUFFIXES = {
- - "webm", "mkv", "flv", "ogv", "ogg", "avi", "mov", "wmv", "mp4",
- - "m4v", "mpeg", "mpg", "iso", "mp3", "m4a", "png", "jpg", "jpeg",
- - "ogv", "oga", "3gp"
- + "3gp", "avi", "flv", "iso", "jpeg", "jpg", "m2ts", "m4a", "m4v"
- + , "mkv", "mov", "mp3", "mp4", "mpeg", "mpg", "oga", "ogg", "ogv"
- + , "ogv", "png", "ts", "vob", "webm", "wmv"
- };
- private static Regex char_remove_regex;
- - private static Regex char_convert_regex;
- private static Regex space_compress_regex;
- private static Regex[] block_regexes;
- private static Regex[] blacklist_regexes;
- private static Regex[] video_suffix_regexes;
- public File file { get; construct set; }
- - public bool extract_metadata { get; construct set; default = true; }
- protected VariantDict serialized_info;
- @@ -61,7 +65,7 @@
- string content_type,
- bool extract_metadata) {
- if (!extract_metadata) {
- - return new Extractor (file, false);
- + return new Extractor (file);
- }
- var is_text = content_type.has_prefix ("text/") ||
- @@ -82,8 +86,8 @@
- return new GenericExtractor (file);
- }
- - private Extractor (File file, bool extract_metadata) {
- - Object (file: file, extract_metadata: extract_metadata);
- + private Extractor (File file) {
- + Object (file: file);
- }
- public override void constructed () {
- @@ -99,12 +103,8 @@
- FileQueryInfoFlags.NONE);
- var display_name = file_info.get_display_name ();
- - if (extract_metadata) {
- - var title = this.strip_invalid_entities (display_name);
- - this.serialized_info.insert (Serializer.TITLE, "s", title);
- - } else {
- - this.serialized_info.insert (Serializer.TITLE, "s", display_name);
- - }
- + var title = this.strip_invalid_entities (display_name);
- + this.serialized_info.insert (Serializer.TITLE, "s", title);
- var mtime = file_info.get_attribute_uint64
- (FileAttribute.TIME_MODIFIED);
- @@ -143,26 +143,25 @@
- try {
- var regex_string = Regex.escape_string (INVALID_CHARS);
- char_remove_regex = new Regex ("[%s]".printf (regex_string));
- - regex_string = Regex.escape_string (CONVERT_CHARS);
- - char_convert_regex = new Regex ("[%s]".printf (regex_string));
- space_compress_regex = new Regex ("\\s+");
- block_regexes = new Regex[0];
- foreach (var block in BLOCKS) {
- var block_re = BLOCK_PATTERN.printf (
- Regex.escape_string ("%C".printf (block[0])),
- + Regex.escape_string ("%C".printf (block[0])),
- Regex.escape_string ("%C".printf (block[1])),
- Regex.escape_string ("%C".printf (block[1])));
- block_regexes += new Regex (block_re);
- }
- foreach (var blacklist in BLACKLIST) {
- - blacklist_regexes += new Regex (Regex.escape_string
- - (blacklist));
- + blacklist_regexes += new Regex (Regex.escape_string (" %s ".printf (blacklist)),
- + RegexCompileFlags.CASELESS);
- }
- foreach (var suffix in VIDEO_SUFFIXES) {
- - var regex = new Regex (Regex.escape_string (suffix),
- + var regex = new Regex ("%s$".printf (Regex.escape_string (".%s".printf (suffix))),
- RegexCompileFlags.CASELESS);
- video_suffix_regexes += regex;
- @@ -177,20 +176,23 @@
- p = original;
- try {
- - foreach (var re in blacklist_regexes) {
- - p = re.replace_literal (p, -1, 0, "");
- - }
- -
- foreach (var re in video_suffix_regexes) {
- - p = re.replace_literal (p, -1, 0, "");
- + p = re.replace_literal (p, -1, 0, " ");
- }
- foreach (var re in block_regexes) {
- - p = re.replace_literal (p, -1, 0, "");
- + p = re.replace_literal (p, -1, 0, " ");
- + }
- +
- + p = char_remove_regex.replace_literal (p, -1, 0, " ");
- +
- + // Add spaces for blacklist_regexes works on the left/right sides of p
- + p = " %s ".printf (space_compress_regex.replace_literal (p, -1, 0, " "));
- +
- + foreach (var re in blacklist_regexes) {
- + p = re.replace_literal (p, -1, 0, " ");
- }
- - p = char_remove_regex.replace_literal (p, -1, 0, "");
- - p = char_convert_regex.replace_literal (p, -1, 0, " ");
- p = space_compress_regex.replace_literal (p, -1, 0, " ");
- p._strip ();
- diff -u ../rygel-0.36.2.5-orig/src/plugins/media-export/rygel-media-export-generic-extractor.vala src/plugins/media-export/rygel-media-export-generic-extractor.vala
- --- ../rygel-0.36.2.5-orig/src/plugins/media-export/rygel-media-export-generic-extractor.vala 2017-04-19 04:38:35.000000000 +0800
- +++ src/plugins/media-export/rygel-media-export-generic-extractor.vala 2020-05-30 10:23:45.527285367 +0800
- @@ -37,7 +37,7 @@
- static construct {
- try {
- - GenericExtractor.discoverer = new Discoverer (10 * Gst.SECOND);
- + GenericExtractor.discoverer = new Discoverer (300 * Gst.SECOND);
- GenericExtractor.discoverer.start ();
- } catch (Error error) {
- debug ("Generic extractor unavailable: %s", error.message);
- @@ -55,6 +55,7 @@
- public override async void run () throws Error {
- yield base.run ();
- + warning (_("------------ new item ---------------"));
- if (GenericExtractor.discoverer == null) {
- throw new ExtractorError.GENERAL ("Backend not avaliable");
- }
- @@ -72,20 +73,32 @@
- var path = this.file.get_path ();
- var uri = this.file.get_uri ();
- +
- + warning (_("path: %s"), path);
- + warning (_("uri: %s"), uri);
- + warning (_("sec: %s"), Gst.SECOND.to_string());
- +
- +
- if (path != null) {
- uri = Filename.to_uri (path);
- }
- -
- +
- +
- +
- GenericExtractor.discoverer.discover_uri_async (uri);
- + //warning (_("uri_1: %s"), uri);
- yield;
- + //warning (_("uri_2: %s"), uri);
- GenericExtractor.discoverer.disconnect (id);
- +
- if (error != null) {
- + //warning (_("uri_3: %s"), error.message);
- // Re-create discoverer, in error case it tends to get really
- // slow.
- GenericExtractor.discoverer.stop ();
- GenericExtractor.discoverer = null;
- - GenericExtractor.discoverer = new Discoverer (10 * Gst.SECOND);
- + GenericExtractor.discoverer = new Discoverer (300 * Gst.SECOND);
- GenericExtractor.discoverer.start ();
- var result = info.get_result ();
- @@ -142,11 +155,13 @@
- // Info has several tags, general and on audio info for music files
- var tags = info.get_tags ();
- if (tags != null) {
- - string? title = null;
- - if (tags.get_string (Tags.TITLE, out title)) {
- - // If not AVI file, replace title we guessed from filename
- - if (this.mime_type != "video/x-msvideo" && title != null) {
- - this.serialized_info.insert (Serializer.TITLE, "s", title);
- + // If not Video file, replace title we guessed from filename
- + if (this.mime_type.substring(0, 5) != "video") {
- + string? title = null;
- + if (tags.get_string (Tags.TITLE, out title)) {
- + if (title != null) {
- + this.serialized_info.insert (Serializer.TITLE, "s", title);
- + }
- }
- }
- @@ -178,6 +193,8 @@
- this.serialized_info.insert (Serializer.VIDEO_DEPTH, "i",
- vinfo.get_depth () > 0 ?
- vinfo.get_depth () : -1);
- +
- + warning (_("depth: %s"), vinfo.get_depth ().to_string());
- }
- if (audio_streams != null && audio_streams.data != null) {
Advertisement
Add Comment
Please, Sign In to add comment