1 JsOsaDAS1.001.00bplist00Ñ
\ 1\ 2Vscript_
\11\12dconst internals = {
4 * Config. In most of the cases, you'll only have to modify values here.
9 * Set this to the name of the account you wish to use. Only supports feeds in the same account.
14 * Set this to your music folder. Only supports feeds in the same folder.
16 musicFolder: "155 - music",
19 * Set this to false to do an "initial import" of all your read files.
23 kURLParser: /https?:\/\/[^\s'"><]+/gi,
28 kMatcher: /youtube.com\/embed\/([^?]+)/,
30 return url.match(this.kMatcher);
33 return 'youtube_embed:' + url.match(this.kMatcher)[1];
38 kMatcher: /youtube.com\/watch.*v=([^&]+)/,
40 return url.match(this.kMatcher);
43 return 'youtube_video:' + url.match(this.kMatcher)[1];
48 kMatcher: /youtube.com\/playlist.*list=([^&]+)/,
50 return url.match(this.kMatcher);
53 return 'youtube_playlist:' + url.match(this.kMatcher)[1];
59 return url.match(/youtube/);
62 return '!!!!!!!!!!!!!!!!!:' + url
65 // bandcamp embedded track
67 kMatcher: /bandcamp.*EmbeddedPlayer.*track=([0-9]+)/,
69 return url.match(this.kMatcher);
72 return 'bc_embed_track:' + url.match(this.kMatcher)[1];
75 // bandcamp embedded album
77 kMatcher: /bandcamp.*EmbeddedPlayer.*album=([0-9]+)/,
79 return url.match(this.kMatcher);
82 return 'bc_embed_album:' + url.match(this.kMatcher)[1];
88 return url.match(/https?:\/\/([^.]+)\.bandcamp\.com\/album/);
91 return 'bc_album:' + url
97 return url.match(/https?:\/\/([^.]+)\.bandcamp\.com\/track/);
100 return 'bc_track:' + url
105 kMatcher: /https?:\/\/([^.]+)\.bandcamp.com(?:\/music)?/,
107 return url.match(this.kMatcher);
110 return 'bc_artist:' + url.match(this.kMatcher)[1];
113 // bandcamp unmatched
116 return url.match(/bandcamp\.com/);
119 return '!!!!!!!!!!!!!!!!!:' + url
124 kMatcher: /soundcloud.com\/player.*tracks%2F([^&]+)/,
126 return url.match(this.kMatcher);
129 return 'sc_player: ' + url.match(this.kMatcher)[1]
134 kMatcher: /soundcloud.com\/([^\/]+)\/([^\/]+)/,
136 return url.match(this.kMatcher);
139 return 'soundcloud_track: ' + url.match(this.kMatcher)[2]
142 // soundcloud unmatched
145 return url.match(/soundcloud/);
148 return '!!!!!!!!!!!!!!!!!:' + url
153 kMatcher: /spotify.com\/embed\/track\/([^?]+)/,
155 return url.match(this.kMatcher);
158 return 'sp_embed:' + url.match(this.kMatcher)[1];
164 return url.match(/spotify/);
167 return '!!!!!!!!!!!!!!!!!:' + url
172 extractURLsFromFeeds() {
173 const app = Application("NetNewsWire");
174 app.includeStandardAdditions = true;
176 let account = app.accounts.whose({name: internals.config.account})[0];
177 let musicFolder = account.folders.whose({name: internals.config.musicFolder})[0];
178 const feeds = musicFolder.webfeeds();
182 for (const feed of feeds) {
183 const articles = feed.articles()
184 .filter((article) => internals.config.onlyUnread ? !article.read : true);
186 for (const article of articles) {
187 console.log(article.title())
188 const html = article.html();
189 const extractedURLs = html.match(internals.kURLParser) || [];
191 urls.push(...extractedURLs)
198 extractSongsFromURLs(urls) {
203 for (const strategy of internals.strategies) {
204 if (strategy.canHandle(url)) {
205 songs.push(strategy.handle(url))
215 const run = function () {
217 const urls = internals.extractURLsFromFeeds();
218 const songs = internals.extractSongsFromURLs(urls);