sjtuross 4 Posted November 26 Posted November 26 (edited) I tried using this method https://dev.emby.media/reference/pluginapi/MediaBrowser.Controller.Entities.BaseItem.html#MediaBrowser_Controller_Entities_BaseItem_HasDateModifiedChanged_System_DateTimeOffset_ The problem is that if I do library scan after media file is modified, this method returns false. But if I don't do library scan, it returns true as expected. var file = directoryService.GetFile(item.Path); item.HasDateModifiedChanged(file.LastWriteTimeUtc)); Edited November 26 by sjtuross
Luke 38528 Posted November 26 Posted November 26 Hi, that's all there is. It returns false after the library scan because the database is up to date with changes in the file.
sjtuross 4 Posted November 27 Author Posted November 27 11 hours ago, Luke said: Hi, that's all there is. It returns false after the library scan because the database is up to date with changes in the file. Got it. So basically it compares database with filesystem. From plugin standpoint, is there any way to get such change event or information?
Luke 38528 Posted November 27 Posted November 27 7 hours ago, sjtuross said: Got it. So basically it compares database with filesystem. From plugin standpoint, is there any way to get such change event or information? In realtime, no. There is the ItemUpdated event on librarymanager that you can subscribe to. You'll get notified when the core server becomes aware of the change.
sjtuross 4 Posted November 28 Author Posted November 28 20 hours ago, Luke said: In realtime, no. There is the ItemUpdated event on librarymanager that you can subscribe to. You'll get notified when the core server becomes aware of the change. Thanks for the suggestion! I tried subscribing to the ItemUpdated event, and it does get triggered for the modified item. However, the UpdateReason is set to "None | MetadataImport | MetadataDownload", which seems to indicate a standard metadata refresh. This makes it difficult to determine if the underlying file itself has been modified.
Luke 38528 Posted November 28 Posted November 28 ItemUpdated is still the closest option though. We just need to add more information to the event about what changed. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now