|
@@ -467,9 +467,17 @@ static inline void wd_playControl_queue(void (^block)(void)){
|
|
|
index:(NSInteger)index
|
|
|
device:(id<MKRUPnPDevice>)device
|
|
|
timeStamp:(NSTimeInterval)timeStamp{
|
|
|
+ [self playTempChannelSongs:songs index:index device:device timeStamp:timeStamp playMode:MKRRadioPlayModeOrder];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)playTempChannelSongs:(NSArray<id<MKRRadioResorce>> *)songs
|
|
|
+ index:(NSInteger)index
|
|
|
+ device:(id<MKRUPnPDevice>)device
|
|
|
+ timeStamp:(NSTimeInterval)timeStamp
|
|
|
+ playMode:(MKRRadioPlayMode)playMode{
|
|
|
MKRM3UListModel *m3uModel = [MKRM3UListModel tempChannelM3UModelWithSongs:songs startIndex:index];
|
|
|
m3uModel.userID = self.userID;
|
|
|
- m3uModel.playModeString = @"REPEAT_ALL";
|
|
|
+ m3uModel.playModeString = [self playModeStringWithPlayMode:playMode];
|
|
|
wd_playControl_queue(^{
|
|
|
[[MKRWIFIDeviceManager shareManager] setM3UList:m3uModel];
|
|
|
id <MKRRadioResorce> song = songs[index];
|
|
@@ -483,9 +491,16 @@ static inline void wd_playControl_queue(void (^block)(void)){
|
|
|
- (void)playTempChannelSongs:(NSArray<id<MKRRadioResorce>> *)songs
|
|
|
device:(id<MKRUPnPDevice>)device
|
|
|
timeStamp:(NSTimeInterval)timeStamp{
|
|
|
+ [self playTempChannelSongs:songs device:device timeStamp:timeStamp playMode:MKRRadioPlayModeOrder];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)playTempChannelSongs:(NSArray<id<MKRRadioResorce>> *)songs
|
|
|
+ device:(id<MKRUPnPDevice>)device
|
|
|
+ timeStamp:(NSTimeInterval)timeStamp
|
|
|
+ playMode:(MKRRadioPlayMode)playMode{
|
|
|
MKRM3UListModel *m3uModel = [MKRM3UListModel tempChannelM3UModelWithSongs:songs startIndex:index];
|
|
|
m3uModel.userID = self.userID;
|
|
|
- m3uModel.playModeString = @"REPEAT_ALL";
|
|
|
+ m3uModel.playModeString = [self playModeStringWithPlayMode:playMode];
|
|
|
wd_playControl_queue(^{
|
|
|
[[MKRWIFIDeviceManager shareManager] setM3UList:m3uModel];
|
|
|
id <MKRRadioResorce> song = songs[0];
|
|
@@ -685,6 +700,33 @@ static inline void wd_playControl_queue(void (^block)(void)){
|
|
|
|
|
|
}
|
|
|
|
|
|
+- (NSString *)playModeStringWithPlayMode:(MKRRadioPlayMode)playmode{
|
|
|
+ switch (playmode) {
|
|
|
+ case MKRRadioPlayModeOrder:{
|
|
|
+ return @"REPEAT_ALL";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case MKRRadioPlayModeSingle:{
|
|
|
+ return @"REPEAT_ONE";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case MKRRadioPlayModeRandom:{
|
|
|
+ return @"SHUFFLE";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:{
|
|
|
+ return @"REPEAT_ALL";
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+static NSString * const playModeStringMap[] = {
|
|
|
+ [MKRRadioPlayModeOrder] = @"列表循环",
|
|
|
+ [MKRRadioPlayModeSingle] = @"单曲循环",
|
|
|
+ [MKRRadioPlayModeRandom] = @"随机播放"
|
|
|
+};
|
|
|
+
|
|
|
- (id<MKRRadioResorce>)currentResource{
|
|
|
if (!_currentResource) {
|
|
|
_currentResource = [[MKRRadioResorce alloc] init];
|