decord/source/modules/content_inventory/matchUtils.tsx

159 lines
5.7 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 9083
// Function ID: 9084
2026-07-29 08:29:29 +00:00
// Name: isMatchingListeningActivity
2026-08-24 06:08:38 +00:00
// Dependencies: [676, 9084, 7280, 9085, 9087, 9088, 8387, 2]
2026-07-29 08:29:29 +00:00
// Exports: findMatchingEntry, isCrunchyrollEntry, isMatchingApplicationActivity, isMatchingWatchActivity, isSpotifyEntry
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 9083 (isMatchingListeningActivity)
import set from "set" /* 2 */;
import ME from "ME" /* 676 */;
import SPOTIFY_APP_PROTOCOL from "SPOTIFY_APP_PROTOCOL" /* 7280 */;
import CRUNCHYROLL_LINK_DEST_ORIGIN from "CRUNCHYROLL_LINK_DEST_ORIGIN" /* 9084 */;
import isPlayedGameEntry from "isPlayedGameEntry" /* 9085 */;
import isCrunchyrollActivityDefault from "isCrunchyrollActivity" /* 9088 */;
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
function isMatchingListeningActivity(closure_0, party) {
if (obj.isListenedSessionEntry(closure_0)) {
const first = closure_0.extra.entries[0];
let provider;
if (first != null) {
const media = first.media;
if (media != null) {
provider = media.provider;
}
}
2026-08-24 06:08:38 +00:00
let isTopArtistEntryResult = provider === tmp(9087).ContentInventoryListenedMediaProvider.SPOTIFY;
2026-07-29 08:29:29 +00:00
} else {
2026-08-24 06:08:38 +00:00
isTopArtistEntryResult = tmp(9085).isTopArtistEntry(closure_0);
2026-07-29 08:29:29 +00:00
if (isTopArtistEntryResult) {
2026-08-24 06:08:38 +00:00
isTopArtistEntryResult = closure_0.extra.media.provider === tmp(9087).ContentInventoryListenedMediaProvider.SPOTIFY;
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
const tmpResult = tmp(9085);
2026-07-29 08:29:29 +00:00
}
let tmp9Result = isTopArtistEntryResult;
if (tmp9Result) {
party = party.party;
let id;
if (party != null) {
id = party.id;
}
tmp9Result = isSpotifyParty(id);
const tmp9 = isSpotifyParty;
}
return tmp9Result;
}
2026-08-24 06:08:38 +00:00
const ActivityTypes = ME.ActivityTypes;
const CRUNCHYROLL_CLIENT_ID = CRUNCHYROLL_LINK_DEST_ORIGIN.CRUNCHYROLL_CLIENT_ID;
const isSpotifyParty = SPOTIFY_APP_PROTOCOL.isSpotifyParty;
const result = set.fileFinishedImporting("modules/content_inventory/matchUtils.tsx");
2026-07-29 08:29:29 +00:00
export const isSpotifyEntry = function isSpotifyEntry(extra) {
2026-07-20 16:05:17 +00:00
if (obj.isListenedSessionEntry(extra)) {
const first = extra.extra.entries[0];
let provider;
2026-07-29 08:29:29 +00:00
if (first != null) {
2026-07-20 16:05:17 +00:00
const media = first.media;
2026-07-29 08:29:29 +00:00
if (media != null) {
2026-07-20 16:05:17 +00:00
provider = media.provider;
}
}
2026-08-24 06:08:38 +00:00
let isTopArtistEntryResult = provider === tmp(9087).ContentInventoryListenedMediaProvider.SPOTIFY;
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
isTopArtistEntryResult = tmp(9085).isTopArtistEntry(extra);
2026-07-29 08:29:29 +00:00
if (isTopArtistEntryResult) {
2026-08-24 06:08:38 +00:00
isTopArtistEntryResult = extra.extra.media.provider === tmp(9087).ContentInventoryListenedMediaProvider.SPOTIFY;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const tmpResult = tmp(9085);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return isTopArtistEntryResult;
};
export const isCrunchyrollEntry = function isCrunchyrollEntry(extra) {
2026-08-24 06:08:38 +00:00
let isWatchedMediaEntryResult = isPlayedGameEntry.isWatchedMediaEntry(extra);
2026-07-29 08:29:29 +00:00
if (isWatchedMediaEntryResult) {
isWatchedMediaEntryResult = extra.extra.application_id === CRUNCHYROLL_CLIENT_ID;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return isWatchedMediaEntryResult;
};
export const isMatchingApplicationActivity = function isMatchingApplicationActivity(extra, type) {
let game_name = extra.extra;
2026-07-20 16:05:17 +00:00
let tmp = null != game_name;
if (tmp) {
2026-07-29 08:29:29 +00:00
let name = type;
if ("application_id" in type && name.application_id === game_name.application_id) {
2026-07-20 16:05:17 +00:00
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;
2026-07-29 08:29:29 +00:00
};
export { isMatchingListeningActivity };
export const isMatchingWatchActivity = function isMatchingWatchActivity(closure_0, details) {
2026-08-24 06:08:38 +00:00
const tmp2 = isCrunchyrollActivityDefault(details);
2026-07-29 08:29:29 +00:00
let tmp3 = !tmp2;
if (tmp2) {
2026-08-24 06:08:38 +00:00
let isWatchedMediaEntryResult = isPlayedGameEntry.isWatchedMediaEntry(closure_0);
2026-07-29 08:29:29 +00:00
if (isWatchedMediaEntryResult) {
isWatchedMediaEntryResult = closure_0.extra.application_id === CRUNCHYROLL_CLIENT_ID;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp3 = !isWatchedMediaEntryResult;
2026-08-24 06:08:38 +00:00
const obj = isPlayedGameEntry;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp7 = !tmp3;
if (!tmp3) {
tmp7 = closure_0.extra.media_title === details.details;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp7;
};
2026-07-20 16:05:17 +00:00
export const findMatchingEntry = function findMatchingEntry(entries, activity) {
2026-07-23 10:11:24 +00:00
const _require = activity;
2026-08-24 06:08:38 +00:00
const found = entries.filter(_require(8387).isEntryActive);
2026-07-20 16:05:17 +00:00
if (activity.type === ActivityTypes.PLAYING) {
2026-08-24 06:08:38 +00:00
const found1 = found.filter(tmp(9085).isGamingLikeEntry);
2026-07-29 08:29:29 +00:00
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) {
2026-08-24 06:08:38 +00:00
const found3 = found.filter(tmp(9085).isListenedSessionEntry);
found2 = found3.find((arg0) => closure_1_6(arg0, closure_0));
2026-07-29 08:29:29 +00:00
} else if (activity.type === tmp3.WATCHING) {
2026-08-24 06:08:38 +00:00
const found4 = entries.filter(tmp(9085).isWatchedMediaEntry);
2026-07-29 08:29:29 +00:00
found2 = found4.find((extra) => {
2026-08-24 06:08:38 +00:00
const tmp3 = closure_1_1(closure_1_2[5])(activity);
2026-07-29 08:29:29 +00:00
let tmp4 = !tmp3;
if (tmp3) {
2026-08-24 06:08:38 +00:00
let isWatchedMediaEntryResult = activity(closure_1_2[3]).isWatchedMediaEntry(extra);
2026-07-29 08:29:29 +00:00
if (isWatchedMediaEntryResult) {
2026-08-24 06:08:38 +00:00
isWatchedMediaEntryResult = extra.extra.application_id === closure_1_4;
2026-07-29 08:29:29 +00:00
}
tmp4 = !isWatchedMediaEntryResult;
2026-08-24 06:08:38 +00:00
const obj = activity(closure_1_2[3]);
2026-07-29 08:29:29 +00:00
}
let tmp8 = !tmp4;
if (!tmp4) {
tmp8 = extra.extra.media_title === activity.details;
}
return tmp8;
});
2026-07-20 16:05:17 +00:00
}
return found2;
};