sjtuross 9 Posted September 1, 2024 Posted September 1, 2024 (edited) In a plugin, I want to archive the underlying media file of the strm file being deleted. The only related event I found is ILibraryManager.ItemRemoved, but this happens after the strm file is deleted, so I can’t read its content or mount path. Which event shall I subscribe that’s triggered before the strm file is actually deleted? If such event is not available, is there a property of the strm media item for getting the real path? Thanks! Edited September 1, 2024 by sjtuross
softworkz 5066 Posted September 1, 2024 Posted September 1, 2024 7 hours ago, sjtuross said: this happens after the strm file is deleted, so I can’t read its content or mount path. Which event shall I subscribe that’s triggered before the strm file is actually deleted? STRM files are handled just like any other media file: Emby Server reacts to changes in the file system. When a file gets deleted from disk, Emby Server receives a file change event and acts accordingly, which means that once Emby Server starts acting, the file has already been deleted. In case the deletion would be executed through the Emby UI, I'm not sure whether there's an event that you could catch, but that wouldn't help you anyway, because that wouldn't allow you to cover all cases of deletion. Did you check the Item property of the Emby SDK Reference: ItemChangeEventArgs of the Emby SDK Reference: ILibraryManager.ItemRemoved event?
sjtuross 9 Posted September 2, 2024 Author Posted September 2, 2024 If I open the strm media item in Emby UI, I can actually see the underlying path in the media info section. Does it mean this path information is stored somewhere like database? I explored ItemChangeEventArgs in a debug session, but it looks like all the path related information is about the strm itself.
softworkz 5066 Posted September 2, 2024 Posted September 2, 2024 Did you check the Emby SDK Reference: BaseItem.MediaStreams property? Otherwise try calling Emby SDK Reference: BaseItem.GetMediaStreams() Though, i don't know whether the property is populated or whether the method is still working at this stage. @Lukemight know better.
Luke 42077 Posted September 3, 2024 Posted September 3, 2024 Quote Does it mean this path information is stored somewhere like database? It's not stored in the database at this time, so currently there's no real way to do this. We might have to add a Deleting event that triggers after the delete is requested, but before it actually happens.
sjtuross 9 Posted September 3, 2024 Author Posted September 3, 2024 (edited) Ok, looking forward to this Deleting event. For the existing strm media item, is there Emby API to get its underlying path? or I have to read its content? Any suggestion? Edited September 3, 2024 by sjtuross
Luke 42077 Posted September 5, 2024 Posted September 5, 2024 On 9/3/2024 at 8:37 AM, sjtuross said: Ok, looking forward to this Deleting event. For the existing strm media item, is there Emby API to get its underlying path? or I have to read its content? Any suggestion? You should be able to get it by looking at the MediaSources property.
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