[rygel] media-export: Use size to consider file change
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] media-export: Use size to consider file change
- Date: Thu, 6 May 2010 21:05:55 +0000 (UTC)
commit 9709df2f3c5b30525969814b4630eb7d5a409ecf
Author: Jens Georg <mail jensge org>
Date: Thu May 6 22:28:25 2010 +0200
media-export: Use size to consider file change
With certain SMB implementations the mtime is only set at the beginning,
so the harvester did not consider the file changed. This fix also
consideres the size to determin wether a file has changed or not.
Fixes #617762
.../media-export/rygel-media-export-harvester.vala | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-harvester.vala b/src/plugins/media-export/rygel-media-export-harvester.vala
index e80b282..3d5b0f3 100644
--- a/src/plugins/media-export/rygel-media-export-harvester.vala
+++ b/src/plugins/media-export/rygel-media-export-harvester.vala
@@ -60,12 +60,22 @@ public class Rygel.MediaExportHarvester : GLib.Object {
if (mtime > timestamp) {
this.files.push_tail (new FileQueueEntry (file, true));
return true;
+ } else {
+ // check size
+ var size = info.get_size ();
+ var item = media_db.get_item (id);
+ if (item.size != size) {
+ this.files.push_tail (new FileQueueEntry (file,
+ true));
+
+ return true;
+ }
}
} else {
this.files.push_tail (new FileQueueEntry (file, false));
return true;
}
- } catch (DatabaseError err) {
+ } catch (Error err) {
warning (_("Failed to query database: %s"), err.message);
}
@@ -115,7 +125,8 @@ public class Rygel.MediaExportHarvester : GLib.Object {
var enumerator = yield directory.enumerate_children_async (
FILE_ATTRIBUTE_STANDARD_TYPE + "," +
FILE_ATTRIBUTE_STANDARD_NAME + "," +
- FILE_ATTRIBUTE_TIME_MODIFIED,
+ FILE_ATTRIBUTE_TIME_MODIFIED + "," +
+ FILE_ATTRIBUTE_STANDARD_SIZE,
FileQueryInfoFlags.NONE,
Priority.DEFAULT,
this.cancellable);
@@ -204,7 +215,8 @@ public class Rygel.MediaExportHarvester : GLib.Object {
var info = yield file.query_info_async (
FILE_ATTRIBUTE_STANDARD_NAME + "," +
FILE_ATTRIBUTE_STANDARD_TYPE + "," +
- FILE_ATTRIBUTE_TIME_MODIFIED,
+ FILE_ATTRIBUTE_TIME_MODIFIED + "," +
+ FILE_ATTRIBUTE_STANDARD_SIZE,
FileQueryInfoFlags.NONE,
Priority.DEFAULT,
this.cancellable);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]