2020-02-20 18:25:28 +00:00
|
|
|
//
|
|
|
|
// Tag.swift
|
|
|
|
// Music Tools
|
|
|
|
//
|
|
|
|
// Created by Andy Pack on 20/02/2020.
|
|
|
|
// Copyright © 2020 Sarsoo. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
import SwiftyJSON
|
|
|
|
|
2020-03-20 00:08:18 +00:00
|
|
|
class Tag: Identifiable, Equatable, Codable {
|
2020-02-20 18:25:28 +00:00
|
|
|
|
|
|
|
//MARK: Properties
|
|
|
|
|
|
|
|
var tag_id: String
|
|
|
|
var name: String
|
|
|
|
var username: String
|
|
|
|
|
|
|
|
var tracks: [JSON]
|
|
|
|
var albums: [JSON]
|
|
|
|
var artists: [JSON]
|
|
|
|
|
2020-03-07 22:30:18 +00:00
|
|
|
var all: [JSON] {
|
|
|
|
get {
|
|
|
|
return tracks + albums + artists
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-20 18:25:28 +00:00
|
|
|
var count: Int
|
|
|
|
var proportion: Double
|
|
|
|
var total_user_scrobbles: Int
|
|
|
|
|
2020-03-20 00:08:18 +00:00
|
|
|
var last_updated: String?
|
2020-02-20 18:25:28 +00:00
|
|
|
|
|
|
|
//MARK: Initialization
|
|
|
|
|
|
|
|
init(tag_id: String,
|
|
|
|
name: String,
|
|
|
|
username: String,
|
2020-03-06 23:36:51 +00:00
|
|
|
|
2020-02-20 18:25:28 +00:00
|
|
|
tracks: [JSON],
|
|
|
|
albums: [JSON],
|
|
|
|
artists: [JSON],
|
2020-03-06 23:36:51 +00:00
|
|
|
|
2020-02-20 18:25:28 +00:00
|
|
|
count: Int,
|
|
|
|
proportion: Double,
|
|
|
|
total_user_scrobbles: Int,
|
2020-03-06 23:36:51 +00:00
|
|
|
|
2020-03-20 00:08:18 +00:00
|
|
|
last_updated: String?){
|
2020-03-06 23:36:51 +00:00
|
|
|
|
2020-02-20 18:25:28 +00:00
|
|
|
self.tag_id = tag_id
|
|
|
|
self.name = name
|
|
|
|
self.username = username
|
2020-03-06 23:36:51 +00:00
|
|
|
|
2020-02-20 18:25:28 +00:00
|
|
|
self.tracks = tracks
|
|
|
|
self.albums = albums
|
|
|
|
self.artists = artists
|
2020-03-06 23:36:51 +00:00
|
|
|
|
2020-02-20 18:25:28 +00:00
|
|
|
self.count = count
|
|
|
|
self.proportion = proportion
|
|
|
|
self.total_user_scrobbles = total_user_scrobbles
|
2020-03-06 23:36:51 +00:00
|
|
|
|
2020-02-20 18:25:28 +00:00
|
|
|
self.last_updated = last_updated
|
|
|
|
}
|
|
|
|
|
|
|
|
static func == (lhs: Tag, rhs: Tag) -> Bool {
|
|
|
|
return lhs.tag_id == rhs.tag_id
|
|
|
|
// && lhs.username == rhs.username
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|