Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
xjbeta committed May 30, 2024
2 parents ccd73f4 + 76da619 commit 3135258
Show file tree
Hide file tree
Showing 16 changed files with 226 additions and 114 deletions.
8 changes: 6 additions & 2 deletions IINA+.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
010F0EF220F890DB00F33553 /* MainWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 010F0EF120F890DB00F33553 /* MainWindowController.swift */; };
010F0F1320FE1DD100F33553 /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = 010F0F1220FE1DD100F33553 /* Preferences.swift */; };
010F0F1920FE4F0900F33553 /* DataModel.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 010F0F1720FE4F0900F33553 /* DataModel.xcdatamodeld */; };
011329262C06252300ED0D78 /* AboutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011329252C06252300ED0D78 /* AboutViewController.swift */; };
011E4D3321E99CA400997633 /* Log.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011E4D3221E99CA300997633 /* Log.swift */; };
0120934227A40869002C7FD3 /* JSPlayerWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0120934127A40869002C7FD3 /* JSPlayerWindowController.swift */; };
0120934427A4F632002C7FD3 /* JSPlayerWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0120934327A4F632002C7FD3 /* JSPlayerWebView.swift */; };
Expand Down Expand Up @@ -188,6 +189,7 @@
010F0EF120F890DB00F33553 /* MainWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainWindowController.swift; sourceTree = "<group>"; };
010F0F1220FE1DD100F33553 /* Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; };
010F0F1820FE4F0900F33553 /* Bookmark.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Bookmark.xcdatamodel; sourceTree = "<group>"; };
011329252C06252300ED0D78 /* AboutViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutViewController.swift; sourceTree = "<group>"; };
011E4D3221E99CA300997633 /* Log.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Log.swift; sourceTree = "<group>"; };
0120932827A3B441002C7FD3 /* flvplayer.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = flvplayer.css; sourceTree = "<group>"; };
0120932927A3B441002C7FD3 /* flvplayer.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = flvplayer.js; sourceTree = "<group>"; };
Expand Down Expand Up @@ -612,6 +614,7 @@
01683DDD211924160016A886 /* BilibiliViewController.swift */,
0196CB6321214B4200BCD29E /* AdvancedViewController.swift */,
01683DD8211869AE0016A886 /* BilibiliLoginViewController.swift */,
011329252C06252300ED0D78 /* AboutViewController.swift */,
0189533E279FBC470011BAAC /* ColorPickButton.swift */,
01B331C62A640D9000AB380C /* PluginViewController.swift */,
);
Expand Down Expand Up @@ -825,6 +828,7 @@
0120934427A4F632002C7FD3 /* JSPlayerWebView.swift in Sources */,
01AEC8BC20EDFFBD001406E8 /* YouGetJSON.swift in Sources */,
01B82B3928EEF9D300928F61 /* SelectVideoCollectionViewHeader.swift in Sources */,
011329262C06252300ED0D78 /* AboutViewController.swift in Sources */,
0132B2E52123D68D001EB7DC /* BilibiliCardImageBoxView.swift in Sources */,
01683DD9211869AE0016A886 /* BilibiliLoginViewController.swift in Sources */,
019F584F2AF1450800235BAE /* JSPlayerURLSchemeHandler.swift in Sources */,
Expand Down Expand Up @@ -1037,7 +1041,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 0.7.27;
MARKETING_VERSION = 0.7.28;
PRODUCT_BUNDLE_IDENTIFIER = "com.xjbeta.iina-plus";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1064,7 +1068,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 0.7.27;
MARKETING_VERSION = 0.7.28;
PRODUCT_BUNDLE_IDENTIFIER = "com.xjbeta.iina-plus";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
6 changes: 3 additions & 3 deletions IINA+/Assets/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"compression-type" : "automatic"
}
}
}
12 changes: 12 additions & 0 deletions IINA+/Assets/Assets.xcassets/WX_Payment.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "WX_Payment.jpg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion IINA+/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class Preferences: NSObject {

