|
@@ -450,44 +450,49 @@ static inline void wd_playControl_queue(void (^block)(void)){
|
|
|
- (id <MKRRadioResorce>)getPlayingStatusWithDevice:(id <MKRUPnPDevice>)device {
|
|
|
|
|
|
wd_playControl_queue(^{
|
|
|
- NSArray *dmrPositionInfo = [[ASControlTools sharedInstanceUPNP] libupnp_GetPositionInfo:device.avTransportUrl];
|
|
|
- if (dmrPositionInfo.count < 16) {
|
|
|
- //执行检查设备是否掉线操作
|
|
|
- return ;
|
|
|
- }
|
|
|
-// MKRRadioResorce *resource = [[MKRRadioResorce alloc] init];
|
|
|
- @synchronized (_currentResource) {
|
|
|
- self.currentResource.songName = dmrPositionInfo[2];
|
|
|
- self.currentResource.songArtist = dmrPositionInfo[3];
|
|
|
- self.currentResource.songAlbumCover = dmrPositionInfo[5];
|
|
|
- self.currentResource.songUrl = dmrPositionInfo[7];
|
|
|
- self.currentResource.songID = [dmrPositionInfo[16] integerValue];
|
|
|
- NSString *songFrom = dmrPositionInfo[17];
|
|
|
- if ([songFrom containsString:@"//"]) {
|
|
|
- NSArray *arr = [songFrom componentsSeparatedByString:@"//"];
|
|
|
- if (arr.count > 1) {
|
|
|
- songFrom = arr[1];
|
|
|
- }
|
|
|
- }
|
|
|
- self.currentResource.songFrom = (MKRSourcePlatform)[songFrom integerValue];
|
|
|
- NSString *channelString = dmrPositionInfo[8];
|
|
|
- if (![channelString containsString:@"Unknown:TrackMetaData Incomplete"]) {
|
|
|
- if ([channelString containsString:@"CHANNEL_UPDATE_"]) {
|
|
|
- self.currentResource.songChannel = [[channelString componentsSeparatedByString:@"CHANNEL_UPDATE_"].lastObject integerValue];
|
|
|
- } else {
|
|
|
- self.currentResource.songChannel = [channelString integerValue];
|
|
|
- }
|
|
|
- }
|
|
|
- // resource.songLength = [self secondsFromTimeString:dmrPositionInfo[1]];
|
|
|
- // MKRPlayResourceStatus *status = [MKRPlayResourceStatus new];
|
|
|
- // status.currentTime = [[self secondsFromTimeString:dmrPositionInfo[10]] integerValue];
|
|
|
- // status.totalTime = [oneSong.songLength integerValue];
|
|
|
- NSString *songChannelUid = [NSString stringWithFormat:@"%@-%@-%zd",self.userID,device.deviceUUID,self.currentResource.songChannel];
|
|
|
- self.currentResource.songChannelUid = songChannelUid;
|
|
|
- self.currentResource.songFlag = [NSString stringWithFormat:@"%@_%zd_%@",songChannelUid,[dmrPositionInfo[16] integerValue],songFrom];
|
|
|
- }
|
|
|
+ NSString *string = [[ASControlTools sharedInstanceUPNP] libupnp_getPlayInfo:device.avTransportUrl];
|
|
|
+ NSLog(@"新的获取播放信息\n%@",string);
|
|
|
});
|
|
|
|
|
|
+// wd_playControl_queue(^{
|
|
|
+// NSArray *dmrPositionInfo = [[ASControlTools sharedInstanceUPNP] libupnp_GetPositionInfo:device.avTransportUrl];
|
|
|
+// if (dmrPositionInfo.count < 16) {
|
|
|
+// //执行检查设备是否掉线操作
|
|
|
+// return ;
|
|
|
+// }
|
|
|
+//// MKRRadioResorce *resource = [[MKRRadioResorce alloc] init];
|
|
|
+// @synchronized (_currentResource) {
|
|
|
+// self.currentResource.songName = dmrPositionInfo[2];
|
|
|
+// self.currentResource.songArtist = dmrPositionInfo[3];
|
|
|
+// self.currentResource.songAlbumCover = dmrPositionInfo[5];
|
|
|
+// self.currentResource.songUrl = dmrPositionInfo[7];
|
|
|
+// self.currentResource.songID = [dmrPositionInfo[16] integerValue];
|
|
|
+// NSString *songFrom = dmrPositionInfo[17];
|
|
|
+// if ([songFrom containsString:@"//"]) {
|
|
|
+// NSArray *arr = [songFrom componentsSeparatedByString:@"//"];
|
|
|
+// if (arr.count > 1) {
|
|
|
+// songFrom = arr[1];
|
|
|
+// }
|
|
|
+// }
|
|
|
+// self.currentResource.songFrom = (MKRSourcePlatform)[songFrom integerValue];
|
|
|
+// NSString *channelString = dmrPositionInfo[8];
|
|
|
+// if (![channelString containsString:@"Unknown:TrackMetaData Incomplete"]) {
|
|
|
+// if ([channelString containsString:@"CHANNEL_UPDATE_"]) {
|
|
|
+// self.currentResource.songChannel = [[channelString componentsSeparatedByString:@"CHANNEL_UPDATE_"].lastObject integerValue];
|
|
|
+// } else {
|
|
|
+// self.currentResource.songChannel = [channelString integerValue];
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // resource.songLength = [self secondsFromTimeString:dmrPositionInfo[1]];
|
|
|
+// // MKRPlayResourceStatus *status = [MKRPlayResourceStatus new];
|
|
|
+// // status.currentTime = [[self secondsFromTimeString:dmrPositionInfo[10]] integerValue];
|
|
|
+// // status.totalTime = [oneSong.songLength integerValue];
|
|
|
+// NSString *songChannelUid = [NSString stringWithFormat:@"%@-%@-%zd",self.userID,device.deviceUUID,self.currentResource.songChannel];
|
|
|
+// self.currentResource.songChannelUid = songChannelUid;
|
|
|
+// self.currentResource.songFlag = [NSString stringWithFormat:@"%@_%zd_%@",songChannelUid,[dmrPositionInfo[16] integerValue],songFrom];
|
|
|
+// }
|
|
|
+// });
|
|
|
+
|
|
|
return self.currentResource;
|
|
|
}
|
|
|
|