2017-06-21 07:00:19 +02:00
|
|
|
//
|
|
|
|
// ParsedItem.swift
|
|
|
|
// RSParser
|
|
|
|
//
|
|
|
|
// Created by Brent Simmons on 6/20/17.
|
|
|
|
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
2017-07-03 20:20:14 +02:00
|
|
|
public struct ParsedItem: Hashable {
|
2017-06-21 07:00:19 +02:00
|
|
|
|
2017-09-02 23:19:42 +02:00
|
|
|
public let syncServiceID: String? //Nil when not syncing
|
|
|
|
public let uniqueID: String //RSS guid, for instance; may be calculated
|
2017-07-02 02:22:19 +02:00
|
|
|
public let feedURL: String
|
2017-06-21 07:00:19 +02:00
|
|
|
public let url: String?
|
|
|
|
public let externalURL: String?
|
|
|
|
public let title: String?
|
|
|
|
public let contentHTML: String?
|
|
|
|
public let contentText: String?
|
|
|
|
public let summary: String?
|
|
|
|
public let imageURL: String?
|
|
|
|
public let bannerImageURL: String?
|
|
|
|
public let datePublished: Date?
|
|
|
|
public let dateModified: Date?
|
|
|
|
public let authors: [ParsedAuthor]?
|
|
|
|
public let tags: [String]?
|
|
|
|
public let attachments: [ParsedAttachment]?
|
2017-07-03 20:20:14 +02:00
|
|
|
public let hashValue: Int
|
|
|
|
|
2017-09-02 23:19:42 +02:00
|
|
|
init(syncServiceID: String?, uniqueID: String, feedURL: String, url: String?, externalURL: String?, title: String?, contentHTML: String?, contentText: String?, summary: String?, imageURL: String?, bannerImageURL: String?, datePublished: Date?, dateModified: Date?, authors: [ParsedAuthor]?, tags: [String]?, attachments: [ParsedAttachment]?) {
|
2017-06-25 19:23:30 +02:00
|
|
|
|
2017-09-02 23:19:42 +02:00
|
|
|
self.syncServiceID = syncServiceID
|
2017-06-25 19:23:30 +02:00
|
|
|
self.uniqueID = uniqueID
|
2017-07-02 02:22:19 +02:00
|
|
|
self.feedURL = feedURL
|
2017-06-25 19:23:30 +02:00
|
|
|
self.url = url
|
|
|
|
self.externalURL = externalURL
|
|
|
|
self.title = title
|
|
|
|
self.contentHTML = contentHTML
|
|
|
|
self.contentText = contentText
|
|
|
|
self.summary = summary
|
|
|
|
self.imageURL = imageURL
|
|
|
|
self.bannerImageURL = bannerImageURL
|
|
|
|
self.datePublished = datePublished
|
|
|
|
self.dateModified = dateModified
|
|
|
|
self.authors = authors
|
|
|
|
self.tags = tags
|
|
|
|
self.attachments = attachments
|
2017-09-03 01:08:02 +02:00
|
|
|
self.hashValue = feedURL.hashValue ^ uniqueID.hashValue
|
2017-07-03 20:20:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public static func ==(lhs: ParsedItem, rhs: ParsedItem) -> Bool {
|
|
|
|
|
|
|
|
return lhs.hashValue == rhs.hashValue && lhs.uniqueID == rhs.uniqueID && lhs.feedURL == rhs.feedURL
|
2017-06-25 19:23:30 +02:00
|
|
|
}
|
2017-06-21 07:00:19 +02:00
|
|
|
}
|
2017-06-25 19:23:30 +02:00
|
|
|
|