#pragma once #include #include #include "Constants.h" struct VideoInfo { const std::string* videoId = nullptr; const std::string* coverUrl = nullptr; const std::string* webVideoUrl = nullptr; long playCount = 0; int inputOrder = -1; VideoInfo() = default; VideoInfo(const std::string* id, const std::string* cover, const std::string* web, long plays, int order) : videoId(id), coverUrl(cover), webVideoUrl(web), playCount(plays), inputOrder(order) {} static bool compareForFinalSort(const VideoInfo& a, const VideoInfo& b) { if (a.playCount != b.playCount) return a.playCount > b.playCount; if (a.videoId && b.videoId && *a.videoId != *b.videoId) return *a.videoId < *b.videoId; return a.inputOrder < b.inputOrder; } bool operator<(const VideoInfo& other) const { if (playCount != other.playCount) return playCount > other.playCount; return inputOrder < other.inputOrder; } }; struct VideoCompareWorse { bool operator()(const VideoInfo& a, const VideoInfo& b) const { if (a.playCount != b.playCount) return a.playCount > b.playCount; return a.inputOrder < b.inputOrder; } };