 import RxSwift
 import SnapKit
 import iTunesMusic
+
+
+extension Track {
+
+    var time: String {
+        let seconds = duration / 1000
+        return "\(seconds/60):\(String(format: "%02d", seconds%60))"
+    }
+}
 
 
 fileprivate final class HeaderView: UIView {

            make.width.equalTo(tableView.snp.width)
            make.height.equalTo(264)
        }
        headerView.artworkImageView.setArtwork(of: album.collection, size: view.frame.width)

        title = album.collection.name

        let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! TableViewCell
        let track = album[indexPath.row]

        cell.titleLabel.text = track.name

        cell.durationLabel.text = track.time
        if track.canPreview {
            cell.titleLabel.textColor = UIColor.black
            cell.selectionStyle = .default
        } else {
            cell.titleLabel.textColor = UIColor.lightGray
            cell.selectionStyle = .none
        }

        cell.button.removeTarget(nil, action: nil, for: [])
        cell.button.addTarget(self, action: #selector(self.addPlaylist(_:event:)), for: .touchUpInside)

