Browse Source

MasterDetail

master
marcoschmickler 1 year ago
parent
commit
4f019f37ae
  1. 26
      kplayer/Info.plist
  2. 2
      kplayer/core/DatabaseManager.swift
  3. 8
      kplayer/master/MasterModel.swift
  4. 3
      kplayer/master/MasterSplitView.swift
  5. 4
      kplayer/video/SVideoPlayer.swift
  6. 1
      kplayer/web/WebView.swift
  7. 3
      kplayerTests/kplayerTests.swift

26
kplayer/Info.plist

@ -22,6 +22,23 @@
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict/>
</dict>
<key>NSFaceIDUsageDescription</key>
<string>cool</string>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>processing</string>
<string>remote-notification</string>
</array>
<key>UIFileSharingEnabled</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
@ -53,14 +70,5 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIFileSharingEnabled</key>
<true/>
<key>NSFaceIDUsageDescription</key>
<string>cool</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>

2
kplayer/core/DatabaseManager.swift

@ -96,7 +96,7 @@ class DatabaseManager {
print("\(r.root) \(r.name)")
for s in r.snapshots as! Set<KSnapshot> {
print("\(s.thumb)")
let t = s.thumb?.replacingOccurrences(of: "/srv/samba/ren/heg", with: "http://linkstation:8089/ren/thumbs/heg")
let t = s.thumb?.replacingOccurrences(of: "/srv/samba/ren/heg", with: NetworkManager.sharedInstance.vidurl + "/ren/thumbs/heg")
print(t)
s.thumb = t
}

8
kplayer/master/MasterModel.swift

@ -29,6 +29,7 @@ class MasterModel : ObservableObject {
@Published var showVideo = false
@Published var showPhoto = false
@Published var showWeb = false
@Published var showFilePicker = false
@Published var showSettings = false
@Published var isTagging = false
@ -176,12 +177,17 @@ class MasterModel : ObservableObject {
self.showPhotos(s.children, selectedItem: selectedItem, categoryItem: categoryItem)
}
} else if sectionItem.isWeb() {
// showWeb(selectedItem: selectedItem)
showWeb(selectedItem: selectedItem)
} else if sectionItem.type == ItemType.DOWNLOAD {
// showDownload(sectionItem: sectionItem)
}
}
func showWeb(selectedItem: MediaItem) {
selectedDetail = selectedItem
showWeb = true
}
func showVideo(selectedItem: MediaItem) {
let mode = false
var clonedChildren = [MediaItem]()

3
kplayer/master/MasterSplitView.swift

@ -68,6 +68,9 @@ struct MasterSplitView: View {
DetailView(model: model)
}
if model.showWeb {
KBrowserView(item: model.selectedDetail!.name, completionHandler: { model.showWeb = false }).background(.black)
}
if model.showVideo {
SVideoPlayer(completionHandler: model.saveVideo, model: model.videoModel).background(.black)
}

4
kplayer/video/SVideoPlayer.swift

@ -660,6 +660,10 @@ struct SVideoPlayer: View, EditItemDelegate {
}
func doSnapshot() {
if player.currentItem == nil {
return
}
let currentItem = player.currentItem!
let asset = currentItem.asset

1
kplayer/web/WebView.swift

@ -54,6 +54,7 @@ struct WebView: UIViewRepresentable, WebViewHandlerDelegate {
let webView = WKWebView(frame: CGRect.zero, configuration: configuration)
webView.navigationDelegate = context.coordinator
webView.allowsBackForwardNavigationGestures = true
webView.allowsLinkPreview = true
webView.scrollView.isScrollEnabled = true
viewModel.httpCookieStore = configuration.websiteDataStore.httpCookieStore

3
kplayerTests/kplayerTests.swift

@ -23,11 +23,8 @@ class kplayerTests: XCTestCase {
}
func testMyExample() {
// http://linkstation.local/tomcat/media/service/listpicdirs/srv/samba/ren/series/sg
// http://linkstation:8080/tomcat/media/service/download/srv/samba/ren/heg/big/francy-made-in-italy-10000px/francy-made-in-italy-03-10000px.jpg
let hqURL = URL(string:
"http://linkstation:8080/tomcat/media/service/download/srv/samba/ren/heg/emily/emily-amazing-10000px/emily-amazing-21-10000px.jpg")!
// "http://linkstation:8080/tomcat/media/service/download/srv/samba/ren/heg/big/francy-made-in-italy-10000px/francy-made-in-italy-03-10000px.jpg")!
let op = ImageLoadOperation(imageURL: hqURL, succeeder: {
i in

Loading…
Cancel
Save