[rygel] media-export: Only scrub name when doing meta-data
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] media-export: Only scrub name when doing meta-data
- Date: Wed, 12 Sep 2018 11:55:11 +0000 (UTC)
commit 388da8133d9ca58177f06f98fcfc8f4961a8440f
Author: Jens Georg <mail jensge org>
Date: Tue Sep 4 21:36:08 2018 +0200
media-export: Only scrub name when doing meta-data
If not extracting meta-data, leave file-name as-is.
There is still the issue that if there's no other meta-data, it might be
really hard to distinguish the files from each other.
Solves #119 - at least partially
.../media-export/rygel-media-export-extractor.vala | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-extractor.vala
b/src/plugins/media-export/rygel-media-export-extractor.vala
index 3625469d..251b2491 100644
--- a/src/plugins/media-export/rygel-media-export-extractor.vala
+++ b/src/plugins/media-export/rygel-media-export-extractor.vala
@@ -49,6 +49,7 @@ public class Rygel.MediaExport.Extractor : Object {
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;
@@ -60,7 +61,7 @@ public class Rygel.MediaExport.Extractor : Object {
string content_type,
bool extract_metadata) {
if (!extract_metadata) {
- return new Extractor (file);
+ return new Extractor (file, false);
}
var is_text = content_type.has_prefix ("text/") ||
@@ -81,8 +82,8 @@ public class Rygel.MediaExport.Extractor : Object {
return new GenericExtractor (file);
}
- private Extractor (File file) {
- Object (file: file);
+ private Extractor (File file, bool extract_metadata) {
+ Object (file: file, extract_metadata: extract_metadata);
}
public override void constructed () {
@@ -97,8 +98,13 @@ public class Rygel.MediaExport.Extractor : Object {
FileAttribute.STANDARD_DISPLAY_NAME,
FileQueryInfoFlags.NONE);
var display_name = file_info.get_display_name ();
- var title = this.strip_invalid_entities (display_name);
- this.serialized_info.insert (Serializer.TITLE, "s", title);
+
+ 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 mtime = file_info.get_attribute_uint64
(FileAttribute.TIME_MODIFIED);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]