Commit 2f8cd017 authored by Felix Paul Kühne's avatar Felix Paul Kühne

tvOS playback: handle chapters and titles without names

parent 424e4c20
...@@ -110,8 +110,11 @@ ...@@ -110,8 +110,11 @@
trackCell.selectionMarkerVisible = isSelected; trackCell.selectionMarkerVisible = isSelected;
NSDictionary *description = self.mediaPlayer.titleDescriptions[row]; NSDictionary *description = self.mediaPlayer.titleDescriptions[row];
NSString *tileName = [NSString stringWithFormat:@"%@ (%@)", description[VLCTitleDescriptionName], [[VLCTime timeWithNumber:description[VLCTitleDescriptionDuration]] stringValue]]; NSString *title = description[VLCTitleDescriptionName];
trackCell.titleLabel.text = tileName; if (title == nil)
title = [NSString stringWithFormat:@"%@ %li", NSLocalizedString(@"TITLE", nil), row];
NSString *titleName = [NSString stringWithFormat:@"%@ (%@)", title, [[VLCTime timeWithNumber:description[VLCTitleDescriptionDuration]] stringValue]];
trackCell.titleLabel.text = titleName;
} }
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
...@@ -141,7 +144,10 @@ ...@@ -141,7 +144,10 @@
NSArray *chapterDescriptions = [player chapterDescriptionsOfTitle:player.currentTitleIndex]; NSArray *chapterDescriptions = [player chapterDescriptionsOfTitle:player.currentTitleIndex];
if (row < chapterDescriptions.count) { if (row < chapterDescriptions.count) {
NSDictionary *description = chapterDescriptions[row]; NSDictionary *description = chapterDescriptions[row];
NSString *chapterTitle = [NSString stringWithFormat:@"%@ (%@)", description[VLCChapterDescriptionName], [[VLCTime timeWithNumber:description[VLCChapterDescriptionDuration]] stringValue]]; NSString *chapter = description[VLCChapterDescriptionName];
if (chapter == nil)
chapter = [NSString stringWithFormat:@"%@ %li", NSLocalizedString(@"CHAPTER", nil), row];
NSString *chapterTitle = [NSString stringWithFormat:@"%@ (%@)", chapter, [[VLCTime timeWithNumber:description[VLCChapterDescriptionDuration]] stringValue]];
trackCell.titleLabel.text = chapterTitle; trackCell.titleLabel.text = chapterTitle;
} }
} }
......
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