()
| 59 | } |
| 60 | |
| 61 | async function main() { |
| 62 | const alive = new KeepAlive(); |
| 63 | alive.start(); |
| 64 | |
| 65 | try { |
| 66 | setBadgeText('⌛'); |
| 67 | await api.settings.init(); |
| 68 | if (!api.settings.get('epPredictions')) { |
| 69 | throw 'epPredictions disabled'; |
| 70 | } |
| 71 | await listUpdateWithPOST(1, 'anime'); |
| 72 | await listUpdateWithPOST(1, 'manga'); |
| 73 | if (api.settings.get('loadPTWForProgress')) { |
| 74 | await listUpdateWithPOST(6, 'anime'); |
| 75 | await listUpdateWithPOST(6, 'manga'); |
| 76 | } |
| 77 | con.log('Progress done'); |
| 78 | setBadgeText(''); |
| 79 | alive.stop(); |
| 80 | return true; |
| 81 | } catch (e) { |
| 82 | con.log('Progress Failed', e); |
| 83 | } |
| 84 | setBadgeText(''); |
| 85 | alive.stop(); |
| 86 | return false; |
| 87 | } |
| 88 | |
| 89 | async function listUpdateWithPOST(state, type) { |
| 90 | const logger = con.m('release').m(type); |
no test coverage detected