@objc dynamic var stateReplay: NSColor {
get {
return colorDecode(defaults(.stateReplay)) ?? .systemBlue
return colorDecode(defaults(.stateReplay)) ?? .controlAccentColor
}
set {
defaultsSet(colorEncode(newValue), forKey: .stateReplay)
Expand Down
90 changes: 59 additions & 31 deletions IINA+/Utils/VideoDecoder/Huya.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class Huya: NSObject, SupportSiteProtocol {
private let huyaUid = Int.random(in: Int(1e12)..<Int(1e13))

func liveInfo(_ url: String) -> Promise<LiveInfo> {
getHuyaInfoM(url).map {
getHuyaInfo(url).map {
$0
}
}

func decodeUrl(_ url: String) -> Promise<YouGetJSON> {
getHuyaInfo(url)
getHuyaVideos(url)
/*
getHuyaInfoM(url).map {
var yougetJson = YouGetJSON(rawUrl: url)
Expand Down Expand Up @@ -70,14 +70,38 @@ class Huya: NSObject, SupportSiteProtocol {
return re
}
}

func getHuyaInfo(_ url: String) -> Promise<HuyaStream.GameLiveInfo> {
getPlayerConfig(url).map {
let stream = try HuyaStream(object: $0)


guard let data = stream.data.first else {
throw VideoGetError.notFountData
}
var info = data.liveInfo
info.isLiving = data.streamInfoList.count > 0

return info
}
}

func getHuyaInfo(_ url: String) -> Promise<YouGetJSON> {
AF.request(url).responseString().map {

let text = $0.string

let hyPlayerConfigStr: String? = {
var str = text.subString(from: "var hyPlayerConfig = ", to: "window.TT_LIVE_TIMING")
func getHuyaVideos(_ url: String) -> Promise<YouGetJSON> {
getPlayerConfig(url).map {
let info = try HuyaStream(object: $0)

var yougetJson = YouGetJSON(rawUrl: url)
return info.write(to: yougetJson, uid: self.huyaUid)
}
}

func getPlayerConfig(_ url: String) -> Promise<JSONObject> {
AF.request(url).responseString().map {

let text = $0.string

let hyPlayerConfigStr: String? = {
var str = text.subString(from: "var hyPlayerConfig = ", to: "window.TT_LIVE_TIMING")

if let range = str.range(of: "stream:") {
str.removeSubrange(str.startIndex..<range.upperBound)
Expand All @@ -88,23 +112,17 @@ class Huya: NSObject, SupportSiteProtocol {
str = String(str[str.startIndex...c2[c1.count-1]])
}
}
return str
}()
return str
}()

guard let data = hyPlayerConfigStr?.data(using: .utf8) else {
throw VideoGetError.notFountData
}

let jsonObj: JSONObject = try JSONParser.JSONObjectWithData(data)
let info = try HuyaStream(object: jsonObj)

var yougetJson = YouGetJSON(rawUrl: url)
yougetJson.title = info.data.first?.liveInfo.roomName ?? ""

return info.write(to: yougetJson, uid: self.huyaUid)

}
}
let jsonObj: JSONObject = try JSONParser.JSONObjectWithData(data)
return jsonObj
}
}

func getHuyaInfoM(_ url: String) -> Promise<HuyaInfoM> {
pSession.request(url).responseString().map {
Expand Down Expand Up @@ -173,7 +191,7 @@ struct HuyaStream: Unmarshaling {
var yougetJson = yougetJson

if let infoData = data.first {
yougetJson.title = infoData.liveInfo.roomName
yougetJson.title = infoData.liveInfo.title

let urls = infoData.streamInfoList.map {
$0.url(uid)
Expand Down Expand Up @@ -231,20 +249,31 @@ struct HuyaStream: Unmarshaling {
}
}

struct GameLiveInfo: Unmarshaling {
struct GameLiveInfo: Unmarshaling, LiveInfo {

let roomName: String
var title: String = ""
var name: String = ""
var isLiving = false
var avatar: String
var rid: Int
var cover: String = ""
var site: SupportSites = .huya
let uid: Int

var isSeeTogetherRoom = false
let isSecret: Int
let screenshot: String
let nick: String
let avatar180: String


init(object: MarshaledObject) throws {
let name1: String = try object.value(for: "roomName")
let name2: String = try object.value(for: "introduction")

roomName = name1 == "" ? name2 : name1
title = name1 == "" ? name2 : name1
name = try object.value(for: "nick")

avatar = try object.value(for: "avatar180")
rid = try object.value(for: "profileRoom")
cover = try object.value(for: "screenshot")

if let uid: Int = try? object.value(for: "uid") {
self.uid = uid
Expand All @@ -256,9 +285,8 @@ struct HuyaStream: Unmarshaling {
}

isSecret = try object.value(for: "isSecret")
screenshot = try object.value(for: "screenshot")
nick = try object.value(for: "nick")
avatar180 = try object.value(for: "avatar180")
let gameHostName: String = try object.value(for: "gameHostName")
isSeeTogetherRoom = gameHostName == "seeTogether"
}
}

Expand Down
Loading

0 comments on commit 3135258

Please sign in to comment.