MCPcopy Create free account
hub / github.com/MALSync/MALSync / fn

Function fn

src/_provider/listAbstract.ts:257–291  ·  view source on GitHub ↗
(
    // TODO: Remove 'startDate' | 'finishDate' | 'rewatchCount' from Omit when all providers are updated
    passedItem: Omit<listElement, 'fn' | 'startDate' | 'finishDate' | 'rewatchCount'> & {
      [k: string]: any;
    },
    streamurl = '',
  )

Source from the content-addressed store, hash-verified

255
256 // itemFunctions;
257 async fn(
258 // TODO: Remove 'startDate' | 'finishDate' | 'rewatchCount' from Omit when all providers are updated
259 passedItem: Omit<listElement, 'fn' | 'startDate' | 'finishDate' | 'rewatchCount'> & {
260 [k: string]: any;
261 },
262 streamurl = '',
263 ) {
264 let continueUrlTemp: any = null;
265 const item = passedItem as listElement;
266 item.fn = {
267 continueUrl: () => {
268 if (continueUrlTemp !== null) return continueUrlTemp;
269 return utils.getContinueWaching(item.type, item.cacheKey).then(obj => {
270 const curEp = parseInt(item.watchedEp.toString());
271
272 if (obj === undefined || obj.ep !== curEp + 1) return '';
273
274 continueUrlTemp = obj.url;
275
276 return continueUrlTemp;
277 });
278 },
279 initProgress: () => {
280 return new ProgressRelease(item.cacheKey, item.type).init().then(progress => {
281 item.fn.progress = progress;
282 });
283 },
284 progress: null,
285 };
286 item.options = await utils.getEntrySettings(item.type, item.cacheKey, item.tags);
287 if (streamurl) item.options!.u = streamurl;
288 if (this.modes.sortAiring || this.modes.initProgress) await item.fn.initProgress();
289
290 return item;
291 }
292
293 // Modes
294 async initProgress() {

Callers 1

loadImageFunction · 0.50

Calls 1

initMethod · 0.45

Tested by

no test coverage detected