<commit_before>//
//  Media.swift
//  Meow
//
//  Created by 林武威 on 2017/6/30.
//  Copyright © 2017年 喵喵喵的伙伴. All rights reserved.
//


import SwiftyJSON

enum MediaType: Int {
    case Image = 0, Video = 1
}

struct Media {
    var type: MediaType?
    var thumbnail: URL?
    var url: URL?
}

extension Media: JSONConvertible {
    static func fromJSON(_ json: JSON) -> Media? {
        var media = self.init()
        guard let type = json["type"].int else { return nil}
        
        media.type = MediaType.init(rawValue: type)
        media.url <- json["url"]
        media.thumbnail <- json["thumbnail"]
        return media
    }
}<commit_msg>Fix media model<commit_after>//
//  Media.swift
//  Meow
//
//  Created by 林武威 on 2017/6/30.
//  Copyright © 2017年 喵喵喵的伙伴. All rights reserved.
//


import SwiftyJSON

enum MediaType: String {
    case Image = "Image", Video = "Video"
}

struct Media {
    var type: MediaType?
    var url: URL?
}

extension Media: JSONConvertible {
    static func fromJSON(_ json: JSON) -> Media? {
        var media = self.init()
        guard let type = json["type"].string else { return nil}
        
        media.type = MediaType.init(rawValue: type)
        media.url <- json["url"]
        return media
    }
}
{'fraction_non_alphanumeric': 0.1250996015936255, 'fraction_numerical': 0.019123505976095617, 'mean_word_length': 2.1959287531806617, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3343398', 'n_tokens_mistral': 461, 'n_tokens_neox': 430, 'n_words': 125}