diff --git a/rss-to-tana/index.js b/rss-to-tana/index.js index 6fef390..e25c987 100644 --- a/rss-to-tana/index.js +++ b/rss-to-tana/index.js @@ -7,18 +7,88 @@ const Tana = require('./tana'); const parser = new RSSParser(); +const schedules = { + twiceAtNight: '0 0 23,6 * * *', // 23:00 and 06:00 every day + everyHour: '0 0 * * * *', // every hour every day +} + const rssFeeds = [ + // Music { url: 'https://lesoreillescurieuses.com/feed/', - cron: '0 0 23,6 * * *', // 23:00 and 06:00 every day + cron: schedules.twiceAtNight, toTana: Tana.album, }, { url: 'https://cmd.wuips.com/rss/feed.xml', - cron: '0 0 * * * *', // every hour every day + cron: schedules.everyHour, + toTana: Tana.music, + }, + { + url: 'http://pitchfork.com/rss/reviews/best/albums/', + cron: schedules.twiceAtNight, + toTana: Tana.album, + }, + { + url: 'https://www.prun.net/emission/8MNV-iss/rss', + cron: schedules.twiceAtNight, + toTana: Tana.music, + }, + { + url: 'https://stnt.org/rss.xml', + cron: schedules.twiceAtNight, + toTana: Tana.album, + }, + { + url: 'https://www.tsugi.fr/feed/', + cron: schedules.twiceAtNight, + toTana: Tana.album, + }, + + // Tech + { + // Codrops + url: 'http://feeds2.feedburner.com/tympanus', + cron: schedules.everyHour, + toTana: Tana.website, + }, + { + url: 'https://leaddev.com/content-piece-and-series/rss.xml', + cron: schedules.everyHour, + toTana: Tana.website, + }, + { + // Thoughtworks Technology Podcast + url: 'http://feeds.soundcloud.com/users/soundcloud:users:94605026/sounds.rss', + cron: schedules.everyHour, + toTana: Tana.website, + }, + + // Design + { + url: 'http://minimalissimo.com/feed/', + cron: schedules.twiceAtNight, + toTana: Tana.website, + }, + + // Personal Development + { + url: 'http://feeds.feedburner.com/zenhabits', + cron: schedules.twiceAtNight, toTana: Tana.website, }, + // Others + { + url: 'http://www.lesothers.com/feed/', + cron: schedules.twiceAtNight, + toTana: Tana.website, + }, + { + url: 'https://worksinprogress.substack.com/feed/', + cron: schedules.twiceAtNight, + toTana: Tana.website, + } ]; function parseFeed(feed) { @@ -32,7 +102,7 @@ function parseFeed(feed) { if (pubDate > lastRunDate) { console.log(feed.url, `new ${item.title} detected`); - const tanaNode = feed.toTana(item) + const tanaNode = feed.toTana(feed.url, item) saveItem(tanaNode); } } diff --git a/rss-to-tana/tana.js b/rss-to-tana/tana.js index 7d26a9e..aec5bc0 100644 --- a/rss-to-tana/tana.js +++ b/rss-to-tana/tana.js @@ -1,4 +1,44 @@ -function album(item) { +function source(feedUrl) { + return { + /* Source */ + type: "field", + attributeId: "SalqarOgiv", + children: [ + { + name: `RSS to Tana - ${feedUrl}` + } + ] + } +} + +function title(item) { + return { + /* Title */ + type: 'field', + attributeId: 'ksBOEhsvfu', + children: [ + { + name: item.title, + } + ] + } +} + +function url(item) { + return { + /* URL */ + type: 'field', + attributeId: 'S4UUISQkxn2X', + children: [ + { + dataType: 'url', + name: item.link + } + ] + } +} + +function album(feedUrl, item) { return { name: item.title, supertags: [ @@ -8,31 +48,31 @@ function album(item) { }, ], children: [ + title(item), + url(item), + source(feedUrl) + ] + } +} + +function music(feedUrl, item) { + return { + name: item.title, + supertags: [ { - /* Title */ - type: 'field', - attributeId: 'ksBOEhsvfu', - children: [ - { - name: item.title, - } - ] + /* Music */ + id: 'VI7FwJEpFAqY' }, - { - /* Source */ - type: 'field', - attributeId: 'SalqarOgiv', - children: [ - { - name: item.link - } - ] - } + ], + children: [ + title(item), + url(item), + source(feedUrl) ] } } -function website(item) { +function website(feedUrl, item) { return { name: item.title, supertags: [ @@ -42,22 +82,14 @@ function website(item) { } ], children: [ - { - /* URL */ - type: 'field', - attributeId: 'S4UUISQkxn2X', - children: [ - { - dataType: 'url', - name: item.link - } - ] - }, + url(item), + source(feedUrl) ] } } module.exports = { album, + music, website, }