2020-02-20 18:25:28 +00:00
|
|
|
//
|
|
|
|
// Tag.swift
|
2022-08-07 13:31:15 +01:00
|
|
|
// Mixonomer
|
2020-02-20 18:25:28 +00:00
|
|
|
//
|
|
|
|
// 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
|
2020-04-30 17:05:23 +01:00
|
|
|
// var username: String
|
2020-02-20 18:25:28 +00:00
|
|
|
|
|
|
|
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
|
2020-04-30 17:05:23 +01:00
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|