对下载内容数据库的调整
This commit is contained in:
parent
1a43357552
commit
d0a1339ee9
@ -150,6 +150,9 @@
|
||||
CBEE8E342BEB16BB007DA798 /* MPPositive_PlayerSilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBEE8E332BEB16BB007DA798 /* MPPositive_PlayerSilder.swift */; };
|
||||
CBEE8E362BEB2604007DA798 /* MPPositive_PlayerLyricView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBEE8E352BEB2604007DA798 /* MPPositive_PlayerLyricView.swift */; };
|
||||
CBEE8E382BEB92CC007DA798 /* MPPositive_SongViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBEE8E372BEB92CC007DA798 /* MPPositive_SongViewModel.swift */; };
|
||||
CBF456DD2BF1E72F00ABF761 /* MPPositive_SearchResultListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBF456DC2BF1E72F00ABF761 /* MPPositive_SearchResultListViewModel.swift */; };
|
||||
CBF456DF2BF1E8A500ABF761 /* MPPositive_SearchResultItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBF456DE2BF1E8A500ABF761 /* MPPositive_SearchResultItemModel.swift */; };
|
||||
CBF456E12BF1EB4300ABF761 /* MPPositive_SearchResultItemViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBF456E02BF1EB4300ABF761 /* MPPositive_SearchResultItemViewModel.swift */; };
|
||||
CBFECE352BF0847F00E07DC4 /* MPPositive_SearchSuggestionItemTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBFECE342BF0847F00E07DC4 /* MPPositive_SearchSuggestionItemTableViewCell.swift */; };
|
||||
CBFECE372BF0C11000E07DC4 /* MPPositive_JsonSearchSuggestions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBFECE362BF0C11000E07DC4 /* MPPositive_JsonSearchSuggestions.swift */; };
|
||||
CBFECE392BF0CFFA00E07DC4 /* MPPositive_SearchSuggestionItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBFECE382BF0CFF900E07DC4 /* MPPositive_SearchSuggestionItemModel.swift */; };
|
||||
@ -305,6 +308,9 @@
|
||||
CBEE8E332BEB16BB007DA798 /* MPPositive_PlayerSilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_PlayerSilder.swift; sourceTree = "<group>"; };
|
||||
CBEE8E352BEB2604007DA798 /* MPPositive_PlayerLyricView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_PlayerLyricView.swift; sourceTree = "<group>"; };
|
||||
CBEE8E372BEB92CC007DA798 /* MPPositive_SongViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_SongViewModel.swift; sourceTree = "<group>"; };
|
||||
CBF456DC2BF1E72F00ABF761 /* MPPositive_SearchResultListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_SearchResultListViewModel.swift; sourceTree = "<group>"; };
|
||||
CBF456DE2BF1E8A500ABF761 /* MPPositive_SearchResultItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_SearchResultItemModel.swift; sourceTree = "<group>"; };
|
||||
CBF456E02BF1EB4300ABF761 /* MPPositive_SearchResultItemViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_SearchResultItemViewModel.swift; sourceTree = "<group>"; };
|
||||
CBFECE342BF0847F00E07DC4 /* MPPositive_SearchSuggestionItemTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_SearchSuggestionItemTableViewCell.swift; sourceTree = "<group>"; };
|
||||
CBFECE362BF0C11000E07DC4 /* MPPositive_JsonSearchSuggestions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_JsonSearchSuggestions.swift; sourceTree = "<group>"; };
|
||||
CBFECE382BF0CFF900E07DC4 /* MPPositive_SearchSuggestionItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPPositive_SearchSuggestionItemModel.swift; sourceTree = "<group>"; };
|
||||
@ -659,6 +665,7 @@
|
||||
CBB5D31E2BDF711600CC333D /* MPPositive_SongItemModel.swift */,
|
||||
CBB75B0A2BEF0BC400B3FF9A /* MPPositive_DownloadItemModel.swift */,
|
||||
CBFECE382BF0CFF900E07DC4 /* MPPositive_SearchSuggestionItemModel.swift */,
|
||||
CBF456DE2BF1E8A500ABF761 /* MPPositive_SearchResultItemModel.swift */,
|
||||
);
|
||||
path = Models;
|
||||
sourceTree = "<group>";
|
||||
@ -671,6 +678,8 @@
|
||||
CBE1CB4D2BDE4BD800701D57 /* MPPositive_ListAlbumListViewModel.swift */,
|
||||
CBE1CB4F2BDE4CC500701D57 /* MPPositive_ListHeaderViewModel.swift */,
|
||||
CBEE8E372BEB92CC007DA798 /* MPPositive_SongViewModel.swift */,
|
||||
CBF456DC2BF1E72F00ABF761 /* MPPositive_SearchResultListViewModel.swift */,
|
||||
CBF456E02BF1EB4300ABF761 /* MPPositive_SearchResultItemViewModel.swift */,
|
||||
);
|
||||
path = ListViewModels;
|
||||
sourceTree = "<group>";
|
||||
@ -1068,9 +1077,11 @@
|
||||
CBB5D31F2BDF711600CC333D /* MPPositive_SongItemModel.swift in Sources */,
|
||||
CBCAFB5A2BB3C2A000BC6520 /* LayoutConstraint.swift in Sources */,
|
||||
CBCB4FEF2BD11402009760B3 /* MPSideA_NavigationController.swift in Sources */,
|
||||
CBF456DD2BF1E72F00ABF761 /* MPPositive_SearchResultListViewModel.swift in Sources */,
|
||||
CBCB35212BD7ACE900802900 /* MPPositive_JsonBrowse.swift in Sources */,
|
||||
CBCB4FF62BD11402009760B3 /* MPSideA_DeleteViewController.swift in Sources */,
|
||||
CBFECE392BF0CFFA00E07DC4 /* MPPositive_SearchSuggestionItemModel.swift in Sources */,
|
||||
CBF456DF2BF1E8A500ABF761 /* MPPositive_SearchResultItemModel.swift in Sources */,
|
||||
CBDD516F2BECBA6E000F12C5 /* MPPositive_PlayerLoadViewModel.swift in Sources */,
|
||||
CBEE8E382BEB92CC007DA798 /* MPPositive_SongViewModel.swift in Sources */,
|
||||
CBCB50122BD11402009760B3 /* MPSideA_Home_FirstListCollectionViewCell.swift in Sources */,
|
||||
@ -1117,6 +1128,7 @@
|
||||
CB0918A32BD26B2F006D2B39 /* MPPositive_LibraryViewController.swift in Sources */,
|
||||
CBEE8E322BEB0FC0007DA798 /* MPPositive_PlayerCoverView.swift in Sources */,
|
||||
CBC32A552BD8DFB900687171 /* MPPositive_BrowseModuleListViewModel.swift in Sources */,
|
||||
CBF456E12BF1EB4300ABF761 /* MPPositive_SearchResultItemViewModel.swift in Sources */,
|
||||
CBE1CB4E2BDE4BD800701D57 /* MPPositive_ListAlbumListViewModel.swift in Sources */,
|
||||
CBD313572BD63B390015D227 /* MPPositive_HomeListSecondCollectionViewCell.swift in Sources */,
|
||||
0096622D2BB14A5A00FCA65F /* AppDelegate.swift in Sources */,
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="22757" systemVersion="23E224" minimumToolsVersion="Automatic" sourceLanguage="Swift" userDefinedModelVersionIdentifier="">
|
||||
<entity name="MPPositive_DownloadItemModel" representedClassName="MPPositive_DownloadItemModel" syncable="YES">
|
||||
<attribute name="coverImage" optional="YES" attributeType="Binary"/>
|
||||
<attribute name="coverImage" optional="YES" attributeType="URI"/>
|
||||
<attribute name="lengthText" optional="YES" attributeType="String"/>
|
||||
<attribute name="longBylineText" optional="YES" attributeType="String"/>
|
||||
<attribute name="lyrics" optional="YES" attributeType="String"/>
|
||||
<attribute name="relatedID" optional="YES" attributeType="String"/>
|
||||
<attribute name="resourcePath" optional="YES" attributeType="String"/>
|
||||
<attribute name="reviewImage" optional="YES" attributeType="Binary"/>
|
||||
<attribute name="reviewImage" optional="YES" attributeType="URI"/>
|
||||
<attribute name="shortBylineText" optional="YES" attributeType="String"/>
|
||||
<attribute name="title" optional="YES" attributeType="String"/>
|
||||
<attribute name="videoId" optional="YES" attributeType="String"/>
|
||||
|
||||
@ -872,10 +872,14 @@ extension MP_NetWorkManager {
|
||||
///解析搜索结果_SearchResults
|
||||
private func parsingSearchResults(_ contents:[JsonSearchResults.Contents.TabbedSearchResultsRenderer.Tab.TabRenderer.Content.SectionListRenderer.Content]) {
|
||||
contents.forEach { content in
|
||||
let resultList = MPPositive_SearchResultListViewModel()
|
||||
//判断当前模块是最佳结果还是其它模块
|
||||
if let musicCardShelfRenderer = content.musicCardShelfRenderer {
|
||||
//当前是最佳结果
|
||||
|
||||
if let title = musicCardShelfRenderer.title {
|
||||
//设置模块标题
|
||||
resultList.title = title.runs?.reduce("", { $0 + ($1.text ?? "")})
|
||||
}
|
||||
}else {
|
||||
//当前是其他结果
|
||||
}
|
||||
@ -901,10 +905,10 @@ extension MP_NetWorkManager {
|
||||
}
|
||||
var browseContent = BrowseItemContent()
|
||||
flexColumn.musicResponsiveListItemFlexColumnRenderer?.text?.runs?.forEach({ run in
|
||||
if run.navigationEndpoint?.browseEndpoint?.browseId != nil {
|
||||
//获取到艺术家的ID
|
||||
item.artistsId = run.navigationEndpoint?.browseEndpoint?.browseId
|
||||
}
|
||||
// if run.navigationEndpoint?.browseEndpoint?.browseId != nil {
|
||||
// //获取到艺术家的ID
|
||||
// item.artistsId = run.navigationEndpoint?.browseEndpoint?.browseId
|
||||
// }
|
||||
if run.navigationEndpoint?.browseEndpoint?.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType != nil && run.navigationEndpoint?.browseEndpoint?.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType != "MUSIC_PAGE_TYPE_ARTIST" {
|
||||
//专辑或则歌单
|
||||
browseContent.pageType = run.navigationEndpoint?.browseEndpoint?.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType
|
||||
@ -938,10 +942,10 @@ extension MP_NetWorkManager {
|
||||
item.subtitle = musicTwoRowItemRenderer.subtitle?.runs?.reduce("", { $0 + ($1.text ?? "")})
|
||||
var browseContent = BrowseItemContent()
|
||||
musicTwoRowItemRenderer.title?.runs?.forEach({ run in
|
||||
if run.navigationEndpoint?.browseEndpoint?.browseId != nil {
|
||||
//获取到艺术家的ID
|
||||
item.artistsId = run.navigationEndpoint?.browseEndpoint?.browseId
|
||||
}
|
||||
// if run.navigationEndpoint?.browseEndpoint?.browseId != nil {
|
||||
// //获取到艺术家的ID
|
||||
// item.artistsId = run.navigationEndpoint?.browseEndpoint?.browseId
|
||||
// }
|
||||
if run.navigationEndpoint?.browseEndpoint?.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType != nil && run.navigationEndpoint?.browseEndpoint?.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType != "MUSIC_PAGE_TYPE_ARTIST" {
|
||||
//专辑或则歌单
|
||||
browseContent.pageType = run.navigationEndpoint?.browseEndpoint?.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType
|
||||
@ -950,10 +954,10 @@ extension MP_NetWorkManager {
|
||||
}
|
||||
})
|
||||
musicTwoRowItemRenderer.subtitle?.runs?.forEach({ run in
|
||||
if run.navigationEndpoint?.browseEndpoint?.browseId != nil {
|
||||
//获取到艺术家的ID
|
||||
item.artistsId = run.navigationEndpoint?.browseEndpoint?.browseId
|
||||
}
|
||||
// if run.navigationEndpoint?.browseEndpoint?.browseId != nil {
|
||||
// //获取到艺术家的ID
|
||||
// item.artistsId = run.navigationEndpoint?.browseEndpoint?.browseId
|
||||
// }
|
||||
if run.navigationEndpoint?.browseEndpoint?.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType != nil && run.navigationEndpoint?.browseEndpoint?.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType != "MUSIC_PAGE_TYPE_ARTIST" {
|
||||
//专辑或则歌单
|
||||
browseContent.pageType = run.navigationEndpoint?.browseEndpoint?.browseEndpointContextSupportedConfigs?.browseEndpointContextMusicConfig?.pageType
|
||||
|
||||
@ -10,9 +10,9 @@ import UIKit
|
||||
class MPPositive_BrowseItemModel: NSObject {
|
||||
///封面
|
||||
var coverUrl:String!
|
||||
///一级标题(通常是名称)
|
||||
///一级标题
|
||||
var maintitle:String!
|
||||
///二级标题(通常是歌手)
|
||||
///二级标题
|
||||
var subtitle:String!
|
||||
///三级标题(通常是专辑名/歌单/播放次数)
|
||||
var thirdtitle:String!
|
||||
@ -20,8 +20,6 @@ class MPPositive_BrowseItemModel: NSObject {
|
||||
var musicVideo:BrowseItemMusicVideo!
|
||||
///item预览内容
|
||||
var browseContent:BrowseItemContent!
|
||||
///作者ID
|
||||
var artistsId:String!
|
||||
///是单曲/视频OR列表/歌单
|
||||
var itemType:BrowseItemType!
|
||||
}
|
||||
@ -47,6 +45,8 @@ enum BrowseItemType: Int{
|
||||
case single = 0
|
||||
///列表/列表
|
||||
case list = 1
|
||||
///艺术家
|
||||
case artist = 2
|
||||
///文本
|
||||
var text:String{
|
||||
switch self {
|
||||
@ -54,6 +54,8 @@ enum BrowseItemType: Int{
|
||||
return "single/video"
|
||||
case .list:
|
||||
return "list/ablum"
|
||||
case .artist:
|
||||
return "artist"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,23 +13,23 @@ import CoreData
|
||||
class MPPositive_DownloadItemModel: NSManagedObject, MP_CoreDataManageableDelegate, MP_CoreDataOperationDelegate {
|
||||
typealias ManagedObject = MPSideA_MusicModel
|
||||
///资源存储地址(沙盒路径后缀名)
|
||||
var resourcePath:String!
|
||||
@NSManaged var resourcePath:String!
|
||||
///封面
|
||||
var coverImage:Data!
|
||||
@NSManaged var coverImage:URL!
|
||||
///预览图片
|
||||
var reviewImage:Data!
|
||||
@NSManaged var reviewImage:URL!
|
||||
///标题(单曲标题)
|
||||
var title:String?
|
||||
@NSManaged var title:String?
|
||||
///长文本标题(作者/播放次数/点赞次数)
|
||||
var longBylineText:String?
|
||||
@NSManaged var longBylineText:String?
|
||||
///单曲长度文本(歌曲长度)
|
||||
var lengthText:String?
|
||||
@NSManaged var lengthText:String?
|
||||
///署名文本(歌手)
|
||||
var shortBylineText:String?
|
||||
@NSManaged var shortBylineText:String?
|
||||
///歌词
|
||||
var lyrics:String?
|
||||
@NSManaged var lyrics:String?
|
||||
///播放的VideoID
|
||||
var videoId:String!
|
||||
@NSManaged var videoId:String!
|
||||
///相关内容ID
|
||||
var relatedID:String!
|
||||
@NSManaged var relatedID:String!
|
||||
}
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
//
|
||||
// MPPositive_SearchResultItemModel.swift
|
||||
// MusicPlayer
|
||||
//
|
||||
// Created by Mr.Zhou on 2024/5/13.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
///预览结果个体模型
|
||||
class MPPositive_SearchResultItemModel: NSObject {
|
||||
///预览图片
|
||||
var reviewUrls:[String]?
|
||||
///一级标题
|
||||
var title:String?
|
||||
///二级标题
|
||||
var subtitle:String?
|
||||
///单曲视频/VideoID
|
||||
var videoId:String?
|
||||
///歌单专辑/browseID
|
||||
var browseId:String?
|
||||
///类型
|
||||
var itemType:BrowseItemType?
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
//
|
||||
// MPPositive_SearchResultItemViewModel.swift
|
||||
// MusicPlayer
|
||||
//
|
||||
// Created by Mr.Zhou on 2024/5/13.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class MPPositive_SearchResultItemViewModel: NSObject {
|
||||
///预览图路径
|
||||
var reviewUrl:URL?
|
||||
///标题
|
||||
var title:String?
|
||||
///副标题
|
||||
var subtitle:String?
|
||||
///搜索结果个体
|
||||
var item:MPPositive_SearchResultItemModel!
|
||||
init(_ resultItem:MPPositive_SearchResultItemModel) {
|
||||
super.init()
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
//
|
||||
// MPPositive_SearchResultListViewModel.swift
|
||||
// MusicPlayer
|
||||
//
|
||||
// Created by Mr.Zhou on 2024/5/13.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
///搜索结果模块列表
|
||||
class MPPositive_SearchResultListViewModel: NSObject {
|
||||
///模块标题
|
||||
var title:String!
|
||||
///模块内容
|
||||
var itemViews:[MPPositive_SearchResultItemViewModel] = []
|
||||
}
|
||||
@ -105,8 +105,8 @@ extension MPPositive_HomeViewController: UITableViewDataSource, UITableViewDeleg
|
||||
cell.requestNextBlock = {
|
||||
[weak self] (item) in
|
||||
guard let self = self else {return}
|
||||
//判断内容的类型,决定跳转方式
|
||||
if item.browseItem.itemType == .single {
|
||||
switch item.browseItem.itemType {
|
||||
case .single:
|
||||
//单曲/视频跳转
|
||||
//触发next请求,优先获取列表全部单曲基础数据(不完善)
|
||||
MP_NetWorkManager.shared.requestNextList(item){ [weak self] listSongs in
|
||||
@ -117,9 +117,11 @@ extension MPPositive_HomeViewController: UITableViewDataSource, UITableViewDeleg
|
||||
MP_PlayerManager.shared.loadPlayer = lodaViewModel
|
||||
NotificationCenter.notificationKey.post(notificationName: .pup_player_vc)
|
||||
}
|
||||
}else {
|
||||
case .list:
|
||||
//列表/专辑跳转
|
||||
loadViewModel.requestListOrAlbum(item)
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
cell.findMoreBlock = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user