decord/source/modules/content_inventory/matchUtils.tsx
github-actions da5b5e5efe chore: update source for alpha 346.6
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
2026-09-12 13:45:10 +00:00

157 lines
5.6 KiB
TypeScript

// Module ID: 8455
// Function ID: 8456
// Name: matchUtils
// Dependencies: [1074, 8456, 8458, 8459, 8461, 8462, 8252, 2]
// Exports: findMatchingEntry, isCrunchyrollEntry, isMatchingApplicationActivity, isMatchingWatchActivity, isSpotifyEntry
// Module 8455 (matchUtils)
import Constants from "Constants" /* 1074 */;
import CrunchyrollConnectionConstants from "CrunchyrollConnectionConstants" /* 8456 */;
import SpotifyConstants from "SpotifyConstants" /* 8458 */;
import ContentInventoryTypes from "ContentInventoryTypes" /* 8459 */;
import isCrunchyrollActivityDefault from "isCrunchyrollActivity" /* 8462 */;
import size from "module_2" /* 2 */;
const require = globalThis.__r;
function isMatchingListeningActivity(extra, party) {
if (obj.isListenedSessionEntry(extra)) {
const first = extra.extra.entries[0];
let provider;
if (first != null) {
const media = first.media;
if (media != null) {
provider = media.provider;
}
}
let isTopArtistEntryResult = provider === tmp(8461).ContentInventoryListenedMediaProvider.SPOTIFY;
} else {
isTopArtistEntryResult = tmp(8459).isTopArtistEntry(extra);
if (isTopArtistEntryResult) {
isTopArtistEntryResult = extra.extra.media.provider === tmp(8461).ContentInventoryListenedMediaProvider.SPOTIFY;
}
const tmpResult = tmp(8459);
}
let tmp9Result = isTopArtistEntryResult;
if (tmp9Result) {
party = party.party;
let id;
if (party != null) {
id = party.id;
}
tmp9Result = isSpotifyParty(id);
}
return tmp9Result;
}
const ActivityTypes = Constants.ActivityTypes;
const CRUNCHYROLL_CLIENT_ID = CrunchyrollConnectionConstants.CRUNCHYROLL_CLIENT_ID;
const isSpotifyParty = SpotifyConstants.isSpotifyParty;
const result = size.fileFinishedImporting("modules/content_inventory/matchUtils.tsx");
export const isSpotifyEntry = function isSpotifyEntry(extra) {
if (obj.isListenedSessionEntry(extra)) {
const first = extra.extra.entries[0];
let provider;
if (first != null) {
const media = first.media;
if (media != null) {
provider = media.provider;
}
}
let isTopArtistEntryResult = provider === tmp(8461).ContentInventoryListenedMediaProvider.SPOTIFY;
} else {
isTopArtistEntryResult = tmp(8459).isTopArtistEntry(extra);
if (isTopArtistEntryResult) {
isTopArtistEntryResult = extra.extra.media.provider === tmp(8461).ContentInventoryListenedMediaProvider.SPOTIFY;
}
const tmpResult = tmp(8459);
}
return isTopArtistEntryResult;
};
export const isCrunchyrollEntry = function isCrunchyrollEntry(extra) {
let isWatchedMediaEntryResult = ContentInventoryTypes.isWatchedMediaEntry(extra);
if (isWatchedMediaEntryResult) {
isWatchedMediaEntryResult = extra.extra.application_id === CRUNCHYROLL_CLIENT_ID;
}
return isWatchedMediaEntryResult;
};
export const isMatchingApplicationActivity = function isMatchingApplicationActivity(extra, type) {
let game_name = extra.extra;
let tmp = null != game_name;
if (tmp) {
let name = type;
if ("application_id" in type && name.application_id === game_name.application_id) {
tmp = tmp2;
} else if ("game_name" in game_name) {
name = name.name;
game_name = game_name.game_name;
let tmp3 = name === game_name;
} else {
tmp3 = "activity_name" in game_name && name.name === game_name.activity_name;
}
}
return tmp;
};
export { isMatchingListeningActivity };
export const isMatchingWatchActivity = function isMatchingWatchActivity(extra, details) {
const tmp2 = isCrunchyrollActivityDefault(details);
let tmp3 = !tmp2;
if (tmp2) {
let isWatchedMediaEntryResult = ContentInventoryTypes.isWatchedMediaEntry(extra);
if (isWatchedMediaEntryResult) {
isWatchedMediaEntryResult = extra.extra.application_id === CRUNCHYROLL_CLIENT_ID;
}
tmp3 = !isWatchedMediaEntryResult;
}
let tmp7 = !tmp3;
if (!tmp3) {
tmp7 = extra.extra.media_title === details.details;
}
return tmp7;
};
export const findMatchingEntry = function findMatchingEntry(entries, activity) {
_require = activity;
const found = entries.filter(require("utils").isEntryActive);
if (activity.type === ActivityTypes.PLAYING) {
const found1 = found.filter(tmp(8459).isGamingLikeEntry);
let found2 = found1.find((extra) => {
let name = closure_0;
let game_name = extra.extra;
let tmp = null != game_name;
if (tmp) {
if ("application_id" in name && name.application_id === game_name.application_id) {
tmp = tmp2;
} else if ("game_name" in game_name) {
name = name.name;
game_name = game_name.game_name;
let tmp3 = name === game_name;
} else {
tmp3 = "activity_name" in game_name && name.name === game_name.activity_name;
}
}
return tmp;
});
} else if (activity.type === tmp3.LISTENING) {
const found3 = found.filter(tmp(8459).isListenedSessionEntry);
found2 = found3.find((item) => isMatchingListeningActivity(item, closure_0));
} else if (activity.type === tmp3.WATCHING) {
const found4 = entries.filter(tmp(8459).isWatchedMediaEntry);
found2 = found4.find((extra) => {
const tmp3 = isCrunchyrollActivityDefault(activity);
let tmp4 = !tmp3;
if (tmp3) {
let isWatchedMediaEntryResult = ContentInventoryTypes.isWatchedMediaEntry(extra);
if (isWatchedMediaEntryResult) {
isWatchedMediaEntryResult = extra.extra.application_id === CRUNCHYROLL_CLIENT_ID;
}
tmp4 = !isWatchedMediaEntryResult;
}
let tmp8 = !tmp4;
if (!tmp4) {
tmp8 = extra.extra.media_title === activity.details;
}
return tmp8;
});
}
return found2;
};