Commit 98e4fda6 authored by Soomin Lee's avatar Soomin Lee

VLCPlaylistCollectionViewCell: Handle formatting inside modelview

parent 831ead30
...@@ -36,3 +36,12 @@ extension VideoModel: MediaLibraryObserver { ...@@ -36,3 +36,12 @@ extension VideoModel: MediaLibraryObserver {
updateView?() updateView?()
} }
} }
extension VLCMLMedia {
@objc func formatDuration(ofMedia media: VLCMLMedia) -> String {
return String(format: "%@ - %@",
VLCTime(int: Int32(media.duration())),
ByteCountFormatter.string(fromByteCount: Int64(media.mainFile().size()),
countStyle: .file))
}
}
...@@ -16,8 +16,7 @@ ...@@ -16,8 +16,7 @@
#import "VLCPlaylistCollectionViewCell.h" #import "VLCPlaylistCollectionViewCell.h"
#import "VLCThumbnailsCache.h" #import "VLCThumbnailsCache.h"
#import "NSString+SupportedMedia.h" #import "NSString+SupportedMedia.h"
#import "VLC-Swift.h"
#import <VLCMediaLibraryKit/VLCMLFile.h>
@interface VLCPlaylistCollectionViewCell () @interface VLCPlaylistCollectionViewCell ()
{ {
...@@ -211,9 +210,7 @@ ...@@ -211,9 +210,7 @@
- (void)_updateDisplayedInformations - (void)_updateDisplayedInformations
{ {
_titleLabel.text = _media.title; _titleLabel.text = _media.title;
_subtitleLabel.text = [NSString stringWithFormat:@"%@ — %@", [VLCTime timeWithNumber:[NSNumber numberWithLongLong:_media.duration]], _subtitleLabel.text = [_media formatDurationOfMedia:_media];
[NSByteCountFormatter stringFromByteCount:[_media.mainFile size] countStyle:NSByteCountFormatterCountStyleFile]];
} }
- (void)_updatedDisplayedInformationForKeyPath:(NSString *)keyPath - (void)_updatedDisplayedInformationForKeyPath:(NSString *)keyPath
......
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