Bläddra i källkod

CollectionModel: Add removal from Playlist

(fixes #507)
Carola Nitz 6 år sedan
förälder
incheckning
2f2cfae524
1 ändrade filer med 7 tillägg och 1 borttagningar
  1. 7 1
      SharedSources/MediaLibraryModel/CollectionModel.swift

+ 7 - 1
SharedSources/MediaLibraryModel/CollectionModel.swift

@@ -40,7 +40,13 @@ class CollectionModel: MLBaseModel {
     var indicatorName: String = "Collections"
 
     func delete(_ items: [VLCMLObject]) {
-       assertionFailure("still needs implementation")
+        if let playlist = mediaCollection as? VLCMLPlaylist {
+            for case let media as VLCMLMedia in items {
+                if let index = files.firstIndex(of: media) {
+                    playlist.removeMedia(fromPosition: UInt32(index))
+                }
+            }
+        }
     }
 }