Commit 23b9f70a authored by Pierre SAGASPE's avatar Pierre SAGASPE Committed by Felix Paul Kühne
Browse files

Fix UPNP media files are listed with 0 bytes in size, by calculation (bitrate...


Fix UPNP media files are listed with 0 bytes in size, by calculation (bitrate * duration) if size is null
Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 8de6af35
......@@ -185,12 +185,28 @@
if (![item isContainer]) {
MediaServer1ItemObject *mediaItem;
NSInteger mediaSize = 0;
if (tableView == self.searchDisplayController.searchResultsTableView)
mediaItem = _searchData[indexPath.row];
else
mediaItem = _mutableObjectList[indexPath.row];
[cell setSubtitle: [NSString stringWithFormat:@"%0.2f MB (%@)", (float)([mediaItem.size intValue] / 1e6), mediaItem.duration]];
if (![mediaItem size]) {
NSRange end = [mediaItem.duration rangeOfString:@"."];
NSString *timeString =[mediaItem.duration substringWithRange:NSMakeRange(0, end.location)];
NSArray *arrayTime = [timeString componentsSeparatedByString:@":"];
NSInteger hours = [[arrayTime objectAtIndex:0] integerValue];
NSInteger minutes = [[arrayTime objectAtIndex:1] integerValue];
NSInteger seconds = [[arrayTime objectAtIndex:2] integerValue];
mediaSize = [mediaItem.bitrate integerValue] * ((hours * 60 * 60) + (minutes * 60) + seconds);
}
else
mediaSize = [mediaItem.size integerValue];
[cell setSubtitle: [NSString stringWithFormat:@"%0.2f MB (%@)", (float)(mediaSize / 1e6), mediaItem.duration]];
[cell setIsDirectory:NO];
cell.isDownloadable = YES;
if (![mediaItem.albumArt isEqualToString:NULL]) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment