Commit 479fc080 authored by Soomin Lee's avatar Soomin Lee

CollectionModel: Fix deletion for VLCMLMedias

parent 26139159
......@@ -46,6 +46,18 @@ class CollectionModel: MLBaseModel {
playlist.removeMedia(fromPosition: UInt32(index))
}
}
} else {
do {
for case let media as VLCMLMedia in items {
if let mainFile = media.mainFile() {
try FileManager.default.removeItem(atPath: mainFile.mrl.path)
}
}
medialibrary.reload()
}
catch let error as NSError {
assertionFailure("CollectionModel: Delete failed: \(error.localizedDescription)")
}
}
}
}
......@@ -65,5 +77,10 @@ extension CollectionModel: MediaLibraryObserver {
updateView?()
}
}
func medialibrary(_ medialibrary: MediaLibraryService, didDeleteMediaWithIds ids: [NSNumber]) {
files = mediaCollection.files() ?? []
updateView?()
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment