From eaf87f2ef0cfc6580101fed046582ef5a3bedc3c Mon Sep 17 00:00:00 2001 From: marcoschmickler Date: Mon, 10 May 2021 19:33:16 +0200 Subject: [PATCH] Web --- Pods/Nimbus/src/photos/src/NIPhotoScrubberView.m | 4 ++-- kplayer/core/NetworkManager.swift | 15 +++------------ kplayer/detail/BrowserController.swift | 15 ++++++++++++++- kplayer/detail/VideoController.swift | 2 +- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Pods/Nimbus/src/photos/src/NIPhotoScrubberView.m b/Pods/Nimbus/src/photos/src/NIPhotoScrubberView.m index 1df8545..ef949a5 100644 --- a/Pods/Nimbus/src/photos/src/NIPhotoScrubberView.m +++ b/Pods/Nimbus/src/photos/src/NIPhotoScrubberView.m @@ -136,7 +136,7 @@ static const NSInteger NIPhotoScrubberViewUnknownTag = -1; CGSize boundsSize = self.bounds.size; // These numbers are roughly estimated from the Photos.app's scrubber. - CGFloat photoWidth = NICGFloatFloor(boundsSize.height / 2.4f); + CGFloat photoWidth = NICGFloatFloor(boundsSize.height / 0.6f); CGFloat photoHeight = NICGFloatFloor(photoWidth * 0.75f); return CGSizeMake(photoWidth, photoHeight); @@ -146,7 +146,7 @@ static const NSInteger NIPhotoScrubberViewUnknownTag = -1; CGSize boundsSize = self.bounds.size; // These numbers are roughly estimated from the Photos.app's scrubber. - CGFloat selectionWidth = NICGFloatFloor(boundsSize.height / 1.2f); + CGFloat selectionWidth = NICGFloatFloor(boundsSize.height / 0.3f); CGFloat selectionHeight = NICGFloatFloor(selectionWidth * 0.75f); return CGSizeMake(selectionWidth, selectionHeight); diff --git a/kplayer/core/NetworkManager.swift b/kplayer/core/NetworkManager.swift index ef067f1..ecb6725 100644 --- a/kplayer/core/NetworkManager.swift +++ b/kplayer/core/NetworkManager.swift @@ -178,16 +178,11 @@ class NetworkManager { print("Empfange \(result.count) Ergebnisse") for s in result { -// print(s) if s.lowercased().hasSuffix(".jpg") { let l = s.count let name = (s as NSString).lastPathComponent var pathlen = l - len - name.count -// print(pathlen) -// print(name) -// print(s) - if (pathlen < 2) { pathlen = 2 } @@ -198,7 +193,6 @@ class NetworkManager { let fl = path.count let pfl = fl - folderName.count -// print("\(folderName) \(pfl)") let fpath = (path as NSString).substring(with: NSMakeRange(0, pfl)) let i = MediaItem(name: folderName, path: fpath, root: root, type: ItemType.PICS) @@ -374,9 +368,6 @@ class NetworkManager { snap.time = t snap.thumbUrl = p -// let op = ImageLoadOperation(baseUrl: self.baseurl, item: snap) -// self.operationQueue.addOperation(op) - snap.parent = item snap.loaded = true item.children.append(snap) @@ -384,7 +375,6 @@ class NetworkManager { item.loaded = true NotificationCenter.default.post(name: Notification.Name(rawValue: "loadedItems"), object: item) -// println(error) } } } @@ -516,8 +506,9 @@ class NetworkManager { } } - func downloadFFMPEG(url: URL) { - let queryItems = [URLQueryItem(name: "url", value: url.absoluteString), URLQueryItem(name: "name", value: url.lastPathComponent + ".mp4")] + func downloadFFMPEG(path: String, url: URL) { + let name = path + "/" + url.lastPathComponent + ".mp4" + let queryItems = [URLQueryItem(name: "url", value: url.absoluteString), URLQueryItem(name: "name", value: name)] var urlComps = URLComponents(string: nodeurl + "ffmpeg")! urlComps.queryItems = queryItems let p = urlComps.url! diff --git a/kplayer/detail/BrowserController.swift b/kplayer/detail/BrowserController.swift index f175a4f..4df15b4 100644 --- a/kplayer/detail/BrowserController.swift +++ b/kplayer/detail/BrowserController.swift @@ -125,6 +125,15 @@ class BrowserController : UIViewController, ItemController, WebBrowserDelegate, var name = s if let u = URL(string: s) { name = u.lastPathComponent + if s.contains("720") { + name = name + "720 " + } + if s.contains("1080") { + name = name + "1080 " + } + if s.contains("480") { + name = name + "480 " + } } let oneAction = UIAlertAction(title: name, style: .default) { (action) in @@ -145,7 +154,11 @@ class BrowserController : UIViewController, ItemController, WebBrowserDelegate, func preview(url: String) { let vc = VideoController() let name = URL(string: url)!.lastPathComponent - let item = MediaItem(name: name, path: name, root: "", type: ItemType.VIDEO) + + let hostcomp = currentItem!.name.split(separator: ".") + let site = String(hostcomp[hostcomp.count-2]) + + let item = MediaItem(name: name, path: name, root: site, type: ItemType.VIDEO) item.externalURL = url vc.setItems(items: [item]) diff --git a/kplayer/detail/VideoController.swift b/kplayer/detail/VideoController.swift index ef01c38..b5f26ad 100644 --- a/kplayer/detail/VideoController.swift +++ b/kplayer/detail/VideoController.swift @@ -162,7 +162,7 @@ class VideoController: UIViewController, ItemController, BMPlayerDelegate { let downloadAction = UIAlertAction(title: "Download", style: .default) { (action) in let url = self.currentItem!.playerURL if url!.pathExtension == "m3u8" { - NetworkManager.sharedInstance.downloadFFMPEG(url: url!) + NetworkManager.sharedInstance.downloadFFMPEG(path: self.currentItem!.root, url: url!) } else { NetworkManager.sharedInstance.download(url: url!)