Преглед изворни кода

VideoModel: Check for duplicate before append

Soomin Lee пре 7 година
родитељ
комит
c83abf7c31
1 измењених фајлова са 5 додато и 0 уклоњено
  1. 5 0
      SharedSources/MediaLibraryModel/VideoModel.swift

+ 5 - 0
SharedSources/MediaLibraryModel/VideoModel.swift

@@ -27,6 +27,11 @@ class VideoModel: MLBaseModel {
     }
 
     func append(_ item: VLCMLMedia) {
+        for file in files {
+            if file.identifier() == item.identifier() {
+                return
+            }
+        }
         files.append(item)
     }