Open gameo1 opened 4 years ago
the idea would be to do this in the NSTableView:
if tableColumn == tableView.tableColumns[0] { image = isDir ? NSImage(named: "Folder40x40"): delegate?.getThumb(path: path)//NSImage(named: "File40x40") text = item cellIdentifier = CellIdentifiers.NameCell }
I will find it out later. Maybe can be easily intergated with Kingfisher.
It would be very nice to have a method for use with Kingfisher
type:
let url = URL(string: client.getURLStrOfFile (path: path)
imageView.kf.setImage(with: url)
I await with interest the developments of your Synology Kit.
Done. Please check out the demo for details.
Hi, Thanks for that. I'll check it. Many thanks again
First, a big thanks for the help you are providing. It is really appreciated.
I must confess that I did not see that you provided a project example. In fact I copied the source files in my project and did the same to include the version of AlamoFire you used so that i did not have to use pods or other methods. I just ran your project in the IoS simulator (as not compatible with maOS) and I have still the same issues: quickconnectID is not working, only IP@s and the thumb is not working as well:
screenshot of your app with showThumb = false
screenshot of your app with showThumb = true
screenshot of the same folder in DSAudio
this is of course your last updated version. I'll now dig into it.
PS: to have the thumb of the folder, i changed your code:
func update(_ model: BrowserModel, showThumb: Bool, client: SynologyClient) { self.model = model if model.isDirectory { if showThumb { let thumbURL = client.thumbURL(path: model.path) iconImageView.kf.setImage(with: thumbURL) } else { iconImageView.image = UIImage(named: "Folder_40x40_") } } else { if showThumb { let thumbURL = client.thumbURL(path: model.path) iconImageView.kf.setImage(with: thumbURL) } else { iconImageView.image = UIImage(named: "File_40x40_") } } titleLabel.text = model.name //subTitleLabel.text = // TODO }
It seems that only images thumb are supported, audio files are not supported.
DS aduio is using webapi/AudioStation/cover.cgi
while SynologyKit using webapi/FileStation/entry.cgi
.
You can make a pull request and add it yourself.
It seems that only images thumb are supported, audio files are not supported. DS aduio is using
webapi/AudioStation/cover.cgi
while SynologyKit usingwebapi/FileStation/entry.cgi
. You can make a pull request and add it yourself.
Good point. Thanks a lot. This can close the issue then.
@alexiscn
Your client.thumbURL(path:
work fine.
Thank you.
sorry to get back to it: getThumbOfFile in your kit is making a getStreamData returning when successful a Data result. it turns out to be returning the correct data (at least by checking the size of the Data compared to the size of the file), but, I can't use this data: I know it is an image, so I tried image = NSImage(data: result) where result is coming if the request is successful, which it is. How would you use the Data to create the image? While debugging, I can't see a correct representation in the result content. Thanks P
i also have an advise to ask: I am getting the list of the folder in a func that uses your listFolder. would it be good to have the thumbs at this time or better in the TableViewController, as we dont know how long it can take to get them. What would be your advise? Also, how can it be to get the GetThumOfFile return a NSImage, building it when it is a success? I tried to modify it with -> NSImage, but I cant get the syntax right. Thanks
Hi, I'm trying to create an NSImage from the getThumbOfFile but I cannot understand the result of the query. would you have an example (cocoa swift)? here is what i did:
func getThumb(path:String) -> NSImage { var image = NSImage() client.getThumbOfFile(path: path) { response in switch response { case .success(let result): print("success in getting the thumb\n") print(result.description) //image = NSImage(data: result.base64EncodedData())! case .failure(let error): print(error) } } return image }
many many thanks.