Prefer permalink to link when creating a calculated unique ID.

This commit is contained in:
Brent Simmons 2017-12-19 11:19:46 -08:00
parent a3dde79b84
commit fefa96d259
1 changed files with 14 additions and 8 deletions

View File

@ -74,21 +74,31 @@
if (self.datePublished) {
datePublishedTimeStampString = [NSString stringWithFormat:@"%.0f", self.datePublished.timeIntervalSince1970];
}
if (!RSParserStringIsEmpty(self.link) && self.datePublished != nil) {
// Ideally we have a permalink and a pubDate. Either one would probably be a good guid, but together they should be rock-solid. (In theory. Feeds are buggy, though.)
if (!RSParserStringIsEmpty(self.permalink) && datePublishedTimeStampString) {
[s appendString:self.permalink];
[s appendString:datePublishedTimeStampString];
}
else if (!RSParserStringIsEmpty(self.link) && datePublishedTimeStampString) {
[s appendString:self.link];
[s appendString:datePublishedTimeStampString];
}
else if (!RSParserStringIsEmpty(self.title) && self.datePublished != nil) {
else if (!RSParserStringIsEmpty(self.title) && datePublishedTimeStampString) {
[s appendString:self.title];
[s appendString:datePublishedTimeStampString];
}
else if (self.datePublished != nil) {
else if (datePublishedTimeStampString) {
[s appendString:datePublishedTimeStampString];
}
else if (!RSParserStringIsEmpty(self.permalink)) {
[s appendString:self.permalink];
}
else if (!RSParserStringIsEmpty(self.link)) {
[s appendString:self.link];
}
@ -101,10 +111,6 @@
[s appendString:self.body];
}
else if (!RSParserStringIsEmpty(self.permalink)) {
[s appendString:self.permalink];
}
return [s rsparser_md5Hash];
}