浏览代码

plex: adding codec information on long touch gesture

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Pierre SAGASPE 10 年之前
父节点
当前提交
73afc3e9f0
共有 2 个文件被更改,包括 14 次插入1 次删除
  1. 9 1
      Sources/VLCLocalPlexFolderListViewController.m
  2. 5 0
      Sources/VLCPlexParser.m

+ 9 - 1
Sources/VLCLocalPlexFolderListViewController.m

@@ -480,7 +480,15 @@
         NSInteger size = [[[ObjList objectAtIndex:0] objectForKey:@"size"] integerValue];
         NSString *mediaSize = [NSByteCountFormatter stringFromByteCount:size countStyle:NSByteCountFormatterCountStyleFile];
         NSString *durationInSeconds = [[ObjList objectAtIndex:0] objectForKey:@"duration"];
-        NSString *message = [NSString stringWithFormat:@"%@ (%@)", mediaSize, durationInSeconds];
+        NSString *audioCodec = [[ObjList objectAtIndex:0] objectForKey:@"audioCodec"];
+        if (!audioCodec)
+            audioCodec = @"no track";
+
+        NSString *videoCodec = [[ObjList objectAtIndex:0] objectForKey:@"videoCodec"];
+        if (!videoCodec)
+            videoCodec = @"no track";
+
+        NSString *message = [NSString stringWithFormat:@"%@ (%@)\naudio(%@) video(%@)", mediaSize, durationInSeconds, audioCodec, videoCodec];
         NSString *summary = [NSString stringWithFormat:@"%@", [[ObjList objectAtIndex:0] objectForKey:@"summary"]];
 
         VLCAlertView *alertView = [[VLCAlertView alloc] initWithTitle:title message:message cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", nil) otherButtonTitles:@[NSLocalizedString(@"BUTTON_PLAY", nil), NSLocalizedString(@"BUTTON_DOWNLOAD", nil)]];

+ 5 - 0
Sources/VLCPlexParser.m

@@ -74,6 +74,11 @@
         else
             [_dicoInfo setObject:@"unwatched" forKey:@"state"];
 
+    } else if([elementName isEqualToString:@"Media"]) {
+        if([attributeDict objectForKey:@"audioCodec"])
+            [_dicoInfo setObject:[attributeDict objectForKey:@"audioCodec"] forKey:@"audioCodec"];
+        if([attributeDict objectForKey:@"videoCodec"])
+            [_dicoInfo setObject:[attributeDict objectForKey:@"videoCodec"] forKey:@"videoCodec"];
     } else if([elementName isEqualToString:@"Part"]) {
         [_dicoInfo setObject:[NSString stringWithFormat:@"%@%@",_PlexMediaServerUrl, [attributeDict objectForKey:@"key"]] forKey:@"keyMedia"];
         if([attributeDict objectForKey:@"file"])