· 4 years ago · Apr 08, 2021, 02:56 AM
1[{"id":"59fd6661.f8f6e8","type":"tab","label":"files","disabled":false,"info":""},{"id":"f5cfc1d5.2e12b","type":"tab","label":"interface","disabled":false,"info":""},{"id":"a3bfbfcd.c2691","type":"tab","label":"ws","disabled":false,"info":""},{"id":"7897ac1d.896074","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"34b586c4.b5bb5a","type":"sqlitedb","z":"","db":"/usr/local/lib/node_modules/node-red/_podcasts.db"},{"id":"aaba90ac.0d1fd","type":"websocket-listener","z":"a3bfbfcd.c2691","path":"/","wholemsg":"false"},{"id":"e774401f.a24ba","type":"sqlitedb","z":"","db":"/usr/local/lib/node_modules/node-red/db/devs.db","mode":"RWC"},{"id":"c5beb7f8.89de18","type":"inject","z":"59fd6661.f8f6e8","name":"","topic":"","payload":"","payloadType":"date","repeat":"28800","crontab":"","once":false,"onceDelay":0.1,"x":430,"y":60,"wires":[["a8588ab2.ff2de8"]]},{"id":"a8588ab2.ff2de8","type":"function","z":"59fd6661.f8f6e8","name":"get pods list","func":"msg.topic=\"SELECT * from podcasts\";\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":100,"wires":[["dbf3f36c.4ffe"]]},{"id":"dbf3f36c.4ffe","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","name":"podcasts","x":420,"y":140,"wires":[["f4fad85f.389de8"]]},{"id":"9f8ae7.68f62518","type":"debug","z":"59fd6661.f8f6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":410,"y":620,"wires":[]},{"id":"f4fad85f.389de8","type":"function","z":"59fd6661.f8f6e8","name":"cycle through list","func":"var podcasts=msg.payload;\nfor (i=0;i<podcasts.length;i++){\n var lastPodcast=0;\n if (i==podcasts.length-1) {\n lastPodcast=1\n }\n node.send({\n topic:\"SELECT * FROM podcast_\"+podcasts[i].podcastid,\n podcastId:podcasts[i].podcastid,\n podcastUrl:podcasts[i].podcasturl,\n lastPodcast:lastPodcast\n });\n}","outputs":1,"noerr":0,"x":450,"y":180,"wires":[["8ef30779.bc5368"]]},{"id":"ab4118be.9d1ef8","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":420,"y":260,"wires":[["a2cab5fb.3feb18"]]},{"id":"a2cab5fb.3feb18","type":"function","z":"59fd6661.f8f6e8","name":"set url","func":"msg.oldEpisodes=msg.payload;\nmsg.url=msg.podcastUrl;\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":300,"wires":[["be8c0c89.540f6"]]},{"id":"c9557f81.f456d","type":"http request","z":"59fd6661.f8f6e8","name":"get feed","method":"GET","ret":"txt","url":"","tls":"","x":420,"y":380,"wires":[["ec26bd0f.865e5"]]},{"id":"ec26bd0f.865e5","type":"xml","z":"59fd6661.f8f6e8","name":"parse feed","property":"payload","attr":"","chr":"","x":430,"y":420,"wires":[["26b89008.6fc78"]]},{"id":"26b89008.6fc78","type":"function","z":"59fd6661.f8f6e8","name":"map fields","func":"msg.newEpisodes=[];\nvar items=msg.payload.rss.channel[0].item;\n\nfor (i=0;i<items.length;i++) {\n \n if (items[i].guid[0]._) {\n items[i].guid[0]=items[i].guid[0]._;\n }\n \n var description=items[i].description[0].replace(/(<([^>]+)>)/ig,\"\");\n \n //items[i].title[0]=items[i].title[0].replace(/(\\r\\n|\\n|\\r)/gm, \"\");\n if (typeof items[i].guid != 'undefined' && typeof items[i].enclosure != 'undefined' && typeof items[i].title != 'undefined' && typeof items[i].pubDate != 'undefined') {\n \n var duration=0;\n if (typeof items[i][\"itunes:duration\"]!=\"undefined\") {\n duration=convertDuration(items[i][\"itunes:duration\"][0]);\n }\n\n msg.newEpisodes.push({\n guid:items[i].guid[0].replace(/[^a-z0-9]/gi, '_').toLowerCase(),\n url:items[i].enclosure[0].$.url,\n title:items[i].title[0],\n date:items[i].pubDate[0],\n /*length:convertDuration(items[i][\"itunes:duration\"][0])*/\n duration:duration,\n description:description\n });\n }\n \n}\n\nfunction convertDuration(duration) {\n //if duration contains 2 instances of \":\"\n if ((duration.match(/:/g) || []).length==2) {\n var a = duration.split(':');\n var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]);\n duration=seconds;\n }\n //if duration contains 1 instance of \":\"\n else if ((duration.match(/:/g) || []).length==1) {\n var h=\"00:\"\n duration=h.concat(duration);\n var a = duration.split(':');\n var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]);\n duration=seconds;\n }\n \n //if duration contains 0 instances of \":\"\n else if ((duration.match(/:/g) || []).length==0) {\n duration=parseInt(duration);\n }\n return duration;\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"x":430,"y":460,"wires":[["610f4b57.c0f6e4"]]},{"id":"610f4b57.c0f6e4","type":"function","z":"59fd6661.f8f6e8","name":"send to db","func":"for (i=msg.newEpisodes.length-1;i>-1;i--) {\n checkAndAdd(msg.newEpisodes[i].guid,msg.newEpisodes[i].url,msg.newEpisodes[i].title,msg.newEpisodes[i].date,msg.newEpisodes[i].duration,msg.newEpisodes[i].description);\n}\n\nfunction checkAndAdd(guid,url,title,date,duration,description) {\n var id = msg.oldEpisodes.length + 1;\n var found = msg.oldEpisodes.some(function (el) {\n return el.episodeguid === guid;\n });\n if (!found) {\n node.send({\n topic:\"INSERT OR REPLACE INTO podcast_\"+msg.podcastId+\" (episodeguid,episodeurl,episodetitle,episodefile,episodedate,episodeduration,episodeplayed,episodearchived,episodeplayedlast,episodeplayedtimestamp,episodedownloaded,episodequeued,episodedescription) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)\",\n payload:[guid,url,title,title.replace(/[^a-z0-9()]/gi, '_').toLowerCase(),date,duration,0,0,0,0,0,0,description]\n });\n\n }\n}\n\nif (msg.lastPodcast==1) {\n node.send({\n topic:\"SELECT sqlite_version();\",\n lastPodcast:msg.lastPodcast\n });\n}\n\n//return msg;","outputs":1,"noerr":0,"x":430,"y":500,"wires":[["74f63b53.4453a4"]]},{"id":"5359f62a.88c378","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":420,"y":580,"wires":[["9f8ae7.68f62518","c5c7a52a.ccfa58"]]},{"id":"8ef30779.bc5368","type":"delay","z":"59fd6661.f8f6e8","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":440,"y":220,"wires":[["ab4118be.9d1ef8"]]},{"id":"74f63b53.4453a4","type":"delay","z":"59fd6661.f8f6e8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"15","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":440,"y":540,"wires":[["5359f62a.88c378"]]},{"id":"be8c0c89.540f6","type":"delay","z":"59fd6661.f8f6e8","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":440,"y":340,"wires":[["c9557f81.f456d"]]},{"id":"a9b58b32.5238a8","type":"http request","z":"59fd6661.f8f6e8","name":"get mp3","method":"GET","ret":"bin","url":"","tls":"","x":1000,"y":260,"wires":[["2d5a9da0.f0bd22"]]},{"id":"bb978172.5340c","type":"debug","z":"59fd6661.f8f6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":990,"y":620,"wires":[]},{"id":"29a02279.7494ee","type":"function","z":"59fd6661.f8f6e8","name":"","func":"delete msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":990,"y":340,"wires":[["96a1008a.734c1"]]},{"id":"2d5a9da0.f0bd22","type":"file","z":"59fd6661.f8f6e8","name":"save mp3","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"true","x":1000,"y":300,"wires":[["29a02279.7494ee"]]},{"id":"8dcc69c5.efe8d8","type":"inject","z":"59fd6661.f8f6e8","name":"","topic":"","payload":"","payloadType":"date","repeat":"86400","crontab":"","once":false,"onceDelay":0.1,"x":750,"y":60,"wires":[["36a94f3a.5e26a"]]},{"id":"36a94f3a.5e26a","type":"function","z":"59fd6661.f8f6e8","name":"get pods list","func":"msg.topic=\"SELECT * from podcasts\";\nreturn msg;","outputs":1,"noerr":0,"x":750,"y":100,"wires":[["39f53f05.e6934"]]},{"id":"39f53f05.e6934","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":740,"y":140,"wires":[["72c3d4fb.cc82ec"]]},{"id":"72c3d4fb.cc82ec","type":"function","z":"59fd6661.f8f6e8","name":"cycle through list","func":"var podcasts=msg.payload;\nfor (i=0;i<podcasts.length;i++){\n var lastPodcast=0;\n if (i==podcasts.length-1) {\n lastPodcast=1\n }\n node.send({\n topic:\"SELECT * FROM podcast_\"+podcasts[i].podcastid+\" WHERE episodedownloaded=0 and episodequeued=0\",\n podcastId:podcasts[i].podcastid,\n podcastTitle:podcasts[i].podcasttitle,\n podcastPath:podcasts[i].podcastpath,\n podcastUrl:podcasts[i].podcasturl,\n lastPodcast:lastPodcast\n });\n}","outputs":1,"noerr":0,"x":770,"y":180,"wires":[["f7adb629.148fe8"]]},{"id":"91e80db6.2b9f8","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":740,"y":260,"wires":[["b6dbeec5.9eb89"]]},{"id":"f7adb629.148fe8","type":"delay","z":"59fd6661.f8f6e8","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":750,"y":220,"wires":[["91e80db6.2b9f8"]]},{"id":"b6dbeec5.9eb89","type":"function","z":"59fd6661.f8f6e8","name":"send to queue","func":"var episodes=msg.payload;\nfor (i=0;i<episodes.length;i++) {\n var lastEpisode=0;\n if (i==episodes.length-1) {\n lastEpisode=1\n }\n var episode=episodes[i];\n node.send({\n route:\"1\",\n topic:\"UPDATE podcast_\"+msg.podcastId+\" SET episodequeued='1' WHERE episodeguid='\"+episode.episodeguid+\"'\",\n episodeGuid:episode.episodeguid,\n episodeTitle:episode.episodetitle,\n episodeUrl:episode.episodeurl,\n podcastId:msg.podcastId\n });\n node.send({\n route:\"2\",\n topic:\"INSERT into podcastsqueue (episodeguid,episodetitle,episodefile,episodeurl,episodepodcastid,episodepodcasttitle,episodepodcastpath) VALUES (?,?,?,?,?,?,?)\",\n payload:[episode.episodeguid,episode.episodetitle,episode.episodefile,episode.episodeurl,msg.podcastId,msg.podcastTitle,msg.podcastPath],\n episodeGuid:episode.episodeguid,\n episodeTitle:episode.episodetitle,\n episodeFile:episode.episodefile,\n episodeUrl:episode.episodeurl,\n podcastId:msg.podcastId,\n podcastTitle:msg.podcastTitle,\n podcastPath:msg.podcastPath,\n lastEpisode:lastEpisode,\n lastPodcast:msg.lastPodcast\n });\n}\n","outputs":1,"noerr":0,"x":760,"y":300,"wires":[["564cd721.a54f58"]]},{"id":"f26dd605.4ea198","type":"switch","z":"59fd6661.f8f6e8","name":"","property":"route","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":730,"y":380,"wires":[["371092e.18b746e"],["81a86b05.a2bd48"]]},{"id":"564cd721.a54f58","type":"delay","z":"59fd6661.f8f6e8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"2","nbRateUnits":"0.1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":750,"y":340,"wires":[["f26dd605.4ea198"]]},{"id":"371092e.18b746e","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":740,"y":420,"wires":[["d4f6d07e.6ec6a"]]},{"id":"81a86b05.a2bd48","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":740,"y":460,"wires":[["d4f6d07e.6ec6a"]]},{"id":"13e009b1.e1f596","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":1000,"y":140,"wires":[["6efbc6af.6bc6d8"]]},{"id":"ecf318f7.25b8c8","type":"function","z":"59fd6661.f8f6e8","name":"get queue list","func":"node.send({\n topic:\"SELECT * FROM podcastsqueue LIMIT 1\"\n});\n","outputs":1,"noerr":0,"x":1010,"y":100,"wires":[["13e009b1.e1f596"]]},{"id":"1b5943a8.48f58c","type":"inject","z":"59fd6661.f8f6e8","name":"","topic":"","payload":"","payloadType":"date","repeat":"300","crontab":"","once":false,"onceDelay":0.1,"x":1010,"y":60,"wires":[["ecf318f7.25b8c8"]]},{"id":"6efbc6af.6bc6d8","type":"function","z":"59fd6661.f8f6e8","name":"mapping","func":"if (msg.payload.length>0) {\n var episode=msg.payload[0];\n \n msg.url=episode.episodeurl;\n msg.title=episode.episodetitle;\n msg.guid=episode.episodeguid;\n msg.podcastId=episode.episodepodcastid;\n msg.podcastTitle=episode.episodepodcasttitle;\n msg.podcastPath=episode.episodepodcastpath;\n msg.file=episode.episodefile;\n\n msg.filename=global.get('podcastsPath')+msg.podcastPath+\"/\"+msg.file+\".mp3\";\n \n return msg;\n}\n","outputs":1,"noerr":0,"x":1000,"y":180,"wires":[["d6c26cc.6a3799"]]},{"id":"96a1008a.734c1","type":"switch","z":"59fd6661.f8f6e8","name":"status code","property":"statusCode","propertyType":"msg","rules":[{"t":"eq","v":"200","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1010,"y":380,"wires":[["cded7546.3afa78","1e7410ed.57df3f"]]},{"id":"cded7546.3afa78","type":"function","z":"59fd6661.f8f6e8","name":"set ep as downloaded","func":"node.send({\n topic:\"UPDATE podcast_\"+msg.podcastId+\" SET episodequeued='0', episodedownloaded='1' WHERE episodeguid='\"+msg.guid+\"'\"\n});","outputs":1,"noerr":0,"x":1040,"y":420,"wires":[["c121c5f1.a95be8"]]},{"id":"1e7410ed.57df3f","type":"function","z":"59fd6661.f8f6e8","name":"delete from queue","func":"node.send({\n topic:\"DELETE FROM podcastsqueue WHERE episodeguid='\"+msg.guid+\"'\"\n});","outputs":1,"noerr":0,"x":1030,"y":500,"wires":[["e953bbb4.725808"]]},{"id":"e953bbb4.725808","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":1000,"y":540,"wires":[["a728abb3.b85918","bb978172.5340c"]]},{"id":"d6c26cc.6a3799","type":"fs-ops-access","z":"59fd6661.f8f6e8","name":"","path":"","pathType":"str","filename":"filename","filenameType":"msg","read":true,"write":false,"throwerror":false,"x":1010,"y":220,"wires":[["cded7546.3afa78","1e7410ed.57df3f"],["a9b58b32.5238a8"]]},{"id":"c5c7a52a.ccfa58","type":"function","z":"59fd6661.f8f6e8","name":"","func":"if (msg.lastPodcast==1) {\n node.send({lastPodcast:msg.lastPodcast});\n}","outputs":1,"noerr":0,"x":590,"y":300,"wires":[["36a94f3a.5e26a"]]},{"id":"95acd1fb.6a2ff","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":120,"y":660,"wires":[["82ac96fb.36ebf8","819d8363.36877"]]},{"id":"6a5cf4a8.ed447c","type":"function","z":"59fd6661.f8f6e8","name":"create pod. table","func":"msg.topic = \"CREATE TABLE IF NOT EXISTS `podcast_\"+msg.payload[0].podcastid+\"` (`episodeguid`\tTEXT,`episodeurl`\tTEXT,`episodetitle`\tTEXT,`episodefile`\tTEXT,`episodedate`\tTEXT,`episodeduration`\tNUMERIC,`episodeplayed`\tINTEGER,`episodearchived`\tINTEGER,`episodeplayedlast`\tINTEGER,`episodeplayedtimestamp`\tINTEGER,`episodequeued`\tINTEGER,`episodedownloaded`\tINTEGER,`episodedescription`\tTEXT,PRIMARY KEY(episodeguid))\";\nreturn msg;","outputs":1,"noerr":0,"x":150,"y":620,"wires":[["95acd1fb.6a2ff"]]},{"id":"82ac96fb.36ebf8","type":"debug","z":"59fd6661.f8f6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":110,"y":700,"wires":[]},{"id":"b1a89ab2.ff70d8","type":"http request","z":"59fd6661.f8f6e8","name":"get feed","method":"GET","ret":"txt","url":"","tls":"","x":120,"y":140,"wires":[["4f134e43.b1255"]]},{"id":"df3bffd8.a0987","type":"inject","z":"59fd6661.f8f6e8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":60,"wires":[["165a410d.cf16df"]]},{"id":"4f134e43.b1255","type":"xml","z":"59fd6661.f8f6e8","name":"parse xml","property":"payload","attr":"","chr":"","x":120,"y":180,"wires":[["2dc76fb3.da224"]]},{"id":"165a410d.cf16df","type":"function","z":"59fd6661.f8f6e8","name":"set link","func":"node.send({\n url:\"https://feeds.megaphone.fm/unexplainable\"\n});\n","outputs":1,"noerr":0,"x":120,"y":100,"wires":[["b1a89ab2.ff70d8"]]},{"id":"2dc76fb3.da224","type":"function","z":"59fd6661.f8f6e8","name":"map url,title,img","func":"//var url=msg.payload.rss.channel[0].title[0];\nmsg.podcastUrl=msg.url;\nmsg.podcastTitle=msg.payload.rss.channel[0].title[0];\n\nif (typeof msg.payload.rss.channel[0][\"itunes:image\"] != \"undefined\") {\n msg.podcastImage=msg.payload.rss.channel[0][\"itunes:image\"][0].$.href;\n}\nelse {\n msg.podcastImage=msg.payload.rss.channel[0].image[0].url[0];\n}\n\n\nmsg.url=msg.podcastImage;\n\nreturn msg;","outputs":1,"noerr":0,"x":140,"y":220,"wires":[["30dfc2da.cae6be"]]},{"id":"6bd9a566.ec8d1c","type":"function","z":"59fd6661.f8f6e8","name":"set path","func":"msg.podcastPath=global.get('podcastsPath')+msg.podcastTitle.replace(/[^a-z0-9()]/gi, '_').toLowerCase()+\"/\"\n\nmsg.filename=msg.podcastPath+\"podcast-cover.png\";\n\nreturn msg;","outputs":1,"noerr":0,"x":120,"y":300,"wires":[["a13fb392.d52c1"]]},{"id":"37fbaae4.928a96","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":120,"y":500,"wires":[["27191515.7afb2a"]]},{"id":"30dfc2da.cae6be","type":"http request","z":"59fd6661.f8f6e8","name":"get cover img","method":"GET","ret":"bin","url":"","tls":"","x":140,"y":260,"wires":[["6bd9a566.ec8d1c"]]},{"id":"4f065a90.f55c04","type":"function","z":"59fd6661.f8f6e8","name":"add pod to table","func":"msg.topic = \"INSERT OR REPLACE INTO podcasts (podcasturl,podcasttitle,podcastpath) VALUES (?,?,?)\";\nmsg.payload = [msg.podcastUrl,msg.podcastTitle,msg.podcastTitle.replace(/[^a-z0-9()]/gi, '_').toLowerCase()];\n\nreturn msg;","outputs":1,"noerr":0,"x":140,"y":460,"wires":[["37fbaae4.928a96"]]},{"id":"e24e133b.4d1b","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":120,"y":580,"wires":[["6a5cf4a8.ed447c"]]},{"id":"27191515.7afb2a","type":"function","z":"59fd6661.f8f6e8","name":"get pod. id","func":"msg.topic=\"SELECT podcastid from podcasts WHERE podcasttitle='\"+msg.podcastTitle.replace(/[']/gi, \"''\")+\"'\"; \n\n//replace ' with '' to escape it (eg skeptics' guid => skeptics'' guide)\n\nreturn msg;","outputs":1,"noerr":0,"x":130,"y":540,"wires":[["e24e133b.4d1b"]]},{"id":"17763d61.7cd483","type":"file","z":"59fd6661.f8f6e8","name":"","filename":"save cover","appendNewline":true,"createDir":true,"overwriteFile":"true","x":130,"y":420,"wires":[["4f065a90.f55c04"]]},{"id":"cdb6d43c.a35458","type":"fs-ops-access","z":"59fd6661.f8f6e8","name":"check if cover","path":"","pathType":"str","filename":"filename","filenameType":"msg","read":true,"write":false,"throwerror":false,"x":140,"y":380,"wires":[["4f065a90.f55c04"],["17763d61.7cd483"]]},{"id":"84257c93.6b885","type":"inject","z":"59fd6661.f8f6e8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":800,"wires":[["38a1694b.2b5816"]]},{"id":"6c909cc1.7dcbb4","type":"function","z":"59fd6661.f8f6e8","name":"delete pod from db","func":"msg.topic=\"DELETE FROM podcasts WHERE podcastid='\"+msg.podcastId+\"'\";\nreturn msg;","outputs":1,"noerr":0,"x":170,"y":1000,"wires":[["8aa7b6de.647848"]]},{"id":"8aa7b6de.647848","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":140,"y":1040,"wires":[["912ccb77.49be78"]]},{"id":"912ccb77.49be78","type":"function","z":"59fd6661.f8f6e8","name":"delete from queue","func":"msg.topic=\"DELETE FROM podcastsqueue WHERE episodepodcastid='\"+msg.podcastId+\"'\";\nreturn msg;","outputs":1,"noerr":0,"x":170,"y":1080,"wires":[["a0802b51.17a3c8"]]},{"id":"f1274aad.ade8c8","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":140,"y":1200,"wires":[["69a273ad.5e455c"]]},{"id":"b56fe199.636ba","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","name":"podcasts","x":140,"y":920,"wires":[["66e70028.757f2"]]},{"id":"81f61c9c.99023","type":"function","z":"59fd6661.f8f6e8","name":"get pods list","func":"msg.topic=\"SELECT * from podcasts\";\nreturn msg;","outputs":1,"noerr":0,"x":150,"y":880,"wires":[["b56fe199.636ba"]]},{"id":"38a1694b.2b5816","type":"function","z":"59fd6661.f8f6e8","name":"set pod id","func":"msg.podcastId=40;\nreturn msg;","outputs":1,"noerr":0,"x":140,"y":840,"wires":[["81f61c9c.99023"]]},{"id":"66e70028.757f2","type":"function","z":"59fd6661.f8f6e8","name":"set pod path","func":"for (i=0;i<msg.payload.length;i++){\n if(msg.podcastId==msg.payload[i].podcastid) {\n msg.podcastPath=msg.payload[i].podcastpath\n delete msg.payload;\n delete msg.topic;\n return msg;\n }\n}","outputs":1,"noerr":0,"x":150,"y":960,"wires":[["6c909cc1.7dcbb4"]]},{"id":"69a273ad.5e455c","type":"function","z":"59fd6661.f8f6e8","name":"set path","func":"msg.filename=global.get('podcastsPath')+msg.podcastPath\nreturn msg;","outputs":1,"noerr":0,"x":140,"y":1240,"wires":[["9ce9dda6.224bf"]]},{"id":"9ce9dda6.224bf","type":"fs-ops-dir","z":"59fd6661.f8f6e8","name":"","path":"filename","pathType":"msg","filter":"*","filterType":"str","dir":"files","dirType":"msg","x":140,"y":1280,"wires":[["ed6b7c52.6ed6c"]]},{"id":"ed6b7c52.6ed6c","type":"fs-ops-delete","z":"59fd6661.f8f6e8","name":"","path":"filename","pathType":"msg","filename":"files","filenameType":"msg","x":150,"y":1320,"wires":[["680c8e33.b421e"]]},{"id":"680c8e33.b421e","type":"fs-ops-delete","z":"59fd6661.f8f6e8","name":"","path":"","pathType":"str","filename":"filename","filenameType":"msg","x":150,"y":1360,"wires":[["e7a25d8b.b598"]]},{"id":"17c8bae3.71b865","type":"function","z":"7897ac1d.896074","name":"","func":"//msg.topic=\"INSERT OR REPLACE INTO podcast_1 () VALUES ();\n\nmsg.topic=\"UPDATE podcast_1 SET episodequeued='0' WHERE episodeguid='urn_bbc_podcast_p04dhs7p'\"\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":160,"wires":[["940c9ff7.1370a"]]},{"id":"940c9ff7.1370a","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":560,"y":200,"wires":[["29d363a5.0c257c"]]},{"id":"6fc57dd8.926c94","type":"inject","z":"7897ac1d.896074","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":560,"y":120,"wires":[["17c8bae3.71b865"]]},{"id":"29d363a5.0c257c","type":"debug","z":"7897ac1d.896074","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":550,"y":240,"wires":[]},{"id":"d617eb20.2d94c8","type":"inject","z":"7897ac1d.896074","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":800,"y":120,"wires":[["895834ed.b02f38"]]},{"id":"895834ed.b02f38","type":"function","z":"7897ac1d.896074","name":"","func":"msg.topic=\"SELECT * from podcasts\";\nreturn msg;","outputs":1,"noerr":0,"x":790,"y":160,"wires":[["d681f113.c580c"]]},{"id":"d681f113.c580c","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","name":"podcasts","x":800,"y":200,"wires":[["d1f9df1c.6e709"]]},{"id":"d1f9df1c.6e709","type":"function","z":"7897ac1d.896074","name":"","func":"podcasts=msg.payload;\nfor (i=0;i<podcasts.length;i++){\n node.send({topic:\"SELECT * FROM podcast_\"+podcasts[i].podcastid+\" WHERE episodequeued='1'\",podcastId:podcasts[i].podcastid,podcastUrl:podcasts[i].podcasturl})\n}","outputs":1,"noerr":0,"x":790,"y":240,"wires":[["e3329f82.f2722"]]},{"id":"f3a183e9.bfbb5","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":800,"y":320,"wires":[["66763415.3333bc"]]},{"id":"e3329f82.f2722","type":"delay","z":"7897ac1d.896074","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":810,"y":280,"wires":[["f3a183e9.bfbb5"]]},{"id":"66763415.3333bc","type":"function","z":"7897ac1d.896074","name":"","func":"//msg.topic=\"INSERT OR REPLACE INTO podcast_1 () VALUES ();\n\nfor (i=0;i<msg.payload.length;i++) {\n var episode=msg.payload[i];\n if (episode.episodedownloaded==0 && episode.episodequeued==1) {\n \n node.send({route:\"1\", topic:\"UPDATE podcast_\"+msg.podcastId+\" SET episodequeued='0' WHERE episodequeued='1'\",episodeGuid:episode.episodeguid,episodeTitle:episode.episodetitle,episodeUrl:episode.episodeurl,podcastId:msg.podcastId});\n \n }\n}\n","outputs":1,"noerr":0,"x":790,"y":360,"wires":[["7e2769b9.22c378"]]},{"id":"1b288e51.fcca12","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":800,"y":440,"wires":[["b95fc388.492f"]]},{"id":"b95fc388.492f","type":"debug","z":"7897ac1d.896074","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":790,"y":480,"wires":[]},{"id":"7e2769b9.22c378","type":"delay","z":"7897ac1d.896074","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"10","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":820,"y":400,"wires":[["1b288e51.fcca12"]]},{"id":"a9167cb0.5ba1","type":"inject","z":"7897ac1d.896074","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":360,"y":120,"wires":[["9543cc8f.fb7fc"]]},{"id":"9543cc8f.fb7fc","type":"function","z":"7897ac1d.896074","name":"","func":"//msg.topic=\"INSERT OR REPLACE INTO podcast_1 () VALUES ();\n\nmsg.topic=\"ALTER TABLE podcasts ADD COLUMN episodedescription TEXT\"\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":160,"wires":[["eaa0a1ad.ff7e9"]]},{"id":"eaa0a1ad.ff7e9","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":360,"y":200,"wires":[["16c692d3.34b9dd"]]},{"id":"16c692d3.34b9dd","type":"debug","z":"7897ac1d.896074","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":350,"y":240,"wires":[]},{"id":"ffee80e2.a76af","type":"comment","z":"7897ac1d.896074","name":"add col.","info":"","x":350,"y":80,"wires":[]},{"id":"d7e0f74d.30f8f8","type":"comment","z":"7897ac1d.896074","name":"update","info":"","x":550,"y":80,"wires":[]},{"id":"1f8e9a6f.e26546","type":"comment","z":"7897ac1d.896074","name":"set queued 0","info":"","x":810,"y":80,"wires":[]},{"id":"e7a25d8b.b598","type":"debug","z":"59fd6661.f8f6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":130,"y":1400,"wires":[]},{"id":"1747d0f1.e0fdbf","type":"function","z":"59fd6661.f8f6e8","name":"delete table","func":"msg.topic=\"DROP TABLE IF EXISTS podcast_\"+msg.podcastId;\nreturn msg;","outputs":1,"noerr":0,"x":150,"y":1160,"wires":[["f1274aad.ade8c8"]]},{"id":"a0802b51.17a3c8","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":140,"y":1120,"wires":[["1747d0f1.e0fdbf"]]},{"id":"c121c5f1.a95be8","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":1000,"y":460,"wires":[["bb978172.5340c"]]},{"id":"a728abb3.b85918","type":"delay","z":"59fd6661.f8f6e8","name":"100ms","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":990,"y":580,"wires":[["ecf318f7.25b8c8"]]},{"id":"b636b245.4b052","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":360,"y":1000,"wires":[["4aac5699.e45e78"]]},{"id":"eb535d6f.e59dd","type":"inject","z":"59fd6661.f8f6e8","name":"","topic":"","payload":"","payloadType":"date","repeat":"259200","crontab":"","once":false,"onceDelay":0.1,"x":370,"y":800,"wires":[["bc0e67c3.1b3e58"]]},{"id":"bc0e67c3.1b3e58","type":"function","z":"59fd6661.f8f6e8","name":"get pods list","func":"msg.topic=\"SELECT * from podcasts\";\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":840,"wires":[["5117880d.441ab8"]]},{"id":"5117880d.441ab8","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","name":"podcasts","x":360,"y":880,"wires":[["bfc602a5.ff71e"]]},{"id":"bfc602a5.ff71e","type":"function","z":"59fd6661.f8f6e8","name":"get ep list","func":"podcasts=msg.payload;\nfor (i=0;i<podcasts.length;i++){\n node.send({\n topic:\"SELECT * FROM podcast_\"+podcasts[i].podcastid+\" WHERE episodedownloaded=1 and episodequeued=0\",\n podcastId:podcasts[i].podcastid,\n podcastTitle:podcasts[i].podcasttitle,\n podcastPath:podcasts[i].podcastpath,\n podcastUrl:podcasts[i].podcasturl\n });\n}","outputs":1,"noerr":0,"x":360,"y":920,"wires":[["9e8004e1.057208"]]},{"id":"9e8004e1.057208","type":"delay","z":"59fd6661.f8f6e8","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":370,"y":960,"wires":[["b636b245.4b052"]]},{"id":"e0fc218.6be8ee","type":"fs-ops-access","z":"59fd6661.f8f6e8","name":"check if file","path":"","pathType":"str","filename":"filename","filenameType":"msg","read":true,"write":false,"throwerror":false,"x":370,"y":1120,"wires":[[],["7c6f7649.75b338"]]},{"id":"4aac5699.e45e78","type":"function","z":"59fd6661.f8f6e8","name":"set filename","func":"for (i=0;i<msg.payload.length;i++){\n msg.filename=global.get('podcastsPath')+msg.podcastPath+\"/\"+msg.payload[i].episodefile+\".mp3\";\n node.send({\n filename:msg.filename,\n guid:msg.payload[i].episodeguid,\n podcastId:msg.podcastId\n });\n}\n//msg.filename=\"/usr/local/lib/node_modules/node-red/public/podcasts\"+msg.podcastPath+msg.file+\".mp3\";\n//return msg;","outputs":1,"noerr":0,"x":370,"y":1040,"wires":[["1db3be09.69cb92"]]},{"id":"e31e8c96.51eb1","type":"debug","z":"59fd6661.f8f6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":350,"y":1240,"wires":[]},{"id":"1db3be09.69cb92","type":"delay","z":"59fd6661.f8f6e8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"0.01","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":370,"y":1080,"wires":[["e0fc218.6be8ee"]]},{"id":"7c6f7649.75b338","type":"function","z":"59fd6661.f8f6e8","name":"set ep. queued/dld to 0","func":"node.send({\n topic:\"UPDATE podcast_\"+msg.podcastId+\" SET episodequeued='0', episodedownloaded='0' WHERE episodeguid='\"+msg.guid+\"'\"\n});","outputs":1,"noerr":0,"x":400,"y":1160,"wires":[["d71d3315.3d0ef"]]},{"id":"d71d3315.3d0ef","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":360,"y":1200,"wires":[["e31e8c96.51eb1"]]},{"id":"809cd5cb.2bfd98","type":"comment","z":"59fd6661.f8f6e8","name":"remove pod","info":"","x":150,"y":760,"wires":[]},{"id":"e65699dd.117098","type":"comment","z":"59fd6661.f8f6e8","name":"dl missing ep","info":"","x":370,"y":760,"wires":[]},{"id":"67bafcac.a75194","type":"comment","z":"59fd6661.f8f6e8","name":"add pod","info":"","x":120,"y":20,"wires":[]},{"id":"4e8e4ca9.ce9994","type":"comment","z":"59fd6661.f8f6e8","name":"add new ep","info":"","x":430,"y":20,"wires":[]},{"id":"8f49041a.868ad8","type":"comment","z":"59fd6661.f8f6e8","name":"add ep to queue","info":"","x":760,"y":20,"wires":[]},{"id":"87c5ab53.9a1478","type":"comment","z":"59fd6661.f8f6e8","name":"down queued ep","info":"","x":1020,"y":20,"wires":[]},{"id":"d4f6d07e.6ec6a","type":"debug","z":"59fd6661.f8f6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":730,"y":500,"wires":[]},{"id":"18b5fa01.759e86","type":"comment","z":"7897ac1d.896074","name":"image avg","info":"","x":160,"y":320,"wires":[]},{"id":"25b4fdee.64f722","type":"inject","z":"7897ac1d.896074","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":360,"wires":[[]]},{"id":"e7e2e3b5.e012c","type":"function","z":"7897ac1d.896074","name":"","func":"msg.topic=\"SELECT * from podcasts\";\nreturn msg;","outputs":1,"noerr":0,"x":150,"y":400,"wires":[["6feedd5c.015544"]]},{"id":"6feedd5c.015544","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","name":"podcasts","x":160,"y":440,"wires":[["5acc96be.84a848"]]},{"id":"5acc96be.84a848","type":"function","z":"7897ac1d.896074","name":"","func":"podcasts=msg.payload;\nfor (i=0;i<podcasts.length;i++){\n if (podcasts[i].podcastcolor==null) {\n var file=\"podcast-cover.jpg\";\n var podcastPath=podcasts[i].podcastpath;\n var url=\"http://192.168.22.16:8080/\"+podcastPath+\"/\"+file;\n node.send({podcast:podcasts[i],url:url});\n }\n}","outputs":1,"noerr":0,"x":150,"y":480,"wires":[["a59144d2.346578"]]},{"id":"a59144d2.346578","type":"delay","z":"7897ac1d.896074","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":180,"y":520,"wires":[["ba377e8b.1b6f4"]]},{"id":"ba377e8b.1b6f4","type":"http request","z":"7897ac1d.896074","name":"","method":"GET","ret":"bin","url":"","tls":"","x":170,"y":560,"wires":[["f48edbd6.5d4e08"]]},{"id":"f48edbd6.5d4e08","type":"image-average","z":"7897ac1d.896074","name":"","source":"","x":180,"y":600,"wires":[["c9602b0f.e9f238"]]},{"id":"c9602b0f.e9f238","type":"function","z":"7897ac1d.896074","name":"","func":"//msg.topic=\"INSERT OR REPLACE INTO podcast_1 () VALUES ();\npodcast=msg.podcast;\n\nmsg.topic=\"UPDATE podcast_\"+podcast.podcastid+\" SET episodecolor='\"+msg.payload.join()+\"'\"\nreturn msg;","outputs":1,"noerr":0,"x":150,"y":640,"wires":[["11e836c7.79b739"]]},{"id":"bbcdeb0c.8a3c38","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":160,"y":680,"wires":[[]]},{"id":"11e836c7.79b739","type":"debug","z":"7897ac1d.896074","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":310,"y":640,"wires":[]},{"id":"819d8363.36877","type":"function","z":"59fd6661.f8f6e8","name":"","func":"msg.payload='';\nmsg.topic='';\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":300,"wires":[["a8588ab2.ff2de8"]]},{"id":"7d453c42.f4eb64","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","name":"podcasts","x":1000,"y":1020,"wires":[["1e5cdce6.1d94a3"]]},{"id":"5df3430f.361d7c","type":"function","z":"59fd6661.f8f6e8","name":"get pods list","func":"msg.topic=\"SELECT * from podcasts\";\nreturn msg;","outputs":1,"noerr":0,"x":1010,"y":980,"wires":[["7d453c42.f4eb64"]]},{"id":"9d82977a.cc6e58","type":"inject","z":"59fd6661.f8f6e8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1000,"y":940,"wires":[["5df3430f.361d7c"]]},{"id":"1e5cdce6.1d94a3","type":"function","z":"59fd6661.f8f6e8","name":"set pod url","func":"for(i=0;i<msg.payload.length;i++) {\n node.send({\n payload:msg.payload[i],\n url:msg.payload[i].podcasturl\n });\n}\n\n","outputs":1,"noerr":0,"x":1010,"y":1060,"wires":[["de8538b7.47d258"]]},{"id":"36fcba33.428006","type":"http request","z":"59fd6661.f8f6e8","name":"get feed","method":"GET","ret":"txt","url":"","tls":"","x":1000,"y":1140,"wires":[["c45301da.2293a"]]},{"id":"c45301da.2293a","type":"xml","z":"59fd6661.f8f6e8","name":"parse xml","property":"payload","attr":"","chr":"","x":1000,"y":1180,"wires":[["fb1ff131.cb51c"]]},{"id":"fb1ff131.cb51c","type":"function","z":"59fd6661.f8f6e8","name":"mapping","func":"msg.podcastTitle=msg.payload.rss.channel[0].title[0];\nmsg.podcastImage=msg.payload.rss.channel[0].image[0].url[0];\nmsg.url=msg.podcastImage;\n\nreturn msg;","outputs":1,"noerr":0,"x":1000,"y":1220,"wires":[["68288db.8637174"]]},{"id":"de8538b7.47d258","type":"delay","z":"59fd6661.f8f6e8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"2","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1010,"y":1100,"wires":[["36fcba33.428006"]]},{"id":"347c1b14.ead994","type":"http request","z":"59fd6661.f8f6e8","name":"get image","method":"GET","ret":"bin","url":"","tls":"","x":1000,"y":1300,"wires":[["a34cb06d.f774"]]},{"id":"463e0c93.23e194","type":"file","z":"59fd6661.f8f6e8","name":"","filename":"save img","appendNewline":true,"createDir":true,"overwriteFile":"true","x":1000,"y":1420,"wires":[[]]},{"id":"a34cb06d.f774","type":"function","z":"59fd6661.f8f6e8","name":"set img path","func":"msg.podcastPath=global.get('podcastsPath')+msg.podcastTitle.replace(/[^a-z0-9()]/gi, '_').toLowerCase()+\"/\"\nmsg.filename=msg.podcastPath+\"podcast-cover.png\";\nreturn msg;\n","outputs":1,"noerr":0,"x":1010,"y":1340,"wires":[["eab6b6f7.788678"]]},{"id":"3edf4bdf.fdec84","type":"comment","z":"59fd6661.f8f6e8","name":"update cover","info":"","x":1010,"y":900,"wires":[]},{"id":"cb668f09.d203e","type":"function","z":"59fd6661.f8f6e8","name":"file path","func":"global.set('podcastsPath','/usr/local/lib/node_modules/node-red/public/podcasts/');\nreturn msg;","outputs":0,"noerr":0,"x":1000,"y":840,"wires":[]},{"id":"7296db52.0846c4","type":"inject","z":"59fd6661.f8f6e8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"1","x":1010,"y":800,"wires":[["cb668f09.d203e"]]},{"id":"2c8657e.03881a8","type":"websocket in","z":"a3bfbfcd.c2691","name":"","server":"aaba90ac.0d1fd","client":"","x":450,"y":180,"wires":[["71bd4057.7bfa3","8a253445.abbab8"]]},{"id":"5803d3e1.8ae03c","type":"websocket out","z":"a3bfbfcd.c2691","name":"","server":"aaba90ac.0d1fd","client":"","x":690,"y":180,"wires":[]},{"id":"71bd4057.7bfa3","type":"debug","z":"a3bfbfcd.c2691","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":690,"y":320,"wires":[]},{"id":"8a253445.abbab8","type":"link out","z":"a3bfbfcd.c2691","name":"websocket in","links":["e2cb3648.db4558"],"x":655,"y":280,"wires":[]},{"id":"b0898015.97277","type":"link in","z":"a3bfbfcd.c2691","name":"websocket send out","links":["373e563.e73b0aa"],"x":475,"y":280,"wires":[["5803d3e1.8ae03c","fb0ebeca.5509d"]]},{"id":"fd9c5c9e.b0aec","type":"function","z":"f5cfc1d5.2e12b","name":"fetch:podcasts","func":"if (msg._session && msg._session.type==\"websocket\") {\n msg.payload = JSON.parse(msg.payload);\n}\n\nif (msg.payload.fetchWhat && msg.payload.fetchWhat==\"podcasts\") {\n msg.topic = \"SELECT * FROM podcasts\";\n return msg;\n}\n\n","outputs":1,"noerr":0,"x":540,"y":140,"wires":[["d006ef2a.316d6"]]},{"id":"e2cb3648.db4558","type":"link in","z":"f5cfc1d5.2e12b","name":"podcasts receive out","links":["8a253445.abbab8"],"x":295,"y":200,"wires":[["fd9c5c9e.b0aec","370b5928.320866","80c63a6c.962408","3b9b7cee.ff9fa4"]]},{"id":"d006ef2a.316d6","type":"sqlite","z":"f5cfc1d5.2e12b","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":520,"y":180,"wires":[["6dc604be.efbe2c"]]},{"id":"373e563.e73b0aa","type":"link out","z":"f5cfc1d5.2e12b","name":"podcasts send in","links":["b0898015.97277"],"x":815,"y":260,"wires":[]},{"id":"6dc604be.efbe2c","type":"function","z":"f5cfc1d5.2e12b","name":"","func":"node.send({\n payload:{\n \"podcasts\":msg.payload\n },\n _session:msg._session\n});\n","outputs":1,"noerr":0,"x":510,"y":220,"wires":[["373e563.e73b0aa"]]},{"id":"ac1b23f.0ddf1e","type":"sqlite","z":"f5cfc1d5.2e12b","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":520,"y":360,"wires":[["64e16664.f5e708"]]},{"id":"370b5928.320866","type":"function","z":"f5cfc1d5.2e12b","name":"fetch:episodes","func":"if (msg._session && msg._session.type==\"websocket\") {\n msg.payload = JSON.parse(msg.payload);\n}\n\nif (msg.payload.fetchWhat && msg.payload.fetchWhat==\"podcastEpisodes\") {\n msg.topic = \"SELECT * FROM podcast_\"+msg.payload.podcastId;\n msg.podcastId=msg.payload.podcastId;\n msg.podcastTitle=msg.payload.podcastTitle;\n return msg;\n}\n","outputs":1,"noerr":0,"x":540,"y":320,"wires":[["ac1b23f.0ddf1e"]]},{"id":"64e16664.f5e708","type":"function","z":"f5cfc1d5.2e12b","name":"","func":"for (i=0;i<msg.payload.length;i++) {\n msg.payload[i].episodepodcastid=msg.podcastId;\n msg.payload[i].episodepodcasttitle=msg.podcastTitle;\n msg.payload[i].episodeid=[i][0];\n}\n\nnode.send({\n payload:{\n \"podcastEpisodes\":msg.payload,\n //\"podcastId\":msg.podcastId\n },\n _session:msg._session\n});\n","outputs":1,"noerr":0,"x":510,"y":400,"wires":[["373e563.e73b0aa"]]},{"id":"f99718cb.f709c8","type":"comment","z":"59fd6661.f8f6e8","name":"set files path","info":"","x":1010,"y":760,"wires":[]},{"id":"80c63a6c.962408","type":"function","z":"f5cfc1d5.2e12b","name":"fetch:updateepisode","func":"if (msg._session && msg._session.type==\"websocket\") {\n msg.payload = JSON.parse(msg.payload);\n}\n\nif (msg.payload.fetchWhat && msg.payload.fetchWhat==\"updateEpisode\") {\n return msg;\n}\n","outputs":1,"noerr":0,"x":560,"y":640,"wires":[["3d0fd5ce.61f19a"]]},{"id":"583e2c2a.ae5ef4","type":"function","z":"59fd6661.f8f6e8","name":"duration","func":"if(msg.payload.duration) {\n node.send({\n topic:\"UPDATE podcast_\"+msg.payload.episode.episodepodcastid+\" SET episodeduration='\"+Math.round(msg.payload.duration)+\"' WHERE episodeguid='\"+msg.payload.episode.episodeguid+\"'\"\n });\n}\n\n","outputs":1,"noerr":0,"x":680,"y":800,"wires":[["492de890.ca1418"]]},{"id":"492de890.ca1418","type":"delay","z":"59fd6661.f8f6e8","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"50","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":700,"y":840,"wires":[["74c596cc.37f038"]]},{"id":"74c596cc.37f038","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":680,"y":880,"wires":[["a886852b.3544a8"]]},{"id":"a886852b.3544a8","type":"debug","z":"59fd6661.f8f6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":670,"y":920,"wires":[]},{"id":"9f676886.a8c368","type":"comment","z":"59fd6661.f8f6e8","name":"update episode","info":"","x":700,"y":760,"wires":[]},{"id":"32ac6869.8ef668","type":"link in","z":"59fd6661.f8f6e8","name":"episode update out","links":["3d0fd5ce.61f19a"],"x":535,"y":940,"wires":[["583e2c2a.ae5ef4","6e79a506.eac3ec","34d05c20.f36a64"]]},{"id":"3d0fd5ce.61f19a","type":"link out","z":"f5cfc1d5.2e12b","name":"episode update in","links":["32ac6869.8ef668"],"x":755,"y":700,"wires":[]},{"id":"6e79a506.eac3ec","type":"function","z":"59fd6661.f8f6e8","name":"played/timestamp","func":"if(msg.payload.playedtimestamp) {\n msg.payload.episode.episodeplayedtimestamp=msg.payload.playedtimestamp;\n var episode=msg.payload.episode;\n\n \n if (episode.episodeplayedtimestamp>9 && (episode.episodeduration-episode.episodeplayedtimestamp)>120){\n node.send({\n topic:\"UPDATE podcast_\"+episode.episodepodcastid+\" SET episodeplayed='0', episodeplayedtimestamp='\"+episode.episodeplayedtimestamp+\"' WHERE episodeguid='\"+episode.episodeguid+\"'\",\n episode:msg.payload.episode\n });\n }\n \n if ((episode.episodeduration-episode.episodeplayedtimestamp)<121){\n episode.episodeplayed=1;\n node.send({\n topic:\"UPDATE podcast_\"+episode.episodepodcastid+\" SET episodeplayed='1', episodeplayedtimestamp='0' WHERE episodeguid='\"+episode.episodeguid+\"'\",\n episode:msg.payload.episode\n });\n }\n}\n\n","outputs":1,"noerr":0,"x":710,"y":980,"wires":[["fff5a9d0.bd67b8"]]},{"id":"fff5a9d0.bd67b8","type":"delay","z":"59fd6661.f8f6e8","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":690,"y":1020,"wires":[["7874c5d5.99833c"]]},{"id":"7874c5d5.99833c","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":680,"y":1060,"wires":[["7783c4d7.1c9b2c"]]},{"id":"d1ab152c.6bb9c8","type":"link in","z":"f5cfc1d5.2e12b","name":"interface out","links":["7b9c140f.6d780c"],"x":295,"y":120,"wires":[["88a985d2.cb0958"]]},{"id":"7b9c140f.6d780c","type":"link out","z":"59fd6661.f8f6e8","name":"interface in","links":["d1ab152c.6bb9c8"],"x":855,"y":1160,"wires":[]},{"id":"7783c4d7.1c9b2c","type":"function","z":"59fd6661.f8f6e8","name":"","func":"msg.updateEpisode=msg.episode;\nreturn msg;","outputs":1,"noerr":0,"x":670,"y":1260,"wires":[["7b9c140f.6d780c","d89ca71c.959b88"]]},{"id":"88a985d2.cb0958","type":"function","z":"f5cfc1d5.2e12b","name":"send:updateepisode","func":"if (msg.updateEpisode) {\n node.send({\n payload:{\n \"updateEpisode\":msg.updateEpisode\n }\n });\n}","outputs":1,"noerr":0,"x":540,"y":80,"wires":[["373e563.e73b0aa"]]},{"id":"34d05c20.f36a64","type":"function","z":"59fd6661.f8f6e8","name":"played/arch","func":"if(typeof msg.payload.state != \"undefined\") {\n for(i=0;i<msg.payload.episodes.length;i++){\n var episode=msg.payload.episodes[i];\n \n if (typeof msg.payload.state.played != \"undefined\") {\n episode.episodeplayed=msg.payload.state.played;\n episode.episodeplayedtimestamp=0;\n node.send({\n topic:\"UPDATE podcast_\"+episode.episodepodcastid+\" SET episodeplayed='\"+msg.payload.state.played+\"', episodeplayedtimestamp='0' WHERE episodeguid='\"+episode.episodeguid+\"'\",\n episode:episode\n });\n }\n if (typeof msg.payload.state.archived != \"undefined\") {\n episode.episodearchived=msg.payload.state.archived;\n node.send({\n topic:\"UPDATE podcast_\"+episode.episodepodcastid+\" SET episodearchived='\"+msg.payload.state.archived+\"' WHERE episodeguid='\"+episode.episodeguid+\"'\",\n episode:episode\n });\n }\n }\n}\n\n","outputs":1,"noerr":0,"x":690,"y":1120,"wires":[["2693ab21.4c0904","36108089.1c3cb"]]},{"id":"ca9e6d4f.83afd","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":680,"y":1200,"wires":[["7783c4d7.1c9b2c"]]},{"id":"d89ca71c.959b88","type":"debug","z":"59fd6661.f8f6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":670,"y":1300,"wires":[]},{"id":"2693ab21.4c0904","type":"delay","z":"59fd6661.f8f6e8","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"50","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":700,"y":1160,"wires":[["ca9e6d4f.83afd"]]},{"id":"3d0f592d.5ca3f6","type":"inject","z":"7897ac1d.896074","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":740,"y":620,"wires":[["4a2ee54a.58f20c"]]},{"id":"4a2ee54a.58f20c","type":"function","z":"7897ac1d.896074","name":"","func":"msg.payload = {\n \"message\":{\n \"user\":\"msg.user\",\n \"state\":\"msg.userstate\"\n }\n};\nreturn msg;","outputs":1,"noerr":0,"x":740,"y":680,"wires":[["d4162b46.9b4318"]]},{"id":"d4162b46.9b4318","type":"debug","z":"7897ac1d.896074","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":780,"y":720,"wires":[]},{"id":"d7292343.06011","type":"function","z":"7897ac1d.896074","name":"","func":"msg.topic=\"SELECT * from podcasts\";\nreturn msg;","outputs":1,"noerr":0,"x":1290,"y":380,"wires":[["e5ba119a.88dae"]]},{"id":"e5ba119a.88dae","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","name":"podcasts","x":1300,"y":420,"wires":[["3e4d165e.44e02a"]]},{"id":"3e4d165e.44e02a","type":"function","z":"7897ac1d.896074","name":"","func":"//msg.topic=\"INSERT OR REPLACE INTO podcast_1 () VALUES ();\n\n\nfor (i=0;i<msg.payload.length;i++) {\n node.send({\"topic\":\"ALTER TABLE podcast_\"+msg.payload[i].podcastid+\" ADD COLUMN episodearchived INTEGER DEFAULT '0'\"});\n}\n","outputs":1,"noerr":0,"x":1290,"y":460,"wires":[["a83bd2c6.d8349"]]},{"id":"a83bd2c6.d8349","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":1300,"y":500,"wires":[["ad0f8af3.5407e8"]]},{"id":"7cb4b9d6.07b7f8","type":"inject","z":"7897ac1d.896074","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1300,"y":340,"wires":[["d7292343.06011"]]},{"id":"ad0f8af3.5407e8","type":"debug","z":"7897ac1d.896074","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1300,"y":560,"wires":[]},{"id":"f1548027.a64bf","type":"inject","z":"7897ac1d.896074","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1060,"y":540,"wires":[["9f4e682.22abd98"]]},{"id":"9f4e682.22abd98","type":"function","z":"7897ac1d.896074","name":"","func":"msg.topic=\"SELECT * from podcasts\";\nreturn msg;","outputs":1,"noerr":0,"x":1050,"y":580,"wires":[["5d5dfb4c.9e6574"]]},{"id":"5d5dfb4c.9e6574","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","name":"podcasts","x":1060,"y":620,"wires":[["11617a46.dcf6b6"]]},{"id":"e878db79.bb6108","type":"debug","z":"7897ac1d.896074","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1050,"y":940,"wires":[]},{"id":"a02f0ac.cf34ff8","type":"http request","z":"7897ac1d.896074","name":"","method":"GET","ret":"txt","url":"","tls":"","x":1070,"y":740,"wires":[["b2f4f3f0.a7eef"]]},{"id":"b2f4f3f0.a7eef","type":"xml","z":"7897ac1d.896074","name":"","property":"payload","attr":"","chr":"","x":1050,"y":780,"wires":[["87f4e87e.7d79f8"]]},{"id":"87f4e87e.7d79f8","type":"function","z":"7897ac1d.896074","name":"","func":"\nvar items=msg.payload.rss.channel[0].item;\n\nfor (i=0;i<items.length;i++) {\n\n if (items[i].guid[0]._) {\n items[i].guid[0]=items[i].guid[0]._;\n }\n var guid=items[i].guid[0].replace(/[^a-z0-9]/gi, '_').toLowerCase();\n \n var description=items[i].description[0].replace(/(<([^>]+)>)/ig,\"\");\n \n node.send({\n topic:\"UPDATE podcast_\"+msg.podcastId+\" SET (episodedescription)=(?) WHERE episodeguid='\"+guid+\"'\",\n payload:[description]\n });\n\n \n}\n","outputs":1,"noerr":0,"x":1050,"y":820,"wires":[["d39dbccd.4076d"]]},{"id":"2779b463.e1925c","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts_","x":1070,"y":900,"wires":[["e878db79.bb6108"]]},{"id":"d39dbccd.4076d","type":"delay","z":"7897ac1d.896074","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"15","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1080,"y":860,"wires":[["2779b463.e1925c"]]},{"id":"a1450dc1.cc4e","type":"delay","z":"7897ac1d.896074","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1080,"y":700,"wires":[["a02f0ac.cf34ff8"]]},{"id":"11617a46.dcf6b6","type":"function","z":"7897ac1d.896074","name":"","func":"var podcasts=msg.payload;\nfor (i=0;i<podcasts.length;i++){\n\n node.send({\n podcastId:podcasts[i].podcastid,\n podcastUrl:podcasts[i].podcasturl,\n url:podcasts[i].podcasturl\n });\n}","outputs":1,"noerr":0,"x":1050,"y":660,"wires":[["a1450dc1.cc4e"]]},{"id":"ee4e51e4.db7a3","type":"function","z":"7897ac1d.896074","name":"","func":"msg.payload=msg.payload.rss.channel[0].item[0].description[0].replace(/(<([^>]+)>)/ig,\"\");\nreturn msg;","outputs":1,"noerr":0,"x":1330,"y":720,"wires":[["ad0f8af3.5407e8"]]},{"id":"3c7748e9.7ae658","type":"catch","z":"7897ac1d.896074","name":"","scope":["2779b463.e1925c"],"x":1090,"y":1020,"wires":[["cb76b042.b6bc3"]]},{"id":"cb76b042.b6bc3","type":"debug","z":"7897ac1d.896074","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1090,"y":1060,"wires":[]},{"id":"4305348b.8da66c","type":"exec","z":"59fd6661.f8f6e8","command":"sudo mount /dev/sda1 /usr/local/lib/node_modules/node-red/public/podcasts","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"mnt ssd","x":1220,"y":800,"wires":[[],[],[]]},{"id":"ae8e2c9f.680e6","type":"inject","z":"59fd6661.f8f6e8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"30","x":1230,"y":760,"wires":[["4305348b.8da66c"]]},{"id":"a13fb392.d52c1","type":"jimp-image","z":"59fd6661.f8f6e8","name":"resize cover","data":"payload","dataType":"msg","ret":"buf","parameter1":"300","parameter1Type":"num","parameter2":"","parameter2Type":"auto","parameter3":"RESIZE_NEAREST_NEIGHBOR","parameter3Type":"resizeMode","parameter4":"","parameter4Type":"msg","parameter5":"","parameter5Type":"msg","parameter6":"","parameter6Type":"msg","parameter7":"","parameter7Type":"msg","parameter8":"","parameter8Type":"msg","parameterCount":3,"jimpFunction":"resize","selectedJimpFunction":{"name":"resize","fn":"resize","description":"resize the image. One of the w or h parameters can be set to automatic (\"Jimp.AUTO\" or -1).","parameters":[{"name":"w","type":"num|auto","required":true,"hint":"the width to resize the image to (or \"Jimp.AUTO\" or -1)"},{"name":"h","type":"num|auto","required":true,"hint":"the height to resize the image to (or \"Jimp.AUTO\" or -1)"},{"name":"mode","type":"resizeMode","required":false,"hint":"a scaling method (e.g. Jimp.RESIZE_BEZIER)"}]},"x":130,"y":340,"wires":[["cdb6d43c.a35458"]]},{"id":"36108089.1c3cb","type":"debug","z":"59fd6661.f8f6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":820,"y":1400,"wires":[]},{"id":"fb0ebeca.5509d","type":"debug","z":"a3bfbfcd.c2691","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":690,"y":400,"wires":[]},{"id":"cb2067b4.f2b418","type":"sqlite","z":"f5cfc1d5.2e12b","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":520,"y":520,"wires":[["68f3b931.28c0b8"]]},{"id":"3b9b7cee.ff9fa4","type":"function","z":"f5cfc1d5.2e12b","name":"fetch:episodes","func":"if (msg._session && msg._session.type==\"websocket\") {\n msg.payload = JSON.parse(msg.payload);\n}\n\nif (msg.payload.fetchWhat && msg.payload.fetchWhat==\"podcastEpisodes_\") {\n \n if (msg.payload.podcastFilter==2) {\n msg.topic = \"SELECT * FROM podcast_\"+msg.payload.podcastId+\" WHERE episodeplayedtimestamp>0 AND episodeplayed=0 AND episodearchived=0\";\n }\n if (msg.payload.podcastFilter==0) {\n msg.topic = \"SELECT * FROM podcast_\"+msg.payload.podcastId+\" WHERE episodeplayedtimestamp=0 AND episodeplayed=0 AND episodearchived=0\";\n }\n if (msg.payload.podcastFilter==3) {\n msg.topic = \"SELECT * FROM podcast_\"+msg.payload.podcastId+\" WHERE episodearchived=1\";\n }\n if (msg.payload.podcastFilter==1) {\n msg.topic = \"SELECT * FROM podcast_\"+msg.payload.podcastId;\n }\n \n //msg.topic = \"SELECT * FROM podcast_\"+msg.payload.podcastId;\n msg.podcastId=msg.payload.podcastId;\n msg.podcastTitle=msg.payload.podcastTitle;\n return msg;\n}\n","outputs":1,"noerr":0,"x":540,"y":480,"wires":[["cb2067b4.f2b418"]]},{"id":"68f3b931.28c0b8","type":"function","z":"f5cfc1d5.2e12b","name":"","func":"//! moment.js\n//! version : 2.15.1\n//! authors : Tim Wood, Iskren Chernev, Moment.js contributors\n//! license : MIT\n//! momentjs.com\n!function(a,b){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=b():\"function\"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){\"use strict\";function a(){return md.apply(null,arguments)}\n// This is done to register the method called with moment()\n// without creating circular dependencies.\nfunction b(a){md=a}function c(a){return a instanceof Array||\"[object Array]\"===Object.prototype.toString.call(a)}function d(a){\n// IE8 will treat undefined and null as object if it wasn't for\n// input != null\nreturn null!=a&&\"[object Object]\"===Object.prototype.toString.call(a)}function e(a){var b;for(b in a)\n// even if its not own property I'd still call it non-empty\nreturn!1;return!0}function f(a){return a instanceof Date||\"[object Date]\"===Object.prototype.toString.call(a)}function g(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function h(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function i(a,b){for(var c in b)h(b,c)&&(a[c]=b[c]);return h(b,\"toString\")&&(a.toString=b.toString),h(b,\"valueOf\")&&(a.valueOf=b.valueOf),a}function j(a,b,c,d){return qb(a,b,c,d,!0).utc()}function k(){\n// We need to deep clone this object.\nreturn{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null}}function l(a){return null==a._pf&&(a._pf=k()),a._pf}function m(a){if(null==a._isValid){var b=l(a),c=nd.call(b.parsedDateParts,function(a){return null!=a}),d=!isNaN(a._d.getTime())&&b.overflow<0&&!b.empty&&!b.invalidMonth&&!b.invalidWeekday&&!b.nullInput&&!b.invalidFormat&&!b.userInvalidated&&(!b.meridiem||b.meridiem&&c);if(a._strict&&(d=d&&0===b.charsLeftOver&&0===b.unusedTokens.length&&void 0===b.bigHour),null!=Object.isFrozen&&Object.isFrozen(a))return d;a._isValid=d}return a._isValid}function n(a){var b=j(NaN);return null!=a?i(l(b),a):l(b).userInvalidated=!0,b}function o(a){return void 0===a}function p(a,b){var c,d,e;if(o(b._isAMomentObject)||(a._isAMomentObject=b._isAMomentObject),o(b._i)||(a._i=b._i),o(b._f)||(a._f=b._f),o(b._l)||(a._l=b._l),o(b._strict)||(a._strict=b._strict),o(b._tzm)||(a._tzm=b._tzm),o(b._isUTC)||(a._isUTC=b._isUTC),o(b._offset)||(a._offset=b._offset),o(b._pf)||(a._pf=l(b)),o(b._locale)||(a._locale=b._locale),od.length>0)for(c in od)d=od[c],e=b[d],o(e)||(a[d]=e);return a}\n// Moment prototype object\nfunction q(b){p(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),pd===!1&&(pd=!0,a.updateOffset(this),pd=!1)}function r(a){return a instanceof q||null!=a&&null!=a._isAMomentObject}function s(a){return 0>a?Math.ceil(a)||0:Math.floor(a)}function t(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=s(b)),c}\n// compare two arrays, return the number of differences\nfunction u(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&t(a[d])!==t(b[d]))&&g++;return g+f}function v(b){a.suppressDeprecationWarnings===!1&&\"undefined\"!=typeof console&&console.warn&&console.warn(\"Deprecation warning: \"+b)}function w(b,c){var d=!0;return i(function(){if(null!=a.deprecationHandler&&a.deprecationHandler(null,b),d){for(var e,f=[],g=0;g<arguments.length;g++){if(e=\"\",\"object\"==typeof arguments[g]){e+=\"\\n[\"+g+\"] \";for(var h in arguments[0])e+=h+\": \"+arguments[0][h]+\", \";e=e.slice(0,-2)}else e=arguments[g];f.push(e)}v(b+\"\\nArguments: \"+Array.prototype.slice.call(f).join(\"\")+\"\\n\"+(new Error).stack),d=!1}return c.apply(this,arguments)},c)}function x(b,c){null!=a.deprecationHandler&&a.deprecationHandler(b,c),qd[b]||(v(c),qd[b]=!0)}function y(a){return a instanceof Function||\"[object Function]\"===Object.prototype.toString.call(a)}function z(a){var b,c;for(c in a)b=a[c],y(b)?this[c]=b:this[\"_\"+c]=b;this._config=a,\n// Lenient ordinal parsing accepts just a number in addition to\n// number + (possibly) stuff coming from _ordinalParseLenient.\nthis._ordinalParseLenient=new RegExp(this._ordinalParse.source+\"|\"+/\\d{1,2}/.source)}function A(a,b){var c,e=i({},a);for(c in b)h(b,c)&&(d(a[c])&&d(b[c])?(e[c]={},i(e[c],a[c]),i(e[c],b[c])):null!=b[c]?e[c]=b[c]:delete e[c]);for(c in a)h(a,c)&&!h(b,c)&&d(a[c])&&(\n// make sure changes to properties don't modify parent config\ne[c]=i({},e[c]));return e}function B(a){null!=a&&this.set(a)}function C(a,b,c){var d=this._calendar[a]||this._calendar.sameElse;return y(d)?d.call(b,c):d}function D(a){var b=this._longDateFormat[a],c=this._longDateFormat[a.toUpperCase()];return b||!c?b:(this._longDateFormat[a]=c.replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a])}function E(){return this._invalidDate}function F(a){return this._ordinal.replace(\"%d\",a)}function G(a,b,c,d){var e=this._relativeTime[c];return y(e)?e(a,b,c,d):e.replace(/%d/i,a)}function H(a,b){var c=this._relativeTime[a>0?\"future\":\"past\"];return y(c)?c(b):c.replace(/%s/i,b)}function I(a,b){var c=a.toLowerCase();zd[c]=zd[c+\"s\"]=zd[b]=a}function J(a){return\"string\"==typeof a?zd[a]||zd[a.toLowerCase()]:void 0}function K(a){var b,c,d={};for(c in a)h(a,c)&&(b=J(c),b&&(d[b]=a[c]));return d}function L(a,b){Ad[a]=b}function M(a){var b=[];for(var c in a)b.push({unit:c,priority:Ad[c]});return b.sort(function(a,b){return a.priority-b.priority}),b}function N(b,c){return function(d){return null!=d?(P(this,b,d),a.updateOffset(this,c),this):O(this,b)}}function O(a,b){return a.isValid()?a._d[\"get\"+(a._isUTC?\"UTC\":\"\")+b]():NaN}function P(a,b,c){a.isValid()&&a._d[\"set\"+(a._isUTC?\"UTC\":\"\")+b](c)}\n// MOMENTS\nfunction Q(a){return a=J(a),y(this[a])?this[a]():this}function R(a,b){if(\"object\"==typeof a){a=K(a);for(var c=M(a),d=0;d<c.length;d++)this[c[d].unit](a[c[d].unit])}else if(a=J(a),y(this[a]))return this[a](b);return this}function S(a,b,c){var d=\"\"+Math.abs(a),e=b-d.length,f=a>=0;return(f?c?\"+\":\"\":\"-\")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}\n// token: 'M'\n// padded: ['MM', 2]\n// ordinal: 'Mo'\n// callback: function () { this.month() + 1 }\nfunction T(a,b,c,d){var e=d;\"string\"==typeof d&&(e=function(){return this[d]()}),a&&(Ed[a]=e),b&&(Ed[b[0]]=function(){return S(e.apply(this,arguments),b[1],b[2])}),c&&(Ed[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function U(a){return a.match(/\\[[\\s\\S]/)?a.replace(/^\\[|\\]$/g,\"\"):a.replace(/\\\\/g,\"\")}function V(a){var b,c,d=a.match(Bd);for(b=0,c=d.length;c>b;b++)Ed[d[b]]?d[b]=Ed[d[b]]:d[b]=U(d[b]);return function(b){var e,f=\"\";for(e=0;c>e;e++)f+=d[e]instanceof Function?d[e].call(b,a):d[e];return f}}\n// format date using native date object\nfunction W(a,b){return a.isValid()?(b=X(b,a.localeData()),Dd[b]=Dd[b]||V(b),Dd[b](a)):a.localeData().invalidDate()}function X(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Cd.lastIndex=0;d>=0&&Cd.test(a);)a=a.replace(Cd,c),Cd.lastIndex=0,d-=1;return a}function Y(a,b,c){Wd[a]=y(b)?b:function(a,d){return a&&c?c:b}}function Z(a,b){return h(Wd,a)?Wd[a](b._strict,b._locale):new RegExp($(a))}\n// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript\nfunction $(a){return _(a.replace(\"\\\\\",\"\").replace(/\\\\(\\[)|\\\\(\\])|\\[([^\\]\\[]*)\\]|\\\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function _(a){return a.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g,\"\\\\$&\")}function aa(a,b){var c,d=b;for(\"string\"==typeof a&&(a=[a]),\"number\"==typeof b&&(d=function(a,c){c[b]=t(a)}),c=0;c<a.length;c++)Xd[a[c]]=d}function ba(a,b){aa(a,function(a,c,d,e){d._w=d._w||{},b(a,d._w,d,e)})}function ca(a,b,c){null!=b&&h(Xd,a)&&Xd[a](b,c._a,c,a)}function da(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function ea(a,b){return a?c(this._months)?this._months[a.month()]:this._months[(this._months.isFormat||fe).test(b)?\"format\":\"standalone\"][a.month()]:this._months}function fa(a,b){return a?c(this._monthsShort)?this._monthsShort[a.month()]:this._monthsShort[fe.test(b)?\"format\":\"standalone\"][a.month()]:this._monthsShort}function ga(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._monthsParse)for(\n// this is not used\nthis._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],d=0;12>d;++d)f=j([2e3,d]),this._shortMonthsParse[d]=this.monthsShort(f,\"\").toLocaleLowerCase(),this._longMonthsParse[d]=this.months(f,\"\").toLocaleLowerCase();return c?\"MMM\"===b?(e=sd.call(this._shortMonthsParse,g),-1!==e?e:null):(e=sd.call(this._longMonthsParse,g),-1!==e?e:null):\"MMM\"===b?(e=sd.call(this._shortMonthsParse,g),-1!==e?e:(e=sd.call(this._longMonthsParse,g),-1!==e?e:null)):(e=sd.call(this._longMonthsParse,g),-1!==e?e:(e=sd.call(this._shortMonthsParse,g),-1!==e?e:null))}function ha(a,b,c){var d,e,f;if(this._monthsParseExact)return ga.call(this,a,b,c);\n// TODO: add sorting\n// Sorting makes sure if one month (or abbr) is a prefix of another\n// see sorting in computeMonthsParse\nfor(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){\n// test the regex\nif(e=j([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp(\"^\"+this.months(e,\"\").replace(\".\",\"\")+\"$\",\"i\"),this._shortMonthsParse[d]=new RegExp(\"^\"+this.monthsShort(e,\"\").replace(\".\",\"\")+\"$\",\"i\")),c||this._monthsParse[d]||(f=\"^\"+this.months(e,\"\")+\"|^\"+this.monthsShort(e,\"\"),this._monthsParse[d]=new RegExp(f.replace(\".\",\"\"),\"i\")),c&&\"MMMM\"===b&&this._longMonthsParse[d].test(a))return d;if(c&&\"MMM\"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}\n// MOMENTS\nfunction ia(a,b){var c;if(!a.isValid())\n// No op\nreturn a;if(\"string\"==typeof b)if(/^\\d+$/.test(b))b=t(b);else\n// TODO: Another silent failure?\nif(b=a.localeData().monthsParse(b),\"number\"!=typeof b)return a;return c=Math.min(a.date(),da(a.year(),b)),a._d[\"set\"+(a._isUTC?\"UTC\":\"\")+\"Month\"](b,c),a}function ja(b){return null!=b?(ia(this,b),a.updateOffset(this,!0),this):O(this,\"Month\")}function ka(){return da(this.year(),this.month())}function la(a){return this._monthsParseExact?(h(this,\"_monthsRegex\")||na.call(this),a?this._monthsShortStrictRegex:this._monthsShortRegex):(h(this,\"_monthsShortRegex\")||(this._monthsShortRegex=ie),this._monthsShortStrictRegex&&a?this._monthsShortStrictRegex:this._monthsShortRegex)}function ma(a){return this._monthsParseExact?(h(this,\"_monthsRegex\")||na.call(this),a?this._monthsStrictRegex:this._monthsRegex):(h(this,\"_monthsRegex\")||(this._monthsRegex=je),this._monthsStrictRegex&&a?this._monthsStrictRegex:this._monthsRegex)}function na(){function a(a,b){return b.length-a.length}var b,c,d=[],e=[],f=[];for(b=0;12>b;b++)c=j([2e3,b]),d.push(this.monthsShort(c,\"\")),e.push(this.months(c,\"\")),f.push(this.months(c,\"\")),f.push(this.monthsShort(c,\"\"));for(\n// Sorting makes sure if one month (or abbr) is a prefix of another it\n// will match the longer piece.\nd.sort(a),e.sort(a),f.sort(a),b=0;12>b;b++)d[b]=_(d[b]),e[b]=_(e[b]);for(b=0;24>b;b++)f[b]=_(f[b]);this._monthsRegex=new RegExp(\"^(\"+f.join(\"|\")+\")\",\"i\"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp(\"^(\"+e.join(\"|\")+\")\",\"i\"),this._monthsShortStrictRegex=new RegExp(\"^(\"+d.join(\"|\")+\")\",\"i\")}\n// HELPERS\nfunction oa(a){return pa(a)?366:365}function pa(a){return a%4===0&&a%100!==0||a%400===0}function qa(){return pa(this.year())}function ra(a,b,c,d,e,f,g){\n//can't just apply() to create a date:\n//http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply\nvar h=new Date(a,b,c,d,e,f,g);\n//the date constructor remaps years 0-99 to 1900-1999\nreturn 100>a&&a>=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function sa(a){var b=new Date(Date.UTC.apply(null,arguments));\n//the Date.UTC function remaps years 0-99 to 1900-1999\nreturn 100>a&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b}\n// start-of-first-week - start-of-year\nfunction ta(a,b,c){var// first-week day -- which january is always in the first week (4 for iso, 1 for other)\nd=7+b-c,\n// first-week day local weekday -- which local weekday is fwd\ne=(7+sa(a,0,d).getUTCDay()-b)%7;return-e+d-1}\n//http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday\nfunction ua(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ta(a,d,e),j=1+7*(b-1)+h+i;return 0>=j?(f=a-1,g=oa(f)+j):j>oa(a)?(f=a+1,g=j-oa(a)):(f=a,g=j),{year:f,dayOfYear:g}}function va(a,b,c){var d,e,f=ta(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return 1>g?(e=a.year()-1,d=g+wa(e,b,c)):g>wa(a.year(),b,c)?(d=g-wa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function wa(a,b,c){var d=ta(a,b,c),e=ta(a+1,b,c);return(oa(a)-d+e)/7}\n// HELPERS\n// LOCALES\nfunction xa(a){return va(a,this._week.dow,this._week.doy).week}function ya(){return this._week.dow}function za(){return this._week.doy}\n// MOMENTS\nfunction Aa(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),\"d\")}function Ba(a){var b=va(this,1,4).week;return null==a?b:this.add(7*(a-b),\"d\")}\n// HELPERS\nfunction Ca(a,b){return\"string\"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),\"number\"==typeof a?a:null):parseInt(a,10)}function Da(a,b){return\"string\"==typeof a?b.weekdaysParse(a)%7||7:isNaN(a)?null:a}function Ea(a,b){return a?c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?\"format\":\"standalone\"][a.day()]:this._weekdays}function Fa(a){return a?this._weekdaysShort[a.day()]:this._weekdaysShort}function Ga(a){return a?this._weekdaysMin[a.day()]:this._weekdaysMin}function Ha(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],d=0;7>d;++d)f=j([2e3,1]).day(d),this._minWeekdaysParse[d]=this.weekdaysMin(f,\"\").toLocaleLowerCase(),this._shortWeekdaysParse[d]=this.weekdaysShort(f,\"\").toLocaleLowerCase(),this._weekdaysParse[d]=this.weekdays(f,\"\").toLocaleLowerCase();return c?\"dddd\"===b?(e=sd.call(this._weekdaysParse,g),-1!==e?e:null):\"ddd\"===b?(e=sd.call(this._shortWeekdaysParse,g),-1!==e?e:null):(e=sd.call(this._minWeekdaysParse,g),-1!==e?e:null):\"dddd\"===b?(e=sd.call(this._weekdaysParse,g),-1!==e?e:(e=sd.call(this._shortWeekdaysParse,g),-1!==e?e:(e=sd.call(this._minWeekdaysParse,g),-1!==e?e:null))):\"ddd\"===b?(e=sd.call(this._shortWeekdaysParse,g),-1!==e?e:(e=sd.call(this._weekdaysParse,g),-1!==e?e:(e=sd.call(this._minWeekdaysParse,g),-1!==e?e:null))):(e=sd.call(this._minWeekdaysParse,g),-1!==e?e:(e=sd.call(this._weekdaysParse,g),-1!==e?e:(e=sd.call(this._shortWeekdaysParse,g),-1!==e?e:null)))}function Ia(a,b,c){var d,e,f;if(this._weekdaysParseExact)return Ha.call(this,a,b,c);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;7>d;d++){\n// test the regex\nif(e=j([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp(\"^\"+this.weekdays(e,\"\").replace(\".\",\".?\")+\"$\",\"i\"),this._shortWeekdaysParse[d]=new RegExp(\"^\"+this.weekdaysShort(e,\"\").replace(\".\",\".?\")+\"$\",\"i\"),this._minWeekdaysParse[d]=new RegExp(\"^\"+this.weekdaysMin(e,\"\").replace(\".\",\".?\")+\"$\",\"i\")),this._weekdaysParse[d]||(f=\"^\"+this.weekdays(e,\"\")+\"|^\"+this.weekdaysShort(e,\"\")+\"|^\"+this.weekdaysMin(e,\"\"),this._weekdaysParse[d]=new RegExp(f.replace(\".\",\"\"),\"i\")),c&&\"dddd\"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&\"ddd\"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&\"dd\"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}\n// MOMENTS\nfunction Ja(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Ca(a,this.localeData()),this.add(a-b,\"d\")):b}function Ka(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,\"d\")}function La(a){if(!this.isValid())return null!=a?this:NaN;\n// behaves the same as moment#day except\n// as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)\n// as a setter, sunday should belong to the previous week.\nif(null!=a){var b=Da(a,this.localeData());return this.day(this.day()%7?b:b-7)}return this.day()||7}function Ma(a){return this._weekdaysParseExact?(h(this,\"_weekdaysRegex\")||Pa.call(this),a?this._weekdaysStrictRegex:this._weekdaysRegex):(h(this,\"_weekdaysRegex\")||(this._weekdaysRegex=pe),this._weekdaysStrictRegex&&a?this._weekdaysStrictRegex:this._weekdaysRegex)}function Na(a){return this._weekdaysParseExact?(h(this,\"_weekdaysRegex\")||Pa.call(this),a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(h(this,\"_weekdaysShortRegex\")||(this._weekdaysShortRegex=qe),this._weekdaysShortStrictRegex&&a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Oa(a){return this._weekdaysParseExact?(h(this,\"_weekdaysRegex\")||Pa.call(this),a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(h(this,\"_weekdaysMinRegex\")||(this._weekdaysMinRegex=re),this._weekdaysMinStrictRegex&&a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Pa(){function a(a,b){return b.length-a.length}var b,c,d,e,f,g=[],h=[],i=[],k=[];for(b=0;7>b;b++)c=j([2e3,1]).day(b),d=this.weekdaysMin(c,\"\"),e=this.weekdaysShort(c,\"\"),f=this.weekdays(c,\"\"),g.push(d),h.push(e),i.push(f),k.push(d),k.push(e),k.push(f);for(\n// Sorting makes sure if one weekday (or abbr) is a prefix of another it\n// will match the longer piece.\ng.sort(a),h.sort(a),i.sort(a),k.sort(a),b=0;7>b;b++)h[b]=_(h[b]),i[b]=_(i[b]),k[b]=_(k[b]);this._weekdaysRegex=new RegExp(\"^(\"+k.join(\"|\")+\")\",\"i\"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp(\"^(\"+i.join(\"|\")+\")\",\"i\"),this._weekdaysShortStrictRegex=new RegExp(\"^(\"+h.join(\"|\")+\")\",\"i\"),this._weekdaysMinStrictRegex=new RegExp(\"^(\"+g.join(\"|\")+\")\",\"i\")}\n// FORMATTING\nfunction Qa(){return this.hours()%12||12}function Ra(){return this.hours()||24}function Sa(a,b){T(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}\n// PARSING\nfunction Ta(a,b){return b._meridiemParse}\n// LOCALES\nfunction Ua(a){\n// IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays\n// Using charAt should be more compatible.\nreturn\"p\"===(a+\"\").toLowerCase().charAt(0)}function Va(a,b,c){return a>11?c?\"pm\":\"PM\":c?\"am\":\"AM\"}function Wa(a){return a?a.toLowerCase().replace(\"_\",\"-\"):a}\n// pick the locale from the array\n// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each\n// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root\nfunction Xa(a){for(var b,c,d,e,f=0;f<a.length;){for(e=Wa(a[f]).split(\"-\"),b=e.length,c=Wa(a[f+1]),c=c?c.split(\"-\"):null;b>0;){if(d=Ya(e.slice(0,b).join(\"-\")))return d;if(c&&c.length>=b&&u(e,c,!0)>=b-1)\n//the next array item is better than a shallower substring of this one\nbreak;b--}f++}return null}function Ya(a){var b=null;\n// TODO: Find a better way to register and load all the locales in Node\nif(!we[a]&&\"undefined\"!=typeof module&&module&&module.exports)try{b=se._abbr,require(\"./locale/\"+a),\n// because defineLocale currently also sets the global locale, we\n// want to undo that for lazy loaded locales\nZa(b)}catch(c){}return we[a]}\n// This function will load locale and then set the global locale. If\n// no arguments are passed in, it will simply return the current global\n// locale key.\nfunction Za(a,b){var c;\n// moment.duration._locale = moment._locale = data;\nreturn a&&(c=o(b)?ab(a):$a(a,b),c&&(se=c)),se._abbr}function $a(a,b){if(null!==b){var c=ve;\n// treat as if there is no base config\n// backwards compat for now: also set the locale\nreturn b.abbr=a,null!=we[a]?(x(\"defineLocaleOverride\",\"use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info.\"),c=we[a]._config):null!=b.parentLocale&&(null!=we[b.parentLocale]?c=we[b.parentLocale]._config:x(\"parentLocaleUndefined\",\"specified parentLocale is not defined yet. See http://momentjs.com/guides/#/warnings/parent-locale/\")),we[a]=new B(A(c,b)),Za(a),we[a]}\n// useful for testing\nreturn delete we[a],null}function _a(a,b){if(null!=b){var c,d=ve;\n// MERGE\nnull!=we[a]&&(d=we[a]._config),b=A(d,b),c=new B(b),c.parentLocale=we[a],we[a]=c,\n// backwards compat for now: also set the locale\nZa(a)}else\n// pass null for config to unupdate, useful for tests\nnull!=we[a]&&(null!=we[a].parentLocale?we[a]=we[a].parentLocale:null!=we[a]&&delete we[a]);return we[a]}\n// returns locale data\nfunction ab(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return se;if(!c(a)){if(b=Ya(a))return b;a=[a]}return Xa(a)}function bb(){return rd(we)}function cb(a){var b,c=a._a;return c&&-2===l(a).overflow&&(b=c[Zd]<0||c[Zd]>11?Zd:c[$d]<1||c[$d]>da(c[Yd],c[Zd])?$d:c[_d]<0||c[_d]>24||24===c[_d]&&(0!==c[ae]||0!==c[be]||0!==c[ce])?_d:c[ae]<0||c[ae]>59?ae:c[be]<0||c[be]>59?be:c[ce]<0||c[ce]>999?ce:-1,l(a)._overflowDayOfYear&&(Yd>b||b>$d)&&(b=$d),l(a)._overflowWeeks&&-1===b&&(b=de),l(a)._overflowWeekday&&-1===b&&(b=ee),l(a).overflow=b),a}\n// date from iso format\nfunction db(a){var b,c,d,e,f,g,h=a._i,i=xe.exec(h)||ye.exec(h);if(i){for(l(a).iso=!0,b=0,c=Ae.length;c>b;b++)if(Ae[b][1].exec(i[1])){e=Ae[b][0],d=Ae[b][2]!==!1;break}if(null==e)return void(a._isValid=!1);if(i[3]){for(b=0,c=Be.length;c>b;b++)if(Be[b][1].exec(i[3])){\n// match[2] should be 'T' or space\nf=(i[2]||\" \")+Be[b][0];break}if(null==f)return void(a._isValid=!1)}if(!d&&null!=f)return void(a._isValid=!1);if(i[4]){if(!ze.exec(i[4]))return void(a._isValid=!1);g=\"Z\"}a._f=e+(f||\"\")+(g||\"\"),jb(a)}else a._isValid=!1}\n// date from iso format or fallback\nfunction eb(b){var c=Ce.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(db(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}\n// Pick the first defined of two or three arguments.\nfunction fb(a,b,c){return null!=a?a:null!=b?b:c}function gb(b){\n// hooks is actually the exported moment object\nvar c=new Date(a.now());return b._useUTC?[c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()]:[c.getFullYear(),c.getMonth(),c.getDate()]}\n// convert an array to a date.\n// the array should mirror the parameters below\n// note: all values past the year are optional and will default to the lowest possible value.\n// [year, month, day , hour, minute, second, millisecond]\nfunction hb(a){var b,c,d,e,f=[];if(!a._d){\n// Default to current date.\n// * if no year, month, day of month are given, default to today\n// * if day of month is given, default month and year\n// * if month is given, default only year\n// * if year is given, don't default anything\nfor(d=gb(a),a._w&&null==a._a[$d]&&null==a._a[Zd]&&ib(a),a._dayOfYear&&(e=fb(a._a[Yd],d[Yd]),a._dayOfYear>oa(e)&&(l(a)._overflowDayOfYear=!0),c=sa(e,0,a._dayOfYear),a._a[Zd]=c.getUTCMonth(),a._a[$d]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];\n// Zero out whatever was not defaulted, including time\nfor(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];\n// Check for 24:00:00.000\n24===a._a[_d]&&0===a._a[ae]&&0===a._a[be]&&0===a._a[ce]&&(a._nextDay=!0,a._a[_d]=0),a._d=(a._useUTC?sa:ra).apply(null,f),\n// Apply timezone offset from input. The actual utcOffset can be changed\n// with parseZone.\nnull!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[_d]=24)}}function ib(a){var b,c,d,e,f,g,h,i;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=fb(b.GG,a._a[Yd],va(rb(),1,4).year),d=fb(b.W,1),e=fb(b.E,1),(1>e||e>7)&&(i=!0)):(f=a._locale._week.dow,g=a._locale._week.doy,c=fb(b.gg,a._a[Yd],va(rb(),f,g).year),d=fb(b.w,1),null!=b.d?(e=b.d,(0>e||e>6)&&(i=!0)):null!=b.e?(e=b.e+f,(b.e<0||b.e>6)&&(i=!0)):e=f),1>d||d>wa(c,f,g)?l(a)._overflowWeeks=!0:null!=i?l(a)._overflowWeekday=!0:(h=ua(c,d,e,f,g),a._a[Yd]=h.year,a._dayOfYear=h.dayOfYear)}\n// date from string and format string\nfunction jb(b){\n// TODO: Move this to another part of the creation flow to prevent circular deps\nif(b._f===a.ISO_8601)return void db(b);b._a=[],l(b).empty=!0;\n// This array is used to make a Date, either with `new Date` or `Date.UTC`\nvar c,d,e,f,g,h=\"\"+b._i,i=h.length,j=0;for(e=X(b._f,b._locale).match(Bd)||[],c=0;c<e.length;c++)f=e[c],d=(h.match(Z(f,b))||[])[0],d&&(g=h.substr(0,h.indexOf(d)),g.length>0&&l(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length),Ed[f]?(d?l(b).empty=!1:l(b).unusedTokens.push(f),ca(f,d,b)):b._strict&&!d&&l(b).unusedTokens.push(f);\n// add remaining unparsed input length to the string\nl(b).charsLeftOver=i-j,h.length>0&&l(b).unusedInput.push(h),\n// clear _12h flag if hour is <= 12\nb._a[_d]<=12&&l(b).bigHour===!0&&b._a[_d]>0&&(l(b).bigHour=void 0),l(b).parsedDateParts=b._a.slice(0),l(b).meridiem=b._meridiem,\n// handle meridiem\nb._a[_d]=kb(b._locale,b._a[_d],b._meridiem),hb(b),cb(b)}function kb(a,b,c){var d;\n// Fallback\nreturn null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}\n// date from string and array of format strings\nfunction lb(a){var b,c,d,e,f;if(0===a._f.length)return l(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;e<a._f.length;e++)f=0,b=p({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._f=a._f[e],jb(b),m(b)&&(f+=l(b).charsLeftOver,f+=10*l(b).unusedTokens.length,l(b).score=f,(null==d||d>f)&&(d=f,c=b));i(a,c||b)}function mb(a){if(!a._d){var b=K(a._i);a._a=g([b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],function(a){return a&&parseInt(a,10)}),hb(a)}}function nb(a){var b=new q(cb(ob(a)));\n// Adding is smart enough around DST\nreturn b._nextDay&&(b.add(1,\"d\"),b._nextDay=void 0),b}function ob(a){var b=a._i,d=a._f;return a._locale=a._locale||ab(a._l),null===b||void 0===d&&\"\"===b?n({nullInput:!0}):(\"string\"==typeof b&&(a._i=b=a._locale.preparse(b)),r(b)?new q(cb(b)):(c(d)?lb(a):f(b)?a._d=b:d?jb(a):pb(a),m(a)||(a._d=null),a))}function pb(b){var d=b._i;void 0===d?b._d=new Date(a.now()):f(d)?b._d=new Date(d.valueOf()):\"string\"==typeof d?eb(b):c(d)?(b._a=g(d.slice(0),function(a){return parseInt(a,10)}),hb(b)):\"object\"==typeof d?mb(b):\"number\"==typeof d?\n// from milliseconds\nb._d=new Date(d):a.createFromInputFallback(b)}function qb(a,b,f,g,h){var i={};\n// object construction must be done this way.\n// https://github.com/moment/moment/issues/1423\nreturn\"boolean\"==typeof f&&(g=f,f=void 0),(d(a)&&e(a)||c(a)&&0===a.length)&&(a=void 0),i._isAMomentObject=!0,i._useUTC=i._isUTC=h,i._l=f,i._i=a,i._f=b,i._strict=g,nb(i)}function rb(a,b,c,d){return qb(a,b,c,d,!1)}\n// Pick a moment m from moments so that m[fn](other) is true for all\n// other. This relies on the function fn to be transitive.\n//\n// moments should either be an array of moment objects or an array, whose\n// first element is an array of moment objects.\nfunction sb(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return rb();for(d=b[0],e=1;e<b.length;++e)b[e].isValid()&&!b[e][a](d)||(d=b[e]);return d}\n// TODO: Use [].sort instead?\nfunction tb(){var a=[].slice.call(arguments,0);return sb(\"isBefore\",a)}function ub(){var a=[].slice.call(arguments,0);return sb(\"isAfter\",a)}function vb(a){var b=K(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;\n// representation for dateAddRemove\nthis._milliseconds=+k+1e3*j+// 1000\n6e4*i+// 1000 * 60\n1e3*h*60*60,//using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978\n// Because of dateAddRemove treats 24 hours as different from a\n// day when working around DST, we need to store them separately\nthis._days=+g+7*f,\n// It is impossible translate months into days without knowing\n// which months you are are talking about, so we have to store\n// it separately.\nthis._months=+e+3*d+12*c,this._data={},this._locale=ab(),this._bubble()}function wb(a){return a instanceof vb}function xb(a){return 0>a?-1*Math.round(-1*a):Math.round(a)}\n// FORMATTING\nfunction yb(a,b){T(a,0,0,function(){var a=this.utcOffset(),c=\"+\";return 0>a&&(a=-a,c=\"-\"),c+S(~~(a/60),2)+b+S(~~a%60,2)})}function zb(a,b){var c=(b||\"\").match(a)||[],d=c[c.length-1]||[],e=(d+\"\").match(Ge)||[\"-\",0,0],f=+(60*e[1])+t(e[2]);return\"+\"===e[0]?f:-f}\n// Return a moment from input, that is local/utc/zone equivalent to model.\nfunction Ab(b,c){var d,e;\n// Use low-level api, because this fn is low-level api.\nreturn c._isUTC?(d=c.clone(),e=(r(b)||f(b)?b.valueOf():rb(b).valueOf())-d.valueOf(),d._d.setTime(d._d.valueOf()+e),a.updateOffset(d,!1),d):rb(b).local()}function Bb(a){\n// On Firefox.24 Date#getTimezoneOffset returns a floating point.\n// https://github.com/moment/moment/pull/1871\nreturn 15*-Math.round(a._d.getTimezoneOffset()/15)}\n// MOMENTS\n// keepLocalTime = true means only change the timezone, without\n// affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->\n// 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset\n// +0200, so we adjust the time as needed, to be valid.\n//\n// Keeping the time actually adds/subtracts (one hour)\n// from the actual represented time. That is why we call updateOffset\n// a second time. In case it wants us to change the offset again\n// _changeInProgress == true case, then we have to adjust, because\n// there is no such time in the given timezone.\nfunction Cb(b,c){var d,e=this._offset||0;return this.isValid()?null!=b?(\"string\"==typeof b?b=zb(Td,b):Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Bb(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,\"m\"),e!==b&&(!c||this._changeInProgress?Sb(this,Nb(b-e,\"m\"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Bb(this):null!=b?this:NaN}function Db(a,b){return null!=a?(\"string\"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Eb(a){return this.utcOffset(0,a)}function Fb(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Bb(this),\"m\")),this}function Gb(){if(this._tzm)this.utcOffset(this._tzm);else if(\"string\"==typeof this._i){var a=zb(Sd,this._i);0===a?this.utcOffset(0,!0):this.utcOffset(zb(Sd,this._i))}return this}function Hb(a){return this.isValid()?(a=a?rb(a).utcOffset():0,(this.utcOffset()-a)%60===0):!1}function Ib(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Jb(){if(!o(this._isDSTShifted))return this._isDSTShifted;var a={};if(p(a,this),a=ob(a),a._a){var b=a._isUTC?j(a._a):rb(a._a);this._isDSTShifted=this.isValid()&&u(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Kb(){return this.isValid()?!this._isUTC:!1}function Lb(){return this.isValid()?this._isUTC:!1}function Mb(){return this.isValid()?this._isUTC&&0===this._offset:!1}function Nb(a,b){var c,d,e,f=a,\n// matching against regexp is expensive, do it on demand\ng=null;// checks for null or undefined\nreturn wb(a)?f={ms:a._milliseconds,d:a._days,M:a._months}:\"number\"==typeof a?(f={},b?f[b]=a:f.milliseconds=a):(g=He.exec(a))?(c=\"-\"===g[1]?-1:1,f={y:0,d:t(g[$d])*c,h:t(g[_d])*c,m:t(g[ae])*c,s:t(g[be])*c,ms:t(xb(1e3*g[ce]))*c}):(g=Ie.exec(a))?(c=\"-\"===g[1]?-1:1,f={y:Ob(g[2],c),M:Ob(g[3],c),w:Ob(g[4],c),d:Ob(g[5],c),h:Ob(g[6],c),m:Ob(g[7],c),s:Ob(g[8],c)}):null==f?f={}:\"object\"==typeof f&&(\"from\"in f||\"to\"in f)&&(e=Qb(rb(f.from),rb(f.to)),f={},f.ms=e.milliseconds,f.M=e.months),d=new vb(f),wb(a)&&h(a,\"_locale\")&&(d._locale=a._locale),d}function Ob(a,b){\n// We'd normally use ~~inp for this, but unfortunately it also\n// converts floats to ints.\n// inp may be undefined, so careful calling replace on it.\nvar c=a&&parseFloat(a.replace(\",\",\".\"));\n// apply sign while we're at it\nreturn(isNaN(c)?0:c)*b}function Pb(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,\"M\").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,\"M\"),c}function Qb(a,b){var c;return a.isValid()&&b.isValid()?(b=Ab(b,a),a.isBefore(b)?c=Pb(a,b):(c=Pb(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}}\n// TODO: remove 'name' arg after deprecation is removed\nfunction Rb(a,b){return function(c,d){var e,f;\n//invert the arguments, but complain about it\nreturn null===d||isNaN(+d)||(x(b,\"moment().\"+b+\"(period, number) is deprecated. Please use moment().\"+b+\"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.\"),f=c,c=d,d=f),c=\"string\"==typeof c?+c:c,e=Nb(c,d),Sb(this,e,a),this}}function Sb(b,c,d,e){var f=c._milliseconds,g=xb(c._days),h=xb(c._months);b.isValid()&&(e=null==e?!0:e,f&&b._d.setTime(b._d.valueOf()+f*d),g&&P(b,\"Date\",O(b,\"Date\")+g*d),h&&ia(b,O(b,\"Month\")+h*d),e&&a.updateOffset(b,g||h))}function Tb(a,b){var c=a.diff(b,\"days\",!0);return-6>c?\"sameElse\":-1>c?\"lastWeek\":0>c?\"lastDay\":1>c?\"sameDay\":2>c?\"nextDay\":7>c?\"nextWeek\":\"sameElse\"}function Ub(b,c){\n// We want to compare the start of today, vs this.\n// Getting start-of-today depends on whether we're local/utc/offset or not.\nvar d=b||rb(),e=Ab(d,this).startOf(\"day\"),f=a.calendarFormat(this,e)||\"sameElse\",g=c&&(y(c[f])?c[f].call(this,d):c[f]);return this.format(g||this.localeData().calendar(f,this,rb(d)))}function Vb(){return new q(this)}function Wb(a,b){var c=r(a)?a:rb(a);return this.isValid()&&c.isValid()?(b=J(o(b)?\"millisecond\":b),\"millisecond\"===b?this.valueOf()>c.valueOf():c.valueOf()<this.clone().startOf(b).valueOf()):!1}function Xb(a,b){var c=r(a)?a:rb(a);return this.isValid()&&c.isValid()?(b=J(o(b)?\"millisecond\":b),\"millisecond\"===b?this.valueOf()<c.valueOf():this.clone().endOf(b).valueOf()<c.valueOf()):!1}function Yb(a,b,c,d){return d=d||\"()\",(\"(\"===d[0]?this.isAfter(a,c):!this.isBefore(a,c))&&(\")\"===d[1]?this.isBefore(b,c):!this.isAfter(b,c))}function Zb(a,b){var c,d=r(a)?a:rb(a);return this.isValid()&&d.isValid()?(b=J(b||\"millisecond\"),\"millisecond\"===b?this.valueOf()===d.valueOf():(c=d.valueOf(),this.clone().startOf(b).valueOf()<=c&&c<=this.clone().endOf(b).valueOf())):!1}function $b(a,b){return this.isSame(a,b)||this.isAfter(a,b)}function _b(a,b){return this.isSame(a,b)||this.isBefore(a,b)}function ac(a,b,c){var d,e,f,g;// 1000\n// 1000 * 60\n// 1000 * 60 * 60\n// 1000 * 60 * 60 * 24, negate dst\n// 1000 * 60 * 60 * 24 * 7, negate dst\nreturn this.isValid()?(d=Ab(a,this),d.isValid()?(e=6e4*(d.utcOffset()-this.utcOffset()),b=J(b),\"year\"===b||\"month\"===b||\"quarter\"===b?(g=bc(this,d),\"quarter\"===b?g/=3:\"year\"===b&&(g/=12)):(f=this-d,g=\"second\"===b?f/1e3:\"minute\"===b?f/6e4:\"hour\"===b?f/36e5:\"day\"===b?(f-e)/864e5:\"week\"===b?(f-e)/6048e5:f),c?g:s(g)):NaN):NaN}function bc(a,b){\n// difference in months\nvar c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),\n// b is in (anchor - 1 month, anchor + 1 month)\nf=a.clone().add(e,\"months\");\n//check for negative zero, return zero if negative zero\n// linear across the month\n// linear across the month\nreturn 0>b-f?(c=a.clone().add(e-1,\"months\"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,\"months\"),d=(b-f)/(c-f)),-(e+d)||0}function cc(){return this.clone().locale(\"en\").format(\"ddd MMM DD YYYY HH:mm:ss [GMT]ZZ\")}function dc(){var a=this.clone().utc();return 0<a.year()&&a.year()<=9999?y(Date.prototype.toISOString)?this.toDate().toISOString():W(a,\"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]\"):W(a,\"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]\")}function ec(b){b||(b=this.isUtc()?a.defaultFormatUtc:a.defaultFormat);var c=W(this,b);return this.localeData().postformat(c)}function fc(a,b){return this.isValid()&&(r(a)&&a.isValid()||rb(a).isValid())?Nb({to:this,from:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function gc(a){return this.from(rb(),a)}function hc(a,b){return this.isValid()&&(r(a)&&a.isValid()||rb(a).isValid())?Nb({from:this,to:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function ic(a){return this.to(rb(),a)}\n// If passed a locale key, it will set the locale for this\n// instance. Otherwise, it will return the locale configuration\n// variables for this instance.\nfunction jc(a){var b;return void 0===a?this._locale._abbr:(b=ab(a),null!=b&&(this._locale=b),this)}function kc(){return this._locale}function lc(a){\n// the following switch intentionally omits break keywords\n// to utilize falling through the cases.\nswitch(a=J(a)){case\"year\":this.month(0);/* falls through */\ncase\"quarter\":case\"month\":this.date(1);/* falls through */\ncase\"week\":case\"isoWeek\":case\"day\":case\"date\":this.hours(0);/* falls through */\ncase\"hour\":this.minutes(0);/* falls through */\ncase\"minute\":this.seconds(0);/* falls through */\ncase\"second\":this.milliseconds(0)}\n// weeks are a special case\n// quarters are also special\nreturn\"week\"===a&&this.weekday(0),\"isoWeek\"===a&&this.isoWeekday(1),\"quarter\"===a&&this.month(3*Math.floor(this.month()/3)),this}function mc(a){\n// 'date' is an alias for 'day', so it should be considered as such.\nreturn a=J(a),void 0===a||\"millisecond\"===a?this:(\"date\"===a&&(a=\"day\"),this.startOf(a).add(1,\"isoWeek\"===a?\"week\":a).subtract(1,\"ms\"))}function nc(){return this._d.valueOf()-6e4*(this._offset||0)}function oc(){return Math.floor(this.valueOf()/1e3)}function pc(){return new Date(this.valueOf())}function qc(){var a=this;return[a.year(),a.month(),a.date(),a.hour(),a.minute(),a.second(),a.millisecond()]}function rc(){var a=this;return{years:a.year(),months:a.month(),date:a.date(),hours:a.hours(),minutes:a.minutes(),seconds:a.seconds(),milliseconds:a.milliseconds()}}function sc(){\n// new Date(NaN).toJSON() === null\nreturn this.isValid()?this.toISOString():null}function tc(){return m(this)}function uc(){return i({},l(this))}function vc(){return l(this).overflow}function wc(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function xc(a,b){T(0,[a,a.length],0,b)}\n// MOMENTS\nfunction yc(a){return Cc.call(this,a,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function zc(a){return Cc.call(this,a,this.isoWeek(),this.isoWeekday(),1,4)}function Ac(){return wa(this.year(),1,4)}function Bc(){var a=this.localeData()._week;return wa(this.year(),a.dow,a.doy)}function Cc(a,b,c,d,e){var f;return null==a?va(this,d,e).year:(f=wa(a,d,e),b>f&&(b=f),Dc.call(this,a,b,c,d,e))}function Dc(a,b,c,d,e){var f=ua(a,b,c,d,e),g=sa(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}\n// MOMENTS\nfunction Ec(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}\n// HELPERS\n// MOMENTS\nfunction Fc(a){var b=Math.round((this.clone().startOf(\"day\")-this.clone().startOf(\"year\"))/864e5)+1;return null==a?b:this.add(a-b,\"d\")}function Gc(a,b){b[ce]=t(1e3*(\"0.\"+a))}\n// MOMENTS\nfunction Hc(){return this._isUTC?\"UTC\":\"\"}function Ic(){return this._isUTC?\"Coordinated Universal Time\":\"\"}function Jc(a){return rb(1e3*a)}function Kc(){return rb.apply(null,arguments).parseZone()}function Lc(a){return a}function Mc(a,b,c,d){var e=ab(),f=j().set(d,b);return e[c](f,a)}function Nc(a,b,c){if(\"number\"==typeof a&&(b=a,a=void 0),a=a||\"\",null!=b)return Mc(a,b,c,\"month\");var d,e=[];for(d=0;12>d;d++)e[d]=Mc(a,d,c,\"month\");return e}\n// ()\n// (5)\n// (fmt, 5)\n// (fmt)\n// (true)\n// (true, 5)\n// (true, fmt, 5)\n// (true, fmt)\nfunction Oc(a,b,c,d){\"boolean\"==typeof a?(\"number\"==typeof b&&(c=b,b=void 0),b=b||\"\"):(b=a,c=b,a=!1,\"number\"==typeof b&&(c=b,b=void 0),b=b||\"\");var e=ab(),f=a?e._week.dow:0;if(null!=c)return Mc(b,(c+f)%7,d,\"day\");var g,h=[];for(g=0;7>g;g++)h[g]=Mc(b,(g+f)%7,d,\"day\");return h}function Pc(a,b){return Nc(a,b,\"months\")}function Qc(a,b){return Nc(a,b,\"monthsShort\")}function Rc(a,b,c){return Oc(a,b,c,\"weekdays\")}function Sc(a,b,c){return Oc(a,b,c,\"weekdaysShort\")}function Tc(a,b,c){return Oc(a,b,c,\"weekdaysMin\")}function Uc(){var a=this._data;return this._milliseconds=Ue(this._milliseconds),this._days=Ue(this._days),this._months=Ue(this._months),a.milliseconds=Ue(a.milliseconds),a.seconds=Ue(a.seconds),a.minutes=Ue(a.minutes),a.hours=Ue(a.hours),a.months=Ue(a.months),a.years=Ue(a.years),this}function Vc(a,b,c,d){var e=Nb(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}\n// supports only 2.0-style add(1, 's') or add(duration)\nfunction Wc(a,b){return Vc(this,a,b,1)}\n// supports only 2.0-style subtract(1, 's') or subtract(duration)\nfunction Xc(a,b){return Vc(this,a,b,-1)}function Yc(a){return 0>a?Math.floor(a):Math.ceil(a)}function Zc(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;\n// if we have a mix of positive and negative values, bubble down first\n// check: https://github.com/moment/moment/issues/2166\n// The following code bubbles up values, see the tests for\n// examples of what that means.\n// convert days to months\n// 12 months -> 1 year\nreturn f>=0&&g>=0&&h>=0||0>=f&&0>=g&&0>=h||(f+=864e5*Yc(_c(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=s(f/1e3),i.seconds=a%60,b=s(a/60),i.minutes=b%60,c=s(b/60),i.hours=c%24,g+=s(c/24),e=s($c(g)),h+=e,g-=Yc(_c(e)),d=s(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function $c(a){\n// 400 years have 146097 days (taking into account leap year rules)\n// 400 years have 12 months === 4800\nreturn 4800*a/146097}function _c(a){\n// the reverse of daysToMonths\nreturn 146097*a/4800}function ad(a){var b,c,d=this._milliseconds;if(a=J(a),\"month\"===a||\"year\"===a)return b=this._days+d/864e5,c=this._months+$c(b),\"month\"===a?c:c/12;switch(b=this._days+Math.round(_c(this._months)),a){case\"week\":return b/7+d/6048e5;case\"day\":return b+d/864e5;case\"hour\":return 24*b+d/36e5;case\"minute\":return 1440*b+d/6e4;case\"second\":return 86400*b+d/1e3;\n// Math.floor prevents floating point math errors here\ncase\"millisecond\":return Math.floor(864e5*b)+d;default:throw new Error(\"Unknown unit \"+a)}}\n// TODO: Use this.as('ms')?\nfunction bd(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*t(this._months/12)}function cd(a){return function(){return this.as(a)}}function dd(a){return a=J(a),this[a+\"s\"]()}function ed(a){return function(){return this._data[a]}}function fd(){return s(this.days()/7)}\n// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize\nfunction gd(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function hd(a,b,c){var d=Nb(a).abs(),e=jf(d.as(\"s\")),f=jf(d.as(\"m\")),g=jf(d.as(\"h\")),h=jf(d.as(\"d\")),i=jf(d.as(\"M\")),j=jf(d.as(\"y\")),k=e<kf.s&&[\"s\",e]||1>=f&&[\"m\"]||f<kf.m&&[\"mm\",f]||1>=g&&[\"h\"]||g<kf.h&&[\"hh\",g]||1>=h&&[\"d\"]||h<kf.d&&[\"dd\",h]||1>=i&&[\"M\"]||i<kf.M&&[\"MM\",i]||1>=j&&[\"y\"]||[\"yy\",j];return k[2]=b,k[3]=+a>0,k[4]=c,gd.apply(null,k)}\n// This function allows you to set the rounding function for relative time strings\nfunction id(a){return void 0===a?jf:\"function\"==typeof a?(jf=a,!0):!1}\n// This function allows you to set a threshold for relative time strings\nfunction jd(a,b){return void 0===kf[a]?!1:void 0===b?kf[a]:(kf[a]=b,!0)}function kd(a){var b=this.localeData(),c=hd(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function ld(){\n// for ISO strings we do not use the normal bubbling rules:\n// * milliseconds bubble up until they become hours\n// * days do not bubble at all\n// * months bubble up until they become years\n// This is because there is no context-free conversion between hours and days\n// (think of clock changes)\n// and also not between days and months (28-31 days per month)\nvar a,b,c,d=lf(this._milliseconds)/1e3,e=lf(this._days),f=lf(this._months);a=s(d/60),b=s(a/60),d%=60,a%=60,c=s(f/12),f%=12;\n// inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js\nvar g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(0>m?\"-\":\"\")+\"P\"+(g?g+\"Y\":\"\")+(h?h+\"M\":\"\")+(i?i+\"D\":\"\")+(j||k||l?\"T\":\"\")+(j?j+\"H\":\"\")+(k?k+\"M\":\"\")+(l?l+\"S\":\"\"):\"P0D\"}var md,nd;nd=Array.prototype.some?Array.prototype.some:function(a){for(var b=Object(this),c=b.length>>>0,d=0;c>d;d++)if(d in b&&a.call(this,b[d],d,b))return!0;return!1};\n// Plugins that add properties should also add the key here (null value),\n// so we can properly clone ourselves.\nvar od=a.momentProperties=[],pd=!1,qd={};a.suppressDeprecationWarnings=!1,a.deprecationHandler=null;var rd;rd=Object.keys?Object.keys:function(a){var b,c=[];for(b in a)h(a,b)&&c.push(b);return c};var sd,td={sameDay:\"[Today at] LT\",nextDay:\"[Tomorrow at] LT\",nextWeek:\"dddd [at] LT\",lastDay:\"[Yesterday at] LT\",lastWeek:\"[Last] dddd [at] LT\",sameElse:\"L\"},ud={LTS:\"h:mm:ss A\",LT:\"h:mm A\",L:\"MM/DD/YYYY\",LL:\"MMMM D, YYYY\",LLL:\"MMMM D, YYYY h:mm A\",LLLL:\"dddd, MMMM D, YYYY h:mm A\"},vd=\"Invalid date\",wd=\"%d\",xd=/\\d{1,2}/,yd={future:\"in %s\",past:\"%s ago\",s:\"a few seconds\",m:\"a minute\",mm:\"%d minutes\",h:\"an hour\",hh:\"%d hours\",d:\"a day\",dd:\"%d days\",M:\"a month\",MM:\"%d months\",y:\"a year\",yy:\"%d years\"},zd={},Ad={},Bd=/(\\[[^\\[]*\\])|(\\\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Cd=/(\\[[^\\[]*\\])|(\\\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Dd={},Ed={},Fd=/\\d/,Gd=/\\d\\d/,Hd=/\\d{3}/,Id=/\\d{4}/,Jd=/[+-]?\\d{6}/,Kd=/\\d\\d?/,Ld=/\\d\\d\\d\\d?/,Md=/\\d\\d\\d\\d\\d\\d?/,Nd=/\\d{1,3}/,Od=/\\d{1,4}/,Pd=/[+-]?\\d{1,6}/,Qd=/\\d+/,Rd=/[+-]?\\d+/,Sd=/Z|[+-]\\d\\d:?\\d\\d/gi,Td=/Z|[+-]\\d\\d(?::?\\d\\d)?/gi,Ud=/[+-]?\\d+(\\.\\d{1,3})?/,Vd=/[0-9]*['a-z\\u00A0-\\u05FF\\u0700-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+|[\\u0600-\\u06FF\\/]+(\\s*?[\\u0600-\\u06FF]+){1,2}/i,Wd={},Xd={},Yd=0,Zd=1,$d=2,_d=3,ae=4,be=5,ce=6,de=7,ee=8;sd=Array.prototype.indexOf?Array.prototype.indexOf:function(a){\n// I know\nvar b;for(b=0;b<this.length;++b)if(this[b]===a)return b;return-1},T(\"M\",[\"MM\",2],\"Mo\",function(){return this.month()+1}),T(\"MMM\",0,0,function(a){return this.localeData().monthsShort(this,a)}),T(\"MMMM\",0,0,function(a){return this.localeData().months(this,a)}),I(\"month\",\"M\"),L(\"month\",8),Y(\"M\",Kd),Y(\"MM\",Kd,Gd),Y(\"MMM\",function(a,b){return b.monthsShortRegex(a)}),Y(\"MMMM\",function(a,b){return b.monthsRegex(a)}),aa([\"M\",\"MM\"],function(a,b){b[Zd]=t(a)-1}),aa([\"MMM\",\"MMMM\"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);null!=e?b[Zd]=e:l(c).invalidMonth=a});\n// LOCALES\nvar fe=/D[oD]?(\\[[^\\[\\]]*\\]|\\s+)+MMMM?/,ge=\"January_February_March_April_May_June_July_August_September_October_November_December\".split(\"_\"),he=\"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec\".split(\"_\"),ie=Vd,je=Vd;\n// FORMATTING\nT(\"Y\",0,0,function(){var a=this.year();return 9999>=a?\"\"+a:\"+\"+a}),T(0,[\"YY\",2],0,function(){return this.year()%100}),T(0,[\"YYYY\",4],0,\"year\"),T(0,[\"YYYYY\",5],0,\"year\"),T(0,[\"YYYYYY\",6,!0],0,\"year\"),\n// ALIASES\nI(\"year\",\"y\"),\n// PRIORITIES\nL(\"year\",1),\n// PARSING\nY(\"Y\",Rd),Y(\"YY\",Kd,Gd),Y(\"YYYY\",Od,Id),Y(\"YYYYY\",Pd,Jd),Y(\"YYYYYY\",Pd,Jd),aa([\"YYYYY\",\"YYYYYY\"],Yd),aa(\"YYYY\",function(b,c){c[Yd]=2===b.length?a.parseTwoDigitYear(b):t(b)}),aa(\"YY\",function(b,c){c[Yd]=a.parseTwoDigitYear(b)}),aa(\"Y\",function(a,b){b[Yd]=parseInt(a,10)}),\n// HOOKS\na.parseTwoDigitYear=function(a){return t(a)+(t(a)>68?1900:2e3)};\n// MOMENTS\nvar ke=N(\"FullYear\",!0);\n// FORMATTING\nT(\"w\",[\"ww\",2],\"wo\",\"week\"),T(\"W\",[\"WW\",2],\"Wo\",\"isoWeek\"),\n// ALIASES\nI(\"week\",\"w\"),I(\"isoWeek\",\"W\"),\n// PRIORITIES\nL(\"week\",5),L(\"isoWeek\",5),\n// PARSING\nY(\"w\",Kd),Y(\"ww\",Kd,Gd),Y(\"W\",Kd),Y(\"WW\",Kd,Gd),ba([\"w\",\"ww\",\"W\",\"WW\"],function(a,b,c,d){b[d.substr(0,1)]=t(a)});var le={dow:0,// Sunday is the first day of the week.\ndoy:6};\n// FORMATTING\nT(\"d\",0,\"do\",\"day\"),T(\"dd\",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),T(\"ddd\",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),T(\"dddd\",0,0,function(a){return this.localeData().weekdays(this,a)}),T(\"e\",0,0,\"weekday\"),T(\"E\",0,0,\"isoWeekday\"),\n// ALIASES\nI(\"day\",\"d\"),I(\"weekday\",\"e\"),I(\"isoWeekday\",\"E\"),\n// PRIORITY\nL(\"day\",11),L(\"weekday\",11),L(\"isoWeekday\",11),\n// PARSING\nY(\"d\",Kd),Y(\"e\",Kd),Y(\"E\",Kd),Y(\"dd\",function(a,b){return b.weekdaysMinRegex(a)}),Y(\"ddd\",function(a,b){return b.weekdaysShortRegex(a)}),Y(\"dddd\",function(a,b){return b.weekdaysRegex(a)}),ba([\"dd\",\"ddd\",\"dddd\"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict);\n// if we didn't get a weekday name, mark the date as invalid\nnull!=e?b.d=e:l(c).invalidWeekday=a}),ba([\"d\",\"e\",\"E\"],function(a,b,c,d){b[d]=t(a)});\n// LOCALES\nvar me=\"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday\".split(\"_\"),ne=\"Sun_Mon_Tue_Wed_Thu_Fri_Sat\".split(\"_\"),oe=\"Su_Mo_Tu_We_Th_Fr_Sa\".split(\"_\"),pe=Vd,qe=Vd,re=Vd;T(\"H\",[\"HH\",2],0,\"hour\"),T(\"h\",[\"hh\",2],0,Qa),T(\"k\",[\"kk\",2],0,Ra),T(\"hmm\",0,0,function(){return\"\"+Qa.apply(this)+S(this.minutes(),2)}),T(\"hmmss\",0,0,function(){return\"\"+Qa.apply(this)+S(this.minutes(),2)+S(this.seconds(),2)}),T(\"Hmm\",0,0,function(){return\"\"+this.hours()+S(this.minutes(),2)}),T(\"Hmmss\",0,0,function(){return\"\"+this.hours()+S(this.minutes(),2)+S(this.seconds(),2)}),Sa(\"a\",!0),Sa(\"A\",!1),\n// ALIASES\nI(\"hour\",\"h\"),\n// PRIORITY\nL(\"hour\",13),Y(\"a\",Ta),Y(\"A\",Ta),Y(\"H\",Kd),Y(\"h\",Kd),Y(\"HH\",Kd,Gd),Y(\"hh\",Kd,Gd),Y(\"hmm\",Ld),Y(\"hmmss\",Md),Y(\"Hmm\",Ld),Y(\"Hmmss\",Md),aa([\"H\",\"HH\"],_d),aa([\"a\",\"A\"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),aa([\"h\",\"hh\"],function(a,b,c){b[_d]=t(a),l(c).bigHour=!0}),aa(\"hmm\",function(a,b,c){var d=a.length-2;b[_d]=t(a.substr(0,d)),b[ae]=t(a.substr(d)),l(c).bigHour=!0}),aa(\"hmmss\",function(a,b,c){var d=a.length-4,e=a.length-2;b[_d]=t(a.substr(0,d)),b[ae]=t(a.substr(d,2)),b[be]=t(a.substr(e)),l(c).bigHour=!0}),aa(\"Hmm\",function(a,b,c){var d=a.length-2;b[_d]=t(a.substr(0,d)),b[ae]=t(a.substr(d))}),aa(\"Hmmss\",function(a,b,c){var d=a.length-4,e=a.length-2;b[_d]=t(a.substr(0,d)),b[ae]=t(a.substr(d,2)),b[be]=t(a.substr(e))});var se,te=/[ap]\\.?m?\\.?/i,ue=N(\"Hours\",!0),ve={calendar:td,longDateFormat:ud,invalidDate:vd,ordinal:wd,ordinalParse:xd,relativeTime:yd,months:ge,monthsShort:he,week:le,weekdays:me,weekdaysMin:oe,weekdaysShort:ne,meridiemParse:te},we={},xe=/^\\s*((?:[+-]\\d{6}|\\d{4})-(?:\\d\\d-\\d\\d|W\\d\\d-\\d|W\\d\\d|\\d\\d\\d|\\d\\d))(?:(T| )(\\d\\d(?::\\d\\d(?::\\d\\d(?:[.,]\\d+)?)?)?)([\\+\\-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?/,ye=/^\\s*((?:[+-]\\d{6}|\\d{4})(?:\\d\\d\\d\\d|W\\d\\d\\d|W\\d\\d|\\d\\d\\d|\\d\\d))(?:(T| )(\\d\\d(?:\\d\\d(?:\\d\\d(?:[.,]\\d+)?)?)?)([\\+\\-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?/,ze=/Z|[+-]\\d\\d(?::?\\d\\d)?/,Ae=[[\"YYYYYY-MM-DD\",/[+-]\\d{6}-\\d\\d-\\d\\d/],[\"YYYY-MM-DD\",/\\d{4}-\\d\\d-\\d\\d/],[\"GGGG-[W]WW-E\",/\\d{4}-W\\d\\d-\\d/],[\"GGGG-[W]WW\",/\\d{4}-W\\d\\d/,!1],[\"YYYY-DDD\",/\\d{4}-\\d{3}/],[\"YYYY-MM\",/\\d{4}-\\d\\d/,!1],[\"YYYYYYMMDD\",/[+-]\\d{10}/],[\"YYYYMMDD\",/\\d{8}/],\n// YYYYMM is NOT allowed by the standard\n[\"GGGG[W]WWE\",/\\d{4}W\\d{3}/],[\"GGGG[W]WW\",/\\d{4}W\\d{2}/,!1],[\"YYYYDDD\",/\\d{7}/]],Be=[[\"HH:mm:ss.SSSS\",/\\d\\d:\\d\\d:\\d\\d\\.\\d+/],[\"HH:mm:ss,SSSS\",/\\d\\d:\\d\\d:\\d\\d,\\d+/],[\"HH:mm:ss\",/\\d\\d:\\d\\d:\\d\\d/],[\"HH:mm\",/\\d\\d:\\d\\d/],[\"HHmmss.SSSS\",/\\d\\d\\d\\d\\d\\d\\.\\d+/],[\"HHmmss,SSSS\",/\\d\\d\\d\\d\\d\\d,\\d+/],[\"HHmmss\",/\\d\\d\\d\\d\\d\\d/],[\"HHmm\",/\\d\\d\\d\\d/],[\"HH\",/\\d\\d/]],Ce=/^\\/?Date\\((\\-?\\d+)/i;a.createFromInputFallback=w(\"value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.\",function(a){a._d=new Date(a._i+(a._useUTC?\" UTC\":\"\"))}),\n// constant that refers to the ISO standard\na.ISO_8601=function(){};var De=w(\"moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/\",function(){var a=rb.apply(null,arguments);return this.isValid()&&a.isValid()?this>a?this:a:n()}),Ee=w(\"moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/\",function(){var a=rb.apply(null,arguments);return this.isValid()&&a.isValid()?a>this?this:a:n()}),Fe=function(){return Date.now?Date.now():+new Date};yb(\"Z\",\":\"),yb(\"ZZ\",\"\"),\n// PARSING\nY(\"Z\",Td),Y(\"ZZ\",Td),aa([\"Z\",\"ZZ\"],function(a,b,c){c._useUTC=!0,c._tzm=zb(Td,a)});\n// HELPERS\n// timezone chunker\n// '+10:00' > ['10', '00']\n// '-1530' > ['-15', '30']\nvar Ge=/([\\+\\-]|\\d\\d)/gi;\n// HOOKS\n// This function will be called whenever a moment is mutated.\n// It is intended to keep the offset in sync with the timezone.\na.updateOffset=function(){};\n// ASP.NET json date format regex\nvar He=/^(\\-)?(?:(\\d*)[. ])?(\\d+)\\:(\\d+)(?:\\:(\\d+)(\\.\\d*)?)?$/,Ie=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Nb.fn=vb.prototype;var Je=Rb(1,\"add\"),Ke=Rb(-1,\"subtract\");a.defaultFormat=\"YYYY-MM-DDTHH:mm:ssZ\",a.defaultFormatUtc=\"YYYY-MM-DDTHH:mm:ss[Z]\";var Le=w(\"moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.\",function(a){return void 0===a?this.localeData():this.locale(a)});\n// FORMATTING\nT(0,[\"gg\",2],0,function(){return this.weekYear()%100}),T(0,[\"GG\",2],0,function(){return this.isoWeekYear()%100}),xc(\"gggg\",\"weekYear\"),xc(\"ggggg\",\"weekYear\"),xc(\"GGGG\",\"isoWeekYear\"),xc(\"GGGGG\",\"isoWeekYear\"),\n// ALIASES\nI(\"weekYear\",\"gg\"),I(\"isoWeekYear\",\"GG\"),\n// PRIORITY\nL(\"weekYear\",1),L(\"isoWeekYear\",1),\n// PARSING\nY(\"G\",Rd),Y(\"g\",Rd),Y(\"GG\",Kd,Gd),Y(\"gg\",Kd,Gd),Y(\"GGGG\",Od,Id),Y(\"gggg\",Od,Id),Y(\"GGGGG\",Pd,Jd),Y(\"ggggg\",Pd,Jd),ba([\"gggg\",\"ggggg\",\"GGGG\",\"GGGGG\"],function(a,b,c,d){b[d.substr(0,2)]=t(a)}),ba([\"gg\",\"GG\"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),\n// FORMATTING\nT(\"Q\",0,\"Qo\",\"quarter\"),\n// ALIASES\nI(\"quarter\",\"Q\"),\n// PRIORITY\nL(\"quarter\",7),\n// PARSING\nY(\"Q\",Fd),aa(\"Q\",function(a,b){b[Zd]=3*(t(a)-1)}),\n// FORMATTING\nT(\"D\",[\"DD\",2],\"Do\",\"date\"),\n// ALIASES\nI(\"date\",\"D\"),\n// PRIOROITY\nL(\"date\",9),\n// PARSING\nY(\"D\",Kd),Y(\"DD\",Kd,Gd),Y(\"Do\",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),aa([\"D\",\"DD\"],$d),aa(\"Do\",function(a,b){b[$d]=t(a.match(Kd)[0],10)});\n// MOMENTS\nvar Me=N(\"Date\",!0);\n// FORMATTING\nT(\"DDD\",[\"DDDD\",3],\"DDDo\",\"dayOfYear\"),\n// ALIASES\nI(\"dayOfYear\",\"DDD\"),\n// PRIORITY\nL(\"dayOfYear\",4),\n// PARSING\nY(\"DDD\",Nd),Y(\"DDDD\",Hd),aa([\"DDD\",\"DDDD\"],function(a,b,c){c._dayOfYear=t(a)}),\n// FORMATTING\nT(\"m\",[\"mm\",2],0,\"minute\"),\n// ALIASES\nI(\"minute\",\"m\"),\n// PRIORITY\nL(\"minute\",14),\n// PARSING\nY(\"m\",Kd),Y(\"mm\",Kd,Gd),aa([\"m\",\"mm\"],ae);\n// MOMENTS\nvar Ne=N(\"Minutes\",!1);\n// FORMATTING\nT(\"s\",[\"ss\",2],0,\"second\"),\n// ALIASES\nI(\"second\",\"s\"),\n// PRIORITY\nL(\"second\",15),\n// PARSING\nY(\"s\",Kd),Y(\"ss\",Kd,Gd),aa([\"s\",\"ss\"],be);\n// MOMENTS\nvar Oe=N(\"Seconds\",!1);\n// FORMATTING\nT(\"S\",0,0,function(){return~~(this.millisecond()/100)}),T(0,[\"SS\",2],0,function(){return~~(this.millisecond()/10)}),T(0,[\"SSS\",3],0,\"millisecond\"),T(0,[\"SSSS\",4],0,function(){return 10*this.millisecond()}),T(0,[\"SSSSS\",5],0,function(){return 100*this.millisecond()}),T(0,[\"SSSSSS\",6],0,function(){return 1e3*this.millisecond()}),T(0,[\"SSSSSSS\",7],0,function(){return 1e4*this.millisecond()}),T(0,[\"SSSSSSSS\",8],0,function(){return 1e5*this.millisecond()}),T(0,[\"SSSSSSSSS\",9],0,function(){return 1e6*this.millisecond()}),\n// ALIASES\nI(\"millisecond\",\"ms\"),\n// PRIORITY\nL(\"millisecond\",16),\n// PARSING\nY(\"S\",Nd,Fd),Y(\"SS\",Nd,Gd),Y(\"SSS\",Nd,Hd);var Pe;for(Pe=\"SSSS\";Pe.length<=9;Pe+=\"S\")Y(Pe,Qd);for(Pe=\"S\";Pe.length<=9;Pe+=\"S\")aa(Pe,Gc);\n// MOMENTS\nvar Qe=N(\"Milliseconds\",!1);\n// FORMATTING\nT(\"z\",0,0,\"zoneAbbr\"),T(\"zz\",0,0,\"zoneName\");var Re=q.prototype;Re.add=Je,Re.calendar=Ub,Re.clone=Vb,Re.diff=ac,Re.endOf=mc,Re.format=ec,Re.from=fc,Re.fromNow=gc,Re.to=hc,Re.toNow=ic,Re.get=Q,Re.invalidAt=vc,Re.isAfter=Wb,Re.isBefore=Xb,Re.isBetween=Yb,Re.isSame=Zb,Re.isSameOrAfter=$b,Re.isSameOrBefore=_b,Re.isValid=tc,Re.lang=Le,Re.locale=jc,Re.localeData=kc,Re.max=Ee,Re.min=De,Re.parsingFlags=uc,Re.set=R,Re.startOf=lc,Re.subtract=Ke,Re.toArray=qc,Re.toObject=rc,Re.toDate=pc,Re.toISOString=dc,Re.toJSON=sc,Re.toString=cc,Re.unix=oc,Re.valueOf=nc,Re.creationData=wc,\n// Year\nRe.year=ke,Re.isLeapYear=qa,\n// Week Year\nRe.weekYear=yc,Re.isoWeekYear=zc,\n// Quarter\nRe.quarter=Re.quarters=Ec,\n// Month\nRe.month=ja,Re.daysInMonth=ka,\n// Week\nRe.week=Re.weeks=Aa,Re.isoWeek=Re.isoWeeks=Ba,Re.weeksInYear=Bc,Re.isoWeeksInYear=Ac,\n// Day\nRe.date=Me,Re.day=Re.days=Ja,Re.weekday=Ka,Re.isoWeekday=La,Re.dayOfYear=Fc,\n// Hour\nRe.hour=Re.hours=ue,\n// Minute\nRe.minute=Re.minutes=Ne,\n// Second\nRe.second=Re.seconds=Oe,\n// Millisecond\nRe.millisecond=Re.milliseconds=Qe,\n// Offset\nRe.utcOffset=Cb,Re.utc=Eb,Re.local=Fb,Re.parseZone=Gb,Re.hasAlignedHourOffset=Hb,Re.isDST=Ib,Re.isLocal=Kb,Re.isUtcOffset=Lb,Re.isUtc=Mb,Re.isUTC=Mb,\n// Timezone\nRe.zoneAbbr=Hc,Re.zoneName=Ic,\n// Deprecations\nRe.dates=w(\"dates accessor is deprecated. Use date instead.\",Me),Re.months=w(\"months accessor is deprecated. Use month instead\",ja),Re.years=w(\"years accessor is deprecated. Use year instead\",ke),Re.zone=w(\"moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/\",Db),Re.isDSTShifted=w(\"isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information\",Jb);var Se=Re,Te=B.prototype;Te.calendar=C,Te.longDateFormat=D,Te.invalidDate=E,Te.ordinal=F,Te.preparse=Lc,Te.postformat=Lc,Te.relativeTime=G,Te.pastFuture=H,Te.set=z,\n// Month\nTe.months=ea,Te.monthsShort=fa,Te.monthsParse=ha,Te.monthsRegex=ma,Te.monthsShortRegex=la,\n// Week\nTe.week=xa,Te.firstDayOfYear=za,Te.firstDayOfWeek=ya,\n// Day of Week\nTe.weekdays=Ea,Te.weekdaysMin=Ga,Te.weekdaysShort=Fa,Te.weekdaysParse=Ia,Te.weekdaysRegex=Ma,Te.weekdaysShortRegex=Na,Te.weekdaysMinRegex=Oa,\n// Hours\nTe.isPM=Ua,Te.meridiem=Va,Za(\"en\",{ordinalParse:/\\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===t(a%100/10)?\"th\":1===b?\"st\":2===b?\"nd\":3===b?\"rd\":\"th\";return a+c}}),\n// Side effect imports\na.lang=w(\"moment.lang is deprecated. Use moment.locale instead.\",Za),a.langData=w(\"moment.langData is deprecated. Use moment.localeData instead.\",ab);var Ue=Math.abs,Ve=cd(\"ms\"),We=cd(\"s\"),Xe=cd(\"m\"),Ye=cd(\"h\"),Ze=cd(\"d\"),$e=cd(\"w\"),_e=cd(\"M\"),af=cd(\"y\"),bf=ed(\"milliseconds\"),cf=ed(\"seconds\"),df=ed(\"minutes\"),ef=ed(\"hours\"),ff=ed(\"days\"),gf=ed(\"months\"),hf=ed(\"years\"),jf=Math.round,kf={s:45,// seconds to minute\nm:45,// minutes to hour\nh:22,// hours to day\nd:26,// days to month\nM:11},lf=Math.abs,mf=vb.prototype;mf.abs=Uc,mf.add=Wc,mf.subtract=Xc,mf.as=ad,mf.asMilliseconds=Ve,mf.asSeconds=We,mf.asMinutes=Xe,mf.asHours=Ye,mf.asDays=Ze,mf.asWeeks=$e,mf.asMonths=_e,mf.asYears=af,mf.valueOf=bd,mf._bubble=Zc,mf.get=dd,mf.milliseconds=bf,mf.seconds=cf,mf.minutes=df,mf.hours=ef,mf.days=ff,mf.weeks=fd,mf.months=gf,mf.years=hf,mf.humanize=kd,mf.toISOString=ld,mf.toString=ld,mf.toJSON=ld,mf.locale=jc,mf.localeData=kc,\n// Deprecations\nmf.toIsoString=w(\"toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)\",ld),mf.lang=Le,\n// Side effect imports\n// FORMATTING\nT(\"X\",0,0,\"unix\"),T(\"x\",0,0,\"valueOf\"),\n// PARSING\nY(\"x\",Rd),Y(\"X\",Ud),aa(\"X\",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),aa(\"x\",function(a,b,c){c._d=new Date(t(a))}),\n// Side effect imports\na.version=\"2.15.1\",b(rb),a.fn=Se,a.min=tb,a.max=ub,a.now=Fe,a.utc=j,a.unix=Jc,a.months=Pc,a.isDate=f,a.locale=Za,a.invalid=n,a.duration=Nb,a.isMoment=r,a.weekdays=Rc,a.parseZone=Kc,a.localeData=ab,a.isDuration=wb,a.monthsShort=Qc,a.weekdaysMin=Tc,a.defineLocale=$a,a.updateLocale=_a,a.locales=bb,a.weekdaysShort=Sc,a.normalizeUnits=J,a.relativeTimeRounding=id,a.relativeTimeThreshold=jd,a.calendarFormat=Tb,a.prototype=Se;var nf=a;return nf});\n\n\n\n\nfor (i=0;i<msg.payload.length;i++) {\n msg.payload[i].episodepodcastid=msg.podcastId;\n msg.payload[i].episodepodcasttitle=msg.podcastTitle;\n msg.payload[i].episodeid=[i][0];\n msg.payload[i].episodedatetimestamp=moment(msg.payload[i].episodedate).format(\"X\");\n}\n\nmsg.payload.sort((a,b) => (a.episodedatetimestamp > b.episodedatetimestamp) ? 1 : ((b.episodedatetimestamp > a.episodedatetimestamp) ? -1 : 0))\n\nnode.send({\n payload:{\n \"podcastEpisodes\":msg.payload,\n //\"podcastId\":msg.podcastId\n },\n _session:msg._session\n});\n","outputs":1,"noerr":0,"x":510,"y":560,"wires":[["373e563.e73b0aa"]]},{"id":"12d6cf8b.b6297","type":"debug","z":"7897ac1d.896074","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":510,"y":560,"wires":[]},{"id":"b794808a.5fde7","type":"inject","z":"7897ac1d.896074","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":460,"y":400,"wires":[["cc81da74.65eaf8"]]},{"id":"cc81da74.65eaf8","type":"http request","z":"7897ac1d.896074","name":"","method":"GET","ret":"txt","url":"https://www.gotceleb.com/feed","tls":"","x":500,"y":480,"wires":[["3f49da7e.ebf556"]]},{"id":"3f49da7e.ebf556","type":"xml","z":"7897ac1d.896074","name":"","property":"payload","attr":"","chr":"","x":490,"y":520,"wires":[["12d6cf8b.b6297"]]},{"id":"76264985.45ba78","type":"function","z":"59fd6661.f8f6e8","name":"set pod url","func":"node.send({\n url:\"https://www.omnycontent.com/d/playlist/aaea4e69-af51-495e-afc9-a9760146922b/d2c4e775-99ce-4c17-b04c-ac380133d68c/2c6993d0-eac8-4252-8c4e-ac380133d69a/podcast.rss\",\n podcastId:\"6\"\n});\n","outputs":1,"noerr":0,"x":1250,"y":980,"wires":[["545b471f.1700e8"]]},{"id":"ad48cd19.c6c67","type":"inject","z":"59fd6661.f8f6e8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1240,"y":940,"wires":[["76264985.45ba78"]]},{"id":"545b471f.1700e8","type":"http request","z":"59fd6661.f8f6e8","name":"get feed","method":"GET","ret":"txt","url":"","tls":"","x":1240,"y":1020,"wires":[["67e5113e.85ea3"]]},{"id":"67e5113e.85ea3","type":"xml","z":"59fd6661.f8f6e8","name":"parse feed","property":"payload","attr":"","chr":"","x":1250,"y":1060,"wires":[["a5069d2d.cc9ef"]]},{"id":"a5069d2d.cc9ef","type":"function","z":"59fd6661.f8f6e8","name":"mapping","func":"msg.newEpisodes=[];\nvar items=msg.payload.rss.channel[0].item;\n\nfor (i=0;i<items.length;i++) {\n \n if (items[i].guid[0]._) {\n items[i].guid[0]=items[i].guid[0]._;\n }\n \n var description=items[i].description[0].replace(/(<([^>]+)>)/ig,\"\");\n \n //items[i].title[0]=items[i].title[0].replace(/(\\r\\n|\\n|\\r)/gm, \"\");\n if (typeof items[i].guid != 'undefined' && typeof items[i].enclosure != 'undefined' && typeof items[i].title != 'undefined' && typeof items[i].pubDate != 'undefined') {\n \n var duration=0;\n if (typeof items[i][\"itunes:duration\"]!=\"undefined\") {\n duration=convertDuration(items[i][\"itunes:duration\"][0]);\n }\n\n msg.newEpisodes.push({\n guid:items[i].guid[0].replace(/[^a-z0-9]/gi, '_').toLowerCase(),\n url:items[i].enclosure[0].$.url,\n title:items[i].title[0],\n date:items[i].pubDate[0],\n /*length:convertDuration(items[i][\"itunes:duration\"][0])*/\n duration:duration,\n description:description\n });\n }\n \n}\n\nfunction convertDuration(duration) {\n //if duration contains 2 instances of \":\"\n if ((duration.match(/:/g) || []).length==2) {\n var a = duration.split(':');\n var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]);\n duration=seconds;\n }\n //if duration contains 1 instance of \":\"\n else if ((duration.match(/:/g) || []).length==1) {\n var h=\"00:\"\n duration=h.concat(duration);\n var a = duration.split(':');\n var seconds = (+a[0]) * 60 * 60 + (+a[1]) * 60 + (+a[2]);\n duration=seconds;\n }\n \n //if duration contains 0 instances of \":\"\n else if ((duration.match(/:/g) || []).length==0) {\n duration=parseInt(duration);\n }\n return duration;\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"x":1240,"y":1100,"wires":[["657198a.6392668"]]},{"id":"657198a.6392668","type":"function","z":"59fd6661.f8f6e8","name":"update in db","func":"for (i=msg.newEpisodes.length-1;i>-1;i--) {\n checkAndAdd(msg.newEpisodes[i].guid,msg.newEpisodes[i].url,msg.newEpisodes[i].title,msg.newEpisodes[i].date,msg.newEpisodes[i].duration,msg.newEpisodes[i].description);\n}\n\nfunction checkAndAdd(guid,url,title,date,duration,description) {\n\n node.send({\n //topic:\"INSERT OR REPLACE INTO podcast_\"+msg.podcastId+\" (episodeguid,episodeurl,episodetitle,episodefile,episodedate,episodeduration,episodeplayed,episodearchived,episodeplayedlast,episodeplayedtimestamp,episodedownloaded,episodequeued,episodedescription) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)\",\n //payload:[guid,url,title,title.replace(/[^a-z0-9()]/gi, '_').toLowerCase(),date,duration,0,0,0,0,0,0,description]\n topic:\"UPDATE podcast_\"+msg.podcastId+\" SET episodeurl='\"+url+\"' WHERE episodeguid='\"+guid+\"'\"\n });\n}\n\n","outputs":1,"noerr":0,"x":1250,"y":1140,"wires":[["1520d36d.ccebed"]]},{"id":"1520d36d.ccebed","type":"delay","z":"59fd6661.f8f6e8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"15","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1260,"y":1180,"wires":[["429e1b5c.5b1dc4"]]},{"id":"def76a59.5b0778","type":"debug","z":"59fd6661.f8f6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1230,"y":1260,"wires":[]},{"id":"d4df55c.65e95a8","type":"comment","z":"59fd6661.f8f6e8","name":"update ep url","info":"","x":1250,"y":900,"wires":[]},{"id":"429e1b5c.5b1dc4","type":"sqlite","z":"59fd6661.f8f6e8","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":1240,"y":1220,"wires":[["def76a59.5b0778"]]},{"id":"f9708410.ae2a08","type":"inject","z":"7897ac1d.896074","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1020,"y":220,"wires":[["1539261a.6ec2aa"]]},{"id":"96809acc.d351f8","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":1020,"y":300,"wires":[["8b5d8ec7.2dc64"]]},{"id":"8b5d8ec7.2dc64","type":"function","z":"7897ac1d.896074","name":"","func":"//msg.topic=\"INSERT OR REPLACE INTO podcast_1 () VALUES ();\n\nfor (i=0;i<msg.payload.length;i++) {\n var episode=msg.payload[i];\n node.send({topic:\"UPDATE podcast_\"+msg.podcastId+\" SET episodequeued='0', episodedownloaded='0' WHERE episodeguid='\"+episode.episodeguid+\"'\"});\n\n}\n","outputs":1,"noerr":0,"x":1010,"y":340,"wires":[["f959173a.485e78"]]},{"id":"7e881517.2999ac","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":1020,"y":420,"wires":[["1af1ebdf.2d2404"]]},{"id":"1af1ebdf.2d2404","type":"debug","z":"7897ac1d.896074","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1170,"y":260,"wires":[]},{"id":"f959173a.485e78","type":"delay","z":"7897ac1d.896074","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"30","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1040,"y":380,"wires":[["7e881517.2999ac"]]},{"id":"1539261a.6ec2aa","type":"function","z":"7897ac1d.896074","name":"","func":"podcasts=msg.payload;\n\n node.send({\n topic:\"SELECT * FROM podcast_26\",\n podcastId:\"26\"\n })\n","outputs":1,"noerr":0,"x":1010,"y":260,"wires":[["96809acc.d351f8"]]},{"id":"eab6b6f7.788678","type":"jimp-image","z":"59fd6661.f8f6e8","name":"resize img","data":"payload","dataType":"msg","ret":"buf","parameter1":"300","parameter1Type":"num","parameter2":"","parameter2Type":"auto","parameter3":"RESIZE_NEAREST_NEIGHBOR","parameter3Type":"resizeMode","parameter4":"","parameter4Type":"msg","parameter5":"","parameter5Type":"msg","parameter6":"","parameter6Type":"msg","parameter7":"","parameter7Type":"msg","parameter8":"","parameter8Type":"msg","parameterCount":3,"jimpFunction":"resize","selectedJimpFunction":{"name":"resize","fn":"resize","description":"resize the image. One of the w or h parameters can be set to automatic (\"Jimp.AUTO\" or -1).","parameters":[{"name":"w","type":"num|auto","required":true,"hint":"the width to resize the image to (or \"Jimp.AUTO\" or -1)"},{"name":"h","type":"num|auto","required":true,"hint":"the height to resize the image to (or \"Jimp.AUTO\" or -1)"},{"name":"mode","type":"resizeMode","required":false,"hint":"a scaling method (e.g. Jimp.RESIZE_BEZIER)"}]},"x":1010,"y":1380,"wires":[["463e0c93.23e194"]]},{"id":"68288db.8637174","type":"delay","z":"59fd6661.f8f6e8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1020,"y":1260,"wires":[["347c1b14.ead994"]]},{"id":"d023c1a1.c6adb","type":"comment","z":"59fd6661.f8f6e8","name":"mnt drive","info":"","x":1220,"y":720,"wires":[]},{"id":"2756f3b.d27ca0c","type":"catch","z":"59fd6661.f8f6e8","name":"","scope":["a9b58b32.5238a8"],"x":1170,"y":260,"wires":[["64b9c116.4823b","ecf318f7.25b8c8"]]},{"id":"64b9c116.4823b","type":"debug","z":"59fd6661.f8f6e8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1170,"y":300,"wires":[]},{"id":"82c8befa.81966","type":"inject","z":"7897ac1d.896074","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1080,"y":80,"wires":[["5c5e5845.c8eb18"]]},{"id":"5c5e5845.c8eb18","type":"function","z":"7897ac1d.896074","name":"","func":"podcasts=msg.payload;\n\n node.send({\n topic:\"DELETE FROM podcast_38 WHERE episodeurl LIKE '%podtrac%'\",\n podcastId:\"38\"\n })\n","outputs":1,"noerr":0,"x":1070,"y":120,"wires":[["52b4f118.f23d"]]},{"id":"52b4f118.f23d","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":1080,"y":160,"wires":[["1af1ebdf.2d2404"]]},{"id":"eabbfde4.ad361","type":"comment","z":"7897ac1d.896074","name":"delete LIKE","info":"","x":1070,"y":40,"wires":[]},{"id":"e3c325d7.f26fc8","type":"inject","z":"7897ac1d.896074","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":100,"wires":[["6c971a07.7f6ba4"]]},{"id":"6c971a07.7f6ba4","type":"function","z":"7897ac1d.896074","name":"","func":"msg.topic=\"INSERT INTO podcast_38 SELECT * FROM podcast_39;\";\n\n\nreturn msg;","outputs":1,"noerr":0,"x":90,"y":140,"wires":[["1604db33.8b41c5"]]},{"id":"1604db33.8b41c5","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","name":"podcasts","x":100,"y":180,"wires":[["e99a1b26.2a3498"]]},{"id":"e99a1b26.2a3498","type":"debug","z":"7897ac1d.896074","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":110,"y":220,"wires":[]},{"id":"8a1400eb.8b6a1","type":"comment","z":"7897ac1d.896074","name":"from one table to another","info":"","x":150,"y":60,"wires":[]},{"id":"7bab40a0.991aa","type":"function","z":"7897ac1d.896074","name":"list tables","func":"msg.topic = \"SELECT * FROM sqlite_master\";\nmsg.payload=\"\";\nreturn msg;\n\n","outputs":1,"noerr":0,"x":420,"y":780,"wires":[["18cd2bb4.8e8164"]]},{"id":"18cd2bb4.8e8164","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":420,"y":820,"wires":[["825f53c2.efb37"]]},{"id":"825f53c2.efb37","type":"debug","z":"7897ac1d.896074","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":410,"y":860,"wires":[]},{"id":"3599775e.e0eb08","type":"inject","z":"7897ac1d.896074","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":420,"y":740,"wires":[["7bab40a0.991aa"]]},{"id":"6dc3ed62.c7d244","type":"function","z":"7897ac1d.896074","name":"","func":"node.send({\n topic:\"DELETE FROM podcastsqueue WHERE episodepodcastid = '22'\"\n});","outputs":1,"noerr":0,"x":1290,"y":120,"wires":[["2b3f3a7c.fea5a6"]]},{"id":"2b3f3a7c.fea5a6","type":"sqlite","z":"7897ac1d.896074","mydb":"34b586c4.b5bb5a","sql":"","name":"podcasts","x":1300,"y":160,"wires":[["74da78d4.c11fc8"]]},{"id":"35ffb0e6.d0896","type":"inject","z":"7897ac1d.896074","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1300,"y":80,"wires":[["6dc3ed62.c7d244"]]},{"id":"74da78d4.c11fc8","type":"debug","z":"7897ac1d.896074","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1290,"y":200,"wires":[]},{"id":"fb6c7174.97c72","type":"comment","z":"7897ac1d.896074","name":"delete from queue","info":"","x":1310,"y":40,"wires":[]}]