Browse Source

Search

master
Marco Schmickler 10 years ago
parent
commit
9d96bfcde2
  1. 1
      .idea/kplayer.iml
  2. 4
      kplayer.xcodeproj/project.pbxproj
  3. 11
      kplayer/core/MediaItem.swift
  4. 17
      kplayer/detail/DetailViewController.swift

1
.idea/kplayer.iml

@ -38,6 +38,7 @@
<sourceFolder url="file://$MODULE_DIR$/kplayer/detail/HeaderCell.swift" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/kplayer/detail/ItemCell.swift" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/kplayer/detail/DetailViewController.swift" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/kplayer/scratch.txt" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/kplayer/Base.lproj/LaunchScreen.xib" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/kplayer/Base.lproj/Main.storyboard" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/Pods/Alamofire/Source/ParameterEncoding.swift" isTestSource="false" />

4
kplayer.xcodeproj/project.pbxproj

@ -12,6 +12,7 @@
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 */; };
1C73651E1241702E5032A8A4 /* scratch.txt in Resources */ = {isa = PBXBuildFile; fileRef = 1C736E3BE8EC464D6F5DC8FA /* scratch.txt */; };
1C73654C9EA6D255CFC039C5 /* NetworkHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C73620D01687FB4F1811C5C /* NetworkHelper.swift */; };
1C7365885FAF292F2221ED44 /* MediaPhotoController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C73673DC671535E3A049F54 /* MediaPhotoController.swift */; };
1C73675C34BE0990D44570BE /* ItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C736253AB7A95EA41B605B7 /* ItemModel.swift */; };
@ -69,6 +70,7 @@
1C736BC4450890C45F8FBC63 /* LayoutTools.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LayoutTools.swift; sourceTree = "<group>"; };
1C736D9BB5498E7E8F11C754 /* HeaderCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeaderCell.swift; sourceTree = "<group>"; };
1C736DCCE3AA9993E15F7652 /* UIImageExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UIImageExtension.swift; sourceTree = "<group>"; };
1C736E3BE8EC464D6F5DC8FA /* scratch.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = scratch.txt; sourceTree = "<group>"; };
1C736F9338CE36708244D42A /* DataLoadOperation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataLoadOperation.swift; sourceTree = "<group>"; };
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 = "<group>"; };
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 = "<group>"; };
@ -211,6 +213,7 @@
1C73615846EE8B07DAAFD230 /* detail */,
1C7364808E72BFA7575E75E1 /* master */,
1C7363B608460DED4F522D1C /* photo */,
1C736E3BE8EC464D6F5DC8FA /* scratch.txt */,
);
path = kplayer;
sourceTree = "<group>";
@ -330,6 +333,7 @@
C98AF5E41B124D6A00D196CC /* LaunchScreen.xib in Resources */,
C98AF5E11B124D6A00D196CC /* Images.xcassets in Resources */,
1C736A5FA5BA53B2597F2ED7 /* Kirschkeks-256x256.png in Resources */,
1C73651E1241702E5032A8A4 /* scratch.txt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

11
kplayer/core/MediaItem.swift

@ -146,8 +146,15 @@ class MediaItem: CustomDebugStringConvertible {
}
var playerURL: NSURL? {
let enc = "/" + name.stringByReplacingOccurrencesOfString(" ", withString: "%20")
return NSURL(string: NetworkManager.sharedInstance.baseurl + "/service/stream" + encodedDir! + enc)
let enc = name.stringByReplacingOccurrencesOfString(" ", withString: "%20")
let s = NetworkManager.sharedInstance.baseurl + "/service/stream" + encodedDir!
if s.endsWith("/") {
return NSURL(string: s + enc)
}
else {
return NSURL(string: s + "/" + enc)
}
}
/**

17
kplayer/detail/DetailViewController.swift

@ -123,13 +123,10 @@ class DetailViewController: UIViewController, UICollectionViewDelegateFlowLayout
if let detail: MediaItem = self.detailItem {
if i.type == ItemType.VIDEO {
if i.parent!.type != ItemType.DETAILS {
let path = NSIndexPath(forItem: index, inSection: i.parent!.index)
self.collectionView.reloadItemsAtIndexPaths([path])
}
} else {
if i.parent! !== detail {
return
@ -257,7 +254,7 @@ class DetailViewController: UIViewController, UICollectionViewDelegateFlowLayout
func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
if let detail: MediaItem = self.detailItem {
var items = detail.children[indexPath.section]
if (items.loaded) {
if (items.type == ItemType.VIDEO || items.loaded) {
if indexPath.item >= items.children.count {
print(items.name)
} else {
@ -268,7 +265,7 @@ class DetailViewController: UIViewController, UICollectionViewDelegateFlowLayout
self.currentItem = items
}
if items.type == ItemType.VIDEO {
if items.type == ItemType.VIDEO || items.type == ItemType.SNAPSHOT {
performSegueWithIdentifier("showVideo", sender: self)
}
else {
@ -348,10 +345,14 @@ class DetailViewController: UIViewController, UICollectionViewDelegateFlowLayout
self.collectionView.reloadData()
self.collectionView.collectionViewLayout.invalidateLayout()
if self.currentItem!.type == ItemType.SNAPSHOT {
self.currentItem = self.currentItem!.parent
if let ci = self.currentItem {
if ci.type == ItemType.SNAPSHOT {
self.currentItem = ci.parent
}
}
if let ci = self.currentItem {
NetworkManager.sharedInstance.saveItem(ci)
}
NetworkManager.sharedInstance.saveItem(self.currentItem!)
self.dismissViewControllerAnimated(true, completion: nil);
}
}

Loading…
Cancel
Save