diff --git a/src/routes/getSkipSegments.ts b/src/routes/getSkipSegments.ts index 427e547..9633cb3 100644 --- a/src/routes/getSkipSegments.ts +++ b/src/routes/getSkipSegments.ts @@ -307,8 +307,6 @@ function splitPercentOverlap(groups: OverlappingSegmentGroup[]): OverlappingSegm const overlapPercent = overlap / overallDuration; return (overlapPercent >= 0.1 && segment.actionType === compareSegment.actionType && segment.category === compareSegment.category && segment.actionType !== ActionType.Chapter) || (overlapPercent >= 0.6 && segment.actionType !== compareSegment.actionType && segment.category === compareSegment.category) - || (overlapPercent >= 0.95 && segment.actionType === compareSegment.actionType && segment.category !== compareSegment.category - && segment.category !== "music_offtopic" && compareSegment.category !== "music_offtopic") || (overlapPercent >= 0.8 && segment.actionType === ActionType.Chapter && compareSegment.actionType === ActionType.Chapter); }); }); diff --git a/src/utils/redisKeys.ts b/src/utils/redisKeys.ts index 38e675e..911db8f 100644 --- a/src/utils/redisKeys.ts +++ b/src/utils/redisKeys.ts @@ -4,16 +4,16 @@ import { HashedValue } from "../types/hash.model"; import { Logger } from "./logger"; export const skipSegmentsKey = (videoID: VideoID, service: Service): string => - `segments.v3.${service}.videoID.${videoID}`; + `segments.v4.${service}.videoID.${videoID}`; export const skipSegmentGroupsKey = (videoID: VideoID, service: Service): string => - `segments.groups.v2.${service}.videoID.${videoID}`; + `segments.groups.v3.${service}.videoID.${videoID}`; export function skipSegmentsHashKey(hashedVideoIDPrefix: VideoIDHash, service: Service): string { hashedVideoIDPrefix = hashedVideoIDPrefix.substring(0, 4) as VideoIDHash; if (hashedVideoIDPrefix.length !== 4) Logger.warn(`Redis skip segment hash-prefix key is not length 4! ${hashedVideoIDPrefix}`); - return `segments.v3.${service}.${hashedVideoIDPrefix}`; + return `segments.v4.${service}.${hashedVideoIDPrefix}`; } export const reputationKey = (userID: UserID): string => diff --git a/test/cases/getSkipSegmentsByHash.ts b/test/cases/getSkipSegmentsByHash.ts index 7cf2081..495912e 100644 --- a/test/cases/getSkipSegmentsByHash.ts +++ b/test/cases/getSkipSegmentsByHash.ts @@ -447,23 +447,25 @@ describe("getSkipSegmentsByHash", () => { .catch(err => done(err)); }); - it("Should be able to get only one segment when two categories are at the same time", (done) => { - client.get(`${endpoint}/7fac?categories=["sponsor","intro"]`) - .then(res => { - assert.strictEqual(res.status, 200); - const data = res.data; - assert.strictEqual(data.length, 1); - const expected = [{ - segments: [{ - category: "intro" - }] - }]; - assert.ok(partialDeepEquals(data, expected)); - assert.strictEqual(data[0].segments.length, 1); - done(); - }) - .catch(err => done(err)); - }); + // This behavior was causing unintended consequence, uncommend when a solution is found + // https://discord.com/channels/603643120093233162/607338052221665320/928099684835274883 + // it("Should be able to get only one segment when two categories are at the same time", (done) => { + // client.get(`${endpoint}/7fac?categories=["sponsor","intro"]`) + // .then(res => { + // assert.strictEqual(res.status, 200); + // const data = res.data; + // assert.strictEqual(data.length, 1); + // const expected = [{ + // segments: [{ + // category: "intro" + // }] + // }]; + // assert.ok(partialDeepEquals(data, expected)); + // assert.strictEqual(data[0].segments.length, 1); + // done(); + // }) + // .catch(err => done(err)); + // }); it("Should be able to get overlapping segments where one is non music and one is other", (done) => { client.get(`${endpoint}/3061?categories=["sponsor","music_offtopic"]`)