diff --git a/kplayer.xcodeproj/project.pbxproj b/kplayer.xcodeproj/project.pbxproj index 4bd1559..c1cd05d 100644 --- a/kplayer.xcodeproj/project.pbxproj +++ b/kplayer.xcodeproj/project.pbxproj @@ -7,25 +7,24 @@ objects = { /* Begin PBXBuildFile section */ - 1C736261CBA1D13D16DCBAFB /* VideoPlayerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C7366EF59D75216EBC0D3F0 /* VideoPlayerController.swift */; }; + 1C73631EACF56BABD3B2BCFB /* LayoutTools.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C736BC4450890C45F8FBC63 /* LayoutTools.swift */; }; 1C73635138BBD2BB480A308F /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C736777456388CA571DA17B /* MediaPlayer.framework */; }; 1C7363D9DC8F9D1F866DE935 /* Kirschkeks-256x256.png in Resources */ = {isa = PBXBuildFile; fileRef = 1C7368DC7EF11A553145E169 /* Kirschkeks-256x256.png */; }; - 1C73641627BE29D9FA819F3C /* LayoutTools.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C73649CEA7BDD2AC1496F76 /* LayoutTools.swift */; }; + 1C73640D928DE56D35175D39 /* UploadOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C736260E748CF136FF37EA7 /* UploadOperation.swift */; }; + 1C73646F87B495A47D7943C7 /* NetData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C7369EC16B19B32B515169E /* NetData.swift */; }; 1C736503B656C999E5E12081 /* NetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C7365B06FA66294E99AC2D3 /* NetworkManager.swift */; }; - 1C73664F657BE51633B69851 /* alamojson.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C736683E76027D72412D440 /* alamojson.swift */; }; - 1C73670791CDD5C9BB6B1DDC /* NetData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C7364950C3B8C5DFA243D62 /* NetData.swift */; }; - 1C7367A160B25EEC5E99A517 /* ImageLoadOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C736E98DC8F46C7FF9CD540 /* ImageLoadOperation.swift */; }; + 1C73654C9EA6D255CFC039C5 /* NetworkHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C73620D01687FB4F1811C5C /* NetworkHelper.swift */; }; + 1C7368364397315E12E90F05 /* VideoPlayerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C7367379DEE94EBF3FAFA78 /* VideoPlayerController.swift */; }; 1C73688D13E5A804880C8768 /* UIImageExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C736DCCE3AA9993E15F7652 /* UIImageExtension.swift */; }; - 1C73691418724950CCD87C14 /* HeaderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C736C189E5F32219F4B4B13 /* HeaderCell.swift */; }; - 1C736AD52D967F2F4000F997 /* UploadOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C7362F9C26405D4F3FA15A1 /* UploadOperation.swift */; }; - 1C736BF3C4F2D3BE570A89C7 /* NetworkHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C7368F1190278747E95C12F /* NetworkHelper.swift */; }; - 1C736C90DB50C4FDED266C3D /* ItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C7362C647AEBF03F5FD9FEB /* ItemCell.swift */; }; + 1C7369ABC44CFB530EA71FB6 /* HeaderCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C736D9BB5498E7E8F11C754 /* HeaderCell.swift */; }; + 1C736C5DD23466269607E07F /* alamojson.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C73618272969871601AB817 /* alamojson.swift */; }; + 1C736D24B49451141CD4B64D /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C7369F53095B7A4D65679C2 /* DetailViewController.swift */; }; + 1C736F6A223D4ADB2E1BA733 /* ItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C736069C214E9522BB1BD97 /* ItemCell.swift */; }; 1C736FB92B19FE17E4357C85 /* MediaItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C73688DAB88F9360FB62A49 /* MediaItem.swift */; }; A5D637AE4588AAB5DC1CBC6B /* Pods.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 127AC1F28342F9AAE3CEC5C2 /* Pods.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; C98AF5D51B124D6A00D196CC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C98AF5D41B124D6A00D196CC /* AppDelegate.swift */; }; C98AF5D81B124D6A00D196CC /* kplayer.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = C98AF5D61B124D6A00D196CC /* kplayer.xcdatamodeld */; }; C98AF5DA1B124D6A00D196CC /* MasterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C98AF5D91B124D6A00D196CC /* MasterViewController.swift */; }; - C98AF5DC1B124D6A00D196CC /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C98AF5DB1B124D6A00D196CC /* DetailViewController.swift */; }; C98AF5DF1B124D6A00D196CC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C98AF5DD1B124D6A00D196CC /* Main.storyboard */; }; C98AF5E11B124D6A00D196CC /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C98AF5E01B124D6A00D196CC /* Images.xcassets */; }; C98AF5E41B124D6A00D196CC /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C98AF5E21B124D6A00D196CC /* LaunchScreen.xib */; }; @@ -44,20 +43,20 @@ /* Begin PBXFileReference section */ 127AC1F28342F9AAE3CEC5C2 /* Pods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 1C7362C647AEBF03F5FD9FEB /* ItemCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemCell.swift; sourceTree = ""; }; - 1C7362F9C26405D4F3FA15A1 /* UploadOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UploadOperation.swift; sourceTree = ""; }; - 1C7364950C3B8C5DFA243D62 /* NetData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetData.swift; sourceTree = ""; }; - 1C73649CEA7BDD2AC1496F76 /* LayoutTools.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LayoutTools.swift; sourceTree = ""; }; + 1C736069C214E9522BB1BD97 /* ItemCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemCell.swift; sourceTree = ""; }; + 1C73618272969871601AB817 /* alamojson.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = alamojson.swift; sourceTree = ""; }; + 1C73620D01687FB4F1811C5C /* NetworkHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkHelper.swift; sourceTree = ""; }; + 1C736260E748CF136FF37EA7 /* UploadOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UploadOperation.swift; sourceTree = ""; }; 1C7365B06FA66294E99AC2D3 /* NetworkManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkManager.swift; sourceTree = ""; }; - 1C736683E76027D72412D440 /* alamojson.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = alamojson.swift; sourceTree = ""; }; - 1C7366EF59D75216EBC0D3F0 /* VideoPlayerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoPlayerController.swift; sourceTree = ""; }; + 1C7367379DEE94EBF3FAFA78 /* VideoPlayerController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoPlayerController.swift; sourceTree = ""; }; 1C736777456388CA571DA17B /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; }; 1C73688DAB88F9360FB62A49 /* MediaItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaItem.swift; sourceTree = ""; }; 1C7368DC7EF11A553145E169 /* Kirschkeks-256x256.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Kirschkeks-256x256.png"; sourceTree = ""; }; - 1C7368F1190278747E95C12F /* NetworkHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkHelper.swift; sourceTree = ""; }; - 1C736C189E5F32219F4B4B13 /* HeaderCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeaderCell.swift; sourceTree = ""; }; + 1C7369EC16B19B32B515169E /* NetData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetData.swift; sourceTree = ""; }; + 1C7369F53095B7A4D65679C2 /* DetailViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = ""; }; + 1C736BC4450890C45F8FBC63 /* LayoutTools.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LayoutTools.swift; sourceTree = ""; }; + 1C736D9BB5498E7E8F11C754 /* HeaderCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeaderCell.swift; sourceTree = ""; }; 1C736DCCE3AA9993E15F7652 /* UIImageExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIImageExtension.swift; sourceTree = ""; }; - 1C736E98DC8F46C7FF9CD540 /* ImageLoadOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageLoadOperation.swift; sourceTree = ""; }; 5C6CBA548F885BF342F594EA /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; A170BFB886D61D57F7009BFC /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; C98AF5CF1B124D6A00D196CC /* kplayer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = kplayer.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -65,7 +64,6 @@ C98AF5D41B124D6A00D196CC /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; C98AF5D71B124D6A00D196CC /* kplayer.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = kplayer.xcdatamodel; sourceTree = ""; }; C98AF5D91B124D6A00D196CC /* MasterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterViewController.swift; sourceTree = ""; }; - C98AF5DB1B124D6A00D196CC /* DetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = ""; }; C98AF5DE1B124D6A00D196CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; C98AF5E01B124D6A00D196CC /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; C98AF5E31B124D6A00D196CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; @@ -94,10 +92,26 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 1C73615846EE8B07DAAFD230 /* detail */ = { + isa = PBXGroup; + children = ( + 1C7367379DEE94EBF3FAFA78 /* VideoPlayerController.swift */, + 1C736069C214E9522BB1BD97 /* ItemCell.swift */, + 1C736D9BB5498E7E8F11C754 /* HeaderCell.swift */, + 1C7369F53095B7A4D65679C2 /* DetailViewController.swift */, + ); + path = detail; + sourceTree = ""; + }; 1C7365603CAE04E39B73D843 /* util */ = { isa = PBXGroup; children = ( 1C736DCCE3AA9993E15F7652 /* UIImageExtension.swift */, + 1C736BC4450890C45F8FBC63 /* LayoutTools.swift */, + 1C73620D01687FB4F1811C5C /* NetworkHelper.swift */, + 1C736260E748CF136FF37EA7 /* UploadOperation.swift */, + 1C7369EC16B19B32B515169E /* NetData.swift */, + 1C73618272969871601AB817 /* alamojson.swift */, ); path = util; sourceTree = ""; @@ -107,11 +121,6 @@ children = ( 1C7365B06FA66294E99AC2D3 /* NetworkManager.swift */, 1C73688DAB88F9360FB62A49 /* MediaItem.swift */, - 1C7362F9C26405D4F3FA15A1 /* UploadOperation.swift */, - 1C7368F1190278747E95C12F /* NetworkHelper.swift */, - 1C7364950C3B8C5DFA243D62 /* NetData.swift */, - 1C736683E76027D72412D440 /* alamojson.swift */, - 1C736E98DC8F46C7FF9CD540 /* ImageLoadOperation.swift */, ); path = core; sourceTree = ""; @@ -159,19 +168,15 @@ children = ( C98AF5D41B124D6A00D196CC /* AppDelegate.swift */, C98AF5D91B124D6A00D196CC /* MasterViewController.swift */, - C98AF5DB1B124D6A00D196CC /* DetailViewController.swift */, C98AF5DD1B124D6A00D196CC /* Main.storyboard */, C98AF5E01B124D6A00D196CC /* Images.xcassets */, C98AF5E21B124D6A00D196CC /* LaunchScreen.xib */, C98AF5D61B124D6A00D196CC /* kplayer.xcdatamodeld */, C98AF5D21B124D6A00D196CC /* Supporting Files */, 1C736DC8C3AFB991541A2079 /* core */, - 1C7362C647AEBF03F5FD9FEB /* ItemCell.swift */, - 1C73649CEA7BDD2AC1496F76 /* LayoutTools.swift */, 1C7368DC7EF11A553145E169 /* Kirschkeks-256x256.png */, - 1C7366EF59D75216EBC0D3F0 /* VideoPlayerController.swift */, 1C7365603CAE04E39B73D843 /* util */, - 1C736C189E5F32219F4B4B13 /* HeaderCell.swift */, + 1C73615846EE8B07DAAFD230 /* detail */, ); path = kplayer; sourceTree = ""; @@ -356,19 +361,18 @@ C98AF5D81B124D6A00D196CC /* kplayer.xcdatamodeld in Sources */, C98AF5D51B124D6A00D196CC /* AppDelegate.swift in Sources */, C98AF5DA1B124D6A00D196CC /* MasterViewController.swift in Sources */, - C98AF5DC1B124D6A00D196CC /* DetailViewController.swift in Sources */, 1C736503B656C999E5E12081 /* NetworkManager.swift in Sources */, 1C736FB92B19FE17E4357C85 /* MediaItem.swift in Sources */, - 1C736C90DB50C4FDED266C3D /* ItemCell.swift in Sources */, - 1C73641627BE29D9FA819F3C /* LayoutTools.swift in Sources */, - 1C736261CBA1D13D16DCBAFB /* VideoPlayerController.swift in Sources */, - 1C736AD52D967F2F4000F997 /* UploadOperation.swift in Sources */, - 1C736BF3C4F2D3BE570A89C7 /* NetworkHelper.swift in Sources */, - 1C73670791CDD5C9BB6B1DDC /* NetData.swift in Sources */, - 1C73664F657BE51633B69851 /* alamojson.swift in Sources */, - 1C7367A160B25EEC5E99A517 /* ImageLoadOperation.swift in Sources */, 1C73688D13E5A804880C8768 /* UIImageExtension.swift in Sources */, - 1C73691418724950CCD87C14 /* HeaderCell.swift in Sources */, + 1C7368364397315E12E90F05 /* VideoPlayerController.swift in Sources */, + 1C736F6A223D4ADB2E1BA733 /* ItemCell.swift in Sources */, + 1C7369ABC44CFB530EA71FB6 /* HeaderCell.swift in Sources */, + 1C736D24B49451141CD4B64D /* DetailViewController.swift in Sources */, + 1C73631EACF56BABD3B2BCFB /* LayoutTools.swift in Sources */, + 1C73654C9EA6D255CFC039C5 /* NetworkHelper.swift in Sources */, + 1C73640D928DE56D35175D39 /* UploadOperation.swift in Sources */, + 1C73646F87B495A47D7943C7 /* NetData.swift in Sources */, + 1C736C5DD23466269607E07F /* alamojson.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/kplayer/core/ImageLoadOperation.swift b/kplayer/core/ImageLoadOperation.swift deleted file mode 100644 index 1c536d9..0000000 --- a/kplayer/core/ImageLoadOperation.swift +++ /dev/null @@ -1,59 +0,0 @@ -// -// Created by Marco Schmickler on 21.03.15. -// Copyright (c) 2015 Marco Schmickler. All rights reserved. -// - -import Foundation -import Alamofire -import SwiftyJSON - -class ImageLoadOperation: NSOperation { - let baseUrl: String - let item: MediaItem - - init(baseUrl: String, item: MediaItem) { - self.baseUrl = baseUrl - self.item = item - } - - override func main() { - if self.cancelled { - return - } - - let path = baseUrl + "/service/download" + item.thumbUrl! - println(path) - - Alamofire.request(.GET, path).validate().responseImage( { - (_, _, image, error) in - - if error == nil && image != nil { - self.item.image = image - } - else { - println(error) - } - }) - - } -} - -extension Alamofire.Request { - class func imageResponseSerializer() -> Serializer { - return { request, response, data in - if data == nil { - return (nil, nil) - } - - let image = UIImage(data: data!) //, scale: UIScreen.mainScreen().scale) - - return (image, nil) - } - } - - func responseImage(completionHandler: (NSURLRequest, NSHTTPURLResponse?, UIImage?, NSError?) -> Void) -> Self { - return response(serializer: Request.imageResponseSerializer(), completionHandler: { (request, response, image, error) in - completionHandler(request, response, image as? UIImage, error) - }) - } -} \ No newline at end of file diff --git a/kplayer/core/MediaItem.swift b/kplayer/core/MediaItem.swift index 00378a9..9296e70 100644 --- a/kplayer/core/MediaItem.swift +++ b/kplayer/core/MediaItem.swift @@ -37,11 +37,10 @@ class MediaItem : DebugPrintable { var thumbPath: String { let len = count("/srv/samba/ren") - let enc = name.stringByReplacingOccurrencesOfString(" ", withString: "+") - let tpath = "/srv/samba/ren/thumb" + (root as NSString).substringFromIndex(len) + "/" + path + "/" + enc + let tpath = "/srv/samba/ren/thumb" + (root as NSString).substringFromIndex(len) + "/" + path + "/" + name + let enc = tpath.stringByReplacingOccurrencesOfString(" ", withString: "+") - - return tpath + "/" + return enc + "/" } var thumbUrlAbsolute: String { diff --git a/kplayer/core/NetworkManager.swift b/kplayer/core/NetworkManager.swift index 0dafb73..97dbe86 100644 --- a/kplayer/core/NetworkManager.swift +++ b/kplayer/core/NetworkManager.swift @@ -233,13 +233,13 @@ class NetworkManager { } else { let imageData = UIImageJPEGRepresentation(c.image, 1.0); - let op = UploadOperation(baseUrl: self.baseurl, data: imageData, path: p) + let op = UploadOperation(baseUrl: self.baseurl + "/service/upload", data: imageData, path: p) self.operationQueue.addOperation(op) let thumb = c.image!.scaleToSize(14 * 16, height: 14 * 10) let imageDataT = UIImageJPEGRepresentation(thumb, 1.0); c.image = thumb - let opT = UploadOperation(baseUrl: self.baseurl, data: imageDataT, path: pt) + let opT = UploadOperation(baseUrl: self.baseurl + "/service/upload", data: imageDataT, path: pt) self.operationQueue.addOperation(opT) c.loaded = true diff --git a/kplayer/DetailViewController.swift b/kplayer/detail/DetailViewController.swift similarity index 90% rename from kplayer/DetailViewController.swift rename to kplayer/detail/DetailViewController.swift index 69542bf..4fc242a 100644 --- a/kplayer/DetailViewController.swift +++ b/kplayer/detail/DetailViewController.swift @@ -95,24 +95,29 @@ class DetailViewController: UIViewController, UICollectionViewDelegateFlowLayout let index = notification.object as! Int if let detail: MediaItem = self.detailItem { - collectionView.performBatchUpdates({ - var newItems = [NSIndexPath]() - var j = 0 - - if count(detail.children) > index { - let path = NSIndexPath(forItem: 0, inSection: index) - self.collectionView.reloadItemsAtIndexPaths([path]) - - for i in detail.children[index].children { - if j >= 1 { - newItems.append(NSIndexPath(forItem: j, inSection: index)) + if (count(detail.children) == 1) { + self.collectionView.reloadData() + } + else { + collectionView.performBatchUpdates({ + var newItems = [NSIndexPath]() + var j = 0 + + if count(detail.children) > index { + let path = NSIndexPath(forItem: 0, inSection: index) + self.collectionView.reloadItemsAtIndexPaths([path]) + + for i in detail.children[index].children { + if j >= 1 { + newItems.append(NSIndexPath(forItem: j, inSection: index)) + } + j++ } - j++ + self.collectionView.insertItemsAtIndexPaths(newItems) } - self.collectionView.insertItemsAtIndexPaths(newItems) - } - return - }, completion: nil) + return + }, completion: nil) + } } } diff --git a/kplayer/HeaderCell.swift b/kplayer/detail/HeaderCell.swift similarity index 100% rename from kplayer/HeaderCell.swift rename to kplayer/detail/HeaderCell.swift diff --git a/kplayer/ItemCell.swift b/kplayer/detail/ItemCell.swift similarity index 100% rename from kplayer/ItemCell.swift rename to kplayer/detail/ItemCell.swift diff --git a/kplayer/VideoPlayerController.swift b/kplayer/detail/VideoPlayerController.swift similarity index 100% rename from kplayer/VideoPlayerController.swift rename to kplayer/detail/VideoPlayerController.swift diff --git a/kplayer/LayoutTools.swift b/kplayer/util/LayoutTools.swift similarity index 100% rename from kplayer/LayoutTools.swift rename to kplayer/util/LayoutTools.swift diff --git a/kplayer/core/NetData.swift b/kplayer/util/NetData.swift similarity index 100% rename from kplayer/core/NetData.swift rename to kplayer/util/NetData.swift diff --git a/kplayer/core/NetworkHelper.swift b/kplayer/util/NetworkHelper.swift similarity index 100% rename from kplayer/core/NetworkHelper.swift rename to kplayer/util/NetworkHelper.swift diff --git a/kplayer/core/UploadOperation.swift b/kplayer/util/UploadOperation.swift similarity index 91% rename from kplayer/core/UploadOperation.swift rename to kplayer/util/UploadOperation.swift index bd9b2a1..83ce3f2 100644 --- a/kplayer/core/UploadOperation.swift +++ b/kplayer/util/UploadOperation.swift @@ -28,7 +28,7 @@ class UploadOperation: NSOperation { "name": path ] - let urlRequest = urlRequestWithComponents(baseUrl + "/service/upload", parameters) + let urlRequest = urlRequestWithComponents(baseUrl, parameters) let request = Alamofire.upload(urlRequest) // success: todo set url to item diff --git a/kplayer/core/alamojson.swift b/kplayer/util/alamojson.swift similarity index 100% rename from kplayer/core/alamojson.swift rename to kplayer/util/alamojson.swift