Explorar o código

版本升级维护

yyqxiaoyin %!s(int64=5) %!d(string=hai) anos
pai
achega
31663abcef

+ 5 - 3
MKRRadioManager/Classes/MKRRadioManager/MKRWIFIDeviceManager/MKRWIFIDeviceManager.h

@@ -231,11 +231,13 @@
 /// @param channelNO 设置播放模式的频道
 - (void)setPlayMode:(MKRRadioPlayMode)playMode device:(id<MKRUPnPDevice>)device channelNO:(NSInteger)channelNO;
 
+
 /// 更新临时频道播放模式
-/// 先刷新临时频道的M3U 更改M3U的播放模式 并向设备发送更新频道命令
-/// @param playMode 播放模式
+/// @param playMode 先刷新临时频道的M3U 更改M3U的播放模式 并向设备发送更新频道命令
+/// @param songs 临时频道播放列表
+/// @param index 下标
 /// @param device 需要设置的设备
-- (void)updateTempChannelPlayMode:(MKRRadioPlayMode)playMode device:(id<MKRUPnPDevice>)device;
+- (void)updateTempChannelPlayMode:(MKRRadioPlayMode)playMode songs:(NSArray <id <MKRRadioResorce>> *)songs index:(NSInteger)index device:(id<MKRUPnPDevice>)device;
 
 /// 设置低电量提醒
 /// @param enable 是否开启低电量提醒

+ 11 - 3
MKRRadioManager/Classes/MKRRadioManager/MKRWIFIDeviceManager/MKRWIFIDeviceManager.m

@@ -568,7 +568,12 @@ static inline void wd_playControl_queue(void (^block)(void)){
 - (void)updateChannel:(NSString *)channelFlag device:(id<MKRUPnPDevice>)device{
     wd_playControl_queue(^{
         NSString *timestamp = [NSString stringWithFormat:@"%.0f", [[NSDate date] timeIntervalSince1970]];
-        int result = libupnp_SetChannelUpdateV2(device.groupManagementUrl, self.userID, timestamp, channelFlag, @"null");
+        NSInteger channelNo = [channelFlag integerValue];
+        NSString *playListUrl = @"null";
+        if (channelNo >= 13) {
+            playListUrl = [NSString stringWithFormat:@"%@/web/playlist",[ASControlTools sharedInstanceUPNP].myIp];
+        }
+        int result = libupnp_SetChannelUpdateV2(device.groupManagementUrl, self.userID, timestamp, channelFlag, playListUrl);
     });
 }
 
@@ -598,9 +603,12 @@ static inline void wd_playControl_queue(void (^block)(void)){
     });
 }
 
-- (void)updateTempChannelPlayMode:(MKRRadioPlayMode)playMode device:(id<MKRUPnPDevice>)device{
+- (void)updateTempChannelPlayMode:(MKRRadioPlayMode)playMode songs:(NSArray <id <MKRRadioResorce>> *)songs index:(NSInteger)index device:(id<MKRUPnPDevice>)device{
     if (!self.currentTempM3UListModel) {
-        return;
+        MKRM3UListModel *m3uModel = [MKRM3UListModel tempChannelM3UModelWithSongs:songs startIndex:index];
+        m3uModel.userID = self.userID;
+        m3uModel.playModeString = [self playModeStringWithPlayMode:playMode];
+        self.currentTempM3UListModel = m3uModel;
     }
     self.currentTempM3UListModel.playModeString = [self playModeStringWithPlayMode:playMode];
     wd_playControl_queue(^{