├── .gitignore ├── Music.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── Music.xccheckout │ └── xcuserdata │ │ └── dengw.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── WorkspaceSettings.xcsettings └── xcuserdata │ └── dengw.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── Music.xcscheme │ └── xcschememanagement.plist ├── Music ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Category │ ├── NSDate+Additions.h │ ├── NSDate+Additions.m │ ├── NSError+Additions.h │ ├── NSError+Additions.m │ ├── NSString+CZ.h │ ├── NSString+CZ.m │ ├── UIButton+CZ.h │ ├── UIButton+CZ.m │ ├── UIImage+CZ.h │ ├── UIImage+CZ.m │ ├── UIView+Additions.h │ ├── UIView+Additions.m │ ├── UIView+Frame.h │ └── UIView+Frame.m ├── Controller │ ├── DZAboutViewController.h │ ├── DZAboutViewController.m │ ├── DZDetailMusicViewController.h │ ├── DZDetailMusicViewController.m │ ├── DZLeftViewController.h │ ├── DZLeftViewController.m │ ├── DZMusicPlayerViewController.h │ ├── DZMusicPlayerViewController.m │ ├── DZOnlineMusicViewController.h │ └── DZOnlineMusicViewController.m ├── Images.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ └── icon@2x.png │ ├── Home_Icon_Highlight.imageset │ │ ├── Contents.json │ │ └── Home_Icon_Highlight@2x.png │ ├── LaunchImage.launchimage │ │ └── Contents.json │ ├── aboutBackground.imageset │ │ ├── Contents.json │ │ └── aboutBackground.png │ ├── backgroundImage.imageset │ │ ├── Contents.json │ │ └── backgroundImage.png │ ├── launch.imageset │ │ ├── Contents.json │ │ └── launch.png │ ├── leftBackground.imageset │ │ ├── Contents.json │ │ └── leftBackground.png │ ├── nav_music.imageset │ │ ├── Contents.json │ │ └── nav_music@2x.png │ ├── onlineBackground.imageset │ │ ├── Contents.json │ │ └── onlineBackground.png │ ├── playbar_slider │ │ ├── playbar_silider_bground.imageset │ │ │ ├── Contents.json │ │ │ ├── playbar_silider_bground.png │ │ │ └── playbar_silider_bground@2x.png │ │ ├── playbar_slider_bg.imageset │ │ │ ├── Contents.json │ │ │ ├── playbar_slider_bg.png │ │ │ └── playbar_slider_bg@2x.png │ │ ├── playbar_slider_blue.imageset │ │ │ ├── Contents.json │ │ │ ├── playbar_slider_blue.png │ │ │ └── playbar_slider_blue@2x.png │ │ ├── playbar_slider_bottom.imageset │ │ │ ├── Contents.json │ │ │ ├── playbar_slider_bottom.png │ │ │ └── playbar_slider_bottom@2x.png │ │ ├── playbar_slider_thumb.imageset │ │ │ ├── Contents.json │ │ │ ├── playbar_slider_thumb.png │ │ │ └── playbar_slider_thumb@2x.png │ │ └── playbar_slider_top.imageset │ │ │ ├── Contents.json │ │ │ ├── playbar_slider_top.png │ │ │ └── playbar_slider_top@2x.png │ └── playbtn │ │ ├── play_bar_bg2.imageset │ │ ├── Contents.json │ │ ├── play_bar_bg2.png │ │ └── play_bar_bg2@2x.png │ │ ├── playbar_nextbtn_click.imageset │ │ ├── Contents.json │ │ ├── playbar_nextbtn_click.png │ │ └── playbar_nextbtn_click@2x.png │ │ ├── playbar_nextbtn_nomal.imageset │ │ ├── Contents.json │ │ ├── playbar_nextbtn_nomal.png │ │ └── playbar_nextbtn_nomal@2x.png │ │ ├── playbar_pausebtn_click.imageset │ │ ├── Contents.json │ │ ├── playbar_pausebtn_click.png │ │ └── playbar_pausebtn_click@2x.png │ │ ├── playbar_pausebtn_nomal.imageset │ │ ├── Contents.json │ │ ├── playbar_pausebtn_nomal.png │ │ └── playbar_pausebtn_nomal@2x.png │ │ ├── playbar_playbtn_click.imageset │ │ ├── Contents.json │ │ ├── playbar_playbtn_click.png │ │ └── playbar_playbtn_click@2x.png │ │ ├── playbar_playbtn_nomal.imageset │ │ ├── Contents.json │ │ ├── playbar_playbtn_nomal.png │ │ └── playbar_playbtn_nomal@2x.png │ │ ├── playbar_prebtn_click.imageset │ │ ├── Contents.json │ │ ├── playbar_prebtn_click.png │ │ └── playbar_prebtn_click@2x.png │ │ └── playbar_prebtn_nomal.imageset │ │ ├── Contents.json │ │ ├── playbar_prebtn_nomal.png │ │ └── playbar_prebtn_nomal@2x.png ├── Info.plist ├── Lib │ ├── Astreamer │ │ ├── audio_queue.h │ │ ├── audio_queue.mm │ │ ├── audio_stream.h │ │ ├── audio_stream.mm │ │ ├── http_stream.h │ │ ├── http_stream.mm │ │ ├── id3_parser.h │ │ └── id3_parser.mm │ ├── AudioPlayer │ │ ├── AudioPlayer.h │ │ ├── AudioPlayer.m │ │ ├── AutoRecoveringHttpDataSource.h │ │ ├── AutoRecoveringHttpDataSource.m │ │ ├── CoreFoundationDataSource.h │ │ ├── CoreFoundationDataSource.m │ │ ├── DataSource.h │ │ ├── DataSource.m │ │ ├── DataSourceWrapper.h │ │ ├── DataSourceWrapper.m │ │ ├── HttpDataSource.h │ │ ├── HttpDataSource.m │ │ ├── LocalFileDataSource.h │ │ └── LocalFileDataSource.m │ ├── FMDB │ │ ├── FMDatabase.h │ │ ├── FMDatabase.m │ │ ├── FMDatabaseAdditions.h │ │ ├── FMDatabaseAdditions.m │ │ ├── FMDatabasePool.h │ │ ├── FMDatabasePool.m │ │ ├── FMDatabaseQueue.h │ │ ├── FMDatabaseQueue.m │ │ ├── FMResultSet.h │ │ ├── FMResultSet.m │ │ └── extra │ │ │ ├── FMDatabase+InMemoryOnDiskIO.h │ │ │ └── FMDatabase+InMemoryOnDiskIO.m │ ├── ImageBrowser │ │ ├── SDWebImage-Category │ │ │ ├── THProgressView │ │ │ │ ├── THProgressView.h │ │ │ │ └── THProgressView.m │ │ │ ├── UIImageView+LK.h │ │ │ ├── UIImageView+LK.m │ │ │ ├── remind_noimage.png │ │ │ └── remind_noimage@2x.png │ │ └── SDWebImage │ │ │ ├── NSData+GIF.h │ │ │ ├── NSData+GIF.m │ │ │ ├── NSData+ImageContentType.h │ │ │ ├── NSData+ImageContentType.m │ │ │ ├── SDImageCache.h │ │ │ ├── SDImageCache.m │ │ │ ├── SDWebImageCompat.h │ │ │ ├── SDWebImageCompat.m │ │ │ ├── SDWebImageDecoder.h │ │ │ ├── SDWebImageDecoder.m │ │ │ ├── SDWebImageDownloader.h │ │ │ ├── SDWebImageDownloader.m │ │ │ ├── SDWebImageDownloaderOperation.h │ │ │ ├── SDWebImageDownloaderOperation.m │ │ │ ├── SDWebImageManager.h │ │ │ ├── SDWebImageManager.m │ │ │ ├── SDWebImageOperation.h │ │ │ ├── SDWebImagePrefetcher.h │ │ │ ├── SDWebImagePrefetcher.m │ │ │ ├── UIButton+WebCache.h │ │ │ ├── UIButton+WebCache.m │ │ │ ├── UIImage+GIF.h │ │ │ ├── UIImage+GIF.m │ │ │ ├── UIImage+MultiFormat.h │ │ │ ├── UIImage+MultiFormat.m │ │ │ ├── UIImageView+WebCache.h │ │ │ └── UIImageView+WebCache.m │ ├── LKDBHelper │ │ ├── LKDB+Manager.h │ │ ├── LKDB+Manager.m │ │ ├── LKDB+Mapping.h │ │ ├── LKDB+Mapping.m │ │ ├── LKDBHelper.h │ │ ├── LKDBHelper.m │ │ ├── LKDBUtils.h │ │ ├── LKDBUtils.m │ │ ├── NSObject+LKDBHelper.h │ │ ├── NSObject+LKDBHelper.m │ │ ├── NSObject+LKModel.h │ │ └── NSObject+LKModel.m │ ├── MJExtension │ │ ├── MJArgument.h │ │ ├── MJArgument.m │ │ ├── MJConst.h │ │ ├── MJConst.m │ │ ├── MJExtension.h │ │ ├── MJFoundation.h │ │ ├── MJFoundation.m │ │ ├── MJIvar.h │ │ ├── MJIvar.m │ │ ├── MJMember.h │ │ ├── MJMember.m │ │ ├── MJMethod.h │ │ ├── MJMethod.m │ │ ├── MJType.h │ │ ├── MJType.m │ │ ├── MJTypeEncoding.h │ │ ├── MJTypeEncoding.m │ │ ├── NSObject+MJCoding.h │ │ ├── NSObject+MJCoding.m │ │ ├── NSObject+MJKeyValue.h │ │ ├── NSObject+MJKeyValue.m │ │ ├── NSObject+MJMember.h │ │ └── NSObject+MJMember.m │ ├── MKNetworkKit │ │ ├── Categories │ │ │ ├── NSAlert+MKNetworkKitAdditions.h │ │ │ ├── NSAlert+MKNetworkKitAdditions.m │ │ │ ├── NSData+MKBase64.h │ │ │ ├── NSData+MKBase64.m │ │ │ ├── NSDate+RFC1123.h │ │ │ ├── NSDate+RFC1123.m │ │ │ ├── NSDictionary+RequestEncoding.h │ │ │ ├── NSDictionary+RequestEncoding.m │ │ │ ├── NSString+MKNetworkKitAdditions.h │ │ │ ├── NSString+MKNetworkKitAdditions.m │ │ │ ├── UIAlertView+MKNetworkKitAdditions.h │ │ │ └── UIAlertView+MKNetworkKitAdditions.m │ │ ├── MKNetworkEngine.h │ │ ├── MKNetworkEngine.m │ │ ├── MKNetworkKit.h │ │ ├── MKNetworkOperation.h │ │ ├── MKNetworkOperation.m │ │ └── Reachability │ │ │ ├── Reachability.h │ │ │ └── Reachability.m │ └── ProgressHUD │ │ ├── ProgressHUD.bundle │ │ ├── error-black.png │ │ ├── error-black@2x.png │ │ ├── error-white.png │ │ ├── error-white@2x.png │ │ ├── success-black.png │ │ ├── success-black@2x.png │ │ ├── success-white.png │ │ └── success-white@2x.png │ │ ├── ProgressHUD.h │ │ └── ProgressHUD.m ├── Model │ ├── DZMusic.h │ ├── DZMusic.m │ ├── DZMySongList.h │ ├── DZMySongList.m │ ├── DZSinger.h │ ├── DZSinger.m │ ├── DZSong.h │ ├── DZSong.m │ ├── DZSongList.h │ ├── DZSongList.m │ └── Network │ │ ├── DZDataEngine.h │ │ ├── DZDataEngine.m │ │ ├── DZNetworkEngine.h │ │ ├── DZNetworkEngine.m │ │ ├── DZNetworkOperation.h │ │ └── DZNetworkOperation.m ├── Music-Prefix.pch ├── Other │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Common.h │ ├── DZGlobal.h │ └── DZGlobal.m ├── Tool │ ├── DZMusicTool.h │ ├── DZMusicTool.m │ └── Singleton.h ├── View │ ├── DZImageView.h │ ├── DZImageView.m │ ├── DZLoadMoreFooterView.h │ ├── DZLoadMoreFooterView.m │ ├── DZMusicCell.h │ ├── DZMusicCell.m │ ├── DZPlayerToolBar.h │ ├── DZPlayerToolBar.m │ ├── DZPlayerToolBar.xib │ ├── DZSingerTableViewCell.h │ ├── DZSingerTableViewCell.m │ ├── DZSongListTableViewCell.h │ ├── DZSongListTableViewCell.m │ ├── StyledTableViewCell.h │ └── StyledTableViewCell.m ├── main.m └── resouces │ ├── Data │ ├── music.db │ └── songs.plist │ ├── MP3 │ ├── Let It Go.mp3 │ ├── 小苹果.mp3 │ ├── 愿得一人心(剧场版).lrc │ ├── 愿得一人心(剧场版).mp3 │ ├── 昨迟人.mp3 │ ├── 泡沫.mp3 │ ├── 爱莫忘.mp3 │ └── 爸爸去哪儿.mp3 │ └── SingerImages │ ├── bbqne_100.png │ ├── bbqne_400.png │ ├── gem_100.png │ ├── gem_400.png │ ├── kzxd_100.png │ ├── kzxd_400.png │ ├── song_100.png │ ├── song_400.png │ ├── zxy_100.png │ └── zxy_400.png ├── MusicTests ├── ._MusicTests.m ├── Info.plist └── MusicTests.m ├── README.md └── screenshots ├── m1.png ├── m2.png ├── m3.png ├── m4.png ├── m5.png ├── m6.png └── m7.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | #other file 20 | .DS_Store 21 | 22 | # CocoaPods 23 | # 24 | # We recommend against adding the Pods directory to your .gitignore. However 25 | # you should judge for yourself, the pros and cons are mentioned at: 26 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 27 | # 28 | #Pods/ 29 | -------------------------------------------------------------------------------- /Music.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Music.xcodeproj/project.xcworkspace/xcshareddata/Music.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 0A90022E-EAEF-4C7A-A1A9-A06F0E4078D3 9 | IDESourceControlProjectName 10 | Music 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | FA7B0BF9B800A8804CF7958AF8044987999FB1F8 14 | git://github.com/charsdavy/music-player.git 15 | 16 | IDESourceControlProjectPath 17 | Music.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | FA7B0BF9B800A8804CF7958AF8044987999FB1F8 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | git://github.com/charsdavy/music-player.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | FA7B0BF9B800A8804CF7958AF8044987999FB1F8 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | FA7B0BF9B800A8804CF7958AF8044987999FB1F8 36 | IDESourceControlWCCName 37 | music-player 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Music.xcodeproj/project.xcworkspace/xcuserdata/dengw.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music.xcodeproj/project.xcworkspace/xcuserdata/dengw.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Music.xcodeproj/project.xcworkspace/xcuserdata/dengw.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Music.xcodeproj/xcuserdata/dengw.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Music.xcodeproj/xcuserdata/dengw.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Music.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | D55F3E141BB7015F00007499 16 | 17 | primary 18 | 19 | 20 | D55F3E2D1BB7016000007499 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Music/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Music/Category/NSDate+Additions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+Additions.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSDate (Additions) 12 | 13 | /** 14 | * 获取点分格式日期字符串 15 | */ 16 | -(NSString *)dateDotString; 17 | 18 | /** 19 | * 获取短横线分割格式日期字符串 20 | */ 21 | -(NSString *)dateStrigulaString; 22 | 23 | /** 24 | * 获取点分格式时间字符串 25 | */ 26 | -(NSString *)dateTimeDotString; 27 | 28 | /** 29 | * 获取短横线分割格式时间字符串 30 | */ 31 | -(NSString *)dateTimeStrigulaString; 32 | 33 | -(NSString *)shortDateString; 34 | -(NSString *)shortTimeString; 35 | 36 | -(NSString *)longTimeString; 37 | -(NSString *)shortDateTimeString; 38 | 39 | -(long long)milseconds; 40 | 41 | +(NSDate *)dateFromYYYYMMDD:(NSString *)dateString; 42 | +(NSDate *)dateWithYear:(int)year; 43 | 44 | + (NSString *) getTimeDiffString:(NSDate *) temp; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Music/Category/NSError+Additions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSError+Additions.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSError (Additions) 12 | 13 | -(BOOL)isURLError; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Music/Category/NSError+Additions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSError+Additions.m 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "NSError+Additions.h" 10 | 11 | @implementation NSError (Additions) 12 | 13 | -(BOOL)isURLError{ 14 | return [self.domain isEqualToString:NSURLErrorDomain]; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Music/Category/NSString+CZ.h: -------------------------------------------------------------------------------- 1 | 2 | // D02-音乐播放 3 | // 4 | // Created by Vincent_Guo on 14-6-28. 5 | // Copyright (c) 2014年 vgios. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface NSString (CZ) 11 | 12 | 13 | /** 14 | * 返回分与秒的字符串 如:01:60 15 | */ 16 | +(NSString *)getMinuteSecondWithSecond:(NSTimeInterval)time; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Music/Category/NSString+CZ.m: -------------------------------------------------------------------------------- 1 | 2 | // D02-音乐播放 3 | // 4 | // Created by Vincent_Guo on 14-6-28. 5 | // Copyright (c) 2014年 vgios. All rights reserved. 6 | // 7 | 8 | #import "NSString+CZ.h" 9 | 10 | @implementation NSString (CZ) 11 | 12 | +(NSString *)getMinuteSecondWithSecond:(NSTimeInterval)time{ 13 | 14 | int minute = (int)time / 60; 15 | int second = (int)time % 60; 16 | 17 | if (second > 9) { 18 | return [NSString stringWithFormat:@"%d:%d",minute,second]; 19 | } 20 | return [NSString stringWithFormat:@"%d:0%d",minute,second]; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Music/Category/UIButton+CZ.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+CZ.h 3 | // QQZone-HD 4 | // 5 | // Created by Vincent_Guo on 14-6-16. 6 | // Copyright (c) 2014年 vgios. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIButton (CZ) 12 | 13 | /** 14 | * 设置拉伸后的正常和高亮状态的按钮背影图片 15 | * 16 | * @param normalBg 普通状态的背影图片 17 | * @param highlighted 高亮状态的背影图片 18 | */ 19 | -(void)setResizedNormalBg:(NSString *)normalBg highlightedBg:(NSString *)highlightedBg; 20 | 21 | 22 | /** 23 | * 设置未拉伸后的正常和高亮状态按钮背影图片 24 | * 25 | * @param normalBg 普通状态的背影图片 26 | * @param highlighted 高亮状态的背影图片 27 | */ 28 | -(void)setNormalBg:(NSString *)normalBg highlightedBg:(NSString *)highlightedBg; 29 | -(void)setNBg:(NSString *)nBg hBg:(NSString *)hBg; 30 | 31 | /** 32 | * 设置未拉伸的正常状态背影图片 33 | */ 34 | -(void)setNormalBg:(NSString *)normalBg; 35 | -(void)setNBg:(NSString *)nBg; 36 | 37 | /** 38 | * 设置未拉伸的高亮状态背影图片 39 | */ 40 | -(void)setHighlightedBg:(NSString *)highlightedBg; 41 | -(void)setHBg:(NSString *)hBg; 42 | 43 | 44 | /** 45 | * 设置拉伸后的正常状态背影图片 46 | */ 47 | -(void)setResizedNormalBg:(NSString *)normalBg; 48 | 49 | /** 50 | * 设置拉伸后的高亮状态背影图片 51 | * 52 | */ 53 | -(void)setResizedHighlightedBg:(NSString *)highlightedBg; 54 | 55 | 56 | /** 57 | * 设置未拉伸的选中状态背影图片 58 | */ 59 | -(void)setSelectedBg:(NSString *)selectedBg; 60 | 61 | /** 62 | * 设置拉伸的选中状态背影图片 63 | */ 64 | -(void)setResizedSelectedBg:(NSString *)selectedBg; 65 | 66 | /** 67 | * 设置未拉伸的正常状态的Image 68 | */ 69 | -(void)setNormalImage:(NSString *)normalImage; 70 | 71 | 72 | /** 73 | * 设置未拉伸的高亮状态的Image 74 | */ 75 | -(void)setHighlightedImage:(NSString *)highlightedImage; 76 | 77 | /** 78 | * 设置未拉伸的普通和高亮状态的Image 79 | */ 80 | 81 | -(void)setNormalImage:(NSString *)normalImage highlightedImage:(NSString *)highlightedImage; 82 | 83 | 84 | 85 | -(void)setNormalTitle:(NSString *)normalTitle; 86 | 87 | 88 | -(void)setNormalTitleColor:(UIColor *)color; 89 | @end 90 | -------------------------------------------------------------------------------- /Music/Category/UIImage+CZ.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+CZ.h 3 | // QQZone-HD 4 | // 5 | // Created by Vincent_Guo on 14-6-16. 6 | // Copyright (c) 2014年 vgios. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (CZ) 12 | 13 | 14 | 15 | 16 | /** 17 | * 返回一张自由拉伸的图片 18 | */ 19 | + (UIImage *)resizedImageWithName:(NSString *)name; 20 | 21 | /** 22 | * 返回拉伸的图片 23 | */ 24 | + (UIImage *)resizedImageWithName:(NSString *)name left:(CGFloat)left top:(CGFloat)top; 25 | 26 | 27 | + (instancetype)circleImageWithName:(NSString *)name borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor; 28 | 29 | + (instancetype)circleImageWithImage:(UIImage *)image borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor; 30 | 31 | +(UIImage *)imageFromMainBundleWithName:(NSString *)name; 32 | @end 33 | -------------------------------------------------------------------------------- /Music/Category/UIView+Additions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Additions.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | @class CALayer,DMPageView; 14 | @interface UIView (Additions) 15 | 16 | /** 17 | * Shortcut for frame.origin.x. 18 | * 19 | * Sets frame.origin.x = left 20 | */ 21 | @property (nonatomic) CGFloat left; 22 | 23 | /** 24 | * Shortcut for frame.origin.y 25 | * 26 | * Sets frame.origin.y = top 27 | */ 28 | @property (nonatomic) CGFloat top; 29 | 30 | /** 31 | * Shortcut for frame.origin.x + frame.size.width 32 | * 33 | * Sets frame.origin.x = right - frame.size.width 34 | */ 35 | @property (nonatomic) CGFloat right; 36 | 37 | /** 38 | * Shortcut for frame.origin.y + frame.size.height 39 | * 40 | * Sets frame.origin.y = bottom - frame.size.height 41 | */ 42 | @property (nonatomic) CGFloat bottom; 43 | 44 | /** 45 | * Shortcut for frame.size.width 46 | * 47 | * Sets frame.size.width = width 48 | */ 49 | @property (nonatomic) CGFloat width; 50 | 51 | /** 52 | * Shortcut for frame.size.height 53 | * 54 | * Sets frame.size.height = height 55 | */ 56 | @property (nonatomic) CGFloat height; 57 | 58 | /** 59 | * Shortcut for center.x 60 | * 61 | * Sets center.x = centerX 62 | */ 63 | @property (nonatomic) CGFloat centerX; 64 | 65 | /** 66 | * Shortcut for center.y 67 | * 68 | * Sets center.y = centerY 69 | */ 70 | @property (nonatomic) CGFloat centerY; 71 | 72 | /** 73 | * Return the x coordinate on the screen. 74 | */ 75 | @property (nonatomic, readonly) CGFloat ttScreenX; 76 | 77 | /** 78 | * Return the y coordinate on the screen. 79 | */ 80 | @property (nonatomic, readonly) CGFloat ttScreenY; 81 | 82 | /** 83 | * Return the x coordinate on the screen, taking into account scroll views. 84 | */ 85 | @property (nonatomic, readonly) CGFloat screenViewX; 86 | 87 | /** 88 | * Return the y coordinate on the screen, taking into account scroll views. 89 | */ 90 | @property (nonatomic, readonly) CGFloat screenViewY; 91 | 92 | /** 93 | * Return the view frame on the screen, taking into account scroll views. 94 | */ 95 | @property (nonatomic, readonly) CGRect screenFrame; 96 | 97 | /** 98 | * Shortcut for frame.origin 99 | */ 100 | @property (nonatomic) CGPoint origin; 101 | 102 | /** 103 | * Shortcut for frame.size 104 | */ 105 | @property (nonatomic) CGSize size; 106 | 107 | /** 108 | * Shortcut for layer.transfrom 109 | */ 110 | 111 | 112 | -(void)removeAllSubviews; 113 | -(void)removeViewWithTag:(NSInteger)tag; 114 | -(void)removeViewWithTags:(NSArray *)tagArray; 115 | -(void)removeViewWithTagLessThan:(NSInteger)tag; 116 | -(void)removeViewWithTagGreaterThan:(NSInteger)tag; 117 | - (UIViewController *)selfViewController; 118 | -(UIView *)subviewWithTag:(NSInteger)tag; 119 | 120 | @end 121 | -------------------------------------------------------------------------------- /Music/Category/UIView+Frame.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Frame.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/1/2. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIView (Frame) 12 | 13 | @property (nonatomic, assign) CGFloat x; 14 | @property (nonatomic, assign) CGFloat y; 15 | @property (nonatomic, assign) CGFloat centerX; 16 | @property (nonatomic, assign) CGFloat centerY; 17 | @property (nonatomic, assign) CGFloat width; 18 | @property (nonatomic, assign) CGFloat height; 19 | @property (nonatomic, assign) CGSize size; 20 | @property (nonatomic, assign) CGPoint origin; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Music/Category/UIView+Frame.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+Frame.m 3 | // Music 4 | // 5 | // Created by dengwei on 16/1/2. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "UIView+Frame.h" 10 | 11 | @implementation UIView (Frame) 12 | 13 | - (void)setX:(CGFloat)x 14 | { 15 | CGRect frame = self.frame; 16 | frame.origin.x = x; 17 | self.frame = frame; 18 | } 19 | 20 | - (CGFloat)x 21 | { 22 | return self.frame.origin.x; 23 | } 24 | 25 | - (void)setY:(CGFloat)y 26 | { 27 | CGRect frame = self.frame; 28 | frame.origin.y = y; 29 | self.frame = frame; 30 | } 31 | 32 | - (CGFloat)y 33 | { 34 | return self.frame.origin.y; 35 | } 36 | 37 | - (void)setWidth:(CGFloat)width 38 | { 39 | CGRect frame = self.frame; 40 | frame.size.width = width; 41 | self.frame = frame; 42 | } 43 | 44 | - (CGFloat)width 45 | { 46 | return self.frame.size.width; 47 | } 48 | 49 | - (void)setHeight:(CGFloat)height 50 | { 51 | CGRect frame = self.frame; 52 | frame.size.height = height; 53 | self.frame = frame; 54 | } 55 | 56 | - (CGFloat)height 57 | { 58 | return self.frame.size.height; 59 | } 60 | 61 | - (void)setSize:(CGSize)size 62 | { 63 | CGRect frame = self.frame; 64 | frame.size = size; 65 | self.frame = frame; 66 | } 67 | 68 | - (CGSize)size 69 | { 70 | return self.frame.size; 71 | } 72 | 73 | - (void)setOrigin:(CGPoint)origin 74 | { 75 | CGRect frame = self.frame; 76 | frame.origin = origin; 77 | self.frame = frame; 78 | } 79 | 80 | - (CGPoint)origin 81 | { 82 | return self.frame.origin; 83 | } 84 | 85 | - (void)setCenterX:(CGFloat)centerX 86 | { 87 | CGPoint center = self.center; 88 | center.x = centerX; 89 | self.center = center; 90 | } 91 | 92 | - (CGFloat)centerX 93 | { 94 | return self.center.x; 95 | } 96 | 97 | - (void)setCenterY:(CGFloat)centerY 98 | { 99 | CGPoint center = self.center; 100 | center.y = centerY; 101 | self.center = center; 102 | } 103 | 104 | - (CGFloat)centerY 105 | { 106 | return self.center.y; 107 | } 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /Music/Controller/DZAboutViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZAboutViewController.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/1/2. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DZAboutViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Music/Controller/DZAboutViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DZAboutViewController.m 3 | // Music 4 | // 5 | // Created by dengwei on 16/1/2. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "DZAboutViewController.h" 10 | 11 | @interface DZAboutViewController () 12 | 13 | @property (nonatomic, strong) UITextView *textView; 14 | 15 | @end 16 | 17 | @implementation DZAboutViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | // Do any additional setup after loading the view. 22 | [self setupUI]; 23 | [self fillContent]; 24 | } 25 | 26 | -(void)setupUI 27 | { 28 | UITextView *textView = [[UITextView alloc] initWithFrame:self.view.bounds]; 29 | textView.backgroundColor = [UIColor whiteColor]; 30 | self.title = @"About"; 31 | textView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"aboutBackground"]]; 32 | [self.view addSubview:textView]; 33 | self.textView = textView; 34 | self.textView.userInteractionEnabled = NO; 35 | } 36 | 37 | -(void)fillContent 38 | { 39 | self.textView.text = @"\t音乐播放器\n\t实现本地音乐播放,具有后台操作功能。\n\n\n代码地址:https://github.com/charsdavy/music-player\n联系方式:chars_d@126.com\n软件作者:dengwei"; 40 | } 41 | 42 | - (void)didReceiveMemoryWarning { 43 | [super didReceiveMemoryWarning]; 44 | // Dispose of any resources that can be recreated. 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Music/Controller/DZDetailMusicViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZDetailMusicViewController.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/1/3. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DZSinger; 12 | 13 | @interface DZDetailMusicViewController : UIViewController 14 | { 15 | UITableView * _tableView; 16 | } 17 | 18 | @property (nonatomic,strong) DZSinger *singerModel; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Music/Controller/DZLeftViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZLeftViewController.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/1/2. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol DZLeftViewDelegate 12 | @required 13 | /** 14 | * 选择HomeView 15 | */ 16 | -(void)showHomeView; 17 | 18 | /** 19 | * 选择OnlineMusicView 20 | */ 21 | -(void)showOnlineMusicView; 22 | 23 | /** 24 | * 选择AboutView 25 | */ 26 | -(void)showAboutView; 27 | @end 28 | 29 | @interface DZLeftViewController : UIViewController 30 | 31 | @property (nonatomic, strong) UITableView *tableView; 32 | 33 | @property (nonatomic, assign)id delegate; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Music/Controller/DZLeftViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // DZLeftViewController.m 3 | // Music 4 | // 5 | // Created by dengwei on 16/1/2. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "DZLeftViewController.h" 10 | 11 | @interface DZLeftViewController () 12 | { 13 | NSArray *_options; 14 | } 15 | 16 | @end 17 | 18 | @implementation DZLeftViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | // Do any additional setup after loading the view. 23 | _options = @[@"首页", @"在线音乐", @"关于"]; 24 | 25 | [self setupTableView]; 26 | } 27 | 28 | -(void)setupTableView{ 29 | self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, kHeight, kViewWidth, kViewHeight) style:(UITableViewStyleGrouped)]; 30 | self.tableView.delegate = self; 31 | self.tableView.dataSource = self; 32 | self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 33 | self.tableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"leftBackground"]]; 34 | self.tableView.scrollEnabled = NO; //设置tableview 不能滚动 35 | [self.view addSubview:self.tableView]; 36 | } 37 | 38 | #pragma mark - UITableViewDelegate methods 39 | -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ 40 | return 1; 41 | } 42 | 43 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 44 | return _options.count; 45 | } 46 | 47 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 48 | static NSString *idfentifier = @"leftViewCell"; 49 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:idfentifier]; 50 | if (cell == nil) { 51 | cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:idfentifier]; 52 | } 53 | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 54 | cell.backgroundColor = [UIColor clearColor]; 55 | cell.textLabel.textColor = [UIColor whiteColor]; 56 | cell.textLabel.text = _options[indexPath.row]; 57 | return cell; 58 | } 59 | 60 | 61 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 62 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 63 | if (indexPath.row == 0) { //点击"首页” 64 | if ([_delegate respondsToSelector:@selector(showHomeView)]) { 65 | [_delegate showHomeView]; 66 | } 67 | }else if(indexPath.row == 1){ //点击“在线音乐” 68 | if ([_delegate respondsToSelector:@selector(showOnlineMusicView)]) { 69 | [_delegate showOnlineMusicView]; 70 | } 71 | }else if(indexPath.row == 2){ //点击“关于” 72 | if ([_delegate respondsToSelector:@selector(showAboutView)]) { 73 | [_delegate showAboutView]; 74 | } 75 | } 76 | } 77 | 78 | - (void)didReceiveMemoryWarning { 79 | [super didReceiveMemoryWarning]; 80 | // Dispose of any resources that can be recreated. 81 | } 82 | 83 | 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /Music/Controller/DZMusicPlayerViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZMusicPlayerViewController.h 3 | // Music 4 | // 5 | // Created by dengwei on 15/9/27. 6 | // Copyright (c) 2015年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DZMusicPlayerViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Music/Controller/DZOnlineMusicViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZOnlineMusicViewController.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/1/2. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DZOnlineMusicViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Music/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "size" : "60x60", 25 | "idiom" : "iphone", 26 | "filename" : "icon@2x.png", 27 | "scale" : "2x" 28 | }, 29 | { 30 | "idiom" : "iphone", 31 | "size" : "60x60", 32 | "scale" : "3x" 33 | } 34 | ], 35 | "info" : { 36 | "version" : 1, 37 | "author" : "xcode" 38 | } 39 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/AppIcon.appiconset/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/AppIcon.appiconset/icon@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/Home_Icon_Highlight.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "Home_Icon_Highlight@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/Home_Icon_Highlight.imageset/Home_Icon_Highlight@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/Home_Icon_Highlight.imageset/Home_Icon_Highlight@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "minimum-system-version" : "7.0", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "orientation" : "portrait", 11 | "idiom" : "iphone", 12 | "minimum-system-version" : "7.0", 13 | "subtype" : "retina4", 14 | "scale" : "2x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/aboutBackground.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "aboutBackground.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/aboutBackground.imageset/aboutBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/aboutBackground.imageset/aboutBackground.png -------------------------------------------------------------------------------- /Music/Images.xcassets/backgroundImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "backgroundImage.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/backgroundImage.imageset/backgroundImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/backgroundImage.imageset/backgroundImage.png -------------------------------------------------------------------------------- /Music/Images.xcassets/launch.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "launch.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/launch.imageset/launch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/launch.imageset/launch.png -------------------------------------------------------------------------------- /Music/Images.xcassets/leftBackground.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "leftBackground.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/leftBackground.imageset/leftBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/leftBackground.imageset/leftBackground.png -------------------------------------------------------------------------------- /Music/Images.xcassets/nav_music.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "nav_music@2x.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/nav_music.imageset/nav_music@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/nav_music.imageset/nav_music@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/onlineBackground.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "onlineBackground.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/onlineBackground.imageset/onlineBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/onlineBackground.imageset/onlineBackground.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_silider_bground.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "playbar_silider_bground.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "playbar_silider_bground@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_silider_bground.imageset/playbar_silider_bground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbar_slider/playbar_silider_bground.imageset/playbar_silider_bground.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_silider_bground.imageset/playbar_silider_bground@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbar_slider/playbar_silider_bground.imageset/playbar_silider_bground@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_slider_bg.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "playbar_slider_bg.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "playbar_slider_bg@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_slider_bg.imageset/playbar_slider_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbar_slider/playbar_slider_bg.imageset/playbar_slider_bg.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_slider_bg.imageset/playbar_slider_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbar_slider/playbar_slider_bg.imageset/playbar_slider_bg@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_slider_blue.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "playbar_slider_blue.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "playbar_slider_blue@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_slider_blue.imageset/playbar_slider_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbar_slider/playbar_slider_blue.imageset/playbar_slider_blue.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_slider_blue.imageset/playbar_slider_blue@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbar_slider/playbar_slider_blue.imageset/playbar_slider_blue@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_slider_bottom.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "playbar_slider_bottom.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "playbar_slider_bottom@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_slider_bottom.imageset/playbar_slider_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbar_slider/playbar_slider_bottom.imageset/playbar_slider_bottom.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_slider_bottom.imageset/playbar_slider_bottom@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbar_slider/playbar_slider_bottom.imageset/playbar_slider_bottom@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_slider_thumb.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "playbar_slider_thumb.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "playbar_slider_thumb@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_slider_thumb.imageset/playbar_slider_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbar_slider/playbar_slider_thumb.imageset/playbar_slider_thumb.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_slider_thumb.imageset/playbar_slider_thumb@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbar_slider/playbar_slider_thumb.imageset/playbar_slider_thumb@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_slider_top.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "playbar_slider_top.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "playbar_slider_top@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_slider_top.imageset/playbar_slider_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbar_slider/playbar_slider_top.imageset/playbar_slider_top.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbar_slider/playbar_slider_top.imageset/playbar_slider_top@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbar_slider/playbar_slider_top.imageset/playbar_slider_top@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/play_bar_bg2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "play_bar_bg2.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "play_bar_bg2@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/play_bar_bg2.imageset/play_bar_bg2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/play_bar_bg2.imageset/play_bar_bg2.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/play_bar_bg2.imageset/play_bar_bg2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/play_bar_bg2.imageset/play_bar_bg2@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_nextbtn_click.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "playbar_nextbtn_click.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "playbar_nextbtn_click@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_nextbtn_click.imageset/playbar_nextbtn_click.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/playbar_nextbtn_click.imageset/playbar_nextbtn_click.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_nextbtn_click.imageset/playbar_nextbtn_click@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/playbar_nextbtn_click.imageset/playbar_nextbtn_click@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_nextbtn_nomal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "playbar_nextbtn_nomal.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "playbar_nextbtn_nomal@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_nextbtn_nomal.imageset/playbar_nextbtn_nomal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/playbar_nextbtn_nomal.imageset/playbar_nextbtn_nomal.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_nextbtn_nomal.imageset/playbar_nextbtn_nomal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/playbar_nextbtn_nomal.imageset/playbar_nextbtn_nomal@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_pausebtn_click.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "playbar_pausebtn_click.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "playbar_pausebtn_click@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_pausebtn_click.imageset/playbar_pausebtn_click.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/playbar_pausebtn_click.imageset/playbar_pausebtn_click.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_pausebtn_click.imageset/playbar_pausebtn_click@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/playbar_pausebtn_click.imageset/playbar_pausebtn_click@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_pausebtn_nomal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "playbar_pausebtn_nomal.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "playbar_pausebtn_nomal@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_pausebtn_nomal.imageset/playbar_pausebtn_nomal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/playbar_pausebtn_nomal.imageset/playbar_pausebtn_nomal.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_pausebtn_nomal.imageset/playbar_pausebtn_nomal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/playbar_pausebtn_nomal.imageset/playbar_pausebtn_nomal@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_playbtn_click.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "playbar_playbtn_click.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "playbar_playbtn_click@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_playbtn_click.imageset/playbar_playbtn_click.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/playbar_playbtn_click.imageset/playbar_playbtn_click.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_playbtn_click.imageset/playbar_playbtn_click@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/playbar_playbtn_click.imageset/playbar_playbtn_click@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_playbtn_nomal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "playbar_playbtn_nomal.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "playbar_playbtn_nomal@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_playbtn_nomal.imageset/playbar_playbtn_nomal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/playbar_playbtn_nomal.imageset/playbar_playbtn_nomal.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_playbtn_nomal.imageset/playbar_playbtn_nomal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/playbar_playbtn_nomal.imageset/playbar_playbtn_nomal@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_prebtn_click.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "playbar_prebtn_click.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "playbar_prebtn_click@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_prebtn_click.imageset/playbar_prebtn_click.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/playbar_prebtn_click.imageset/playbar_prebtn_click.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_prebtn_click.imageset/playbar_prebtn_click@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/playbar_prebtn_click.imageset/playbar_prebtn_click@2x.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_prebtn_nomal.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "playbar_prebtn_nomal.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x", 11 | "filename" : "playbar_prebtn_nomal@2x.png" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_prebtn_nomal.imageset/playbar_prebtn_nomal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/playbar_prebtn_nomal.imageset/playbar_prebtn_nomal.png -------------------------------------------------------------------------------- /Music/Images.xcassets/playbtn/playbar_prebtn_nomal.imageset/playbar_prebtn_nomal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Images.xcassets/playbtn/playbar_prebtn_nomal.imageset/playbar_prebtn_nomal@2x.png -------------------------------------------------------------------------------- /Music/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIBackgroundModes 6 | 7 | audio 8 | 9 | CFBundleDevelopmentRegion 10 | en 11 | CFBundleExecutable 12 | $(EXECUTABLE_NAME) 13 | CFBundleIdentifier 14 | com.dengwei.app.$(PRODUCT_NAME:rfc1034identifier) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | $(PRODUCT_NAME) 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.0 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1 27 | LSRequiresIPhoneOS 28 | 29 | UILaunchStoryboardName 30 | LaunchScreen 31 | UIMainStoryboardFile 32 | Main 33 | UIRequiredDeviceCapabilities 34 | 35 | armv7 36 | 37 | UISupportedInterfaceOrientations 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationLandscapeLeft 41 | UIInterfaceOrientationLandscapeRight 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Music/Lib/Astreamer/http_stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the FreeStreamer project, 3 | * (C)Copyright 2011-2013 Matias Muhonen. 4 | * See the file ''LICENSE'' for using the code. 5 | */ 6 | 7 | #ifndef ASTREAMER_HTTP_STREAM_H 8 | #define ASTREAMER_HTTP_STREAM_H 9 | 10 | #import 11 | #import 12 | #import 13 | #import 14 | #import "id3_parser.h" 15 | 16 | namespace astreamer { 17 | 18 | class HTTP_Stream_Delegate; 19 | 20 | struct HTTP_Stream_Position { 21 | size_t start; 22 | size_t end; 23 | }; 24 | 25 | class HTTP_Stream : public ID3_Parser_Delegate { 26 | private: 27 | 28 | HTTP_Stream(const HTTP_Stream&); 29 | HTTP_Stream& operator=(const HTTP_Stream&); 30 | 31 | static const size_t STREAM_BUFSIZ; 32 | 33 | static CFStringRef httpRequestMethod; 34 | static CFStringRef httpUserAgentHeader; 35 | static CFStringRef httpUserAgentValue; 36 | static CFStringRef httpRangeHeader; 37 | static CFStringRef icyMetaDataHeader; 38 | static CFStringRef icyMetaDataValue; 39 | 40 | CFURLRef m_url; 41 | CFReadStreamRef m_readStream; 42 | bool m_scheduledInRunLoop; 43 | HTTP_Stream_Position m_position; 44 | 45 | /* HTTP headers */ 46 | bool m_httpHeadersParsed; 47 | std::string m_contentType; 48 | size_t m_contentLength; 49 | 50 | /* ICY protocol */ 51 | bool m_icyStream; 52 | bool m_icyHeaderCR; 53 | bool m_icyHeadersRead; 54 | bool m_icyHeadersParsed; 55 | 56 | std::vector m_icyHeaderLines; 57 | size_t m_icyMetaDataInterval; 58 | size_t m_dataByteReadCount; 59 | size_t m_metaDataBytesRemaining; 60 | 61 | std::vector m_icyMetaData; 62 | 63 | /* Read buffers */ 64 | UInt8 *m_httpReadBuffer; 65 | UInt8 *m_icyReadBuffer; 66 | 67 | ID3_Parser *m_id3Parser; 68 | 69 | CFReadStreamRef createReadStream(CFURLRef url); 70 | void parseHttpHeadersIfNeeded(UInt8 *buf, CFIndex bufSize); 71 | void parseICYStream(UInt8 *buf, CFIndex bufSize); 72 | CFStringRef createMetaDataStringWithMostReasonableEncoding(const UInt8 *bytes, CFIndex numBytes); 73 | 74 | static void readCallBack(CFReadStreamRef stream, CFStreamEventType eventType, void *clientCallBackInfo); 75 | 76 | public: 77 | 78 | HTTP_Stream_Delegate *m_delegate; 79 | 80 | HTTP_Stream(); 81 | virtual ~HTTP_Stream(); 82 | 83 | HTTP_Stream_Position position(); 84 | 85 | std::string contentType(); 86 | size_t contentLength(); 87 | 88 | bool open(); 89 | bool open(const HTTP_Stream_Position& position); 90 | void close(); 91 | 92 | void setScheduledInRunLoop(bool scheduledInRunLoop); 93 | 94 | void setUrl(CFURLRef url); 95 | 96 | /* ID3_Parser_Delegate */ 97 | void id3metaDataAvailable(std::map metaData); 98 | }; 99 | 100 | class HTTP_Stream_Delegate { 101 | public: 102 | virtual void streamIsReadyRead() = 0; 103 | virtual void streamHasBytesAvailable(UInt8 *data, UInt32 numBytes) = 0; 104 | virtual void streamEndEncountered() = 0; 105 | virtual void streamErrorOccurred() = 0; 106 | virtual void streamMetaDataAvailable(std::map metaData) = 0; 107 | }; 108 | 109 | } // namespace astreamer 110 | 111 | #endif // ASTREAMER_HTTP_STREAM_H -------------------------------------------------------------------------------- /Music/Lib/Astreamer/id3_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the FreeStreamer project, 3 | * (C)Copyright 2011-2013 Matias Muhonen. 4 | * See the file ''LICENSE'' for using the code. 5 | */ 6 | 7 | #ifndef ASTREAMER_ID3_PARSER_H 8 | #define ASTREAMER_ID3_PARSER_H 9 | 10 | #include 11 | 12 | #import 13 | 14 | namespace astreamer { 15 | 16 | class ID3_Parser_Delegate; 17 | class ID3_Parser_Private; 18 | 19 | class ID3_Parser { 20 | public: 21 | ID3_Parser(); 22 | ~ID3_Parser(); 23 | 24 | void reset(); 25 | bool wantData(); 26 | void feedData(UInt8 *data, UInt32 numBytes); 27 | 28 | ID3_Parser_Delegate *m_delegate; 29 | 30 | private: 31 | ID3_Parser_Private *m_private; 32 | }; 33 | 34 | class ID3_Parser_Delegate { 35 | public: 36 | virtual void id3metaDataAvailable(std::map metaData) = 0; 37 | }; 38 | 39 | } // namespace astreamer 40 | 41 | #endif // ASTREAMER_ID3_PARSER_H 42 | -------------------------------------------------------------------------------- /Music/Lib/AudioPlayer/AutoRecoveringHttpDataSource.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************** 2 | AudioPlayer.m 3 | 4 | Created by Thong Nguyen on 16/10/2012. 5 | https://github.com/tumtumtum/audjustable 6 | 7 | Copyright (c) 2012 Thong Nguyen (tumtumtum@gmail.com). All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 1. Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 3. All advertising materials mentioning features or use of this software 17 | must display the following acknowledgement: 18 | This product includes software developed by Thong Nguyen (tumtumtum@gmail.com) 19 | 4. Neither the name of Thong Nguyen nor the 20 | names of its contributors may be used to endorse or promote products 21 | derived from this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY Thong Nguyen ''AS IS'' AND ANY 24 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THONG NGUYEN BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | **********************************************************************************/ 34 | 35 | #import "DataSource.h" 36 | #import "HttpDataSource.h" 37 | #import "DataSourceWrapper.h" 38 | 39 | @interface AutoRecoveringHttpDataSource : DataSourceWrapper 40 | 41 | -(id) initWithHttpDataSource:(HttpDataSource*)innerDataSource; 42 | 43 | @property (readonly) HttpDataSource* innerDataSource; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Music/Lib/AudioPlayer/CoreFoundationDataSource.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************** 2 | AudioPlayer.m 3 | 4 | Created by Thong Nguyen on 14/05/2012. 5 | https://github.com/tumtumtum/audjustable 6 | 7 | Copyright (c) 2012 Thong Nguyen (tumtumtum@gmail.com). All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 1. Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 3. All advertising materials mentioning features or use of this software 17 | must display the following acknowledgement: 18 | This product includes software developed by Thong Nguyen (tumtumtum@gmail.com) 19 | 4. Neither the name of Thong Nguyen nor the 20 | names of its contributors may be used to endorse or promote products 21 | derived from this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY Thong Nguyen ''AS IS'' AND ANY 24 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THONG NGUYEN BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | **********************************************************************************/ 34 | 35 | #import "DataSource.h" 36 | 37 | @class CoreFoundationDataSource; 38 | 39 | @interface CoreFoundationDataSourceClientInfo : NSObject 40 | @property (readwrite) CFReadStreamRef readStreamRef; 41 | @property (readwrite, retain) CoreFoundationDataSource* datasource; 42 | @end 43 | 44 | @interface CoreFoundationDataSource : DataSource 45 | { 46 | @protected 47 | CFReadStreamRef stream; 48 | NSRunLoop* eventsRunLoop; 49 | } 50 | 51 | -(BOOL) reregisterForEvents; 52 | 53 | -(void) dataAvailable; 54 | -(void) eof; 55 | -(void) errorOccured; 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /Music/Lib/AudioPlayer/DataSource.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************** 2 | AudioPlayer.m 3 | 4 | Created by Thong Nguyen on 14/05/2012. 5 | https://github.com/tumtumtum/audjustable 6 | 7 | Copyright (c) 2012 Thong Nguyen (tumtumtum@gmail.com). All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 1. Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 3. All advertising materials mentioning features or use of this software 17 | must display the following acknowledgement: 18 | This product includes software developed by Thong Nguyen (tumtumtum@gmail.com) 19 | 4. Neither the name of Thong Nguyen nor the 20 | names of its contributors may be used to endorse or promote products 21 | derived from this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY Thong Nguyen ''AS IS'' AND ANY 24 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THONG NGUYEN BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | **********************************************************************************/ 34 | 35 | #import 36 | #include 37 | 38 | @class DataSource; 39 | 40 | @protocol DataSourceDelegate 41 | -(void) dataSourceDataAvailable:(DataSource*)dataSource; 42 | -(void) dataSourceErrorOccured:(DataSource*)dataSource; 43 | -(void) dataSourceEof:(DataSource*)dataSource; 44 | @end 45 | 46 | @protocol AudioDataSource 47 | @property (readwrite) double averageBitRate; 48 | @property (readwrite) long long audioDataOffset; 49 | @end 50 | 51 | @interface DataSource : NSObject 52 | 53 | @property (readonly) long long position; 54 | @property (readonly) long long length; 55 | @property (readonly) BOOL hasBytesAvailable; 56 | @property (readwrite, unsafe_unretained) id delegate; 57 | 58 | -(BOOL) registerForEvents:(NSRunLoop*)runLoop; 59 | -(void) unregisterForEvents; 60 | -(void) close; 61 | 62 | -(void) seekToOffset:(long long)offset; 63 | -(int) readIntoBuffer:(UInt8*)buffer withSize:(int)size; 64 | -(AudioFileTypeID) audioFileTypeHint; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Music/Lib/AudioPlayer/DataSource.m: -------------------------------------------------------------------------------- 1 | /********************************************************************************** 2 | AudioPlayer.m 3 | 4 | Created by Thong Nguyen on 14/05/2012. 5 | https://github.com/tumtumtum/audjustable 6 | 7 | Copyright (c) 2012 Thong Nguyen (tumtumtum@gmail.com). All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 1. Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 3. All advertising materials mentioning features or use of this software 17 | must display the following acknowledgement: 18 | This product includes software developed by Thong Nguyen (tumtumtum@gmail.com) 19 | 4. Neither the name of Thong Nguyen nor the 20 | names of its contributors may be used to endorse or promote products 21 | derived from this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY Thong Nguyen ''AS IS'' AND ANY 24 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THONG NGUYEN BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | **********************************************************************************/ 34 | 35 | #import "DataSource.h" 36 | 37 | @implementation DataSource 38 | @synthesize delegate; 39 | 40 | -(long long) length 41 | { 42 | return 0; 43 | } 44 | 45 | -(void) seekToOffset:(long long)offset 46 | { 47 | } 48 | 49 | -(int) readIntoBuffer:(UInt8*)buffer withSize:(int)size 50 | { 51 | return -1; 52 | } 53 | 54 | -(long long) position 55 | { 56 | return 0; 57 | } 58 | 59 | -(BOOL) registerForEvents:(NSRunLoop*)runLoop 60 | { 61 | return NO; 62 | } 63 | 64 | -(void) unregisterForEvents 65 | { 66 | } 67 | 68 | -(void) close 69 | { 70 | } 71 | 72 | -(BOOL) hasBytesAvailable 73 | { 74 | return NO; 75 | } 76 | 77 | -(AudioFileTypeID) audioFileTypeHint 78 | { 79 | return 0; 80 | } 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /Music/Lib/AudioPlayer/DataSourceWrapper.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************** 2 | AudioPlayer.m 3 | 4 | Created by Thong Nguyen on 16/10/2012. 5 | https://github.com/tumtumtum/audjustable 6 | 7 | Copyright (c) 2012 Thong Nguyen (tumtumtum@gmail.com). All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 1. Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 3. All advertising materials mentioning features or use of this software 17 | must display the following acknowledgement: 18 | This product includes software developed by Thong Nguyen (tumtumtum@gmail.com) 19 | 4. Neither the name of Thong Nguyen nor the 20 | names of its contributors may be used to endorse or promote products 21 | derived from this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY Thong Nguyen''AS IS'' AND ANY 24 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | **********************************************************************************/ 34 | 35 | #import "DataSource.h" 36 | 37 | @interface DataSourceWrapper : DataSource 38 | 39 | -(id) initWithDataSource:(DataSource*)innerDataSource; 40 | 41 | @property (readonly) DataSource* innerDataSource; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Music/Lib/AudioPlayer/HttpDataSource.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************** 2 | AudioPlayer.m 3 | 4 | Created by Thong Nguyen on 14/05/2012. 5 | https://github.com/tumtumtum/audjustable 6 | 7 | Copyright (c) 2012 Thong Nguyen (tumtumtum@gmail.com). All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 1. Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 3. All advertising materials mentioning features or use of this software 17 | must display the following acknowledgement: 18 | This product includes software developed by Thong Nguyen (tumtumtum@gmail.com) 19 | 4. Neither the name of Thong Nguyen nor the 20 | names of its contributors may be used to endorse or promote products 21 | derived from this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY Thong Nguyen ''AS IS'' AND ANY 24 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THONG NGUYEN BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | **********************************************************************************/ 34 | 35 | #import "CoreFoundationDataSource.h" 36 | 37 | @interface HttpDataSource : CoreFoundationDataSource 38 | { 39 | @private 40 | int seekStart; 41 | int relativePosition; 42 | int fileLength; 43 | int discontinuous; 44 | NSDictionary* httpHeaders; 45 | AudioFileTypeID audioFileTypeHint; 46 | } 47 | 48 | @property (readwrite, retain) NSURL* url; 49 | @property (readwrite) UInt32 httpStatusCode; 50 | 51 | +(AudioFileTypeID) audioFileTypeHintFromMimeType:(NSString*)fileExtension; 52 | -(id) initWithURL:(NSURL*)url; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /Music/Lib/AudioPlayer/LocalFileDataSource.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************** 2 | AudioPlayer.m 3 | 4 | Created by Thong Nguyen on 14/05/2012. 5 | https://github.com/tumtumtum/audjustable 6 | 7 | Copyright (c) 2012 Thong Nguyen (tumtumtum@gmail.com). All rights reserved. 8 | 9 | Redistribution and use in source and binary forms, with or without 10 | modification, are permitted provided that the following conditions are met: 11 | 1. Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 3. All advertising materials mentioning features or use of this software 17 | must display the following acknowledgement: 18 | This product includes software developed by Thong Nguyen (tumtumtum@gmail.com) 19 | 4. Neither the name of Thong Nguyen nor the 20 | names of its contributors may be used to endorse or promote products 21 | derived from this software without specific prior written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY Thong Nguyen ''AS IS'' AND ANY 24 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 26 | DISCLAIMED. IN NO EVENT SHALL THONG NGUYEN BE LIABLE FOR ANY 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 30 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | **********************************************************************************/ 34 | 35 | #import "CoreFoundationDataSource.h" 36 | 37 | @interface LocalFileDataSource : CoreFoundationDataSource 38 | { 39 | @private 40 | long long position; 41 | long long length; 42 | AudioFileTypeID audioFileTypeHint; 43 | } 44 | 45 | +(AudioFileTypeID) audioFileTypeHintFromFileExtension:(NSString*)fileExtension; 46 | 47 | @property (readonly, copy) NSString* filePath; 48 | 49 | -(id) initWithFilePath:(NSString*)filePath; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Music/Lib/FMDB/FMDatabaseAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // FMDatabaseAdditions.h 3 | // fmkit 4 | // 5 | // Created by August Mueller on 10/30/05. 6 | // Copyright 2005 Flying Meat Inc.. All rights reserved. 7 | // 8 | 9 | #import 10 | @interface FMDatabase (FMDatabaseAdditions) 11 | 12 | 13 | - (int)intForQuery:(NSString*)objs, ...; 14 | - (long)longForQuery:(NSString*)objs, ...; 15 | - (BOOL)boolForQuery:(NSString*)objs, ...; 16 | - (double)doubleForQuery:(NSString*)objs, ...; 17 | - (NSString*)stringForQuery:(NSString*)objs, ...; 18 | - (NSData*)dataForQuery:(NSString*)objs, ...; 19 | - (NSDate*)dateForQuery:(NSString*)objs, ...; 20 | 21 | // Notice that there's no dataNoCopyForQuery:. 22 | // That would be a bad idea, because we close out the result set, and then what 23 | // happens to the data that we just didn't copy? Who knows, not I. 24 | 25 | 26 | - (BOOL)tableExists:(NSString*)tableName; 27 | - (FMResultSet*)getSchema; 28 | - (FMResultSet*)getTableSchema:(NSString*)tableName; 29 | 30 | - (BOOL)columnExists:(NSString*)columnName inTableWithName:(NSString*)tableName; 31 | 32 | - (BOOL)validateSQL:(NSString*)sql error:(NSError**)error; 33 | 34 | // deprecated - use columnExists:inTableWithName: instead. 35 | - (BOOL)columnExists:(NSString*)tableName columnName:(NSString*)columnName __attribute__ ((deprecated)); 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Music/Lib/FMDB/FMDatabasePool.h: -------------------------------------------------------------------------------- 1 | // 2 | // FMDatabasePool.h 3 | // fmdb 4 | // 5 | // Created by August Mueller on 6/22/11. 6 | // Copyright 2011 Flying Meat Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "sqlite3.h" 11 | 12 | /* 13 | 14 | ***README OR SUFFER*** 15 | Before using FMDatabasePool, please consider using FMDatabaseQueue instead. 16 | 17 | If you really really really know what you're doing and FMDatabasePool is what 18 | you really really need (ie, you're using a read only database), OK you can use 19 | it. But just be careful not to deadlock! 20 | 21 | For an example on deadlocking, search for: 22 | ONLY_USE_THE_POOL_IF_YOU_ARE_DOING_READS_OTHERWISE_YOULL_DEADLOCK_USE_FMDATABASEQUEUE_INSTEAD 23 | in the main.m file. 24 | 25 | */ 26 | 27 | 28 | 29 | @class FMDatabase; 30 | 31 | @interface FMDatabasePool : NSObject { 32 | NSString *_path; 33 | 34 | dispatch_queue_t _lockQueue; 35 | 36 | NSMutableArray *_databaseInPool; 37 | NSMutableArray *_databaseOutPool; 38 | 39 | __unsafe_unretained id _delegate; 40 | 41 | NSUInteger _maximumNumberOfDatabasesToCreate; 42 | } 43 | 44 | @property (atomic, retain) NSString *path; 45 | @property (atomic, assign) id delegate; 46 | @property (atomic, assign) NSUInteger maximumNumberOfDatabasesToCreate; 47 | 48 | + (id)databasePoolWithPath:(NSString*)aPath; 49 | - (id)initWithPath:(NSString*)aPath; 50 | 51 | - (NSUInteger)countOfCheckedInDatabases; 52 | - (NSUInteger)countOfCheckedOutDatabases; 53 | - (NSUInteger)countOfOpenDatabases; 54 | - (void)releaseAllDatabases; 55 | 56 | - (void)inDatabase:(void (^)(FMDatabase *db))block; 57 | 58 | - (void)inTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block; 59 | - (void)inDeferredTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block; 60 | 61 | #if SQLITE_VERSION_NUMBER >= 3007000 62 | // NOTE: you can not nest these, since calling it will pull another database out of the pool and you'll get a deadlock. 63 | // If you need to nest, use FMDatabase's startSavePointWithName:error: instead. 64 | - (NSError*)inSavePoint:(void (^)(FMDatabase *db, BOOL *rollback))block; 65 | #endif 66 | 67 | @end 68 | 69 | 70 | @interface NSObject (FMDatabasePoolDelegate) 71 | 72 | - (BOOL)databasePool:(FMDatabasePool*)pool shouldAddDatabaseToPool:(FMDatabase*)database; 73 | 74 | @end 75 | 76 | -------------------------------------------------------------------------------- /Music/Lib/FMDB/FMDatabaseQueue.h: -------------------------------------------------------------------------------- 1 | // 2 | // FMDatabaseQueue.h 3 | // fmdb 4 | // 5 | // Created by August Mueller on 6/22/11. 6 | // Copyright 2011 Flying Meat Inc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "sqlite3.h" 11 | 12 | @class FMDatabase; 13 | 14 | @interface FMDatabaseQueue : NSObject { 15 | NSString *_path; 16 | dispatch_queue_t _queue; 17 | FMDatabase *_db; 18 | } 19 | 20 | @property (atomic, retain) NSString *path; 21 | 22 | + (id)databaseQueueWithPath:(NSString*)aPath; 23 | - (id)initWithPath:(NSString*)aPath; 24 | - (void)close; 25 | 26 | - (void)inDatabase:(void (^)(FMDatabase *db))block; 27 | 28 | - (void)inTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block; 29 | - (void)inDeferredTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block; 30 | 31 | #if SQLITE_VERSION_NUMBER >= 3007000 32 | // NOTE: you can not nest these, since calling it will pull another database out of the pool and you'll get a deadlock. 33 | // If you need to nest, use FMDatabase's startSavePointWithName:error: instead. 34 | - (NSError*)inSavePoint:(void (^)(FMDatabase *db, BOOL *rollback))block; 35 | #endif 36 | 37 | @end 38 | 39 | -------------------------------------------------------------------------------- /Music/Lib/FMDB/extra/FMDatabase+InMemoryOnDiskIO.h: -------------------------------------------------------------------------------- 1 | // 2 | // FMDatabase+InMemoryOnDiskIO.h 3 | // FMDB 4 | // 5 | // Created by Peter Carr on 6/12/12. 6 | // 7 | // I find there is a massive performance hit using an "on-disk" representation when 8 | // constantly reading from or writing to the DB. If your machine has sufficient memory, you 9 | // should get a significant performance boost using an "in-memory" representation. The FMDB 10 | // warpper does not contain methods to load an "on-disk" representation into memory and 11 | // similarly save an "in-memory" representation to disk. However, SQLite3 has built-in 12 | // support for this functionality via its "Backup" API. Here, we extend the FMBD wrapper 13 | // to include this functionality. 14 | // 15 | // http://www.sqlite.org/backup.html 16 | 17 | #import "FMDatabase.h" 18 | 19 | @interface FMDatabase (InMemoryOnDiskIO) 20 | 21 | // Loads an on-disk representation into memory. 22 | - (BOOL)readFromFile:(NSString*)filePath; 23 | 24 | // Saves an in-memory representation to disk 25 | - (BOOL)writeToFile:(NSString *)filePath; 26 | @end 27 | -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage-Category/THProgressView/THProgressView.h: -------------------------------------------------------------------------------- 1 | // 2 | // THProgressView.h 3 | // 4 | // Created by Tiago Henriques on 10/22/13. 5 | // Copyright (c) 2013 Tiago Henriques. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface THProgressView : UIView 11 | 12 | @property (nonatomic, strong) UIColor* progressTintColor; 13 | @property (nonatomic, strong) UIColor* borderTintColor; 14 | @property (nonatomic) CGFloat progress; 15 | 16 | - (void)setProgress:(CGFloat)progress animated:(BOOL)animated; 17 | 18 | @end -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage-Category/UIImageView+LK.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImageView+SY.h 3 | // Seeyou 4 | // 5 | // Created by ljh on 14-2-13. 6 | // Copyright (c) 2014年 linggan. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "UIImageView+WebCache.h" 11 | typedef NS_ENUM(NSInteger, LKImageViewStatus){ 12 | LKImageViewStatusNone = 0, 13 | LKImageViewStatusLoaded = 1, 14 | LKImageViewStatusLoading = 2, 15 | LKImageViewStatusFail = 3 16 | }; 17 | 18 | //图片加载出错了 可以点击重试 19 | @interface UIImageView (LK) 20 | 21 | //加载的图片 url地址 可以是 NSString 或 NSURL 22 | @property(copy, nonatomic) id imageURL; 23 | 24 | //这个不会设置 image 只会保存ImageURL 25 | - (void)setImageURLFromCache:(id)imageURL; 26 | 27 | //当前状态 28 | @property LKImageViewStatus status; 29 | 30 | //图片点击事件 不用再手动添加UITapGestureRecognizer 31 | @property(copy, nonatomic) void(^onTouchTapBlock)(UIImageView *imageView); 32 | 33 | //重新加载图片 34 | - (void)reloadImageURL; 35 | @end -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage-Category/remind_noimage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Lib/ImageBrowser/SDWebImage-Category/remind_noimage.png -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage-Category/remind_noimage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Lib/ImageBrowser/SDWebImage-Category/remind_noimage@2x.png -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage/NSData+GIF.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+GIF.h 3 | // SDWebImage 4 | // 5 | // Created by Andy LaVoy on 4/28/13. 6 | // Copyright (c) 2013 Dailymotion. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSData (GIF) 12 | 13 | - (BOOL)sd_isGIF; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage/NSData+GIF.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+GIF.m 3 | // SDWebImage 4 | // 5 | // Created by Andy LaVoy on 4/28/13. 6 | // Copyright (c) 2013 Dailymotion. All rights reserved. 7 | // 8 | 9 | #import "NSData+GIF.h" 10 | 11 | @implementation NSData (GIF) 12 | 13 | - (BOOL)sd_isGIF 14 | { 15 | BOOL isGIF = NO; 16 | 17 | uint8_t c; 18 | [self getBytes:&c length:1]; 19 | 20 | switch (c) 21 | { 22 | case 0x47: // probably a GIF 23 | isGIF = YES; 24 | break; 25 | default: 26 | break; 27 | } 28 | 29 | return isGIF; 30 | } 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage/NSData+ImageContentType.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Fabrice Aneche on 06/01/14. 3 | // Copyright (c) 2014 Dailymotion. All rights reserved. 4 | // 5 | 6 | #import 7 | 8 | @interface NSData (ImageContentType) 9 | + (NSString *)contentTypeForImageData:(NSData *)data; 10 | @end 11 | -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage/NSData+ImageContentType.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Fabrice Aneche on 06/01/14. 3 | // Copyright (c) 2014 Dailymotion. All rights reserved. 4 | // 5 | 6 | #import "NSData+ImageContentType.h" 7 | 8 | 9 | @implementation NSData (ImageContentType) 10 | 11 | + (NSString *)contentTypeForImageData:(NSData *)data 12 | { 13 | uint8_t c; 14 | [data getBytes:&c length:1]; 15 | switch (c) 16 | { 17 | case 0xFF: 18 | return @"image/jpeg"; 19 | case 0x89: 20 | return @"image/png"; 21 | case 0x47: 22 | return @"image/gif"; 23 | case 0x49: 24 | case 0x4D: 25 | return @"image/tiff"; 26 | case 0x52: 27 | // R as RIFF for WEBP 28 | if ([data length] < 12) 29 | { 30 | return nil; 31 | } 32 | 33 | NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding]; 34 | if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"]) 35 | { 36 | return @"image/webp"; 37 | } 38 | 39 | return nil; 40 | } 41 | return nil; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage/SDWebImageCompat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * (c) Jamie Pinkham 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | 10 | #import 11 | 12 | #ifdef __OBJC_GC__ 13 | #error SDWebImage does not support Objective-C Garbage Collection 14 | #endif 15 | 16 | #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0 17 | #error SDWebImage doesn't support Deployement Target version < 5.0 18 | #endif 19 | 20 | #if !TARGET_OS_IPHONE 21 | #import 22 | #ifndef UIImage 23 | #define UIImage NSImage 24 | #endif 25 | #ifndef UIImageView 26 | #define UIImageView NSImageView 27 | #endif 28 | #else 29 | 30 | #import 31 | 32 | #endif 33 | 34 | #ifndef NS_ENUM 35 | #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type 36 | #endif 37 | 38 | #ifndef NS_OPTIONS 39 | #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type 40 | #endif 41 | 42 | #if OS_OBJECT_USE_OBJC 43 | #undef SDDispatchQueueRelease 44 | #undef SDDispatchQueueSetterSementics 45 | #define SDDispatchQueueRelease(q) 46 | #define SDDispatchQueueSetterSementics strong 47 | #else 48 | #undef SDDispatchQueueRelease 49 | #undef SDDispatchQueueSetterSementics 50 | #define SDDispatchQueueRelease(q) (dispatch_release(q)) 51 | #define SDDispatchQueueSetterSementics assign 52 | #endif 53 | 54 | extern UIImage *SDScaledImageForKey(NSString *key, UIImage *image); 55 | 56 | #define dispatch_main_sync_safe(block)\ 57 | if ([NSThread isMainThread])\ 58 | {\ 59 | block();\ 60 | }\ 61 | else\ 62 | {\ 63 | dispatch_sync(dispatch_get_main_queue(), block);\ 64 | } 65 | -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage/SDWebImageCompat.m: -------------------------------------------------------------------------------- 1 | // 2 | // SDWebImageCompat.m 3 | // SDWebImage 4 | // 5 | // Created by Olivier Poitrey on 11/12/12. 6 | // Copyright (c) 2012 Dailymotion. All rights reserved. 7 | // 8 | 9 | #import "SDWebImageCompat.h" 10 | 11 | #if !__has_feature(objc_arc) 12 | #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag 13 | #endif 14 | 15 | inline UIImage *SDScaledImageForKey(NSString *key, UIImage *image) { 16 | if ([image.images count] > 0) { 17 | NSMutableArray *scaledImages = [NSMutableArray array]; 18 | 19 | for (UIImage *tempImage in image.images) { 20 | [scaledImages addObject:SDScaledImageForKey(key, tempImage)]; 21 | } 22 | 23 | return [UIImage animatedImageWithImages:scaledImages duration:image.duration]; 24 | } 25 | else { 26 | if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { 27 | CGFloat scale = 1.0; 28 | if (key.length >= 8) { 29 | // Search @2x. at the end of the string, before a 3 to 4 extension length (only if key len is 8 or more @2x. + 4 len ext) 30 | NSRange range = [key rangeOfString:@"@2x." options:0 range:NSMakeRange(key.length - 8, 5)]; 31 | if (range.location != NSNotFound) { 32 | scale = 2.0; 33 | } 34 | } 35 | 36 | UIImage *scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation]; 37 | image = scaledImage; 38 | } 39 | return image; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage/SDWebImageDecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * Created by james on 9/28/11. 6 | * 7 | * For the full copyright and license information, please view the LICENSE 8 | * file that was distributed with this source code. 9 | */ 10 | 11 | #import 12 | #import "SDWebImageCompat.h" 13 | 14 | @interface UIImage (ForceDecode) 15 | 16 | + (UIImage *)decodedImageWithImage:(UIImage *)image; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage/SDWebImageDecoder.m: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * Created by james on 9/28/11. 6 | * 7 | * For the full copyright and license information, please view the LICENSE 8 | * file that was distributed with this source code. 9 | */ 10 | 11 | #import "SDWebImageDecoder.h" 12 | 13 | @implementation UIImage (ForceDecode) 14 | 15 | + (UIImage *)decodedImageWithImage:(UIImage *)image { 16 | if (image.images) { 17 | // Do not decode animated images 18 | return image; 19 | } 20 | 21 | CGImageRef imageRef = image.CGImage; 22 | CGSize imageSize = CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef)); 23 | CGRect imageRect = (CGRect){.origin = CGPointZero, .size = imageSize}; 24 | 25 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 26 | CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef); 27 | 28 | int infoMask = (bitmapInfo & kCGBitmapAlphaInfoMask); 29 | BOOL anyNonAlpha = (infoMask == kCGImageAlphaNone || 30 | infoMask == kCGImageAlphaNoneSkipFirst || 31 | infoMask == kCGImageAlphaNoneSkipLast); 32 | 33 | // CGBitmapContextCreate doesn't support kCGImageAlphaNone with RGB. 34 | // https://developer.apple.com/library/mac/#qa/qa1037/_index.html 35 | if (infoMask == kCGImageAlphaNone && CGColorSpaceGetNumberOfComponents(colorSpace) > 1) { 36 | // Unset the old alpha info. 37 | bitmapInfo &= ~kCGBitmapAlphaInfoMask; 38 | 39 | // Set noneSkipFirst. 40 | bitmapInfo |= kCGImageAlphaNoneSkipFirst; 41 | } 42 | // Some PNGs tell us they have alpha but only 3 components. Odd. 43 | else if (!anyNonAlpha && CGColorSpaceGetNumberOfComponents(colorSpace) == 3) { 44 | // Unset the old alpha info. 45 | bitmapInfo &= ~kCGBitmapAlphaInfoMask; 46 | bitmapInfo |= kCGImageAlphaPremultipliedFirst; 47 | } 48 | 49 | // It calculates the bytes-per-row based on the bitsPerComponent and width arguments. 50 | CGContextRef context = CGBitmapContextCreate(NULL, 51 | imageSize.width, 52 | imageSize.height, 53 | CGImageGetBitsPerComponent(imageRef), 54 | 0, 55 | colorSpace, 56 | bitmapInfo); 57 | CGColorSpaceRelease(colorSpace); 58 | 59 | // If failed, return undecompressed image 60 | if (!context) return image; 61 | 62 | CGContextDrawImage(context, imageRect, imageRef); 63 | CGImageRef decompressedImageRef = CGBitmapContextCreateImage(context); 64 | 65 | CGContextRelease(context); 66 | 67 | UIImage *decompressedImage = [UIImage imageWithCGImage:decompressedImageRef scale:image.scale orientation:image.imageOrientation]; 68 | CGImageRelease(decompressedImageRef); 69 | return decompressedImage; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage/SDWebImageDownloaderOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageDownloader.h" 11 | #import "SDWebImageOperation.h" 12 | 13 | @interface SDWebImageDownloaderOperation : NSOperation 14 | 15 | @property (strong, nonatomic, readonly) NSURLRequest *request; 16 | @property (assign, nonatomic, readonly) SDWebImageDownloaderOptions options; 17 | 18 | - (id)initWithRequest:(NSURLRequest *)request 19 | options:(SDWebImageDownloaderOptions)options 20 | progress:(SDWebImageDownloaderProgressBlock)progressBlock 21 | completed:(SDWebImageDownloaderCompletedBlock)completedBlock 22 | cancelled:(void (^)())cancelBlock; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage/SDWebImageOperation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | 11 | @protocol SDWebImageOperation 12 | 13 | - (void)cancel; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage/SDWebImagePrefetcher.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the SDWebImage package. 3 | * (c) Olivier Poitrey 4 | * 5 | * For the full copyright and license information, please view the LICENSE 6 | * file that was distributed with this source code. 7 | */ 8 | 9 | #import 10 | #import "SDWebImageManager.h" 11 | 12 | @class SDWebImagePrefetcher; 13 | 14 | @protocol SDWebImagePrefetcherDelegate 15 | 16 | @optional 17 | 18 | /** 19 | * Called when an image was prefetched. 20 | * 21 | * @param imagePrefetcher The current image prefetcher 22 | * @param imageURL The image url that was prefetched 23 | * @param finishedCount The total number of images that were prefetched 24 | * @param totalCount The total number of images that need to be prefetched 25 | */ 26 | - (void)imagePrefetcher:(SDWebImagePrefetcher *)imagePrefetcher didPrefetchURL:(NSURL *)imageURL finishedCount:(NSUInteger)finishedCount totalCount:(NSUInteger)totalCount; 27 | 28 | /** 29 | * Called when all images are prefetched. 30 | * @param imagePrefetcher The current image prefetcher 31 | * @param totalCount The total number of images that need to be prefetched 32 | * @param skippedCount The total number of images that were skipped 33 | */ 34 | - (void)imagePrefetcher:(SDWebImagePrefetcher *)imagePrefetcher didFinishWithTotalCount:(NSUInteger)totalCount skippedCount:(NSUInteger)skippedCount; 35 | 36 | @end 37 | 38 | 39 | /** 40 | * Prefetch some URLs in the cache for future use. Images are downloaded in low priority. 41 | */ 42 | @interface SDWebImagePrefetcher : NSObject 43 | 44 | /** 45 | * Maximum number of URLs to prefetch at the same time. Defaults to 3. 46 | */ 47 | @property (nonatomic, assign) NSUInteger maxConcurrentDownloads; 48 | 49 | /** 50 | * SDWebImageOptions for prefetcher. Defaults to SDWebImageLowPriority. 51 | */ 52 | @property (nonatomic, assign) SDWebImageOptions options; 53 | 54 | @property (weak, nonatomic) id delegate; 55 | 56 | /** 57 | * Return the global image prefetcher instance. 58 | */ 59 | + (SDWebImagePrefetcher *)sharedImagePrefetcher; 60 | 61 | /** 62 | * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, 63 | * currently one image is downloaded at a time, 64 | * and skips images for failed downloads and proceed to the next image in the list 65 | * 66 | * @param urls list of URLs to prefetch 67 | */ 68 | - (void)prefetchURLs:(NSArray *)urls; 69 | 70 | /** 71 | * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching, 72 | * currently one image is downloaded at a time, 73 | * and skips images for failed downloads and proceed to the next image in the list 74 | * 75 | * @param urls list of URLs to prefetch 76 | * @param completionBlock block to be called when prefetching is completed 77 | */ 78 | - (void)prefetchURLs:(NSArray *)urls completed:(void (^)(NSUInteger finishedCount, NSUInteger skippedCount))completionBlock; 79 | 80 | /** 81 | * Remove and cancel queued list 82 | */ 83 | - (void)cancelPrefetching; 84 | 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage/UIImage+GIF.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+GIF.h 3 | // LBGIFImage 4 | // 5 | // Created by Laurin Brandner on 06.01.12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (GIF) 12 | 13 | + (UIImage *)sd_animatedGIFNamed:(NSString *)name; 14 | 15 | + (UIImage *)sd_animatedGIFWithData:(NSData *)data; 16 | 17 | - (UIImage *)sd_animatedImageByScalingAndCroppingToSize:(CGSize)size; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage/UIImage+MultiFormat.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+MultiFormat.h 3 | // SDWebImage 4 | // 5 | // Created by Olivier Poitrey on 07/06/13. 6 | // Copyright (c) 2013 Dailymotion. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (MultiFormat) 12 | 13 | + (UIImage *)sd_imageWithData:(NSData *)data; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Music/Lib/ImageBrowser/SDWebImage/UIImage+MultiFormat.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+MultiFormat.m 3 | // SDWebImage 4 | // 5 | // Created by Olivier Poitrey on 07/06/13. 6 | // Copyright (c) 2013 Dailymotion. All rights reserved. 7 | // 8 | 9 | #import "UIImage+MultiFormat.h" 10 | #import "UIImage+GIF.h" 11 | #import "NSData+ImageContentType.h" 12 | 13 | #ifdef SD_WEBP 14 | #import "UIImage+WebP.h" 15 | #endif 16 | 17 | @implementation UIImage (MultiFormat) 18 | 19 | + (UIImage *)sd_imageWithData:(NSData *)data { 20 | UIImage *image; 21 | NSString *imageContentType = [NSData contentTypeForImageData:data]; 22 | if ([imageContentType isEqualToString:@"image/gif"]) { 23 | image = [UIImage sd_animatedGIFWithData:data]; 24 | } 25 | #ifdef SD_WEBP 26 | else if ([imageContentType isEqualToString:@"image/webp"]) 27 | { 28 | image = [UIImage sd_imageWithWebPData:data]; 29 | } 30 | #endif 31 | else { 32 | image = [[UIImage alloc] initWithData:data]; 33 | } 34 | 35 | 36 | return image; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /Music/Lib/LKDBHelper/LKDB+Manager.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+TableManager.h 3 | // LKDBHelper 4 | // 5 | // Created by upin on 13-6-20. 6 | // Copyright (c) 2013年 ljh. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class LKDBHelper; 12 | typedef enum { 13 | LKTableUpdateTypeDefault = 1<<0, //不操作 可能后续的操作会报错 14 | LKTableUpdateTypeDeleteOld = 1<<1, //直接删除旧表 创建新表 15 | LKTableUpdateTypeCustom = 1<<2 //自定义 更新 16 | }LKTableUpdateType; 17 | 18 | @interface NSObject (TableManager) 19 | 20 | +(int)getTableVersion; 21 | 22 | /** 23 | * @brief overwrite in your models, operating table update 24 | */ 25 | +(LKTableUpdateType)tableUpdateForOldVersion:(int)oldVersion newVersion:(int)newVersion; 26 | 27 | +(void)tableUpdateAddColumeWithPN:(NSString*)propertyName; 28 | +(void)tableUpdateAddColumeWithName:(NSString*)columeName sqliteType:(NSString*)sqliteType; 29 | 30 | 31 | #pragma mark- DEPRECATED 32 | /** 33 | +(LKTableUpdateType)tableUpdateWithDBHelper:(LKDBHelper *)helper oldVersion:(int)oldVersion newVersion:(int)newVersion DEPRECATED_ATTRIBUTE; 34 | */ 35 | 36 | @end 37 | 38 | 39 | @interface LKTableManager : NSObject 40 | -(id)initWithLKDBHelper:(LKDBHelper*)helper; 41 | 42 | -(void)setTableName:(NSString*)name version:(int)version; 43 | -(int)versionWithName:(NSString*)name; 44 | -(void)clearTableInfos; 45 | @end 46 | -------------------------------------------------------------------------------- /Music/Lib/LKDBHelper/LKDB+Manager.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+TableManager.m 3 | // LKDBHelper 4 | // 5 | // Created by upin on 13-6-20. 6 | // Copyright (c) 2013年 ljh. All rights reserved. 7 | // 8 | 9 | #import "LKDB+Manager.h" 10 | #import "LKDBHelper.h" 11 | 12 | @implementation NSObject (TableManager) 13 | +(int)getTableVersion 14 | { 15 | return 1; 16 | } 17 | +(LKTableUpdateType)tableUpdateForOldVersion:(int)oldVersion newVersion:(int)newVersion 18 | { 19 | return LKTableUpdateTypeDefault; 20 | } 21 | 22 | +(void)tableUpdateAddColumeWithPN:(NSString*)propertyName 23 | { 24 | LKModelInfos* infos = [self getModelInfos]; 25 | LKDBProperty* property = [infos objectWithPropertyName:propertyName]; 26 | 27 | NSAssert(property, @"#error %@ add colume name, not exists property name %@",NSStringFromClass(self),propertyName); 28 | 29 | [self tableUpdateAddColumeWithName:property.sqlColumeName sqliteType:property.sqlColumeType]; 30 | } 31 | +(void)tableUpdateAddColumeWithName:(NSString*)columeName sqliteType:(NSString*)sqliteType 32 | { 33 | NSString* alertSQL =[NSString stringWithFormat:@"alter table %@ add column %@ %@ ",[self getTableName],columeName,sqliteType]; 34 | [[self getUsingLKDBHelper] executeDB:^(FMDatabase *db) { 35 | [db executeUpdate:alertSQL]; 36 | }]; 37 | } 38 | @end 39 | 40 | @interface LKTableManager() 41 | @property(strong,nonatomic)NSMutableDictionary* tableInfos; 42 | @property(unsafe_unretained,nonatomic)LKDBHelper* dbhelper; 43 | @end 44 | @implementation LKTableManager 45 | - (id)initWithLKDBHelper:(LKDBHelper *)helper 46 | { 47 | self = [super init]; 48 | if (self) { 49 | 50 | self.dbhelper = helper; 51 | self.tableInfos = [NSMutableDictionary dictionaryWithCapacity:0]; 52 | [helper executeDB:^(FMDatabase *db) { 53 | 54 | [db executeUpdate:@"CREATE TABLE IF NOT EXISTS LKTableManager(table_name text primary key,version integer)"]; 55 | 56 | FMResultSet* set = [db executeQuery:@"select table_name,version from LKTableManager"]; 57 | 58 | while ([set next]) { 59 | [_tableInfos setObject:[NSNumber numberWithInt:[set intForColumnIndex:1]] forKey:[set stringForColumnIndex:0]]; 60 | } 61 | 62 | [set close]; 63 | }]; 64 | } 65 | return self; 66 | } 67 | -(int)versionWithName:(NSString *)name 68 | { 69 | return [[_tableInfos objectForKey:name] intValue]; 70 | } 71 | -(void)setTableName:(NSString *)name version:(int)version 72 | { 73 | [_tableInfos setObject:[NSNumber numberWithInt:version] forKey:name]; 74 | [_dbhelper executeDB:^(FMDatabase *db) { 75 | NSString* replaceSQL = [NSString stringWithFormat:@"replace into LKTableManager(table_name,version) values('%@',%d)",name,version]; 76 | [db executeUpdate:replaceSQL]; 77 | }]; 78 | } 79 | -(void)clearTableInfos 80 | { 81 | [_dbhelper executeDB:^(FMDatabase *db) { 82 | 83 | [db executeUpdate:@"delete from LKTableManager"]; 84 | 85 | [db executeUpdate:@"CREATE TABLE IF NOT EXISTS LKTableManager(table_name text primary key,version integer)"]; 86 | }]; 87 | [self.tableInfos removeAllObjects]; 88 | } 89 | @end -------------------------------------------------------------------------------- /Music/Lib/LKDBHelper/LKDB+Mapping.h: -------------------------------------------------------------------------------- 1 | // 2 | // LKDBProperty+KeyMapping.h 3 | // LKDBHelper 4 | // 5 | // Created by upin on 13-6-17. 6 | // Copyright (c) 2013年 ljh. All rights reserved. 7 | // 8 | 9 | #import "LKDBUtils.h" 10 | 11 | static NSString* const LKSQLText = @"text"; 12 | static NSString* const LKSQLInt = @"integer"; 13 | static NSString* const LKSQLDouble = @"double"; 14 | static NSString* const LKSQLBlob = @"blob"; 15 | 16 | static NSString* const LKSQLNotNull = @"NOT NULL"; 17 | static NSString* const LKSQLPrimaryKey = @"PRIMARY KEY"; 18 | static NSString* const LKSQLDefault = @"DEFAULT"; 19 | static NSString* const LKSQLUnique = @"UNIQUE"; 20 | static NSString* const LKSQLCheck = @"CHECK"; 21 | static NSString* const LKSQLForeignKey = @"FOREIGN KEY"; 22 | 23 | static NSString* const LKSQLFloatType = @"float_double_decimal"; 24 | static NSString* const LKSQLIntType = @"int_char_short_long"; 25 | static NSString* const LKSQLBlobType = @""; 26 | 27 | static NSString* const LKSQLInherit = @"LKDBInherit"; 28 | static NSString* const LKSQLBinding = @"LKDBBinding"; 29 | static NSString* const LKSQLUserCalculate = @"LKDBUserCalculate"; 30 | 31 | //Object-c type converted to SQLite type 把Object-c 类型 转换为sqlite 类型 32 | extern inline NSString* LKSQLTypeFromObjcType(NSString *objcType); 33 | 34 | @interface NSObject(TableMapping) 35 | 36 | /** 37 | * @brief Overwrite in your models if your property names don't match your Table Colume names. 38 | also use for set create table columes. 39 | 40 | @{ sql colume name : ( model property name ) or LKDBInherit or LKDBUserCalculate} 41 | 42 | */ 43 | +(NSDictionary*)getTableMapping; 44 | 45 | //simple set a colume as "LKSQLUserCalculate" 46 | //colume name 47 | +(void)setUserCalculateForCN:(NSString*)columename; 48 | //property type name 49 | +(void)setUserCalculateForPTN:(NSString*)propertyTypeName; 50 | 51 | //remove unwanted binding property 52 | +(void)removePropertyWithColumeName:(NSString*)columename; 53 | @end 54 | 55 | @interface LKDBProperty:NSObject 56 | 57 | @property(readonly,nonatomic)NSString* type; 58 | 59 | @property(readonly,nonatomic)NSString* sqlColumeName; 60 | @property(readonly,nonatomic)NSString* sqlColumeType; 61 | 62 | @property(readonly,nonatomic)NSString* propertyName; 63 | @property(readonly,nonatomic)NSString* propertyType; 64 | 65 | //创建表的时候 使用 66 | @property BOOL isUnique; 67 | @property BOOL isNotNull; 68 | @property(strong,nonatomic) NSString* defaultValue; 69 | @property(strong,nonatomic) NSString* checkValue; 70 | @property int length; 71 | 72 | 73 | -(BOOL)isUserCalculate; 74 | @end 75 | 76 | 77 | @interface LKModelInfos : NSObject 78 | 79 | -(id)initWithKeyMapping:(NSDictionary*)keyMapping propertyNames:(NSArray*)propertyNames propertyType:(NSArray*)propertyType primaryKeys:(NSArray*)primaryKeys; 80 | 81 | @property(readonly,nonatomic)int count; 82 | @property(readonly,nonatomic)NSArray* primaryKeys; 83 | 84 | -(LKDBProperty*)objectWithIndex:(int)index; 85 | -(LKDBProperty*)objectWithPropertyName:(NSString*)propertyName; 86 | -(LKDBProperty*)objectWithSqlColumeName:(NSString*)columeName; 87 | 88 | @end -------------------------------------------------------------------------------- /Music/Lib/LKDBHelper/LKDBUtils.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+LKUtils.h 3 | // LKDBHelper 4 | // 5 | // Created by upin on 13-4-15. 6 | // Copyright (c) 2013年 ljh. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LKDBUtils:NSObject 12 | //返回根目录路径 "document" 13 | +(NSString*) getDocumentPath; 14 | //返回 "document/dir/" 文件夹路径 15 | +(NSString*) getDirectoryForDocuments:(NSString*) dir; 16 | //返回 "document/filename" 路径 17 | +(NSString*) getPathForDocuments:(NSString*)filename; 18 | //返回 "document/dir/filename" 路径 19 | +(NSString*) getPathForDocuments:(NSString *)filename inDir:(NSString*)dir; 20 | //文件是否存在 21 | +(BOOL) isFileExists:(NSString*)filepath; 22 | //删除文件 23 | +(BOOL)deleteWithFilepath:(NSString*)filepath; 24 | //返回该文件目录下 所有文件名 25 | +(NSArray*)getFilenamesWithDir:(NSString*)dir; 26 | 27 | //检测字符串是否为空 28 | +(BOOL)checkStringIsEmpty:(NSString *)string; 29 | //把Date 转换成String 30 | +(NSString*)stringWithDate:(NSDate*)date; 31 | //把String 转换成Date 32 | +(NSDate *)dateWithString:(NSString *)str; 33 | @end 34 | -------------------------------------------------------------------------------- /Music/Lib/LKDBHelper/NSObject+LKDBHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+LKDBHelper.h 3 | // LKDBHelper 4 | // 5 | // Created by upin on 13-6-8. 6 | // Copyright (c) 2013年 ljh. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "LKDBHelper.h" 11 | 12 | @class LKDBHelper; 13 | @interface NSObject(LKDBHelper) 14 | 15 | //callback delegate 16 | +(void)dbDidCreateTable:(LKDBHelper*)helper; 17 | 18 | +(void)dbWillInsert:(NSObject*)entity; 19 | +(void)dbDidInserted:(NSObject*)entity result:(BOOL)result; 20 | 21 | +(void)dbWillUpdate:(NSObject*)entity; 22 | +(void)dbDidUpdated:(NSObject*)entity result:(BOOL)result; 23 | 24 | +(void)dbWillDelete:(NSObject*)entity; 25 | +(void)dbDidIDeleted:(NSObject*)entity result:(BOOL)result; 26 | 27 | 28 | //only simplify synchronous function 29 | +(int)rowCountWithWhere:(id)where; 30 | +(NSMutableArray*)searchWithWhere:(id)where orderBy:(NSString*)orderBy offset:(int)offset count:(int)count; 31 | +(id)searchSingleWithWhere:(id)where orderBy:(NSString*)orderBy; 32 | 33 | +(BOOL)insertToDB:(NSObject*)model; 34 | +(BOOL)insertWhenNotExists:(NSObject*)model; 35 | +(BOOL)updateToDB:(NSObject *)model where:(id)where; 36 | +(BOOL)updateToDBWithSet:(NSString*)sets where:(id)where; 37 | +(BOOL)deleteToDB:(NSObject*)model; 38 | +(BOOL)deleteWithWhere:(id)where; 39 | +(BOOL)isExistsWithModel:(NSObject*)model; 40 | 41 | - (void)saveToDB; 42 | - (void)deleteToDB; 43 | @end -------------------------------------------------------------------------------- /Music/Lib/LKDBHelper/NSObject+LKDBHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+LKDBHelper.m 3 | // LKDBHelper 4 | // 5 | // Created by upin on 13-6-8. 6 | // Copyright (c) 2013年 ljh. All rights reserved. 7 | // 8 | 9 | #import "NSObject+LKDBHelper.h" 10 | 11 | 12 | @implementation NSObject(LKDBHelper) 13 | 14 | +(void)dbDidCreateTable:(LKDBHelper *)helper{} 15 | 16 | +(void)dbDidIDeleted:(NSObject *)entity result:(BOOL)result{} 17 | +(void)dbWillDelete:(NSObject *)entity{} 18 | 19 | +(void)dbDidInserted:(NSObject *)entity result:(BOOL)result{} 20 | +(void)dbWillInsert:(NSObject *)entity{} 21 | 22 | +(void)dbDidUpdated:(NSObject *)entity result:(BOOL)result{} 23 | +(void)dbWillUpdate:(NSObject *)entity{} 24 | 25 | #pragma mark - simplify synchronous function 26 | +(BOOL)checkModelClass:(NSObject*)model 27 | { 28 | if([model isMemberOfClass:self]) 29 | return YES; 30 | 31 | NSLog(@"%@ can not use %@",NSStringFromClass(self),NSStringFromClass(model.class)); 32 | return NO; 33 | } 34 | 35 | +(int)rowCountWithWhere:(id)where{ 36 | return [[self getUsingLKDBHelper] rowCount:self where:where]; 37 | } 38 | 39 | +(NSMutableArray*)searchWithWhere:(id)where orderBy:(NSString*)orderBy offset:(int)offset count:(int)count{ 40 | // NSLog(@"%@",[[self getUsingLKDBHelper] search:self where:where orderBy:orderBy offset:offset count:count]); 41 | return [[self getUsingLKDBHelper] search:self where:where orderBy:orderBy offset:offset count:count]; 42 | } 43 | +(id)searchSingleWithWhere:(id)where orderBy:(NSString *)orderBy 44 | { 45 | // NSLog(@"%@",[[self getUsingLKDBHelper] searchSingle:self where:where orderBy:orderBy]); 46 | return [[self getUsingLKDBHelper] searchSingle:self where:where orderBy:orderBy]; 47 | } 48 | 49 | +(BOOL)insertToDB:(NSObject*)model{ 50 | 51 | if([self checkModelClass:model]) 52 | { 53 | return [[self getUsingLKDBHelper] insertToDB:model]; 54 | } 55 | return NO; 56 | 57 | } 58 | +(BOOL)insertWhenNotExists:(NSObject*)model{ 59 | if([self checkModelClass:model]) 60 | { 61 | return [[self getUsingLKDBHelper] insertWhenNotExists:model]; 62 | } 63 | return NO; 64 | } 65 | +(BOOL)updateToDB:(NSObject *)model where:(id)where{ 66 | if([self checkModelClass:model]) 67 | { 68 | return [[self getUsingLKDBHelper] updateToDB:model where:where]; 69 | } 70 | return NO; 71 | } 72 | +(BOOL)updateToDBWithSet:(NSString *)sets where:(id)where 73 | { 74 | return [[self getUsingLKDBHelper] updateToDB:self set:sets where:where]; 75 | } 76 | +(BOOL)deleteToDB:(NSObject*)model{ 77 | if([self checkModelClass:model]) 78 | { 79 | return [[self getUsingLKDBHelper] deleteToDB:model]; 80 | } 81 | return NO; 82 | } 83 | +(BOOL)deleteWithWhere:(id)where{ 84 | return [[self getUsingLKDBHelper] deleteWithClass:self where:where]; 85 | } 86 | +(BOOL)isExistsWithModel:(NSObject *)model 87 | { 88 | if([self checkModelClass:model]) 89 | { 90 | return [[self getUsingLKDBHelper] isExistsModel:model]; 91 | } 92 | return NO; 93 | } 94 | 95 | - (void)saveToDB 96 | { 97 | [self.class insertToDB:self]; 98 | } 99 | 100 | - (void)deleteToDB 101 | { 102 | [self.class deleteToDB:self]; 103 | } 104 | @end -------------------------------------------------------------------------------- /Music/Lib/LKDBHelper/NSObject+LKModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+LKModel.h 3 | // LKDBHelper 4 | // 5 | // Created by upin on 13-4-15. 6 | // Copyright (c) 2013年 ljh. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @class LKDBProperty; 13 | @class LKModelInfos; 14 | @class LKDBHelper; 15 | 16 | #pragma mark- 表结构 17 | @interface NSObject(LKTabelStructure) 18 | 19 | // overwrite in your models, return # table name # 20 | +(NSString*)getTableName; 21 | 22 | // overwrite in your models, set colume attribute 23 | +(void)columeAttributeWithProperty:(LKDBProperty*)property; 24 | 25 | /** 26 | * @brief overwrite in your models, if your table has primary key 27 | return # colume name # 28 | 29 | 主键列名 如果rowid<0 则跟据此名称update 和delete 30 | */ 31 | +(NSString*)getPrimaryKey; 32 | //return multi primary key 返回联合主键 33 | +(NSArray*) getPrimaryKeyUnionArray; 34 | 35 | @property int rowid; 36 | 37 | /** 38 | * @brief get saved pictures and data file path,can overwirte 39 | 40 | 获取保存的 图片和数据的文件路径 41 | */ 42 | +(NSString*)getDBImagePathWithName:(NSString*)filename; 43 | +(NSString*)getDBDataPathWithName:(NSString*)filename; 44 | @end 45 | 46 | 47 | #pragma mark- 表数据操作 48 | @interface NSObject(LKTableData) 49 | 50 | /** 51 | * @brief overwrite in your models,return insert sqlite table data 52 | * 53 | * 54 | * @return property the data after conversion 55 | */ 56 | -(id)userGetValueForModel:(LKDBProperty*)property; 57 | 58 | /** 59 | * @brief overwrite in your models,return insert sqlite table data 60 | * 61 | * @param property will set property 62 | * @param value sqlite value (normal value is NSString type) 63 | */ 64 | -(void)userSetValueForModel:(LKDBProperty*)property value:(id)value; 65 | 66 | 67 | 68 | //lkdbhelper use 69 | -(id)modelGetValue:(LKDBProperty*)property; 70 | -(void)modelSetValue:(LKDBProperty*)property value:(id)value; 71 | -(id)getPrimaryValue; 72 | @end 73 | 74 | @interface NSObject (LKModel) 75 | 76 | //return model use LKDBHelper , default return global LKDBHelper; 77 | +(LKDBHelper*)getUsingLKDBHelper; 78 | 79 | /** 80 | * @brief 返回 该Model 的基础信息 81 | * 82 | */ 83 | +(LKModelInfos*)getModelInfos; 84 | 85 | /** 86 | * @brief Containing the super class attributes 设置是否包含 父类 的属性 87 | */ 88 | +(BOOL)isContainParent; 89 | 90 | /** 91 | * @brief log all property 打印所有的属性名称和数据 92 | */ 93 | -(NSString*)printAllPropertys; 94 | 95 | @end -------------------------------------------------------------------------------- /Music/Lib/MJExtension/MJArgument.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJArgument.h 3 | // ItcastWeibo 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 包装一个方法参数 8 | 9 | #import 10 | /** 11 | * 包装一个方法参数 12 | */ 13 | @interface MJArgument : NSObject 14 | /** 参数的索引 */ 15 | @property (nonatomic, assign) NSInteger index; 16 | /** 参数类型 */ 17 | @property (nonatomic, copy) NSString *type; 18 | @end 19 | -------------------------------------------------------------------------------- /Music/Lib/MJExtension/MJArgument.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJArgument.m 3 | // ItcastWeibo 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import "MJArgument.h" 10 | #import "MJExtension.h" 11 | 12 | @implementation MJArgument 13 | MJLogAllIvrs 14 | @end 15 | -------------------------------------------------------------------------------- /Music/Lib/MJExtension/MJConst.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __MJConst__H__ 3 | #define __MJConst__H__ 4 | 5 | #ifdef DEBUG // 调试状态 6 | // 打开LOG功能 7 | #define MJLog(...) NSLog(__VA_ARGS__) 8 | #else // 发布状态 9 | // 关闭LOG功能 10 | #define MJLog(...) 11 | #endif 12 | 13 | // 颜色 14 | #define MJColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0] 15 | 16 | // 随机色 17 | #define MJRandomColor MJColor(arc4random_uniform(256), arc4random_uniform(256), arc4random_uniform(256)) 18 | 19 | // 断言 20 | #define MJAssert2(condition, desc, returnValue) \ 21 | if ((condition) == NO) { \ 22 | NSString *file = [NSString stringWithUTF8String:__FILE__]; \ 23 | MJLog(@"\n警告文件:%@\n警告行数:第%d行\n警告方法:%s\n警告描述:%@", file, __LINE__, __FUNCTION__, desc); \ 24 | MJLog(@"\n如果不想看到警告信息,可以删掉MJConst.h中的第23、第24行"); \ 25 | return returnValue; \ 26 | } 27 | 28 | #define MJAssert(condition, desc) MJAssert2(condition, desc, ) 29 | 30 | #define MJAssertParamNotNil2(param, returnValue) \ 31 | MJAssert2(param != nil, [[NSString stringWithFormat:@#param] stringByAppendingString:@"参数不能为nil"], returnValue) 32 | 33 | #define MJAssertParamNotNil(param) MJAssertParamNotNil2(param, ) 34 | 35 | #endif -------------------------------------------------------------------------------- /Music/Lib/MJExtension/MJConst.m: -------------------------------------------------------------------------------- 1 | #ifndef __MJConst__M__ 2 | #define __MJConst__M__ 3 | 4 | #endif -------------------------------------------------------------------------------- /Music/Lib/MJExtension/MJExtension.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJExtension.h 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 代码地址:https://github.com/CoderMJLee/MJExtension 8 | // 代码地址:http://code4app.com/ios/%E5%AD%97%E5%85%B8-JSON-%E4%B8%8E%E6%A8%A1%E5%9E%8B%E7%9A%84%E8%BD%AC%E6%8D%A2/5339992a933bf062608b4c57 9 | 10 | #import "MJTypeEncoding.h" 11 | #import "NSObject+MJCoding.h" 12 | #import "NSObject+MJMember.h" 13 | #import "NSObject+MJKeyValue.h" 14 | 15 | #define MJLogAllIvrs \ 16 | - (NSString *)description \ 17 | { \ 18 | return [self keyValues].description; \ 19 | } 20 | -------------------------------------------------------------------------------- /Music/Lib/MJExtension/MJFoundation.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJFoundation.h 3 | // MJExtensionExample 4 | // 5 | // Created by MJ Lee on 14/7/16. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MJFoundation : NSObject 12 | + (BOOL)isClassFromFoundation:(Class)c; 13 | @end 14 | -------------------------------------------------------------------------------- /Music/Lib/MJExtension/MJFoundation.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJFoundation.m 3 | // MJExtensionExample 4 | // 5 | // Created by MJ Lee on 14/7/16. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import "MJFoundation.h" 10 | #import "MJConst.h" 11 | 12 | static NSArray *_foundationClasses; 13 | 14 | @implementation MJFoundation 15 | 16 | + (void)initialize 17 | { 18 | _foundationClasses = @[@"NSObject", @"NSNumber",@"NSArray", @"NSURL", @"NSMutableURL",@"NSMutableArray",@"NSData",@"NSMutableData",@"NSDate",@"NSDictionary",@"NSMutableDictionary",@"NSString",@"NSMutableString",@"NSException"]; 19 | } 20 | 21 | + (BOOL)isClassFromFoundation:(Class)c 22 | { 23 | MJAssertParamNotNil2(c, NO); 24 | return [_foundationClasses containsObject:NSStringFromClass(c)]; 25 | } 26 | @end 27 | -------------------------------------------------------------------------------- /Music/Lib/MJExtension/MJIvar.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJIvar.h 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 包装一个成员变量 8 | 9 | #import "MJMember.h" 10 | @class MJType; 11 | 12 | /** 13 | * 包装一个成员变量 14 | */ 15 | @interface MJIvar : MJMember 16 | /** 成员变量 */ 17 | @property (nonatomic, assign) Ivar ivar; 18 | /** 成员属性名 */ 19 | @property (nonatomic, copy, readonly) NSString *propertyName; 20 | /** 成员变量的值 */ 21 | @property (nonatomic) id value; 22 | /** 成员变量的类型 */ 23 | @property (nonatomic, strong, readonly) MJType *type; 24 | 25 | /** 26 | * 初始化 27 | * 28 | * @param ivar 成员变量 29 | * @param srcObject 哪个对象的成员变量 30 | * 31 | * @return 初始化好的对象 32 | */ 33 | - (instancetype)initWithIvar:(Ivar)ivar srcObject:(id)srcObject; 34 | @end 35 | 36 | /** 37 | * 遍历成员变量用的block 38 | * 39 | * @param ivar 成员变量的包装对象 40 | * @param stop YES代表停止遍历,NO代表继续遍历 41 | */ 42 | typedef void (^MJIvarsBlock)(MJIvar *ivar, BOOL *stop); -------------------------------------------------------------------------------- /Music/Lib/MJExtension/MJIvar.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJIvar.m 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import "MJIvar.h" 10 | #import "MJTypeEncoding.h" 11 | #import "MJConst.h" 12 | 13 | @implementation MJIvar 14 | /** 15 | * 初始化 16 | * 17 | * @param ivar 成员变量 18 | * @param srcObject 哪个对象的成员变量 19 | * 20 | * @return 初始化好的对象 21 | */ 22 | - (instancetype)initWithIvar:(Ivar)ivar srcObject:(id)srcObject 23 | { 24 | if (self = [super initWithSrcObject:srcObject]) { 25 | self.ivar = ivar; 26 | } 27 | return self; 28 | } 29 | 30 | /** 31 | * 设置成员变量 32 | */ 33 | - (void)setIvar:(Ivar)ivar 34 | { 35 | _ivar = ivar; 36 | 37 | MJAssertParamNotNil(ivar); 38 | 39 | // 1.成员变量名 40 | _name = [NSString stringWithUTF8String:ivar_getName(ivar)]; 41 | 42 | // 2.属性名 43 | if ([_name hasPrefix:@"_"]) { 44 | _propertyName = [_name stringByReplacingCharactersInRange:NSMakeRange(0, 1) withString:@""]; 45 | } else { 46 | _propertyName = _name; 47 | } 48 | 49 | // 3.成员变量的类型符 50 | NSString *code = [NSString stringWithUTF8String:ivar_getTypeEncoding(ivar)]; 51 | _type = [[MJType alloc] initWithCode:code]; 52 | } 53 | 54 | /** 55 | * 获得成员变量的值 56 | */ 57 | - (id)value 58 | { 59 | if (_type.KVCDisabled) return [NSNull null]; 60 | return [_srcObject valueForKey:_propertyName]; 61 | } 62 | 63 | /** 64 | * 设置成员变量的值 65 | */ 66 | - (void)setValue:(id)value 67 | { 68 | if (_type.KVCDisabled) return; 69 | [_srcObject setValue:value forKey:_propertyName]; 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Music/Lib/MJExtension/MJMember.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJMember.h 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "MJType.h" 12 | #import "MJArgument.h" 13 | 14 | @interface MJMember : NSObject 15 | { 16 | __weak id _srcObject; 17 | NSString *_name; 18 | } 19 | /** 成员来源于哪个类(可能是父类) */ 20 | @property (nonatomic, assign) Class srcClass; 21 | /** 成员来源类是否是Foundation框架的 */ 22 | @property (nonatomic, readonly, getter = isSrcClassFromFoundation) BOOL srcClassFromFoundation; 23 | 24 | /** 成员来源于哪个对象 */ 25 | @property (nonatomic, weak, readonly) id srcObject; 26 | 27 | /** 成员名 */ 28 | @property (nonatomic, copy, readonly) NSString *name; 29 | 30 | /** 31 | * 初始化 32 | * 33 | * @param srcObject 来源于哪个对象 34 | * 35 | * @return 初始化好的对象 36 | */ 37 | - (instancetype)initWithSrcObject:(id)srcObject; 38 | @end 39 | -------------------------------------------------------------------------------- /Music/Lib/MJExtension/MJMember.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJMember.m 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import "MJMember.h" 10 | #import "MJExtension.h" 11 | #import "MJFoundation.h" 12 | #import "MJConst.h" 13 | 14 | @implementation MJMember 15 | 16 | 17 | /** 18 | * 初始化 19 | * 20 | * @param srcObject 来源于哪个对象 21 | * 22 | * @return 初始化好的对象 23 | */ 24 | - (instancetype)initWithSrcObject:(id)srcObject 25 | { 26 | if (self = [super init]) { 27 | _srcObject = srcObject; 28 | } 29 | return self; 30 | } 31 | 32 | - (void)setSrcClass:(Class)srcClass 33 | { 34 | _srcClass = srcClass; 35 | 36 | MJAssertParamNotNil(srcClass); 37 | 38 | _srcClassFromFoundation = [MJFoundation isClassFromFoundation:srcClass]; 39 | } 40 | 41 | MJLogAllIvrs 42 | @end 43 | -------------------------------------------------------------------------------- /Music/Lib/MJExtension/MJMethod.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJMethod.h 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 包装一个方法 8 | 9 | #import "MJMember.h" 10 | /** 11 | * 包装一个方法 12 | */ 13 | @interface MJMethod : MJMember 14 | /** 方法 */ 15 | @property (nonatomic, assign) Method method; 16 | /** 方法名 */ 17 | @property (nonatomic, assign, readonly) SEL selector; 18 | /** 所有的参数(都是MJArgument对象) */ 19 | @property (nonatomic, strong, readonly) NSArray *arguments; 20 | /** 返回值类型 */ 21 | @property (nonatomic, copy, readonly) NSString *returnType; 22 | /** 23 | * 初始化 24 | * 25 | * @param method 方法 26 | * @param srcObject 哪个对象的方法 27 | * 28 | * @return 初始化好的对象 29 | */ 30 | - (instancetype)initWithMethod:(Method)method srcObject:(id)srcObject; 31 | @end 32 | 33 | /** 34 | * 遍历方法用的block 35 | * 36 | * @param method 方法的包装对象 37 | * @param stop YES代表停止遍历,NO代表继续遍历 38 | */ 39 | typedef void (^MJMethodsBlock)(MJMethod *method, BOOL *stop); -------------------------------------------------------------------------------- /Music/Lib/MJExtension/MJMethod.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJMethod.m 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import "MJMethod.h" 10 | #import "MJConst.h" 11 | 12 | @implementation MJMethod 13 | /** 14 | * 初始化 15 | * 16 | * @param method 方法 17 | * @param srcObject 哪个对象的方法 18 | * 19 | * @return 初始化好的对象 20 | */ 21 | - (instancetype)initWithMethod:(Method)method srcObject:(id)srcObject 22 | { 23 | if (self = [super initWithSrcObject:srcObject]) { 24 | self.method = method; 25 | } 26 | return self; 27 | } 28 | 29 | /** 30 | * 设置方法 31 | */ 32 | - (void)setMethod:(Method)method 33 | { 34 | _method = method; 35 | 36 | MJAssertParamNotNil(method); 37 | 38 | // 1.方法选择器 39 | _selector = method_getName(method); 40 | _name = NSStringFromSelector(self.selector); 41 | 42 | // 2.参数 43 | int step = 2; // 跳过前面的2个参数 44 | int argsCount = method_getNumberOfArguments(method); 45 | NSMutableArray *args = [NSMutableArray arrayWithCapacity:argsCount - step]; 46 | for (int i = step; i 10 | /** 11 | * 包装一种类型 12 | */ 13 | @interface MJType : NSObject 14 | /** 类型标识符 */ 15 | @property (nonatomic, copy) NSString *code; 16 | 17 | /** 对象类型(如果是基本数据类型,此值为nil) */ 18 | @property (nonatomic, assign, readonly) Class typeClass; 19 | 20 | /** 类型是否来自于Foundation框架,比如NSString、NSArray */ 21 | @property (nonatomic, readonly, getter = isFromFoundation) BOOL fromFoundation; 22 | /** 类型是否不支持KVC */ 23 | @property (nonatomic, readonly, getter = isKVCDisabled) BOOL KVCDisabled; 24 | 25 | /** 26 | * 初始化一个类型对象 27 | * 28 | * @param code 类型标识符 29 | */ 30 | - (instancetype)initWithCode:(NSString *)code; 31 | @end -------------------------------------------------------------------------------- /Music/Lib/MJExtension/MJType.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJType.m 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import "MJType.h" 10 | #import "MJExtension.h" 11 | #import "MJFoundation.h" 12 | #import "MJConst.h" 13 | 14 | @implementation MJType 15 | 16 | - (instancetype)initWithCode:(NSString *)code 17 | { 18 | if (self = [super init]) { 19 | self.code = code; 20 | } 21 | return self; 22 | } 23 | 24 | /** 类型标识符 */ 25 | - (void)setCode:(NSString *)code 26 | { 27 | _code = code; 28 | 29 | MJAssertParamNotNil(code); 30 | 31 | if (code.length == 0 || [code isEqualToString:MJTypeSEL] || 32 | [code isEqualToString:MJTypeIvar] || 33 | [code isEqualToString:MJTypeMethod]) { 34 | _KVCDisabled = YES; 35 | } else if ([code hasPrefix:@"@"] && code.length > 3) { 36 | // 去掉@"和",截取中间的类型名称 37 | _code = [code substringFromIndex:2]; 38 | _code = [_code substringToIndex:_code.length - 1]; 39 | _typeClass = NSClassFromString(_code); 40 | 41 | _fromFoundation = [MJFoundation isClassFromFoundation:_typeClass]; 42 | } 43 | } 44 | 45 | MJLogAllIvrs 46 | @end 47 | -------------------------------------------------------------------------------- /Music/Lib/MJExtension/MJTypeEncoding.h: -------------------------------------------------------------------------------- 1 | // 2 | // MJTypeEncoding.h 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | #import 9 | /** 10 | * 类型(属性类型) 11 | */ 12 | extern NSString *const MJTypeInt; 13 | extern NSString *const MJTypeFloat; 14 | extern NSString *const MJTypeDouble; 15 | extern NSString *const MJTypeLong; 16 | extern NSString *const MJTypeLongLong; 17 | extern NSString *const MJTypeChar; 18 | extern NSString *const MJTypeBOOL; 19 | extern NSString *const MJTypePointer; 20 | 21 | extern NSString *const MJTypeIvar; 22 | extern NSString *const MJTypeMethod; 23 | extern NSString *const MJTypeBlock; 24 | extern NSString *const MJTypeClass; 25 | extern NSString *const MJTypeSEL; 26 | extern NSString *const MJTypeId; 27 | 28 | /** 29 | * 返回值类型 30 | */ 31 | extern NSString *const MJReturnTypeVoid; 32 | extern NSString *const MJReturnTypeObject; 33 | 34 | -------------------------------------------------------------------------------- /Music/Lib/MJExtension/MJTypeEncoding.m: -------------------------------------------------------------------------------- 1 | // 2 | // MJTypeEncoding.m 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | #import 9 | /** 10 | * 成员变量类型(属性类型) 11 | */ 12 | NSString *const MJTypeInt = @"i"; 13 | NSString *const MJTypeFloat = @"f"; 14 | NSString *const MJTypeDouble = @"d"; 15 | NSString *const MJTypeLong = @"q"; 16 | NSString *const MJTypeLongLong = @"q"; 17 | NSString *const MJTypeChar = @"c"; 18 | NSString *const MJTypeBOOL = @"c"; 19 | NSString *const MJTypePointer = @"*"; 20 | 21 | NSString *const MJTypeIvar = @"^{objc_ivar=}"; 22 | NSString *const MJTypeMethod = @"^{objc_method=}"; 23 | NSString *const MJTypeBlock = @"@?"; 24 | NSString *const MJTypeClass = @"#"; 25 | NSString *const MJTypeSEL = @":"; 26 | NSString *const MJTypeId = @"@"; 27 | 28 | /** 29 | * 返回值类型(如果是unsigned,就是大写) 30 | */ 31 | NSString *const MJReturnTypeVoid = @"v"; 32 | NSString *const MJReturnTypeObject = @"@"; 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Music/Lib/MJExtension/NSObject+MJCoding.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+MJCoding.h 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSObject (MJCoding) 12 | /** 13 | * 解码(从文件中解析对象) 14 | */ 15 | - (void)decode:(NSCoder *)decoder; 16 | /** 17 | * 编码(将对象写入文件中) 18 | */ 19 | - (void)encode:(NSCoder *)encoder; 20 | @end 21 | 22 | /** 23 | 归档的实现 24 | */ 25 | #define MJCodingImplementation \ 26 | - (id)initWithCoder:(NSCoder *)decoder \ 27 | { \ 28 | if (self = [super init]) { \ 29 | [self decode:decoder]; \ 30 | } \ 31 | return self; \ 32 | } \ 33 | \ 34 | - (void)encodeWithCoder:(NSCoder *)encoder \ 35 | { \ 36 | [self encode:encoder]; \ 37 | } -------------------------------------------------------------------------------- /Music/Lib/MJExtension/NSObject+MJCoding.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+MJCoding.m 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import "NSObject+MJCoding.h" 10 | #import "NSObject+MJMember.h" 11 | 12 | @implementation NSObject (MJCoding) 13 | /** 14 | * 编码(将对象写入文件中) 15 | */ 16 | - (void)encode:(NSCoder *)encoder 17 | { 18 | [self enumerateIvarsWithBlock:^(MJIvar *ivar, BOOL *stop) { 19 | if (ivar.isSrcClassFromFoundation) return; 20 | [encoder encodeObject:ivar.value forKey:ivar.name]; 21 | }]; 22 | } 23 | 24 | /** 25 | * 解码(从文件中解析对象) 26 | */ 27 | - (void)decode:(NSCoder *)decoder 28 | { 29 | [self enumerateIvarsWithBlock:^(MJIvar *ivar, BOOL *stop) { 30 | if (ivar.isSrcClassFromFoundation) return; 31 | ivar.value = [decoder decodeObjectForKey:ivar.name]; 32 | }]; 33 | } 34 | @end 35 | -------------------------------------------------------------------------------- /Music/Lib/MJExtension/NSObject+MJKeyValue.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+MJKeyValue.h 3 | // MJExtension 4 | // 5 | // Created by mj on 13-8-24. 6 | // Copyright (c) 2013年 itcast. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * KeyValue协议 13 | */ 14 | @protocol MJKeyValue 15 | @optional 16 | /** 17 | * 将属性名换为其他key去字典中取值 18 | * 19 | * @return 字典中的key是属性名,value是从字典中取值用的key 20 | */ 21 | - (NSDictionary *)replacedKeyFromPropertyName; 22 | 23 | /** 24 | * 数组中需要转换的模型类 25 | * 26 | * @return 字典中的key是数组属性名,value是数组中存放模型的Class 27 | */ 28 | - (NSDictionary *)objectClassInArray; 29 | 30 | /** 31 | * 当字典转模型完毕时调用 32 | */ 33 | - (void)keyValuesDidFinishConvertingToObject; 34 | 35 | /** 36 | * 当模型转字典完毕时调用 37 | */ 38 | - (void)objectDidFinishConvertingToKeyValues; 39 | @end 40 | 41 | @interface NSObject (MJKeyValue) 42 | /** 43 | * 将字典的键值对转成模型属性 44 | * @param keyValues 字典 45 | */ 46 | - (void)setKeyValues:(NSDictionary *)keyValues; 47 | 48 | /** 49 | * 将模型转成字典 50 | * @return 字典 51 | */ 52 | - (NSDictionary *)keyValues; 53 | 54 | /** 55 | * 通过模型数组来创建一个字典数组 56 | * @param objectArray 模型数组 57 | * @return 字典数组 58 | */ 59 | + (NSArray *)keyValuesArrayWithObjectArray:(NSArray *)objectArray; 60 | 61 | #pragma mark - 字典转模型 62 | /** 63 | * 通过JSON数据来创建一个模型 64 | * @param data JSON数据 65 | * @return 新建的对象 66 | */ 67 | + (instancetype)objectWithJSONData:(NSData *)data; 68 | 69 | /** 70 | * 通过字典来创建一个模型 71 | * @param keyValues 字典 72 | * @return 新建的对象 73 | */ 74 | + (instancetype)objectWithKeyValues:(NSDictionary *)keyValues; 75 | 76 | /** 77 | * 通过plist来创建一个模型 78 | * @param filename 文件名(仅限于mainBundle中的文件) 79 | * @return 新建的对象 80 | */ 81 | + (instancetype)objectWithFilename:(NSString *)filename; 82 | 83 | /** 84 | * 通过plist来创建一个模型 85 | * @param file 文件全路径 86 | * @return 新建的对象 87 | */ 88 | + (instancetype)objectWithFile:(NSString *)file; 89 | 90 | #pragma mark - 字典数组转模型数组 91 | /** 92 | * 通过JSON数据来创建一个模型数组 93 | * @param data JSON数据 94 | * @return 新建的对象 95 | */ 96 | + (NSArray *)objectArrayWithJSONData:(NSData *)data; 97 | 98 | /** 99 | * 通过字典数组来创建一个模型数组 100 | * @param keyValuesArray 字典数组 101 | * @return 模型数组 102 | */ 103 | + (NSArray *)objectArrayWithKeyValuesArray:(NSArray *)keyValuesArray; 104 | 105 | /** 106 | * 通过plist来创建一个模型数组 107 | * @param filename 文件名(仅限于mainBundle中的文件) 108 | * @return 模型数组 109 | */ 110 | + (NSArray *)objectArrayWithFilename:(NSString *)filename; 111 | 112 | /** 113 | * 通过plist来创建一个模型数组 114 | * @param file 文件全路径 115 | * @return 模型数组 116 | */ 117 | + (NSArray *)objectArrayWithFile:(NSString *)file; 118 | @end 119 | -------------------------------------------------------------------------------- /Music/Lib/MJExtension/NSObject+MJMember.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+MJMember.h 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MJIvar.h" 11 | #import "MJMethod.h" 12 | 13 | /** 14 | * 遍历所有类的block(父类) 15 | */ 16 | typedef void (^MJClassesBlock)(Class c, BOOL *stop); 17 | 18 | @interface NSObject (MJMember) 19 | 20 | /** 21 | * 遍历所有的成员变量 22 | */ 23 | - (void)enumerateIvarsWithBlock:(MJIvarsBlock)block; 24 | 25 | /** 26 | * 遍历所有的方法 27 | */ 28 | - (void)enumerateMethodsWithBlock:(MJMethodsBlock)block; 29 | 30 | /** 31 | * 遍历所有的类 32 | */ 33 | - (void)enumerateClassesWithBlock:(MJClassesBlock)block; 34 | @end 35 | -------------------------------------------------------------------------------- /Music/Lib/MJExtension/NSObject+MJMember.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+MJMember.m 3 | // MJExtension 4 | // 5 | // Created by mj on 14-1-15. 6 | // Copyright (c) 2014年 itcast. All rights reserved. 7 | // 8 | 9 | #import "NSObject+MJMember.h" 10 | 11 | 12 | @implementation NSObject (MJMember) 13 | 14 | /** 15 | * 遍历所有的成员变量 16 | */ 17 | - (void)enumerateIvarsWithBlock:(MJIvarsBlock)block 18 | { 19 | [self enumerateClassesWithBlock:^(__unsafe_unretained Class c, BOOL *stop) { 20 | // 1.获得所有的成员变量 21 | unsigned int outCount = 0; 22 | Ivar *ivars = class_copyIvarList(c, &outCount); 23 | 24 | // 2.遍历每一个成员变量 25 | for (unsigned int i = 0; i 28 | 29 | @interface NSAlert (MKNetworkKitAdditions) 30 | +(NSAlert*) showWithError:(NSError*) networkError; 31 | @end 32 | #endif -------------------------------------------------------------------------------- /Music/Lib/MKNetworkKit/Categories/NSAlert+MKNetworkKitAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSAlert+MKNetworkKitAdditions.m 3 | // MKNetworkKitDemo 4 | // 5 | // Created by Mugunth Kumar (@mugunthkumar) on 11/11/11. 6 | // Copyright (C) 2011-2020 by Steinlogic Consulting and Training Pte Ltd 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | #if !TARGET_OS_IPHONE 26 | #import "NSAlert+MKNetworkKitAdditions.h" 27 | 28 | @implementation NSAlert (MKNetworkKitAdditions) 29 | 30 | +(NSAlert*) showWithError:(NSError*) networkError { 31 | 32 | DLog(@"%@", [networkError userInfo]); 33 | 34 | NSAlert *alert = [NSAlert alertWithError:networkError]; 35 | [alert runModal]; 36 | return alert; 37 | } 38 | @end 39 | #endif -------------------------------------------------------------------------------- /Music/Lib/MKNetworkKit/Categories/NSData+MKBase64.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+MKNKBase64.h 3 | // base64 4 | // 5 | // Created by Matt Gallagher on 2009/06/03. 6 | // Copyright 2009 Matt Gallagher. All rights reserved. 7 | // 8 | // This software is provided 'as-is', without any express or implied 9 | // warranty. In no event will the authors be held liable for any damages 10 | // arising from the use of this software. Permission is granted to anyone to 11 | // use this software for any purpose, including commercial applications, and to 12 | // alter it and redistribute it freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would be 17 | // appreciated but is not required. 18 | // 2. Altered source versions must be plainly marked as such, and must not be 19 | // misrepresented as being the original software. 20 | // 3. This notice may not be removed or altered from any source 21 | // distribution. 22 | // 23 | 24 | #import 25 | 26 | void *NewBase64Decode( 27 | const char *inputBuffer, 28 | size_t length, 29 | size_t *outputLength); 30 | 31 | char *NewBase64Encode( 32 | const void *inputBuffer, 33 | size_t length, 34 | bool separateLines, 35 | size_t *outputLength); 36 | 37 | @interface NSData (MKNKBase64) 38 | 39 | + (NSData *)dataFromBase64String:(NSString *)aString; 40 | - (NSString *)base64EncodedString; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Music/Lib/MKNetworkKit/Categories/NSDate+RFC1123.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+RFC1123.h 3 | // MKNetworkKit 4 | // 5 | // Created by Marcus Rohrmoser 6 | // http://blog.mro.name/2009/08/nsdateformatter-http-header/ 7 | // http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 8 | 9 | // No obvious license attached 10 | 11 | @interface NSDate (RFC1123) 12 | /** 13 | Convert a RFC1123 'Full-Date' string 14 | (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1) 15 | into NSDate. 16 | */ 17 | +(NSDate*)dateFromRFC1123:(NSString*)value_; 18 | 19 | /** 20 | Convert NSDate into a RFC1123 'Full-Date' string 21 | (http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1). 22 | */ 23 | -(NSString*)rfc1123String; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Music/Lib/MKNetworkKit/Categories/NSDate+RFC1123.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+RFC1123.m 3 | // MKNetworkKit 4 | // 5 | // Originally created by Marcus Rohrmoser 6 | // http://blog.mro.name/2009/08/nsdateformatter-http-header/ 7 | // Updated with strptime methods by Bo98 8 | // 9 | // No obvious license attached 10 | 11 | #import "NSDate+RFC1123.h" 12 | #import 13 | #import 14 | 15 | @implementation NSDate (RFC1123) 16 | 17 | +(NSDate*)dateFromRFC1123:(NSString*)value_ 18 | { 19 | if(value_ == nil) 20 | return nil; 21 | 22 | const char *str = [value_ UTF8String]; 23 | const char *fmt; 24 | NSDate *retDate; 25 | char *ret; 26 | 27 | fmt = "%a, %d %b %Y %H:%M:%S %Z"; 28 | struct tm rfc1123timeinfo; 29 | memset(&rfc1123timeinfo, 0, sizeof(rfc1123timeinfo)); 30 | ret = strptime_l(str, fmt, &rfc1123timeinfo, NULL); 31 | if (ret) { 32 | time_t rfc1123time = mktime(&rfc1123timeinfo); 33 | retDate = [NSDate dateWithTimeIntervalSince1970:rfc1123time]; 34 | if (retDate != nil) 35 | return retDate; 36 | } 37 | 38 | 39 | fmt = "%A, %d-%b-%y %H:%M:%S %Z"; 40 | struct tm rfc850timeinfo; 41 | memset(&rfc850timeinfo, 0, sizeof(rfc850timeinfo)); 42 | ret = strptime_l(str, fmt, &rfc850timeinfo, NULL); 43 | if (ret) { 44 | time_t rfc850time = mktime(&rfc850timeinfo); 45 | retDate = [NSDate dateWithTimeIntervalSince1970:rfc850time]; 46 | if (retDate != nil) 47 | return retDate; 48 | } 49 | 50 | fmt = "%a %b %e %H:%M:%S %Y"; 51 | struct tm asctimeinfo; 52 | memset(&asctimeinfo, 0, sizeof(asctimeinfo)); 53 | ret = strptime_l(str, fmt, &asctimeinfo, NULL); 54 | if (ret) { 55 | time_t asctime = mktime(&asctimeinfo); 56 | return [NSDate dateWithTimeIntervalSince1970:asctime]; 57 | } 58 | 59 | return nil; 60 | } 61 | 62 | -(NSString*)rfc1123String 63 | { 64 | time_t date = (time_t)[self timeIntervalSince1970]; 65 | struct tm timeinfo; 66 | gmtime_r(&date, &timeinfo); 67 | char buffer[32]; 68 | size_t ret = strftime_l(buffer, sizeof(buffer), "%a, %d %b %Y %H:%M:%S GMT", &timeinfo, NULL); 69 | if (ret) { 70 | return @(buffer); 71 | } else { 72 | return nil; 73 | } 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /Music/Lib/MKNetworkKit/Categories/NSDictionary+RequestEncoding.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+RequestEncoding.h 3 | // MKNetworkKitDemo 4 | // 5 | // Created by Mugunth Kumar (@mugunthkumar) on 11/11/11. 6 | // Copyright (C) 2011-2020 by Steinlogic Consulting and Training Pte Ltd 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | @interface NSDictionary (RequestEncoding) 27 | 28 | -(NSString*) urlEncodedKeyValueString; 29 | -(NSString*) jsonEncodedKeyValueString; 30 | -(NSString*) plistEncodedKeyValueString; 31 | @end 32 | -------------------------------------------------------------------------------- /Music/Lib/MKNetworkKit/Categories/NSDictionary+RequestEncoding.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+RequestEncoding.m 3 | // MKNetworkKitDemo 4 | // 5 | // Created by Mugunth Kumar (@mugunthkumar) on 11/11/11. 6 | // Copyright (C) 2011-2020 by Steinlogic Consulting and Training Pte Ltd 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "MKNetworkKit.h" 27 | 28 | @implementation NSDictionary (RequestEncoding) 29 | 30 | -(NSString*) urlEncodedKeyValueString { 31 | 32 | NSMutableString *string = [NSMutableString string]; 33 | for (NSString *key in self) { 34 | 35 | NSObject *value = [self valueForKey:key]; 36 | if([value isKindOfClass:[NSString class]]) 37 | [string appendFormat:@"%@=%@&", [key urlEncodedString], [((NSString*)value) urlEncodedString]]; 38 | else 39 | [string appendFormat:@"%@=%@&", [key urlEncodedString], value]; 40 | } 41 | 42 | if([string length] > 0) 43 | [string deleteCharactersInRange:NSMakeRange([string length] - 1, 1)]; 44 | 45 | return string; 46 | } 47 | 48 | 49 | -(NSString*) jsonEncodedKeyValueString { 50 | 51 | NSError *error = nil; 52 | NSData *data = [NSJSONSerialization dataWithJSONObject:self 53 | options:0 // non-pretty printing 54 | error:&error]; 55 | if(error) 56 | DLog(@"JSON Parsing Error: %@", error); 57 | 58 | return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 59 | } 60 | 61 | 62 | -(NSString*) plistEncodedKeyValueString { 63 | 64 | NSError *error = nil; 65 | NSData *data = [NSPropertyListSerialization dataWithPropertyList:self 66 | format:NSPropertyListXMLFormat_v1_0 67 | options:0 error:&error]; 68 | if(error) 69 | DLog(@"JSON Parsing Error: %@", error); 70 | 71 | return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /Music/Lib/MKNetworkKit/Categories/NSString+MKNetworkKitAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+MKNetworkKitAdditions.h 3 | // MKNetworkKitDemo 4 | // 5 | // Created by Mugunth Kumar (@mugunthkumar) on 11/11/11. 6 | // Copyright (C) 2011-2020 by Steinlogic Consulting and Training Pte Ltd 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | @interface NSString (MKNetworkKitAdditions) 27 | 28 | - (NSString *) md5; 29 | + (NSString*) uniqueString; 30 | - (NSString*) urlEncodedString; 31 | - (NSString*) urlDecodedString; 32 | @end 33 | -------------------------------------------------------------------------------- /Music/Lib/MKNetworkKit/Categories/UIAlertView+MKNetworkKitAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIAlertView+MKNetworkKitAdditions.h 3 | // MKNetworkKitDemo 4 | // 5 | // Created by Mugunth Kumar (@mugunthkumar) on 11/11/11. 6 | // Copyright (C) 2011-2020 by Steinlogic Consulting and Training Pte Ltd 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | #if TARGET_OS_IPHONE 26 | #import 27 | 28 | @interface UIAlertView (MKNetworkKitAdditions) 29 | +(UIAlertView*) showWithError:(NSError*) networkError; 30 | @end 31 | #endif 32 | -------------------------------------------------------------------------------- /Music/Lib/MKNetworkKit/Categories/UIAlertView+MKNetworkKitAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIAlertView+MKNetworkKitAdditions.m 3 | // MKNetworkKitDemo 4 | // 5 | // Created by Mugunth Kumar (@mugunthkumar) on 11/11/11. 6 | // Copyright (C) 2011-2020 by Steinlogic Consulting and Training Pte Ltd 7 | 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | #if TARGET_OS_IPHONE 26 | #import "UIAlertView+MKNetworkKitAdditions.h" 27 | 28 | @implementation UIAlertView (MKNetworkKitAdditions) 29 | 30 | +(UIAlertView*) showWithError:(NSError*) networkError { 31 | 32 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[networkError localizedDescription] 33 | message:[networkError localizedRecoverySuggestion] 34 | delegate:nil 35 | cancelButtonTitle:NSLocalizedString(@"Dismiss", @"") 36 | otherButtonTitles:nil]; 37 | [alert show]; 38 | return alert; 39 | } 40 | @end 41 | #endif 42 | -------------------------------------------------------------------------------- /Music/Lib/ProgressHUD/ProgressHUD.bundle/error-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Lib/ProgressHUD/ProgressHUD.bundle/error-black.png -------------------------------------------------------------------------------- /Music/Lib/ProgressHUD/ProgressHUD.bundle/error-black@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Lib/ProgressHUD/ProgressHUD.bundle/error-black@2x.png -------------------------------------------------------------------------------- /Music/Lib/ProgressHUD/ProgressHUD.bundle/error-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Lib/ProgressHUD/ProgressHUD.bundle/error-white.png -------------------------------------------------------------------------------- /Music/Lib/ProgressHUD/ProgressHUD.bundle/error-white@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Lib/ProgressHUD/ProgressHUD.bundle/error-white@2x.png -------------------------------------------------------------------------------- /Music/Lib/ProgressHUD/ProgressHUD.bundle/success-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Lib/ProgressHUD/ProgressHUD.bundle/success-black.png -------------------------------------------------------------------------------- /Music/Lib/ProgressHUD/ProgressHUD.bundle/success-black@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Lib/ProgressHUD/ProgressHUD.bundle/success-black@2x.png -------------------------------------------------------------------------------- /Music/Lib/ProgressHUD/ProgressHUD.bundle/success-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Lib/ProgressHUD/ProgressHUD.bundle/success-white.png -------------------------------------------------------------------------------- /Music/Lib/ProgressHUD/ProgressHUD.bundle/success-white@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/Lib/ProgressHUD/ProgressHUD.bundle/success-white@2x.png -------------------------------------------------------------------------------- /Music/Model/DZMusic.h: -------------------------------------------------------------------------------- 1 | // DZMusic.h 2 | // Music 3 | // 4 | // Created by dengwei on 15/9/27. 5 | // Copyright (c) 2015年 dengwei. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | @interface DZMusic : NSObject 11 | /** 12 | * 歌曲名字 13 | */ 14 | @property(nonatomic,copy)NSString *name; 15 | /** 16 | * 本地音乐文件名 17 | */ 18 | @property(nonatomic,copy)NSString *filename; 19 | 20 | /** 21 | * 歌手名字 22 | */ 23 | @property(nonatomic,copy)NSString *singer; 24 | 25 | /** 26 | * 歌手相片 27 | */ 28 | @property(nonatomic,copy)NSString *singerIcon; 29 | 30 | /** 31 | * 专辑图片 32 | */ 33 | @property(nonatomic,copy)NSString *icon; 34 | @end 35 | -------------------------------------------------------------------------------- /Music/Model/DZMusic.m: -------------------------------------------------------------------------------- 1 | // DZMusic.m 2 | // Music 3 | // 4 | // Created by dengwei on 15/9/27. 5 | // Copyright (c) 2015年 dengwei. All rights reserved. 6 | // 7 | 8 | #import "DZMusic.h" 9 | @implementation DZMusic 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /Music/Model/DZMySongList.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZMySongList.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DZMySongList : NSObject 12 | 13 | @property (nonatomic,assign) int songnums; 14 | @property (nonatomic,assign) BOOL havemore; 15 | @property (nonatomic,assign) int error_code; 16 | @property (nonatomic,retain) NSMutableArray *songLists; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Music/Model/DZMySongList.m: -------------------------------------------------------------------------------- 1 | // 2 | // DZMySongList.m 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "DZMySongList.h" 10 | 11 | @implementation DZMySongList 12 | 13 | -(instancetype)init { 14 | if (self = [super init]) { 15 | self.songLists = [NSMutableArray new]; 16 | } 17 | return self; 18 | } 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Music/Model/DZSinger.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZSinger.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/1/3. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DZSinger : NSObject 12 | 13 | @property (nonatomic, assign) long long ting_uid; 14 | @property (nonatomic, copy) NSString * name; 15 | @property (nonatomic, copy) NSString * firstchar; 16 | @property (nonatomic, assign) int gender; 17 | @property (nonatomic, assign) int area; 18 | @property (nonatomic, copy) NSString * country; 19 | @property (nonatomic, copy) NSString * avatar_big; 20 | @property (nonatomic, copy) NSString * avatar_middle; 21 | @property (nonatomic, copy) NSString * avatar_small; 22 | @property (nonatomic, copy) NSString * avatar_mini; 23 | @property (nonatomic, copy) NSString * constellation; 24 | @property (nonatomic, assign) float stature; 25 | @property (nonatomic, assign) float weight; 26 | @property (nonatomic, copy) NSString * bloodtype; 27 | @property (nonatomic, copy) NSString * company; 28 | @property (nonatomic, copy) NSString * intro; 29 | @property (nonatomic, assign) int albums_total; 30 | @property (nonatomic, assign) int songs_total; 31 | @property (nonatomic, assign) NSDate * birth; 32 | @property (nonatomic, copy) NSString * url; 33 | @property (nonatomic, assign) int artist_id; 34 | @property (nonatomic, copy) NSString * avatar_s180; 35 | @property (nonatomic, copy) NSString * avatar_s500; 36 | @property (nonatomic, copy) NSString * avatar_s1000; 37 | @property (nonatomic, assign) int piao_id; 38 | 39 | -(NSMutableArray *)itemWith:(NSString *)name; 40 | -(NSMutableArray *)itemTop100; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Music/Model/DZSinger.m: -------------------------------------------------------------------------------- 1 | // 2 | // DZSinger.m 3 | // Music 4 | // 5 | // Created by dengwei on 16/1/3. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "DZSinger.h" 10 | #import "NSObject+LKDBHelper.h" 11 | 12 | @implementation DZSinger 13 | 14 | /**表名*/ 15 | +(NSString *)getTableName 16 | { 17 | return @"SingerInfo"; 18 | } 19 | 20 | /**表版本*/ 21 | +(int)getTableVersion 22 | { 23 | return 1; 24 | } 25 | 26 | /**主键*/ 27 | +(NSString *)getPrimaryKey 28 | { 29 | return @"ting_uid"; 30 | } 31 | 32 | -(NSMutableArray *)itemWith:(NSString *)name 33 | { 34 | NSMutableArray * array = [DZSinger searchWithWhere:[NSString stringWithFormat:@"name like '%%%@%%'",name] orderBy:nil offset:0 count:0]; 35 | NSMutableArray * temp = [NSMutableArray new]; 36 | NSMutableArray * temp1 = [NSMutableArray new]; 37 | for (DZSinger * sub in array) { 38 | if ([sub.name length]!=0) { 39 | if ([sub.company length]!=0) { 40 | [temp addObject:sub]; 41 | }else{ 42 | [temp1 addObject:sub]; 43 | } 44 | } 45 | } 46 | [temp addObjectsFromArray:temp1]; 47 | return temp; 48 | } 49 | 50 | -(NSMutableArray *)itemTop100 51 | { 52 | NSMutableArray * array = [DZSinger searchWithWhere:[NSString stringWithFormat:@"'songs_total' >1000"] orderBy:nil offset:0 count:50]; 53 | //NSMutableArray *array = [self itemWith:@"李"]; 54 | 55 | return array; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Music/Model/DZSong.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZSong.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DZSong : NSObject 12 | 13 | @property (nonatomic,assign) long long queryId; 14 | @property (nonatomic,assign) long long songId; 15 | @property (nonatomic,copy) NSString * songName; 16 | @property (nonatomic,assign) long long artistId; 17 | @property (nonatomic,copy) NSString * artistName; 18 | @property (nonatomic,assign) long long albumId; 19 | @property (nonatomic,copy) NSString * albumName; 20 | @property (nonatomic,copy) NSString * songPicSmall; 21 | @property (nonatomic,copy) NSString * songPicBig; 22 | @property (nonatomic,copy) NSString * songPicRadio; 23 | @property (nonatomic,copy) NSString * lrcLink; 24 | @property (nonatomic,copy) NSString * version; 25 | @property (nonatomic,assign) int copyType; 26 | @property (nonatomic,assign) int time; 27 | @property (nonatomic,assign) int linkCode; 28 | @property (nonatomic,copy) NSString * songLink; 29 | @property (nonatomic,copy) NSString * showLink; 30 | @property (nonatomic,copy) NSString * format; 31 | @property (nonatomic,assign) int rate; 32 | @property (nonatomic,assign) long long size; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Music/Model/DZSong.m: -------------------------------------------------------------------------------- 1 | // 2 | // DZSong.m 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "DZSong.h" 10 | 11 | @implementation DZSong 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Music/Model/DZSongList.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZSongList.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DZSongList : NSObject 12 | 13 | @property (nonatomic,assign) int artist_id; 14 | @property (nonatomic,assign) int all_artist_ting_uid; 15 | @property (nonatomic,assign) int all_artist_id; 16 | @property (nonatomic,copy) NSString * language; 17 | @property (nonatomic,copy) NSString * publishtime; 18 | @property (nonatomic,assign) int album_no; 19 | @property (nonatomic,copy) NSString * pic_big; 20 | @property (nonatomic,copy) NSString * pic_small; 21 | @property (nonatomic,copy) NSString *country; 22 | @property (nonatomic,assign) int area; 23 | @property (nonatomic,copy) NSString *lrclink; 24 | @property (nonatomic,assign) int hot; 25 | @property (nonatomic,assign) int file_duration; 26 | @property (nonatomic,assign) int del_status; 27 | @property (nonatomic,assign) int resource_type; 28 | @property (nonatomic,assign) int copy_type; 29 | @property (nonatomic,assign) int relate_status; 30 | @property (nonatomic,assign) int all_rate; 31 | @property (nonatomic,assign) int has_mv_mobile; 32 | @property (nonatomic,assign) long long toneid; 33 | @property (nonatomic,assign) long long song_id; 34 | @property (nonatomic,copy) NSString * title; 35 | @property (nonatomic,assign) long long ting_uid; 36 | @property (nonatomic,copy) NSString * author; 37 | @property (nonatomic,assign) long long album_id; 38 | @property (nonatomic,copy) NSString * album_title; 39 | @property (nonatomic,assign) int is_first_publish; 40 | @property (nonatomic,assign) int havehigh; 41 | @property (nonatomic,assign) int charge; 42 | @property (nonatomic,assign) int has_mv; 43 | @property (nonatomic,assign) int learn; 44 | @property (nonatomic,assign) int piao_id; 45 | @property (nonatomic,assign) long long listen_total; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /Music/Model/DZSongList.m: -------------------------------------------------------------------------------- 1 | // 2 | // DZSongList.m 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "DZSongList.h" 10 | 11 | @implementation DZSongList 12 | 13 | #pragma mark 表名 14 | +(NSString *)getTableName{ 15 | return @"SongListTable"; 16 | } 17 | 18 | #pragma mark 表版本 19 | +(int)getTableVersion{ 20 | return 1; 21 | } 22 | 23 | #pragma mark 主键 24 | +(NSString *)getPrimaryKey{ 25 | return @"song_id"; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Music/Model/Network/DZDataEngine.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZDataEngine.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "DZNetworkEngine.h" 10 | 11 | @class DZSong, DZMySongList; 12 | @interface DZDataEngine : DZNetworkEngine 13 | 14 | typedef void (^SalesResponseBlock) (NSArray *array); 15 | typedef void (^DZSongListModelResponseBlock) (DZMySongList *songList); 16 | typedef void (^DZSongModelResponseBlock) (DZSong *songModel); 17 | typedef void (^DZSongLrcResponseBlock)(BOOL sucess,NSString * path); 18 | typedef void (^DZSongLinkDownLoadResponseBlock)(BOOL sucess,NSString * path); 19 | 20 | -(MKNetworkOperation *)getSingerInformationWith:(long long)tinguid 21 | WithCompletionHandler:(SalesResponseBlock)completion 22 | errorHandler:(MKNKErrorBlock)errorHandler; 23 | 24 | -(MKNetworkOperation *)getSingerSongListWith:(long long)tinguid :(int) number 25 | WithCompletionHandler:(DZSongListModelResponseBlock)completion 26 | errorHandler:(MKNKErrorBlock)errorHandler; 27 | 28 | -(MKNetworkOperation *)getSongInformationWith:(long long)songID 29 | WithCompletionHandler:(DZSongModelResponseBlock)completion 30 | errorHandler:(MKNKErrorBlock)errorHandler; 31 | 32 | -(MKNetworkOperation *)getSongLrcWith:(long long)tingUid :(long long)songID :(NSString *)lrclink 33 | WithCompletionHandler:(DZSongLrcResponseBlock)completion 34 | errorHandler:(MKNKErrorBlock)errorHandler; 35 | 36 | -(MKNetworkOperation *)downLoadSongWith:(long long)tingUid :(long long)songID :(NSString *)songLink 37 | WithCompletionHandler:(DZSongLinkDownLoadResponseBlock)completion 38 | errorHandler:(MKNKErrorBlock)errorHandler; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Music/Model/Network/DZNetworkEngine.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZNetworkEngine.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "MKNetworkEngine.h" 10 | #import "NSError+Additions.h" 11 | 12 | #define KHServerBase @"tingapi.ting.baidu.com" 13 | //#define KHServerBase @"ting.baidu.com" 14 | //1,3,5,9,10,12,14,,15,18,19,21,,22,,23,24,25,26,27,,28,29,30,31,32,33,34,35,36,37,38,39,40,99,100,104,//269,277 15 | //http://api.tudou.com/v3/gw?method=item.ranking&format=xml&appKey=2aaf400b13fc9bad&pageNo=1&pageSize=20&channelId=22&sort=d 16 | //土豆视频排行 17 | 18 | #define kHAppErrorDomain @"应用错误" 19 | #define kHErrorParse @"解析数据出错" 20 | 21 | @interface KHError : NSError 22 | 23 | @property (nonatomic,copy) NSString *reason; 24 | -(id)initWithMKNetworkOperation:(MKNetworkOperation *)op error:(NSError *)error; 25 | 26 | @end 27 | 28 | @interface DZNetworkEngine : MKNetworkEngine 29 | 30 | typedef void (^CommonResponseBlock)(BOOL changed); 31 | typedef void (^ListResponseBlock)(NSMutableArray *array); 32 | 33 | @property (nonatomic,assign) BOOL showError; 34 | -(void)showPrompt:(NSString *)msg; 35 | -(BOOL)checkError:(id)resp; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /Music/Model/Network/DZNetworkOperation.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZNetworkOperation.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "MKNetworkOperation.h" 10 | 11 | @interface DZNetworkOperation : MKNetworkOperation 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Music/Model/Network/DZNetworkOperation.m: -------------------------------------------------------------------------------- 1 | // 2 | // DZNetworkOperation.m 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "DZNetworkOperation.h" 10 | 11 | @implementation DZNetworkOperation 12 | 13 | -(BOOL) isCacheable{ 14 | return NO; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Music/Music-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Music-Prefix.pch 3 | // Music 4 | // 5 | // Created by dengwei on 16/1/2. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #ifndef Music_Music_Prefix_pch 10 | #define Music_Music_Prefix_pch 11 | 12 | // Include any system framework and library headers here that should be included in all compilation units. 13 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. 14 | #import 15 | #import 16 | #import 17 | #import 18 | #import "LKDBHelper.h" 19 | #import "ProgressHUD.h" 20 | #import "Common.h" 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /Music/Other/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Music 4 | // 5 | // Created by dengwei on 15/9/27. 6 | // Copyright (c) 2015年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * 播放远程事件block 13 | */ 14 | typedef void (^playerRemoteEventBlock)(UIEvent *event); 15 | 16 | @interface AppDelegate : UIResponder 17 | 18 | @property (strong, nonatomic) UIWindow *window; 19 | 20 | @property (nonatomic, copy) playerRemoteEventBlock myRemoteEventBlock; 21 | 22 | @end 23 | 24 | -------------------------------------------------------------------------------- /Music/Other/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Music 4 | // 5 | // Created by dengwei on 15/9/27. 6 | // Copyright (c) 2015年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import 11 | #import "DZGlobal.h" 12 | 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 21 | // Override point for customization after application launch. 22 | 23 | DZGlobal *global = [DZGlobal sharedGlobal]; 24 | [global copySqlitePath]; 25 | global.isPlaying = YES; 26 | 27 | //设置音乐后台播放的会话类型 28 | AVAudioSession *session = [AVAudioSession sharedInstance]; 29 | NSError *error = nil; 30 | [session setCategory:AVAudioSessionCategoryPlayback error:&error]; 31 | if (error) { 32 | NSLog(@"%s %@", __func__, error); 33 | } 34 | [session setActive:YES error:nil]; 35 | 36 | //开启远程事件(锁屏时使用) 37 | [application beginReceivingRemoteControlEvents]; 38 | 39 | return YES; 40 | } 41 | 42 | #pragma mark 接收远程事件 43 | -(void)remoteControlReceivedWithEvent:(UIEvent *)event{ 44 | //判断是否为远程事件 45 | if (event.type == UIEventTypeRemoteControl) { 46 | NSLog(@"receive remote event"); 47 | //调用block 48 | self.myRemoteEventBlock(event); 49 | } 50 | } 51 | 52 | - (void)applicationWillResignActive:(UIApplication *)application { 53 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 54 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 55 | } 56 | 57 | - (void)applicationDidEnterBackground:(UIApplication *)application { 58 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 59 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 60 | 61 | //开启后台任务 62 | [application beginBackgroundTaskWithExpirationHandler:nil]; 63 | } 64 | 65 | - (void)applicationWillEnterForeground:(UIApplication *)application { 66 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 67 | } 68 | 69 | - (void)applicationDidBecomeActive:(UIApplication *)application { 70 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 71 | } 72 | 73 | - (void)applicationWillTerminate:(UIApplication *)application { 74 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /Music/Other/Common.h: -------------------------------------------------------------------------------- 1 | // 2 | // Common.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/1/2. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #ifndef Music_Common_h 10 | #define Music_Common_h 11 | 12 | #define kHeight 44 13 | #define kMainWidth ([[UIScreen mainScreen] bounds].size.width) 14 | #define kMainHeight ([[UIScreen mainScreen] bounds].size.height) 15 | #define kViewWidth ([[UIScreen mainScreen] bounds].size.width * 0.5) 16 | #define kViewHeight ([[UIScreen mainScreen] bounds].size.height - kHeight) 17 | 18 | #define kDocumentPath ([NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]) 19 | #define kRadioViewStatusNotification @"RadioViewStatusNotification" 20 | #define kRadioViewSetSongInfoNotification @"RadioViewSetSongInfoNotification" 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /Music/Other/DZGlobal.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZGlobal.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/1/3. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DZGlobal : NSObject 12 | 13 | @property (nonatomic, assign) BOOL isApplicationEnterBackground; 14 | @property (nonatomic, assign) BOOL isPlaying; 15 | 16 | +(DZGlobal *)sharedGlobal; 17 | -(void)copySqlitePath; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Music/Other/DZGlobal.m: -------------------------------------------------------------------------------- 1 | // 2 | // DZGlobal.m 3 | // Music 4 | // 5 | // Created by dengwei on 16/1/3. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "DZGlobal.h" 10 | 11 | @implementation DZGlobal 12 | 13 | +(DZGlobal *)sharedGlobal 14 | { 15 | static DZGlobal *global = nil; 16 | if (global == nil) { 17 | global = [[DZGlobal alloc] init]; 18 | } 19 | return global; 20 | } 21 | 22 | -(instancetype)init 23 | { 24 | if (self = [super init]) { 25 | 26 | } 27 | return self; 28 | } 29 | 30 | -(void)copySqlitePath 31 | { 32 | NSError *error = nil; 33 | NSFileManager *fileMgr = [NSFileManager defaultManager]; 34 | NSString *dbPath = [kDocumentPath stringByAppendingString:@"/music.db"]; 35 | NSLog(@"%s dbPath %@", __func__, dbPath); 36 | if (![fileMgr fileExistsAtPath:dbPath]) { 37 | NSString *srcPath = [[NSBundle mainBundle] pathForResource:@"music" ofType:@"db"]; 38 | [fileMgr copyItemAtPath:srcPath toPath:dbPath error:&error]; 39 | } 40 | if (error) { 41 | NSLog(@"%s error:%@", __func__, error); 42 | } 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /Music/Tool/DZMusicTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZMusicTool.h 3 | // Music 4 | // 5 | // Created by dengwei on 15/9/27. 6 | // Copyright (c) 2015年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "Singleton.h" 12 | 13 | @class DZMusic; 14 | @interface DZMusicTool : NSObject 15 | 16 | singleton_interface(DZMusicTool) 17 | 18 | /** 19 | * 播放器 20 | */ 21 | @property (nonatomic, strong) AVAudioPlayer *player; 22 | 23 | /** 24 | * 音乐播放前的准备工作 25 | * 26 | */ 27 | -(void)prepareToPlayWithMusic:(DZMusic *)music; 28 | 29 | /** 30 | * 播放音乐 31 | * 32 | */ 33 | -(void)play; 34 | 35 | /** 36 | * 暂停音乐 37 | * 38 | */ 39 | -(void)pause; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Music/Tool/DZMusicTool.m: -------------------------------------------------------------------------------- 1 | // 2 | // DZMusicTool.m 3 | // Music 4 | // 5 | // Created by dengwei on 15/9/27. 6 | // Copyright (c) 2015年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "DZMusicTool.h" 10 | #import "DZMusic.h" 11 | #import 12 | 13 | @implementation DZMusicTool 14 | 15 | singleton_implementation(DZMusicTool) 16 | 17 | -(void)prepareToPlayWithMusic:(DZMusic *)music{ 18 | //创建播放器 19 | NSURL *musicURL = [[NSBundle mainBundle] URLForResource:music.filename withExtension:nil]; 20 | NSError *error = nil; 21 | self.player = [[AVAudioPlayer alloc] initWithContentsOfURL:musicURL error:&error]; 22 | if (error) { 23 | NSLog(@"%s %@", __func__, error); 24 | } 25 | 26 | //准备 27 | [self.player prepareToPlay]; 28 | 29 | //建议:锁屏信息最好在程序退出到后台的时候再设置 30 | //设置锁屏音乐信息 31 | NSMutableDictionary *info = [NSMutableDictionary dictionary]; 32 | //设置专辑名称 33 | info[MPMediaItemPropertyAlbumTitle] = @"网络热曲"; 34 | //设置歌曲名 35 | info[MPMediaItemPropertyTitle] = music.name; 36 | //设置歌手 37 | info[MPMediaItemPropertyArtist] = music.singer; 38 | //设置专辑图片 39 | UIImage *image = [UIImage imageNamed:music.icon]; 40 | MPMediaItemArtwork *artwork = [[MPMediaItemArtwork alloc] initWithImage:image]; 41 | info[MPMediaItemPropertyArtwork] = artwork; 42 | //设置歌曲时间 43 | info[MPMediaItemPropertyPlaybackDuration] = @(self.player.duration); 44 | [MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo = info; 45 | } 46 | 47 | -(void)play{ 48 | [self.player play]; 49 | } 50 | 51 | -(void)pause{ 52 | [self.player pause]; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /Music/Tool/Singleton.h: -------------------------------------------------------------------------------- 1 | //.h 2 | #define singleton_interface(class) \ 3 | + (instancetype)shared##class; 4 | 5 | // .m 6 | #define singleton_implementation(class) \ 7 | static class *_instance; \ 8 | \ 9 | + (id)allocWithZone:(struct _NSZone *)zone \ 10 | { \ 11 | static dispatch_once_t onceToken; \ 12 | dispatch_once(&onceToken, ^{ \ 13 | _instance = [super allocWithZone:zone]; \ 14 | }); \ 15 | \ 16 | return _instance; \ 17 | } \ 18 | \ 19 | + (instancetype)shared##class \ 20 | { \ 21 | if (_instance == nil) { \ 22 | _instance = [[class alloc] init]; \ 23 | } \ 24 | \ 25 | return _instance; \ 26 | } 27 | 28 | -------------------------------------------------------------------------------- /Music/View/DZImageView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZImageView.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DZImageView : UIImageView 12 | 13 | @property (nonatomic, assign, getter = isCacheEnabled) BOOL cacheEnabled; 14 | @property (nonatomic, strong) UIImageView *containerImageView; 15 | 16 | - (instancetype)initWithFrame:(CGRect)frame backgroundProgressColor:(UIColor *)backgroundProgresscolor; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Music/View/DZImageView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DZImageView.m 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "DZImageView.h" 10 | 11 | 12 | #pragma mark - Utils 13 | 14 | #define rad(degrees) ((degrees) / (180.0 / M_PI)) 15 | #define kLineWidth 3.f 16 | 17 | NSString * const spm_identifier = @"spm.imagecache.tg"; 18 | 19 | #pragma mark - SPMImageAsyncView interface 20 | 21 | @interface DZImageView () 22 | 23 | @property (nonatomic, strong) CAShapeLayer *backgroundLayer; 24 | @property (nonatomic, strong) CAShapeLayer *progressLayer; 25 | 26 | @property (nonatomic, strong) UIView *progressContainer; 27 | 28 | @end 29 | 30 | #pragma mark - SPMImageAsyncView 31 | 32 | 33 | @implementation DZImageView 34 | 35 | - (instancetype)initWithFrame:(CGRect)frame { 36 | return [[DZImageView alloc] initWithFrame:frame 37 | backgroundProgressColor:[UIColor whiteColor]]; 38 | } 39 | 40 | - (id)initWithFrame:(CGRect)frame backgroundProgressColor:(UIColor *)backgroundProgresscolor 41 | { 42 | self = [super initWithFrame:frame]; 43 | if (self) { 44 | 45 | self.layer.cornerRadius = CGRectGetWidth(self.bounds)/2.f; 46 | self.layer.masksToBounds = NO; 47 | self.clipsToBounds = YES; 48 | 49 | CGPoint arcCenter = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); 50 | CGFloat radius = MIN(CGRectGetMidX(self.bounds)-1, CGRectGetMidY(self.bounds)-1); 51 | 52 | UIBezierPath *circlePath = [UIBezierPath bezierPathWithArcCenter:arcCenter 53 | radius:radius 54 | startAngle:-rad(90) 55 | endAngle:rad(360-90) 56 | clockwise:YES]; 57 | 58 | _backgroundLayer = [CAShapeLayer layer]; 59 | _backgroundLayer.path = circlePath.CGPath; 60 | _backgroundLayer.strokeColor = [backgroundProgresscolor CGColor]; 61 | _backgroundLayer.fillColor = [[UIColor clearColor] CGColor]; 62 | _backgroundLayer.lineWidth = kLineWidth; 63 | } 64 | return self; 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /Music/View/DZLoadMoreFooterView.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZLoadMoreFooterView.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DZLoadMoreFooterView : UIView 12 | 13 | @property (nonatomic,strong) UIActivityIndicatorView * activeView; 14 | @property (nonatomic,strong) UILabel * titleLabel; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Music/View/DZLoadMoreFooterView.m: -------------------------------------------------------------------------------- 1 | // 2 | // DZLoadMoreFooterView.m 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "DZLoadMoreFooterView.h" 10 | #import "UIView+Additions.h" 11 | 12 | @implementation DZLoadMoreFooterView 13 | 14 | - (instancetype)initWithFrame:(CGRect)frame{ 15 | self = [super initWithFrame:frame]; 16 | if (self) { 17 | // Initialization code 18 | self.activeView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(frame.size.width/2-(30+100)/2, frame.size.height/2-30/2, 30, 30)]; 19 | _activeView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; 20 | // _activeView.backgroundColor =[UIColor redColor]; 21 | [self addSubview:_activeView]; 22 | 23 | self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(_activeView.size.width+_activeView.origin.x, frame.size.height/2-25/2, 100, 25)]; 24 | // _titleLabel.backgroundColor = [UIColor redColor]; 25 | [self addSubview:_titleLabel]; 26 | } 27 | return self; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Music/View/DZMusicCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZMusicCell.h 3 | // Music 4 | // 5 | // Created by dengwei on 15/9/27. 6 | // Copyright (c) 2015年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class DZMusic; 12 | @interface DZMusicCell : UITableViewCell 13 | 14 | +(instancetype)musicCellWithTableView:(UITableView *)tableView; 15 | 16 | @property (nonatomic, strong) DZMusic *music; 17 | @end 18 | -------------------------------------------------------------------------------- /Music/View/DZMusicCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // DZMusicCell.m 3 | // Music 4 | // 5 | // Created by dengwei on 15/9/27. 6 | // Copyright (c) 2015年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "DZMusicCell.h" 10 | #import "DZMusic.h" 11 | #import "UIImage+CZ.h" 12 | 13 | @implementation DZMusicCell 14 | 15 | +(instancetype)musicCellWithTableView:(UITableView *)tableView 16 | { 17 | static NSString *cellIdentifier = @"cell"; 18 | //forIndexPath:indexPath 跟 storyboard 配套使用 19 | DZMusicCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 20 | //Configure the cell ... 21 | if (cell == nil) { 22 | cell = [[DZMusicCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; 23 | } 24 | return cell; 25 | } 26 | 27 | //显示cell的数据 28 | -(void)setMusic:(DZMusic *)music 29 | { 30 | _music = music; 31 | 32 | self.textLabel.text = music.name; 33 | self.detailTextLabel.text = music.singer; 34 | UIImage *circleImage = [UIImage circleImageWithName:music.singerIcon borderWidth:1.0 borderColor:[UIColor whiteColor]]; 35 | self.imageView.image = circleImage; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /Music/View/DZPlayerToolBar.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZPlayerToolBar.h 3 | // Music 4 | // 5 | // Created by dengwei on 15/9/27. 6 | // Copyright (c) 2015年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum{ 12 | BtnTypePlay, //播放 13 | BtnTypePause, //暂停 14 | BtnTypePrevious, //上一首 15 | BtnTypeNext //下一首 16 | }BtnType; 17 | 18 | @class DZMusic,DZPlayerToolBar; 19 | 20 | @protocol DZPlayerToolBarDelegate 21 | 22 | -(void)playerToolBar:(DZPlayerToolBar *)toolBar btnClickWithType:(BtnType) btnType; 23 | 24 | @end 25 | 26 | @interface DZPlayerToolBar : UIView 27 | 28 | /** 29 | * 播放状态,默认是暂停状态 30 | */ 31 | @property (nonatomic, assign,getter=isPlaying) BOOL playing; 32 | 33 | /** 34 | * 当前播放的音乐 35 | */ 36 | @property (nonatomic, strong) DZMusic *playingMusic; 37 | 38 | @property (nonatomic, weak) id delegate; 39 | 40 | +(instancetype)playerToolBar; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Music/View/DZSingerTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZSingerTableViewCell.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "StyledTableViewCell.h" 10 | 11 | @class DZImageView; 12 | @class DZSinger; 13 | 14 | @interface DZSingerTableViewCell : StyledTableViewCell 15 | { 16 | 17 | DZImageView * headerImageView; 18 | UILabel * nameLabel; 19 | UILabel * titleLabel; 20 | 21 | } 22 | 23 | @property (nonatomic,strong) DZSinger *model; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Music/View/DZSingerTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // DZSingerTableViewCell.m 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "DZSingerTableViewCell.h" 10 | #import "DZSinger.h" 11 | #import "DZImageView.h" 12 | #import "UIView+Additions.h" 13 | #import "UIImageView+WebCache.h" 14 | 15 | @implementation DZSingerTableViewCell 16 | 17 | -(void)setModel:(DZSinger *)model 18 | { 19 | _model = model; 20 | [headerImageView setImageWithURL:[NSURL URLWithString:_model.avatar_big] placeholderImage:[UIImage imageNamed:@"headerImage"]]; 21 | nameLabel.text = _model.name; 22 | if ([_model.company length]!=0) { 23 | titleLabel.text = _model.company; 24 | }else{ 25 | titleLabel.text = @"<无信息>"; 26 | } 27 | } 28 | - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier 29 | { 30 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 31 | if (self) { 32 | // Initialization code 33 | self.accessoryType =UITableViewCellAccessoryDisclosureIndicator; 34 | 35 | headerImageView = [[DZImageView alloc] initWithFrame:CGRectMake(5, 5, 60, 60)]; 36 | [self.contentView addSubview:headerImageView]; 37 | 38 | nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(headerImageView.size.width+headerImageView.origin.x+5, headerImageView.origin.y, self.contentView.size.width-headerImageView.size.width-headerImageView.origin.x-30, 30)]; 39 | nameLabel.font = [UIFont boldSystemFontOfSize:16.0f]; 40 | [self.contentView addSubview:nameLabel]; 41 | 42 | titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(nameLabel.origin.x, nameLabel.size.height+nameLabel.origin.y+5, nameLabel.size.width, nameLabel.size.height-10)]; 43 | titleLabel.font = [UIFont systemFontOfSize:13.0f]; 44 | titleLabel.textColor = [UIColor lightGrayColor]; 45 | 46 | [self.contentView addSubview:titleLabel]; 47 | } 48 | return self; 49 | } 50 | 51 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 52 | [super setSelected:selected animated:animated]; 53 | 54 | // Configure the view for the selected state 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /Music/View/DZSongListTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // DZSongListTableViewCell.h 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "StyledTableViewCell.h" 10 | 11 | @class DZSongList; 12 | @interface DZSongListTableViewCell : StyledTableViewCell 13 | { 14 | UILabel * nameLabel; 15 | UILabel * titleLabel; 16 | UILabel * timeLabel; 17 | } 18 | 19 | @property (nonatomic,strong) DZSongList *songListModel; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Music/View/DZSongListTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // DZSongListTableViewCell.m 3 | // Music 4 | // 5 | // Created by dengwei on 16/2/4. 6 | // Copyright (c) 2016年 dengwei. All rights reserved. 7 | // 8 | 9 | #import "DZSongListTableViewCell.h" 10 | #import "UIView+Additions.h" 11 | #import "DZSongList.h" 12 | 13 | @implementation DZSongListTableViewCell 14 | 15 | -(NSString*)TimeformatFromSeconds:(int)seconds{ 16 | int totalm = seconds/(60); 17 | int h = totalm/(60); 18 | int m = totalm%(60); 19 | int s = seconds%(60); 20 | if (h==0) { 21 | return [[NSString stringWithFormat:@"%02d:%02d", m, s] substringToIndex:5]; 22 | } 23 | return [NSString stringWithFormat:@"%02d:%02d:%02d", h, m, s]; 24 | } 25 | 26 | -(void)setSongListModel:(DZSongList *)songListModel { 27 | _songListModel = songListModel; 28 | nameLabel.text = _songListModel.title; 29 | timeLabel.text =[self TimeformatFromSeconds:_songListModel.file_duration]; 30 | titleLabel.text = [NSString stringWithFormat:@"%@•%@",_songListModel.author,_songListModel.album_title]; 31 | } 32 | 33 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ 34 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 35 | if (self) { 36 | self.accessoryType =UITableViewCellAccessoryDisclosureIndicator; 37 | 38 | // Initialization code 39 | //歌名 40 | nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(8, 5, self.contentView.size.width-16-60, 25)]; 41 | nameLabel.font = [UIFont systemFontOfSize:16.0f]; 42 | nameLabel.backgroundColor = [UIColor clearColor]; 43 | [self.contentView addSubview:nameLabel]; 44 | //时间 45 | timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(nameLabel.size.width+nameLabel.origin.x, nameLabel.size.height/2+nameLabel.origin.y, 40, 25)]; 46 | timeLabel.font = [UIFont systemFontOfSize:14.0f]; 47 | timeLabel.backgroundColor = [UIColor clearColor]; 48 | timeLabel.textColor = [UIColor lightGrayColor]; 49 | [self.contentView addSubview:timeLabel]; 50 | //专辑名 51 | titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(nameLabel.origin.x, nameLabel.size.height+nameLabel.origin.y, nameLabel.size.width, 25)]; 52 | titleLabel.font = [UIFont systemFontOfSize:14.0f]; 53 | titleLabel.backgroundColor = [UIColor clearColor]; 54 | titleLabel.textColor = [UIColor lightGrayColor]; 55 | [self.contentView addSubview:titleLabel]; 56 | } 57 | return self; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Music/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Music 4 | // 5 | // Created by dengwei on 15/9/27. 6 | // Copyright (c) 2015年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Music/resouces/Data/music.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/Data/music.db -------------------------------------------------------------------------------- /Music/resouces/Data/songs.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | name 7 | Let It Go 8 | filename 9 | Let It Go.mp3 10 | singer 11 | 黛米·洛瓦托,伊迪娜·门泽尔 12 | singerIcon 13 | song_100.png 14 | icon 15 | song_400.png 16 | 17 | 18 | name 19 | 小苹果 20 | filename 21 | 小苹果.mp3 22 | singer 23 | 筷子兄弟 24 | singerIcon 25 | kzxd_100.png 26 | icon 27 | kzxd_400.png 28 | 29 | 30 | name 31 | 愿得一人心(剧场版) 32 | filename 33 | 愿得一人心(剧场版).mp3 34 | singer 35 | 李行亮 雨宗林 36 | singerIcon 37 | song_100.png 38 | icon 39 | song_400.png 40 | 41 | 42 | name 43 | 爱莫忘 44 | filename 45 | 爱莫忘.mp3 46 | singer 47 | 郑欣宜 48 | singerIcon 49 | zxy_100.png 50 | icon 51 | zxy_400.png 52 | 53 | 54 | name 55 | 泡沫 56 | filename 57 | 泡沫.mp3 58 | singer 59 | 邓紫琪G.E.M 60 | singerIcon 61 | gem_100.png 62 | icon 63 | gem_400.png 64 | 65 | 66 | name 67 | 爸爸去哪儿 68 | filename 69 | 爸爸去哪儿.mp3 70 | singer 71 | 爸爸去哪儿第一季 72 | singerIcon 73 | song_100.png 74 | icon 75 | song_400.png 76 | 77 | 78 | name 79 | 昨迟人 80 | filename 81 | 昨迟人.mp3 82 | singer 83 | 爸爸去哪儿第一季 84 | singerIcon 85 | bbqne_100.png 86 | icon 87 | bbqne_400.png 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /Music/resouces/MP3/Let It Go.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/MP3/Let It Go.mp3 -------------------------------------------------------------------------------- /Music/resouces/MP3/小苹果.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/MP3/小苹果.mp3 -------------------------------------------------------------------------------- /Music/resouces/MP3/愿得一人心(剧场版).lrc: -------------------------------------------------------------------------------- 1 | 2 | [00:02.05]愿得一人心 3 | [00:08.64]词:胡小健 曲:罗俊霖 4 | [00:11.14]演唱: 李行亮,雨宗林 5 | [00:24.93] 6 | [00:26.53]曾在我背包小小夹层里的那个人 7 | [00:31.67]陪伴我漂洋过海经过每一段旅程 8 | [00:36.66]隐形的稻草人 守护我的天真 9 | [00:41.78]曾以为爱情能让未来只为一个人 10 | [00:46.84]关了灯依旧在书桌角落的那个人 11 | [00:51.84]变成我许多年来纪念爱情的标本 12 | [00:56.90]消失的那个人 回不去的青春 13 | [01:02.06]忘不了爱过的人才会对过往认真 14 | [01:08.75]只愿得一人心 白首不分离 15 | [01:13.93]这简单的话语 需要巨大的勇气 16 | [01:19.00]没想过失去你 却是在骗自己 17 | [01:24.46]最后你深深藏在我的歌声里 18 | [01:29.02]只愿得一人心 白首不分离 19 | [01:34.27]这清晰的话语 嘲笑孤单的自己 20 | [01:39.27]盼望能见到你 却一直骗自己 21 | [01:44.77]遗憾你听不到我唱的这首歌 22 | [01:49.39]多想唱给你 23 | [01:53.27] 24 | [02:10.06]曾在我背包小小夹层里的那个人 25 | [02:15.20]陪伴我漂洋过海经过每一段旅程 26 | [02:20.26]隐形的稻草人 守护我的天真 27 | [02:25.34]曾以为爱情能让未来只为一个人 28 | [02:30.25]关了灯依旧在书桌角落的那个人 29 | [02:35.31]变成我许多年来纪念爱情的标本 30 | [02:40.50]消失的那个人 回不去的青春 31 | [02:45.50]忘不了爱过的人才会对过往认真 32 | [02:52.31]只愿得一人心 白首不分离 33 | [02:57.50]这简单的话语 需要巨大的勇气 34 | [03:02.63]没想过失去你 却是在骗自己 35 | [03:08.12]最后你深深藏在我的歌声里 36 | [03:12.68]只愿得一人心 白首不分离 37 | [03:17.74]这清晰的话语 嘲笑孤单的自己 38 | [03:22.74]盼望能见到你 却一直骗自己 39 | [03:28.30]遗憾你听不到我唱的这首歌 40 | [03:32.82]只愿得一人心 白首不分离 41 | [03:37.91]这简单的话语 需要巨大的勇气 42 | [03:43.04]没想过失去你 却是在骗自己 43 | [03:48.60]最后你深深藏在我的歌声里 44 | [03:53.10]只愿得一人心 白首不分离 45 | [03:58.10]这清晰的话语 嘲笑孤单的自己 46 | [04:03.45]我很想你 却一直骗自己 47 | [04:08.83]遗憾你听不到我唱的这首歌 48 | [04:13.43]多想唱给你 49 | [04:17.51] 50 | -------------------------------------------------------------------------------- /Music/resouces/MP3/愿得一人心(剧场版).mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/MP3/愿得一人心(剧场版).mp3 -------------------------------------------------------------------------------- /Music/resouces/MP3/昨迟人.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/MP3/昨迟人.mp3 -------------------------------------------------------------------------------- /Music/resouces/MP3/泡沫.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/MP3/泡沫.mp3 -------------------------------------------------------------------------------- /Music/resouces/MP3/爱莫忘.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/MP3/爱莫忘.mp3 -------------------------------------------------------------------------------- /Music/resouces/MP3/爸爸去哪儿.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/MP3/爸爸去哪儿.mp3 -------------------------------------------------------------------------------- /Music/resouces/SingerImages/bbqne_100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/SingerImages/bbqne_100.png -------------------------------------------------------------------------------- /Music/resouces/SingerImages/bbqne_400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/SingerImages/bbqne_400.png -------------------------------------------------------------------------------- /Music/resouces/SingerImages/gem_100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/SingerImages/gem_100.png -------------------------------------------------------------------------------- /Music/resouces/SingerImages/gem_400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/SingerImages/gem_400.png -------------------------------------------------------------------------------- /Music/resouces/SingerImages/kzxd_100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/SingerImages/kzxd_100.png -------------------------------------------------------------------------------- /Music/resouces/SingerImages/kzxd_400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/SingerImages/kzxd_400.png -------------------------------------------------------------------------------- /Music/resouces/SingerImages/song_100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/SingerImages/song_100.png -------------------------------------------------------------------------------- /Music/resouces/SingerImages/song_400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/SingerImages/song_400.png -------------------------------------------------------------------------------- /Music/resouces/SingerImages/zxy_100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/SingerImages/zxy_100.png -------------------------------------------------------------------------------- /Music/resouces/SingerImages/zxy_400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/Music/resouces/SingerImages/zxy_400.png -------------------------------------------------------------------------------- /MusicTests/._MusicTests.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/MusicTests/._MusicTests.m -------------------------------------------------------------------------------- /MusicTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.dengwei.app.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /MusicTests/MusicTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // MusicTests.m 3 | // MusicTests 4 | // 5 | // Created by dengwei on 15/9/27. 6 | // Copyright (c) 2015年 dengwei. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface MusicTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation MusicTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # music-player 2 | This is music player code.
3 | 功能:播放,暂停,上一曲,下一曲,循环播放,后台操作。 4 | 5 | screenshots 6 | ----------------------- 7 | one 8 |    9 | one 10 |    11 | one 12 |    13 | one 14 |    15 | one 16 |    17 | one 18 |    19 | one 20 |    21 | 22 | #Blog 23 | My blog is [here](http://my.oschina.net/chars/blog). Welcome to visit! 24 | 25 | #E-mail 26 | Author:chars_d@126.com 27 | 28 | #公众号 29 | one 30 |    31 | 32 | Copyright © deng wei 33 | -------------------------------------------------------------------------------- /screenshots/m1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/screenshots/m1.png -------------------------------------------------------------------------------- /screenshots/m2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/screenshots/m2.png -------------------------------------------------------------------------------- /screenshots/m3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/screenshots/m3.png -------------------------------------------------------------------------------- /screenshots/m4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/screenshots/m4.png -------------------------------------------------------------------------------- /screenshots/m5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/screenshots/m5.png -------------------------------------------------------------------------------- /screenshots/m6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/screenshots/m6.png -------------------------------------------------------------------------------- /screenshots/m7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/charsdavy/music-player/2121c88c886afd0cbfd8c0a96141a28cc883917b/screenshots/m7.png --------------------------------------------------------------------------------