diff options
author | Jens Georg <mail@jensge.org> | 2020-12-27 16:40:37 +0100 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2020-12-27 16:40:45 +0100 |
commit | d3ef8793a38ecde5d5573af6b0ee655ff3eb7de3 (patch) | |
tree | 82387da885eb9f4db7b255116e705ab4469705b8 /src | |
parent | 4f08b8ac5bad8346382ba4522383723297434064 (diff) | |
download | rygel-d3ef8793a38ecde5d5573af6b0ee655ff3eb7de3.tar.gz |
media-export: Respect .nomedia for skipping folder
Fixes #187
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/media-export/rygel-media-export-harvester.vala | 7 | ||||
-rw-r--r-- | src/plugins/media-export/rygel-media-export-harvesting-task.vala | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/plugins/media-export/rygel-media-export-harvester.vala b/src/plugins/media-export/rygel-media-export-harvester.vala index 3c4f3fd3..f86dc803 100644 --- a/src/plugins/media-export/rygel-media-export-harvester.vala +++ b/src/plugins/media-export/rygel-media-export-harvester.vala @@ -67,6 +67,10 @@ internal class Rygel.MediaExport.Harvester : GLib.Object { * @return true if file should be extracted, false otherwise */ public static bool is_eligible (File file, FileInfo info) { + if (info.get_file_type () == FileType.DIRECTORY) { + return !file.get_child (".nomedia").query_exists (); + } + var is_supported_content_type = info.get_content_type ().has_prefix ("image/") || info.get_content_type ().has_prefix ("video/") || @@ -191,8 +195,7 @@ internal class Rygel.MediaExport.Harvester : GLib.Object { FileAttribute.STANDARD_CONTENT_TYPE, FileQueryInfoFlags.NONE, this.cancellable); - if (info.get_file_type () == FileType.DIRECTORY || - Harvester.is_eligible (file, info)) { + if (Harvester.is_eligible (file, info)) { var id = MediaCache.get_id (file.get_parent ()); try { var parent_container = cache.get_object (id) diff --git a/src/plugins/media-export/rygel-media-export-harvesting-task.vala b/src/plugins/media-export/rygel-media-export-harvesting-task.vala index 1cc4b8a5..05285e18 100644 --- a/src/plugins/media-export/rygel-media-export-harvesting-task.vala +++ b/src/plugins/media-export/rygel-media-export-harvesting-task.vala @@ -210,6 +210,10 @@ public class Rygel.MediaExport.HarvestingTask : Rygel.StateMachine, } if (info.get_file_type () == FileType.DIRECTORY) { + if (!Harvester.is_eligible (file, info)) { + return false; + } + // queue directory for processing later this.monitor.add.begin (file); |