You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.3 KiB
59 lines
1.3 KiB
//
|
|
// Created by Marco Schmickler on 25.05.15.
|
|
// Copyright (c) 2015 Marco Schmickler. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
enum ItemType {
|
|
case FOLDER
|
|
case VIDEO
|
|
case SNAPSHOT
|
|
}
|
|
|
|
class MediaItem : DebugPrintable {
|
|
var name : String
|
|
var path : String
|
|
var root: String
|
|
|
|
var image: UIImage?
|
|
var time: NSTimeInterval?
|
|
var thumbUrl: String?
|
|
|
|
var children: [MediaItem]
|
|
var parent: MediaItem?
|
|
var type: ItemType
|
|
|
|
var loaded = false
|
|
|
|
init(name: String, path: String, root: String, type: ItemType) {
|
|
self.name = name
|
|
self.path = path
|
|
self.root = root
|
|
self.type = type
|
|
children = [MediaItem]()
|
|
}
|
|
|
|
var thumbPath: String {
|
|
let len = count("/srv/samba/ren")
|
|
let tpath = "/srv/samba/ren/thumb" + (root as NSString).substringFromIndex(len) + "/" + path + "/" + name
|
|
let enc = tpath.stringByReplacingOccurrencesOfString(" ", withString: "+")
|
|
|
|
return enc + "/"
|
|
}
|
|
|
|
var thumbUrlAbsolute: String {
|
|
return NetworkManager.sharedInstance.baseurl + "/service/download" + thumbUrl!
|
|
}
|
|
|
|
var fullPath: String {
|
|
let fpath = root + "/" + path + "/" + name
|
|
|
|
return fpath
|
|
}
|
|
|
|
var debugDescription: String {
|
|
return root + " " + path + " " + name
|
|
}
|
|
}
|