From 5e6558d3682531c8778b18cc9517e8fbdcd5f066 Mon Sep 17 00:00:00 2001 From: xfangfang <2553041586@qq.com> Date: Thu, 30 May 2024 21:50:20 +0800 Subject: [PATCH] Change aid/cid/epid/sessionid to uint64_t (#349) * Change cid aid seasonid epid mid to uint64_t * Correct mid definition --- wiliwili/include/activity/player_activity.hpp | 8 +-- wiliwili/include/api/bilibili.h | 58 +++++++++---------- .../api/bilibili/result/dynamic_article.h | 4 +- .../api/bilibili/result/dynamic_video.h | 4 +- .../bilibili/result/home_hots_all_result.h | 6 +- .../result/home_hots_history_result.h | 6 +- .../api/bilibili/result/home_hots_rank.h | 8 +-- .../bilibili/result/home_hots_weekly_result.h | 6 +- .../api/bilibili/result/home_live_result.h | 2 +- .../api/bilibili/result/home_pgc_result.h | 4 +- .../bilibili/result/home_pgc_season_result.h | 14 ++--- .../include/api/bilibili/result/home_result.h | 6 +- .../bilibili/result/mine_collection_result.h | 2 +- .../api/bilibili/result/mine_history_result.h | 8 +-- .../api/bilibili/result/mine_later_result.h | 8 +-- .../include/api/bilibili/result/mine_result.h | 6 +- .../api/bilibili/result/search_result.h | 4 +- .../include/api/bilibili/result/user_result.h | 8 +-- .../api/bilibili/result/video_detail_result.h | 23 ++++---- wiliwili/include/api/live/danmaku_live.hpp | 4 +- wiliwili/include/fragment/dynamic_tab.hpp | 4 +- .../include/fragment/player_collection.hpp | 4 +- wiliwili/include/fragment/player_setting.hpp | 4 +- wiliwili/include/presenter/dynamic_video.hpp | 4 +- wiliwili/include/presenter/video_detail.hpp | 36 ++++++------ wiliwili/include/utils/activity_helper.hpp | 6 +- wiliwili/include/view/video_view.hpp | 2 +- wiliwili/source/activity/player_activity.cpp | 2 +- .../source/activity/player_base_activity.cpp | 8 +-- .../activity/player_season_activity.cpp | 2 +- wiliwili/source/api/danmaku_live.cpp | 4 +- wiliwili/source/api/dynamic_api.cpp | 2 +- wiliwili/source/api/mine_api.cpp | 8 +-- wiliwili/source/api/video_detail_api.cpp | 49 ++++++++-------- wiliwili/source/fragment/dynamic_tab.cpp | 4 +- .../source/fragment/player_collection.cpp | 14 ++--- wiliwili/source/fragment/player_setting.cpp | 2 +- wiliwili/source/presenter/dynamic_video.cpp | 2 +- wiliwili/source/presenter/video_detail.cpp | 40 ++++++------- wiliwili/source/utils/activity_helper.cpp | 6 +- wiliwili/source/view/video_view.cpp | 2 +- 41 files changed, 197 insertions(+), 197 deletions(-) diff --git a/wiliwili/include/activity/player_activity.hpp b/wiliwili/include/activity/player_activity.hpp index 0821715c..bd307c2d 100644 --- a/wiliwili/include/activity/player_activity.hpp +++ b/wiliwili/include/activity/player_activity.hpp @@ -51,10 +51,10 @@ class BasePlayerActivity : public brls::Activity, public VideoDetail { void setRelationButton(bool liked, bool coin, bool favorite); // 展示收藏列表对话框 - void showCollectionDialog(int64_t id, int videoType); + void showCollectionDialog(uint64_t id, int videoType); // 展示投币对话框 - void showCoinDialog(size_t aid); + void showCoinDialog(uint64_t aid); // 设置清晰度 void setVideoQuality(); @@ -141,7 +141,7 @@ class BasePlayerActivity : public brls::Activity, public VideoDetail { class PlayerActivity : public BasePlayerActivity { public: - PlayerActivity(const std::string& bvid, unsigned int cid = 0, int progress = -1); + PlayerActivity(const std::string& bvid, uint64_t cid = 0, int progress = -1); void setProgress(int p) override; int getProgress() override; @@ -202,7 +202,7 @@ class PlayerSeasonActivity : public BasePlayerActivity { void onCastPlayUrl(const bilibili::VideoUrlResult& result) override; // 正在播放的情况下切换到新的番剧 - void playSeason(size_t season_id); + void playSeason(uint64_t season_id); size_t getAid() override; diff --git a/wiliwili/include/api/bilibili.h b/wiliwili/include/api/bilibili.h index 9bd858ca..953e37ce 100644 --- a/wiliwili/include/api/bilibili.h +++ b/wiliwili/include/api/bilibili.h @@ -192,7 +192,7 @@ class BilibiliClient { * @param callback * @param error */ - static void get_my_collection_list(int64_t mid, int index = 1, int num = 20, int type = 1, + static void get_my_collection_list(uint64_t mid, int index = 1, int num = 20, int type = 1, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); @@ -227,31 +227,31 @@ class BilibiliClient { const ErrorCallback& error = nullptr); /// get user's upload videos - static void get_user_videos(int64_t mid, int pn, int ps, + static void get_user_videos(uint64_t mid, int pn, int ps, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// get user's dynamic videos - static void get_user_videos2(int64_t mid, int pn, int ps, + static void get_user_videos2(uint64_t mid, int pn, int ps, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// get season detail by seasonID - static void get_season_detail(int seasonID, int epID = 0, + static void get_season_detail(uint64_t seasonID, uint64_t epID = 0, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// 获取番剧相关推荐 - static void get_season_recommend(size_t seasonID, + static void get_season_recommend(uint64_t seasonID, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// 获取番剧的播放进度 - static void get_season_status(size_t seasonID, const std::function& callback, + static void get_season_status(uint64_t seasonID, const std::function& callback, const ErrorCallback& error); /// get video detail by aid - static void get_video_detail(int aid, const std::function& callback = nullptr, + static void get_video_detail(uint64_t aid, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// get video detail by bvid @@ -264,10 +264,10 @@ class BilibiliClient { const ErrorCallback& error = nullptr); /// 获取分P详情 (主要内容为cc字幕) - static void get_page_detail(int aid, int cid, const std::function& callback = nullptr, + static void get_page_detail(uint64_t aid, uint64_t cid, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); - static void get_page_detail(const std::string& bvid, int cid, + static void get_page_detail(const std::string& bvid, uint64_t cid, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); @@ -277,7 +277,7 @@ class BilibiliClient { const ErrorCallback& error = nullptr); /// get video pagelist by aid - static void get_video_pagelist(int aid, const std::function& callback = nullptr, + static void get_video_pagelist(uint64_t aid, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// get video pagelist by bvid @@ -286,7 +286,7 @@ class BilibiliClient { const ErrorCallback& error = nullptr); /// get video url by aid & cid - static void get_video_url(int aid, int cid, int qn = 64, + static void get_video_url(uint64_t aid, uint64_t cid, int qn = 64, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); @@ -295,17 +295,17 @@ class BilibiliClient { * @param oid aid 或 epic * @param type 如果传入的普通视频的 aid 则为 1;如果是番剧类的 epid 则为 2 */ - static void get_video_url_cast(int oid, int cid, int type, int qn = 64, const std::string& csrf = "", + static void get_video_url_cast(uint64_t oid, uint64_t cid, int type, int qn = 64, const std::string& csrf = "", const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// get video url by bvid & cid - static void get_video_url(const std::string& bvid, int cid, int qn = 64, + static void get_video_url(const std::string& bvid, uint64_t cid, int qn = 64, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// get season video url by cid - static void get_season_url(int cid, int qn = 64, const std::function& callback = nullptr, + static void get_season_url(uint64_t cid, int qn = 64, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// get live video url by roomid @@ -453,10 +453,10 @@ class BilibiliClient { const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// 视频页 获取单个视频播放人数 - static void get_video_online(int aid, int cid, const std::function& callback = nullptr, + static void get_video_online(uint64_t aid, uint64_t cid, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); - static void get_video_online(const std::string& bvid, int cid, + static void get_video_online(const std::string& bvid, uint64_t cid, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); @@ -465,11 +465,11 @@ class BilibiliClient { const std::function& callback = nullptr, const ErrorCallback& error = nullptr); - static void get_video_relation(size_t epid, const std::function& callback = nullptr, + static void get_video_relation(uint64_t epid, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// 视频页 获取弹幕的xml文件 - static void get_danmaku(unsigned int cid, const std::function& callback = nullptr, + static void get_danmaku(uint64_t cid, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// 视频页 获取字幕 @@ -477,14 +477,14 @@ class BilibiliClient { const ErrorCallback& error = nullptr); /// 视频页 获取高能进度条 - static void get_highlight_progress(unsigned int cid, + static void get_highlight_progress(uint64_t cid, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// 视频页 上报历史记录 - static void report_history(const std::string& mid, const std::string& access_key, unsigned int aid, - unsigned int cid, int type = 3, unsigned int progress = 0, unsigned int duration = 0, - unsigned int sid = 0, unsigned int epid = 0, + static void report_history(const std::string& mid, const std::string& access_key, uint64_t aid, + uint64_t cid, int type = 3, unsigned int progress = 0, unsigned int duration = 0, + uint64_t sid = 0, uint64_t epid = 0, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// 直播页 上报观看记录 @@ -492,11 +492,11 @@ class BilibiliClient { const ErrorCallback& error = nullptr); /// 点赞 - static void be_agree(const std::string& access_key, int aid, bool is_like, + static void be_agree(const std::string& access_key, uint64_t aid, bool is_like, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// 投币 - static void add_coin(const std::string& access_key, int aid, unsigned int coin_number, bool is_like, + static void add_coin(const std::string& access_key, uint64_t aid, unsigned int coin_number, bool is_like, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// 投币经验值 @@ -507,7 +507,7 @@ class BilibiliClient { const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// 追剧或取消追剧 - static void follow_season(const std::string& access_key, size_t season, bool follow = true, + static void follow_season(const std::string& access_key, uint64_t season, bool follow = true, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /** @@ -520,7 +520,7 @@ class BilibiliClient { * @param callback 若成功 进行回调 * @param error 若失败返回失败原因 */ - static void add_resource(const std::string& access_key, int rid, int type, const std::string& add_ids, + static void add_resource(const std::string& access_key, uint64_t rid, int type, const std::string& add_ids, const std::string& del_ids, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); @@ -553,12 +553,12 @@ class BilibiliClient { * @param error */ static void get_collection_list_all( - int rid, int type, std::string mid, + uint64_t rid, int type, const std::string& mid, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// 三连 - static void triple_like(const std::string& access_key, int aid, const std::function& callback = nullptr, + static void triple_like(const std::string& access_key, uint64_t aid, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); /// 搜索页 获取搜索视频内容 @@ -579,7 +579,7 @@ class BilibiliClient { const ErrorCallback& error = nullptr); /// 动态页 获取全部关注用户的最近动态 图文 - static void dynamic_article(const unsigned int page, const std::string& offset = "", const int64_t mid = 0, + static void dynamic_article(const unsigned int page, const std::string& offset = "", uint64_t mid = 0, const std::function& callback = nullptr, const ErrorCallback& error = nullptr); diff --git a/wiliwili/include/api/bilibili/result/dynamic_article.h b/wiliwili/include/api/bilibili/result/dynamic_article.h index a5b9da11..f1c6e054 100644 --- a/wiliwili/include/api/bilibili/result/dynamic_article.h +++ b/wiliwili/include/api/bilibili/result/dynamic_article.h @@ -67,7 +67,7 @@ class DynamicArticleModuleArchive { public: std::string aid, bvid, cover, title, duration_text; std::string desc; // 可能为 null - unsigned int epid{}; // 可能为 null + uint64_t epid{}; // 可能为 null int type{}; // 1: UGC VideoSimpleStateResultV2 stat; }; @@ -99,7 +99,7 @@ class DynamicArticleModuleLiveCardInfo { int room_id{}; std::string title; // int area_id{}, parent_area_id{}; - // int64_t uid{}; + // uint64_t uid{}; // int live_status{}, online{}; ShowInfo watched_show; }; diff --git a/wiliwili/include/api/bilibili/result/dynamic_video.h b/wiliwili/include/api/bilibili/result/dynamic_video.h index 506aa0d4..fedac75e 100644 --- a/wiliwili/include/api/bilibili/result/dynamic_video.h +++ b/wiliwili/include/api/bilibili/result/dynamic_video.h @@ -13,7 +13,7 @@ namespace bilibili { class DynamicVideoResult { public: - int aid = 0; + uint64_t aid = 0; std::string bvid; std::string pic; std::string title; @@ -66,7 +66,7 @@ class DynamicUpResult { bool has_update; std::string face; std::string uname; - int64_t mid; + uint64_t mid; }; NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(DynamicUpResult, has_update, face, uname, mid); diff --git a/wiliwili/include/api/bilibili/result/home_hots_all_result.h b/wiliwili/include/api/bilibili/result/home_hots_all_result.h index a9334084..7d7da28e 100644 --- a/wiliwili/include/api/bilibili/result/home_hots_all_result.h +++ b/wiliwili/include/api/bilibili/result/home_hots_all_result.h @@ -4,7 +4,7 @@ #pragma once -#include "nlohmann/json.hpp" +#include "bilibili/util/json.hpp" #include "user_result.h" #include "home_result.h" @@ -12,9 +12,9 @@ namespace bilibili { class HotsAllVideoResult { public: - int aid; + uint64_t aid; std::string bvid; - int cid; + uint64_t cid; std::string pic; std::string title; int duration; diff --git a/wiliwili/include/api/bilibili/result/home_hots_history_result.h b/wiliwili/include/api/bilibili/result/home_hots_history_result.h index 76520bc0..2c76d510 100644 --- a/wiliwili/include/api/bilibili/result/home_hots_history_result.h +++ b/wiliwili/include/api/bilibili/result/home_hots_history_result.h @@ -4,7 +4,7 @@ #pragma once -#include "nlohmann/json.hpp" +#include "bilibili/util/json.hpp" #include "user_result.h" #include "home_result.h" @@ -12,9 +12,9 @@ namespace bilibili { class HotsHistoryVideoResult { public: - int aid; + uint64_t aid; std::string bvid; - int cid; + uint64_t cid; std::string pic; std::string title; int duration; diff --git a/wiliwili/include/api/bilibili/result/home_hots_rank.h b/wiliwili/include/api/bilibili/result/home_hots_rank.h index d9e7e168..18134e3e 100644 --- a/wiliwili/include/api/bilibili/result/home_hots_rank.h +++ b/wiliwili/include/api/bilibili/result/home_hots_rank.h @@ -4,7 +4,7 @@ #pragma once -#include "nlohmann/json.hpp" +#include "bilibili/util/json.hpp" #include "user_result.h" #include "home_result.h" @@ -19,7 +19,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(HotsRankPGCConfig, index_show); class HotsRankPGCVideoResult { public: int rank; - int season_id; + uint64_t season_id; std::string ss_horizontal_cover; //横版封面 std::string cover; //竖版封面 std::string title; @@ -40,9 +40,9 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(HotsRankPGCVideoListResultWrapper, note, list class HotsRankVideoResult { public: - int aid; + uint64_t aid; std::string bvid; - int cid; + uint64_t cid; std::string pic; std::string title; int duration; diff --git a/wiliwili/include/api/bilibili/result/home_hots_weekly_result.h b/wiliwili/include/api/bilibili/result/home_hots_weekly_result.h index 3eae2c28..a6547da8 100644 --- a/wiliwili/include/api/bilibili/result/home_hots_weekly_result.h +++ b/wiliwili/include/api/bilibili/result/home_hots_weekly_result.h @@ -4,7 +4,7 @@ #pragma once -#include "nlohmann/json.hpp" +#include "bilibili/util/json.hpp" #include "user_result.h" #include "home_result.h" @@ -29,9 +29,9 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(HotsWeeklyResultWrapper, list); class HotsWeeklyVideoResult { public: - int aid; + uint64_t aid; std::string bvid; - int cid; + uint64_t cid; std::string pic; std::string title; int duration; diff --git a/wiliwili/include/api/bilibili/result/home_live_result.h b/wiliwili/include/api/bilibili/result/home_live_result.h index a14bb71d..72d54e99 100644 --- a/wiliwili/include/api/bilibili/result/home_live_result.h +++ b/wiliwili/include/api/bilibili/result/home_live_result.h @@ -93,7 +93,7 @@ inline void from_json(const nlohmann::json& nlohmann_json_j, LivePlayUrlInfo& nl class LiveRoomPlayInfo { public: int room_id; - int64_t uid; + uint64_t uid; int live_status; size_t live_time; LivePlayUrlInfo playurl_info; diff --git a/wiliwili/include/api/bilibili/result/home_pgc_result.h b/wiliwili/include/api/bilibili/result/home_pgc_result.h index db0ca9ac..53f25a55 100644 --- a/wiliwili/include/api/bilibili/result/home_pgc_result.h +++ b/wiliwili/include/api/bilibili/result/home_pgc_result.h @@ -15,7 +15,7 @@ class PGCItemResult { std::string title; std::string desc; std::string cover; - int season_id; + uint64_t season_id; std::string bottom_left_badge; // pic link 不是所有都包含此项 std::string bottom_right_badge; // text std::string badge_info; // pic link @@ -82,7 +82,7 @@ class PGCIndexResult { std::string title; std::string cover; int season_type; - int season_id; + uint64_t season_id; int is_finish; int media_id; std::string order; // eg: 800万追番 diff --git a/wiliwili/include/api/bilibili/result/home_pgc_season_result.h b/wiliwili/include/api/bilibili/result/home_pgc_season_result.h index 9751915a..edf25bab 100644 --- a/wiliwili/include/api/bilibili/result/home_pgc_season_result.h +++ b/wiliwili/include/api/bilibili/result/home_pgc_season_result.h @@ -4,7 +4,7 @@ #pragma once -#include "nlohmann/json.hpp" +#include "bilibili/util/json.hpp" #include "bilibili/result/user_result.h" namespace bilibili { @@ -38,9 +38,9 @@ class SeasonEpisodeResult { SeasonEpisodeResult() = default; SeasonEpisodeResult(std::string title) : title(title) { id = 0; } size_t index; - unsigned int aid; - unsigned int cid; - unsigned int id; //ep id + uint64_t aid; + uint64_t cid; + uint64_t id; //ep id std::string bvid; unsigned int duration; std::string title; @@ -134,7 +134,7 @@ class SeasonSeriesItem { EpisodesBadge badge_info; std::string season_title, cover, subtitle; - size_t season_id; + uint64_t season_id; SeasonSeriesItemStat stat; }; inline void from_json(const nlohmann::json& nlohmann_json_j, SeasonSeriesItem& nlohmann_json_t) { @@ -174,7 +174,7 @@ class SeasonRecommendItem { std::string cover, title, subtitle; float score; SeasonRecommendItemStat stat; - size_t season_id; + uint64_t season_id; }; inline void from_json(const nlohmann::json& nlohmann_json_j, SeasonRecommendItem& nlohmann_json_t) { if (nlohmann_json_j.contains("new_ep")) { @@ -205,7 +205,7 @@ inline void from_json(const nlohmann::json& nlohmann_json_j, SeasonRecommendWrap class SeasonResultWrapper { public: - unsigned int season_id; + uint64_t season_id; std::string cover; std::string season_title; std::string season_desc; diff --git a/wiliwili/include/api/bilibili/result/home_result.h b/wiliwili/include/api/bilibili/result/home_result.h index ee57762e..72ce80fa 100644 --- a/wiliwili/include/api/bilibili/result/home_result.h +++ b/wiliwili/include/api/bilibili/result/home_result.h @@ -4,7 +4,7 @@ #pragma once -#include "nlohmann/json.hpp" +#include "bilibili/util/json.hpp" #include "user_result.h" namespace bilibili { @@ -56,9 +56,9 @@ inline void from_json(const nlohmann::json& nlohmann_json_j, RecommendReasonResu class RecommendVideoResult { public: - int id; + uint64_t id; std::string bvid; - int cid; + uint64_t cid; std::string pic = ""; std::string title = ""; int duration; diff --git a/wiliwili/include/api/bilibili/result/mine_collection_result.h b/wiliwili/include/api/bilibili/result/mine_collection_result.h index 04677569..9208d900 100644 --- a/wiliwili/include/api/bilibili/result/mine_collection_result.h +++ b/wiliwili/include/api/bilibili/result/mine_collection_result.h @@ -21,7 +21,7 @@ class SimpleCollectionList { public: int64_t id; int64_t fid; - int64_t mid; + uint64_t mid; unsigned int attr; std::string title; unsigned int fav_state; diff --git a/wiliwili/include/api/bilibili/result/mine_history_result.h b/wiliwili/include/api/bilibili/result/mine_history_result.h index ec6154c4..1a21da8e 100644 --- a/wiliwili/include/api/bilibili/result/mine_history_result.h +++ b/wiliwili/include/api/bilibili/result/mine_history_result.h @@ -4,7 +4,7 @@ #pragma once -#include "nlohmann/json.hpp" +#include "bilibili/util/json.hpp" namespace bilibili { @@ -19,9 +19,9 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(HistoryVideoListCursor, max, view_at, busines class HistoryVideoData { public: - int oid; - int epid; - int cid; + uint64_t oid; + uint64_t epid; + uint64_t cid; std::string bvid; std::string business; int dt; // device type: 4: 平板 1: 手机 2:电脑 diff --git a/wiliwili/include/api/bilibili/result/mine_later_result.h b/wiliwili/include/api/bilibili/result/mine_later_result.h index 9adca98a..6e1f4005 100644 --- a/wiliwili/include/api/bilibili/result/mine_later_result.h +++ b/wiliwili/include/api/bilibili/result/mine_later_result.h @@ -4,14 +4,14 @@ #pragma once -#include "nlohmann/json.hpp" +#include "bilibili/util/json.hpp" namespace bilibili { class Up { public: std::string name; - int mid; + uint64_t mid; }; NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Up, name, mid); @@ -27,10 +27,10 @@ class WatchLaterItem { Up owner; int duration; // video length in seconds std::string title; - int aid; + uint64_t aid; Stat stat; std::string bvid; - int cid; + uint64_t cid; }; NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(WatchLaterItem, aid, pic, title, duration, owner, stat, bvid, cid); diff --git a/wiliwili/include/api/bilibili/result/mine_result.h b/wiliwili/include/api/bilibili/result/mine_result.h index 84bb0669..b26e7433 100644 --- a/wiliwili/include/api/bilibili/result/mine_result.h +++ b/wiliwili/include/api/bilibili/result/mine_result.h @@ -87,10 +87,10 @@ class UserUploadedVideoResult { std::string title; unsigned int video_review; std::string author; - unsigned int mid; + uint64_t mid; unsigned int created; std::string length; - unsigned int aid; + uint64_t aid; std::string bvid; bool is_charging_arc; // 充电专属视频 }; @@ -150,7 +150,7 @@ inline void from_json(const nlohmann::json& nlohmann_json_j, UserDynamicCount& n class UserRelationStat { public: - unsigned int mid, following, black, follower; + uint64_t mid, following, black, follower; }; NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(UserRelationStat, mid, following, black, follower); diff --git a/wiliwili/include/api/bilibili/result/search_result.h b/wiliwili/include/api/bilibili/result/search_result.h index c4ae71c7..f49cf663 100644 --- a/wiliwili/include/api/bilibili/result/search_result.h +++ b/wiliwili/include/api/bilibili/result/search_result.h @@ -37,9 +37,9 @@ class VideoItemSearchResult { // 搜索的类型:video/media_bangumi/media_ft 视频/影视/番剧 std::string type; - unsigned int aid; + uint64_t aid; std::string bvid; - unsigned int season_id; + uint64_t season_id; std::string title; // 部分带xml标识关键词 std::string subtitle; diff --git a/wiliwili/include/api/bilibili/result/user_result.h b/wiliwili/include/api/bilibili/result/user_result.h index 40215608..cfbe4942 100644 --- a/wiliwili/include/api/bilibili/result/user_result.h +++ b/wiliwili/include/api/bilibili/result/user_result.h @@ -10,7 +10,7 @@ namespace bilibili { class UserSimpleResult { public: - int64_t mid = 0; + uint64_t mid = 0; std::string name; std::string face; }; @@ -18,7 +18,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(UserSimpleResult, mid, name, face); class UserResult { public: - int64_t mid = -1; + uint64_t mid = -1; int level = 0; int following = 0; int follower = 0; @@ -32,7 +32,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(UserResult, mid, level, following, follower, class SeasonUserResult { public: - int64_t mid = 0; + uint64_t mid = 0; unsigned int follower = 0; unsigned int is_follow = 0; std::string uname; @@ -49,7 +49,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(UserCommentVip, nickname_color); class UserDynamicResult { public: - int64_t mid = 0; + uint64_t mid = 0; std::string name; std::string face; UserCommentVip vip; diff --git a/wiliwili/include/api/bilibili/result/video_detail_result.h b/wiliwili/include/api/bilibili/result/video_detail_result.h index 4d729366..a9dd47a9 100644 --- a/wiliwili/include/api/bilibili/result/video_detail_result.h +++ b/wiliwili/include/api/bilibili/result/video_detail_result.h @@ -159,7 +159,7 @@ inline void from_json(const nlohmann::json& nlohmann_json_j, VideoCommentCursor& class VideoCommentUpper { public: - int64_t mid; + uint64_t mid; }; inline void from_json(const nlohmann::json& nlohmann_json_j, VideoCommentUpper& nlohmann_json_t) { NLOHMANN_JSON_FROM(mid); @@ -187,7 +187,7 @@ class VideoSingleCommentDetail { public: VideoCommentCursor cursor; VideoCommentResult root; - int64_t upper; + uint64_t upper; }; inline void from_json(const nlohmann::json& nlohmann_json_j, VideoSingleCommentDetail& nlohmann_json_t) { if (nlohmann_json_j.contains("upper") && !nlohmann_json_j.at("upper").is_null()) { @@ -214,7 +214,7 @@ inline void from_json(const nlohmann::json& nlohmann_json_j, VideoCommentAddResu class VideoDetailPage { public: - int cid = 0; + uint64_t cid = 0; size_t page; // 分p的序号 int duration; // 视频长度,单位秒 int progress = -1; // 视频初始化的播放时间,用于加载历史记录 @@ -226,7 +226,7 @@ typedef std::vector VideoDetailPageListResult; class VideoDetailStat { public: - unsigned int aid; + uint64_t aid; int view; int danmaku; int favorite; @@ -253,14 +253,15 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(UGCSeasonState, view); class UGCSeasonEpisodePage { public: - int cid, duration, page; + uint64_t cid; + int duration, page; std::string part; // 原视频标题 }; NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(UGCSeasonEpisodePage, cid, duration, part, page); class UGCSeasonEpisode { public: - int season_id = 0, section_id = 0, id = 0, aid = 0, cid = 0; + uint64_t season_id = 0, section_id = 0, id = 0, aid = 0, cid = 0; int index = -1; std::string bvid, title; // 合集视频标题 UGCSeasonEpisodePage page; @@ -269,7 +270,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(UGCSeasonEpisode, season_id, section_id, id, class UGCSeasonSection { public: - int season_id; + uint64_t season_id; int id; // section id std::string title; int type; @@ -288,7 +289,7 @@ inline void to_json(nlohmann::json& nlohmann_json_j, const UGCSeasonSection& nlo class UGCSeason { public: int id; - int64_t mid; + uint64_t mid; std::string title, cover, intro; UGCSeasonState stat; bool is_pay_season; @@ -310,7 +311,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(UGCSeason, sections, id, mid, title, cover, i class VideoDetailResult { public: std::string bvid; - int aid; + uint64_t aid; int videos; // 视频数量 int tid; //分类ID int tname; //分类名称 @@ -575,7 +576,7 @@ class VideoPageResult { public: int online_count; int64_t last_play_time; - int last_play_cid; + uint64_t last_play_cid; VideoPageSubtitleList subtitles; std::string mask_url; }; @@ -672,7 +673,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(VideoOnlineTotal, total); class Video { public: - int aid; + uint64_t aid; std::string bvid; Video() = default; diff --git a/wiliwili/include/api/live/danmaku_live.hpp b/wiliwili/include/api/live/danmaku_live.hpp index 332aef41..7ae2f1b5 100644 --- a/wiliwili/include/api/live/danmaku_live.hpp +++ b/wiliwili/include/api/live/danmaku_live.hpp @@ -24,9 +24,9 @@ class LiveDanmaku { public: int room_id; int uid; - void connect(int room_id, int64_t uid, const bilibili::LiveDanmakuinfo &info); + void connect(int room_id, uint64_t uid, const bilibili::LiveDanmakuinfo &info); void disconnect(); - void send_join_request(int room_id, int64_t uid); + void send_join_request(int room_id, uint64_t uid); void send_heartbeat(); void send_text_message(const std::string &message); diff --git a/wiliwili/include/fragment/dynamic_tab.hpp b/wiliwili/include/fragment/dynamic_tab.hpp index a0a84bc4..78c3aa5d 100644 --- a/wiliwili/include/fragment/dynamic_tab.hpp +++ b/wiliwili/include/fragment/dynamic_tab.hpp @@ -17,7 +17,7 @@ class RecyclingGrid; class AutoTabFrame; class DynamicVideo; -typedef brls::Event UserSelectedEvent; +typedef brls::Event UserSelectedEvent; class DynamicTab : public AttachedView, public DynamicTabRequest, public DynamicVideoRequest { public: @@ -37,7 +37,7 @@ class DynamicTab : public AttachedView, public DynamicTabRequest, public Dynamic void onCreate() override; - void changeUser(int64_t mid); + void changeUser(uint64_t mid); void onDynamicVideoList(const bilibili::DynamicVideoListResult& result, unsigned int index) override; diff --git a/wiliwili/include/fragment/player_collection.hpp b/wiliwili/include/fragment/player_collection.hpp index 76c2fa4d..17ff2401 100644 --- a/wiliwili/include/fragment/player_collection.hpp +++ b/wiliwili/include/fragment/player_collection.hpp @@ -28,7 +28,7 @@ class RecyclingGrid; class PlayerCollection : public brls::Box { public: - PlayerCollection(int rid, int type); + PlayerCollection(uint64_t rid, int type); ~PlayerCollection() override; @@ -41,7 +41,7 @@ class PlayerCollection : public brls::Box { void onCollectionList(const bilibili::SimpleCollectionListResultWrapper& result); /// 获取收藏列表 - void getCollectionList(int rid, int type); + void getCollectionList(uint64_t rid, int type); private: BRLS_BIND(RecyclingGrid, recyclingGrid, "player/collection/recyclingGrid"); diff --git a/wiliwili/include/fragment/player_setting.hpp b/wiliwili/include/fragment/player_setting.hpp index d6722b03..a872d20d 100644 --- a/wiliwili/include/fragment/player_setting.hpp +++ b/wiliwili/include/fragment/player_setting.hpp @@ -53,7 +53,7 @@ class PlayerSetting : public brls::Box { void hideSkipOpeningCreditsSetting(); - void setBangumiCustomSetting(const std::string& title, unsigned int seasonId); + void setBangumiCustomSetting(const std::string& title, uint64_t seasonId); private: BRLS_BIND(ButtonClose, closebtn, "button/close"); @@ -98,7 +98,7 @@ class PlayerSetting : public brls::Box { BRLS_BIND(brls::InputNumericCell, btnClipStart, "setting/video/custom/clip/start"); BRLS_BIND(brls::InputNumericCell, btnClipEnd, "setting/video/custom/clip/end"); - unsigned int seasonId{}; + uint64_t seasonId{}; // 更新倒计时 void updateCountdown(size_t now); diff --git a/wiliwili/include/presenter/dynamic_video.hpp b/wiliwili/include/presenter/dynamic_video.hpp index e3ae3be0..9f1f0506 100644 --- a/wiliwili/include/presenter/dynamic_video.hpp +++ b/wiliwili/include/presenter/dynamic_video.hpp @@ -32,11 +32,11 @@ class DynamicVideoRequest : public Presenter { void requestUserDynamicVideoList(int64_t mid, int pn = 0, int ps = 30); protected: - int64_t currentUser = 0; + uint64_t currentUser = 0; unsigned int currentVideoPage = 1, currentArticlePage = 1; std::string currentVideoOffset, currentArticleOffset; - void requestVideoData(unsigned int page, const std::string& offset, int64_t mid); + void requestVideoData(unsigned int page, const std::string& offset, uint64_t mid); }; class DynamicArticleRequest : public Presenter { diff --git a/wiliwili/include/presenter/video_detail.hpp b/wiliwili/include/presenter/video_detail.hpp index 71e75ccc..e7e58efe 100644 --- a/wiliwili/include/presenter/video_detail.hpp +++ b/wiliwili/include/presenter/video_detail.hpp @@ -45,16 +45,16 @@ class VideoDetail : public CommentRequest { void requestData(const bilibili::VideoDetailResult& video); /// 请求番剧数据 - void requestData(size_t id, PGC_ID_TYPE type = PGC_ID_TYPE::SEASON_ID); + void requestData(uint64_t id, PGC_ID_TYPE type = PGC_ID_TYPE::SEASON_ID); /// 获取番剧信息 - void requestSeasonInfo(size_t seasonID, size_t epID = 0); + void requestSeasonInfo(uint64_t seasonID, uint64_t epID = 0); /// 获取番剧相关推荐 - void requestSeasonRecommend(size_t seasonID); + void requestSeasonRecommend(uint64_t seasonID); /// 获取番剧播放进度,追剧情况 - void requestSeasonStatue(size_t seasonID); + void requestSeasonStatue(uint64_t seasonID); /// 获取视频信息:标题、作者、简介、分P等 void requestVideoInfo(const std::string& bvid); @@ -63,16 +63,16 @@ class VideoDetail : public CommentRequest { * 获取视频地址 * @param requestHistoryInfo 是否获取历史播放进度 */ - void requestVideoUrl(std::string bvid, int cid, bool requestHistoryInfo = true); + void requestVideoUrl(const std::string& bvid, uint64_t cid, bool requestHistoryInfo = true); /** * 获取番剧地址 * @param requestHistoryInfo 是否获取历史播放进度 */ - void requestSeasonVideoUrl(const std::string& bvid, int cid, bool requestHistoryInfo = true); + void requestSeasonVideoUrl(const std::string& bvid, uint64_t cid, bool requestHistoryInfo = true); /// 获取投屏地址 - void requestCastVideoUrl(int oid, int cid, int type); + void requestCastVideoUrl(uint64_t oid, uint64_t cid, int type); int getQualityIndex(); @@ -80,28 +80,28 @@ class VideoDetail : public CommentRequest { void changeEpisode(const bilibili::SeasonEpisodeResult& i); /// 获取Up主的其他视频: pn 为0 自动获取下一页 - void requestUploadedVideos(int64_t mid, int pn = 0, int ps = 10); + void requestUploadedVideos(uint64_t mid, int pn = 0, int ps = 10); /// 获取单个视频播放人数 - void requestVideoOnline(const std::string& bvid, int cid); + void requestVideoOnline(const std::string& bvid, uint64_t cid); /// 获取视频的 点赞、投币、收藏情况 void requestVideoRelationInfo(const std::string& bvid); /// 获取番剧分集的 点赞、投币、收藏情况 - void requestVideoRelationInfo(size_t epid); + void requestVideoRelationInfo(uint64_t epid); /// 获取视频弹幕 - void requestVideoDanmaku(int cid); + void requestVideoDanmaku(uint64_t cid); /// 获取视频高能进度条 - void requestHighlightProgress(int cid); + void requestHighlightProgress(uint64_t cid); /// 获取视频分P详情 - void requestVideoPageDetail(const std::string& bvid, int cid, bool requestHistoryInfo = true); + void requestVideoPageDetail(const std::string& bvid, uint64_t cid, bool requestHistoryInfo = true); /// 上报播放进度 - void reportHistory(unsigned int aid, unsigned int cid, unsigned int progress = 0, unsigned int duration = 0, + void reportHistory(uint64_t aid, uint64_t cid, unsigned int progress = 0, unsigned int duration = 0, int type = 3); inline static bool REPORT_HISTORY = true; @@ -109,10 +109,10 @@ class VideoDetail : public CommentRequest { int getCoinTolerate(); /// 投币 - void addCoin(int aid, int num, bool like); + void addCoin(uint64_t aid, int num, bool like); /// 点赞 - void beAgree(int aid); + void beAgree(uint64_t aid); /** * 收藏视频 @@ -122,11 +122,11 @@ class VideoDetail : public CommentRequest { * @param del 移除的收藏夹 * @param isFavorite 在添加或移除过后是否处于收藏状态 */ - void addResource(int rid, int type = 2, bool isFavorite = true, std::string add = "1", std::string del = ""); + void addResource(uint64_t rid, int type = 2, bool isFavorite = true, std::string add = "1", std::string del = ""); void followUp(const std::string& mid, bool follow); - void followSeason(size_t season, bool follow); + void followSeason(uint64_t season, bool follow); static inline int defaultQuality = 116; diff --git a/wiliwili/include/utils/activity_helper.hpp b/wiliwili/include/utils/activity_helper.hpp index eef9bca7..cf8a09b4 100644 --- a/wiliwili/include/utils/activity_helper.hpp +++ b/wiliwili/include/utils/activity_helper.hpp @@ -8,9 +8,9 @@ class Intent { public: // 开启各类视频 - static void openBV(const std::string& bvid, int cid = 0, int progress = -1); - static void openSeasonBySeasonId(int seasonId, int progress = -1); - static void openSeasonByEpId(int epId, int progress = -1); + static void openBV(const std::string& bvid, uint64_t cid = 0, int progress = -1); + static void openSeasonBySeasonId(uint64_t seasonId, int progress = -1); + static void openSeasonByEpId(uint64_t epId, int progress = -1); static void openLive(int id, const std::string& name = "", const std::string& views = ""); /// 开启收藏夹 diff --git a/wiliwili/include/view/video_view.hpp b/wiliwili/include/view/video_view.hpp index f86d8a04..b24c1e40 100644 --- a/wiliwili/include/view/video_view.hpp +++ b/wiliwili/include/view/video_view.hpp @@ -161,7 +161,7 @@ class VideoView : public brls::Box { void setCustomToggleAction(std::function action); /// 番剧自定义菜单信息 - void setBangumiCustomSetting(const std::string& title, unsigned int seasonId); + void setBangumiCustomSetting(const std::string& title, uint64_t seasonId); void setTitle(const std::string& title); diff --git a/wiliwili/source/activity/player_activity.cpp b/wiliwili/source/activity/player_activity.cpp index 9847738e..d3906d3d 100644 --- a/wiliwili/source/activity/player_activity.cpp +++ b/wiliwili/source/activity/player_activity.cpp @@ -98,7 +98,7 @@ class UGCSeasonHeader : public RecyclingGridItem { /// PlayerActivity -PlayerActivity::PlayerActivity(const std::string& bvid, unsigned int cid, int progress) { +PlayerActivity::PlayerActivity(const std::string& bvid, uint64_t cid, int progress) { videoDetailResult.bvid = bvid; videoDetailPage.cid = cid; this->setProgress(progress); diff --git a/wiliwili/source/activity/player_base_activity.cpp b/wiliwili/source/activity/player_base_activity.cpp index c9a25538..3b8362fb 100644 --- a/wiliwili/source/activity/player_base_activity.cpp +++ b/wiliwili/source/activity/player_base_activity.cpp @@ -24,7 +24,7 @@ class DataSourceCommentList : public RecyclingGridDataSource, public CommentAction { public: - DataSourceCommentList(bilibili::VideoCommentListResult result, size_t aid, int mode, std::function cb) + DataSourceCommentList(bilibili::VideoCommentListResult result, uint64_t aid, int mode, std::function cb) : dataList(std::move(result)), aid(aid), commentMode(mode), switchModeCallback(cb) {} RecyclingGridItem* cellForRow(RecyclingGrid* recycler, size_t index) override { if (index == 0) { @@ -128,7 +128,7 @@ class DataSourceCommentList : public RecyclingGridDataSource, public CommentActi private: bilibili::VideoCommentListResult dataList; - size_t aid; + uint64_t aid; int commentMode = 3; // 2: 按时间;3: 按热度 std::function switchModeCallback = nullptr; }; @@ -363,7 +363,7 @@ void BasePlayerActivity::setCommonData() { video->hideOSDLockButton(); } -void BasePlayerActivity::showCollectionDialog(int64_t id, int videoType) { +void BasePlayerActivity::showCollectionDialog(uint64_t id, int videoType) { if (!DialogHelper::checkLogin()) return; auto playerCollection = new PlayerCollection(id, videoType); auto dialog = new brls::Dialog(playerCollection); @@ -383,7 +383,7 @@ void BasePlayerActivity::showCollectionDialog(int64_t id, int videoType) { dialog->open(); } -void BasePlayerActivity::showCoinDialog(size_t aid) { +void BasePlayerActivity::showCoinDialog(uint64_t aid) { if (!DialogHelper::checkLogin()) return; if (std::to_string(videoDetailResult.owner.mid) == ProgramConfig::instance().getUserID()) { diff --git a/wiliwili/source/activity/player_season_activity.cpp b/wiliwili/source/activity/player_season_activity.cpp index e6cecd39..85edac3e 100644 --- a/wiliwili/source/activity/player_season_activity.cpp +++ b/wiliwili/source/activity/player_season_activity.cpp @@ -384,7 +384,7 @@ void PlayerSeasonActivity::onSeasonRecommend(const bilibili::SeasonRecommendWrap }); } -void PlayerSeasonActivity::playSeason(size_t season_id) { +void PlayerSeasonActivity::playSeason(uint64_t season_id) { //上报历史记录 this->reportCurrentProgress(MPVCore::instance().video_progress, MPVCore::instance().duration); diff --git a/wiliwili/source/api/danmaku_live.cpp b/wiliwili/source/api/danmaku_live.cpp index 95e5be6c..9e391bf0 100644 --- a/wiliwili/source/api/danmaku_live.cpp +++ b/wiliwili/source/api/danmaku_live.cpp @@ -50,7 +50,7 @@ LiveDanmaku::~LiveDanmaku() { while (!msg_q.empty()) msg_q.pop(); } -void LiveDanmaku::connect(int room_id, int64_t uid, const bilibili::LiveDanmakuinfo &info) { +void LiveDanmaku::connect(int room_id, uint64_t uid, const bilibili::LiveDanmakuinfo &info) { if (connected.load(std::memory_order_acquire)) { return; } @@ -141,7 +141,7 @@ bool LiveDanmaku::is_connected() { return connected.load(std::memory_order_acqui bool LiveDanmaku::is_evOK() { return ms_ev_ok.load(std::memory_order_acquire); } -void LiveDanmaku::send_join_request(const int room_id, const int64_t uid) { +void LiveDanmaku::send_join_request(const int room_id, const uint64_t uid) { json join_request = {{"uid", uid}, {"roomid", room_id}, {"protover", 2}, diff --git a/wiliwili/source/api/dynamic_api.cpp b/wiliwili/source/api/dynamic_api.cpp index ceeb7543..4f35080c 100644 --- a/wiliwili/source/api/dynamic_api.cpp +++ b/wiliwili/source/api/dynamic_api.cpp @@ -24,7 +24,7 @@ void BilibiliClient::dynamic_video(const unsigned int page, const std::string& o error); } -void BilibiliClient::dynamic_article(const unsigned int page, const std::string& offset, const int64_t mid, +void BilibiliClient::dynamic_article(const unsigned int page, const std::string& offset, uint64_t mid, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync( diff --git a/wiliwili/source/api/mine_api.cpp b/wiliwili/source/api/mine_api.cpp index 80ebb282..f44cb78d 100644 --- a/wiliwili/source/api/mine_api.cpp +++ b/wiliwili/source/api/mine_api.cpp @@ -245,7 +245,7 @@ void BilibiliClient::getWatchLater(const std::function& callback = nullptr, // const ErrorCallback& error = nullptr); -void BilibiliClient::get_my_collection_list(const int64_t mid, int index, int num, int type, +void BilibiliClient::get_my_collection_list(uint64_t mid, int index, int num, int type, const std::function& callback, const ErrorCallback& error) { BilibiliClient::get_my_collection_list(std::to_string(mid), index, num, type, callback, error); @@ -269,7 +269,7 @@ void BilibiliClient::get_my_collection_list(const std::string& mid, int index, i error); } -void BilibiliClient::get_collection_list_all(int rid, int type, std::string mid, +void BilibiliClient::get_collection_list_all(uint64_t rid, int type, const std::string& mid, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync( @@ -321,7 +321,7 @@ void BilibiliClient::get_my_bangumi(const std::string& mid, size_t type, size_t } /// get user's upload videos -void BilibiliClient::get_user_videos(const int64_t mid, int pn, int ps, +void BilibiliClient::get_user_videos(uint64_t mid, int pn, int ps, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync(Api::UserUploadedVideo, @@ -333,7 +333,7 @@ void BilibiliClient::get_user_videos(const int64_t mid, int pn, int ps, callback, error); } -void BilibiliClient::get_user_videos2(const int64_t mid, int pn, int ps, +void BilibiliClient::get_user_videos2(uint64_t mid, int pn, int ps, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync(Api::UserDynamicVideo, diff --git a/wiliwili/source/api/video_detail_api.cpp b/wiliwili/source/api/video_detail_api.cpp index 2c2ab513..6ab68d32 100644 --- a/wiliwili/source/api/video_detail_api.cpp +++ b/wiliwili/source/api/video_detail_api.cpp @@ -14,7 +14,7 @@ void BilibiliClient::get_video_detail(const std::string& bvid, const std::functi HTTP::getResultAsync(Api::Detail, {{"bvid", bvid}}, callback, error); } -void BilibiliClient::get_video_detail(int aid, const std::function& callback, +void BilibiliClient::get_video_detail(uint64_t aid, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync(Api::Detail, {{"aid", std::to_string(aid)}}, callback, error); } @@ -25,13 +25,13 @@ void BilibiliClient::get_video_detail_all(const std::string& bvid, HTTP::getResultAsync(Api::DetailAll, {{"bvid", bvid}}, callback, error); } -void BilibiliClient::get_page_detail(int aid, int cid, const std::function& callback, +void BilibiliClient::get_page_detail(uint64_t aid, uint64_t cid, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync(Api::PageDetail, {{"aid", std::to_string(aid)}, {"cid", std::to_string(cid)}}, callback, error); } -void BilibiliClient::get_page_detail(const std::string& bvid, int cid, +void BilibiliClient::get_page_detail(const std::string& bvid, uint64_t cid, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync(Api::PageDetail, {{"bvid", bvid}, {"cid", std::to_string(cid)}}, callback, error); @@ -60,12 +60,12 @@ void BilibiliClient::get_video_pagelist(const std::string& bvid, HTTP::getResultAsync(Api::PlayPageList, {{"bvid", std::string(bvid)}}, callback, error); } -void BilibiliClient::get_video_pagelist(int aid, const std::function& callback, +void BilibiliClient::get_video_pagelist(uint64_t aid, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync(Api::PlayPageList, {{"aid", std::to_string(aid)}}, callback, error); } -void BilibiliClient::get_video_url(const std::string& bvid, int cid, int qn, +void BilibiliClient::get_video_url(const std::string& bvid, uint64_t cid, int qn, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync(Api::PlayInformation, {{"bvid", std::string(bvid)}, @@ -77,7 +77,7 @@ void BilibiliClient::get_video_url(const std::string& bvid, int cid, int qn, callback, error); } -void BilibiliClient::get_video_url(int aid, int cid, int qn, const std::function& callback, +void BilibiliClient::get_video_url(uint64_t aid, uint64_t cid, int qn, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync(Api::PlayInformation, {{"aid", std::to_string(aid)}, @@ -89,7 +89,7 @@ void BilibiliClient::get_video_url(int aid, int cid, int qn, const std::function callback, error); } -void BilibiliClient::get_video_url_cast(int oid, int cid, int type, int qn, const std::string& csrf, +void BilibiliClient::get_video_url_cast(uint64_t oid, uint64_t cid, int type, int qn, const std::string& csrf, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync(Api::PlayUrlCast, @@ -140,7 +140,7 @@ void BilibiliClient::get_comment_detail(const std::string& access_key, const std callback, error); } -void BilibiliClient::get_season_detail(int seasonID, int epID, const std::function& callback, +void BilibiliClient::get_season_detail(uint64_t seasonID, uint64_t epID, const std::function& callback, const ErrorCallback& error) { cpr::Parameters params; if (epID == 0) { @@ -152,13 +152,13 @@ void BilibiliClient::get_season_detail(int seasonID, int epID, const std::functi HTTP::getResultAsync(Api::SeasonDetail, params, callback, error); } -void BilibiliClient::get_season_recommend(size_t seasonID, const std::function& callback, +void BilibiliClient::get_season_recommend(uint64_t seasonID, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync(Api::SeasonRCMD, {{"season_id", std::to_string(seasonID)}}, callback, error); } -void BilibiliClient::get_season_status(size_t seasonID, const std::function& callback, +void BilibiliClient::get_season_status(uint64_t seasonID, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync(Api::SeasonStatus, cpr::Parameters{{"season_id", std::to_string(seasonID)}, @@ -166,7 +166,7 @@ void BilibiliClient::get_season_status(size_t seasonID, const std::function& callback, +void BilibiliClient::get_season_url(uint64_t cid, int qn, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync( Api::SeasonUrl, @@ -221,7 +221,7 @@ void BilibiliClient::get_live_pay_link(int roomid, const std::function& callback, +void BilibiliClient::get_video_online(uint64_t aid, uint64_t cid, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync(Api::OnlineViewerCount, { @@ -231,7 +231,7 @@ void BilibiliClient::get_video_online(int aid, int cid, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync(Api::OnlineViewerCount, @@ -249,13 +249,13 @@ void BilibiliClient::get_video_relation(const std::string& bvid, const std::func } /// 视频页 获取番剧点赞/收藏/投币情况 -void BilibiliClient::get_video_relation(size_t epid, const std::function& callback, +void BilibiliClient::get_video_relation(uint64_t epid, const std::function& callback, const ErrorCallback& error) { HTTP::getResultAsync(Api::VideoEpisodeRelation, {{"ep_id", std::to_string(epid)}}, callback, error); } -void BilibiliClient::get_danmaku(unsigned int cid, const std::function& callback, +void BilibiliClient::get_danmaku(uint64_t cid, const std::function& callback, const ErrorCallback& error) { cpr::GetCallback<>( [callback, error](const cpr::Response& r) { @@ -271,7 +271,7 @@ void BilibiliClient::get_danmaku(unsigned int cid, const std::function& callback, const ErrorCallback& error) { cpr::GetCallback<>( @@ -314,9 +314,9 @@ void BilibiliClient::get_subtitle(const std::string& link, const std::function& callback, +void BilibiliClient::report_history(const std::string& mid, const std::string& access_key, uint64_t aid, + uint64_t cid, int type, unsigned int progress, unsigned int duration, + uint64_t sid, uint64_t epid, const std::function& callback, const ErrorCallback& error) { cpr::Payload payload = { {"mid", mid}, @@ -350,7 +350,7 @@ void BilibiliClient::report_live_history(int room_id, const std::string& csrf, c HTTP::postResultAsync(Api::LiveReport, {}, payload, callback, error); } -void BilibiliClient::be_agree(const std::string& access_key, int aid, bool is_like, +void BilibiliClient::be_agree(const std::string& access_key, uint64_t aid, bool is_like, const std::function& callback, const ErrorCallback& error) { cpr::Payload payload = { {"aid", std::to_string(aid)}, @@ -422,7 +422,7 @@ void BilibiliClient::add_comment(const std::string& access_key, const std::strin error); } -void BilibiliClient::add_coin(const std::string& access_key, int aid, unsigned int coin_number, bool is_like, +void BilibiliClient::add_coin(const std::string& access_key, uint64_t aid, unsigned int coin_number, bool is_like, const std::function& callback, const ErrorCallback& error) { cpr::Payload payload = { {"aid", std::to_string(aid)}, @@ -431,7 +431,6 @@ void BilibiliClient::add_coin(const std::string& access_key, int aid, unsigned i {"csrf", access_key}, }; - printf("[add coin] aid: %d; coin: %d; select_like: %d;\n", aid, coin_number, is_like); HTTP::postResultAsync(Api::CoinWeb, {}, payload, callback, error); } @@ -439,7 +438,7 @@ void BilibiliClient::get_coin_exp(const std::function& callback, cons HTTP::getResultAsync(Api::CoinExp, {}, callback, error); } -void BilibiliClient::add_resource(const std::string& access_key, int rid, int type, const std::string& add_ids, +void BilibiliClient::add_resource(const std::string& access_key, uint64_t rid, int type, const std::string& add_ids, const std::string& del_ids, const std::function& callback, const ErrorCallback& error) { cpr::Payload payload = { @@ -449,7 +448,7 @@ void BilibiliClient::add_resource(const std::string& access_key, int rid, int ty HTTP::postResultAsync(Api::CollectionVideoListSave, {}, payload, callback, error); } -void BilibiliClient::triple_like(const std::string& access_key, int aid, const std::function& callback, +void BilibiliClient::triple_like(const std::string& access_key, uint64_t aid, const std::function& callback, const ErrorCallback& error) { cpr::Payload payload = { {"aid", std::to_string(aid)}, @@ -468,7 +467,7 @@ void BilibiliClient::follow_up(const std::string& access_key, const std::string& HTTP::postResultAsync(Api::Follow, {}, payload, callback, error); } -void BilibiliClient::follow_season(const std::string& access_key, size_t season, bool follow, +void BilibiliClient::follow_season(const std::string& access_key, uint64_t season, bool follow, const std::function& callback, const ErrorCallback& error) { cpr::Payload payload = { {"season_id", std::to_string(season)}, diff --git a/wiliwili/source/fragment/dynamic_tab.cpp b/wiliwili/source/fragment/dynamic_tab.cpp index 9d84da72..073c0cae 100644 --- a/wiliwili/source/fragment/dynamic_tab.cpp +++ b/wiliwili/source/fragment/dynamic_tab.cpp @@ -311,7 +311,7 @@ void DynamicTab::onUpList(const bilibili::DynamicUpListResultWrapper& result) { brls::Threading::sync([this, result]() { auto dataSource = new DataSourceUpList(result.items); upRecyclingGrid->setDataSource(dataSource); - dataSource->getSelectedEvent()->subscribe([this](int64_t mid) { this->changeUser(mid); }); + dataSource->getSelectedEvent()->subscribe([this](uint64_t mid) { this->changeUser(mid); }); }); } @@ -350,7 +350,7 @@ void DynamicTab::onCreate() { }); } -void DynamicTab::changeUser(int64_t mid) { +void DynamicTab::changeUser(uint64_t mid) { this->setCurrentUser(mid); this->videoRecyclingGrid->showSkeleton(tabFrame->getActiveIndex() == 0 ? 30 : 0); this->DynamicVideoRequest::requestData(true, DynamicRequestMode::Video); diff --git a/wiliwili/source/fragment/player_collection.cpp b/wiliwili/source/fragment/player_collection.cpp index 1c631e9f..c86234bc 100644 --- a/wiliwili/source/fragment/player_collection.cpp +++ b/wiliwili/source/fragment/player_collection.cpp @@ -41,7 +41,7 @@ class CollectionDataSourceList : public RecyclingGridDataSource { for (auto& i : data) { brls::Logger::debug("{} {} {}", i.title, i.id, i.fav_state); } - for (size_t i = 0; i < data.size(); i++) selectionData.emplace_back(data[i].fav_state); + for (auto & i : data) selectionData.emplace_back(i.fav_state); } RecyclingGridItem* cellForRow(RecyclingGrid* recycler, size_t index) override { @@ -60,7 +60,7 @@ class CollectionDataSourceList : public RecyclingGridDataSource { void onItemSelected(RecyclingGrid* recycler, size_t index) override { currentIndex = index; selectionData[index] = !selectionData[index]; - CollectionListCell* item = dynamic_cast(recycler->getGridItemByIndex(index)); + auto* item = dynamic_cast(recycler->getGridItemByIndex(index)); if (!item) return; item->setSelected(selectionData[index]); @@ -110,7 +110,7 @@ class CollectionDataSourceList : public RecyclingGridDataSource { } }; -PlayerCollection::PlayerCollection(int rid, int type) { +PlayerCollection::PlayerCollection(uint64_t rid, int type) { this->inflateFromXMLRes("xml/fragment/player_collection.xml"); brls::Logger::debug("Fragment PlayerCollection: create"); this->recyclingGrid->showSkeleton(); @@ -121,19 +121,19 @@ PlayerCollection::PlayerCollection(int rid, int type) { PlayerCollection::~PlayerCollection() { brls::Logger::debug("Fragment PlayerCollection: delete"); } std::string PlayerCollection::getAddCollectionList() { - CollectionDataSourceList* dataSource = dynamic_cast(recyclingGrid->getDataSource()); + auto* dataSource = dynamic_cast(recyclingGrid->getDataSource()); if (!dataSource) return ""; return dataSource->getAddCollectionList(); } std::string PlayerCollection::getDeleteCollectionList() { - CollectionDataSourceList* dataSource = dynamic_cast(recyclingGrid->getDataSource()); + auto* dataSource = dynamic_cast(recyclingGrid->getDataSource()); if (!dataSource) return ""; return dataSource->getDeleteCollectionList(); } bool PlayerCollection::isFavorite() { - CollectionDataSourceList* dataSource = dynamic_cast(recyclingGrid->getDataSource()); + auto* dataSource = dynamic_cast(recyclingGrid->getDataSource()); if (!dataSource) return false; return dataSource->isFavorite(); } @@ -142,7 +142,7 @@ void PlayerCollection::onCollectionList(const bilibili::SimpleCollectionListResu recyclingGrid->setDataSource(new CollectionDataSourceList(result.list)); } -void PlayerCollection::getCollectionList(int rid, int type) { +void PlayerCollection::getCollectionList(uint64_t rid, int type) { std::string mid = ProgramConfig::instance().getUserID(); ASYNC_RETAIN diff --git a/wiliwili/source/fragment/player_setting.cpp b/wiliwili/source/fragment/player_setting.cpp index 96cb76f3..470a0e89 100644 --- a/wiliwili/source/fragment/player_setting.cpp +++ b/wiliwili/source/fragment/player_setting.cpp @@ -451,7 +451,7 @@ void PlayerSetting::hideHighlightLineCells() { btnHighlight->setVisibility(brls: void PlayerSetting::hideSkipOpeningCreditsSetting() { btnSkip->setVisibility(brls::Visibility::GONE); } -void PlayerSetting::setBangumiCustomSetting(const std::string& title, unsigned int id) { +void PlayerSetting::setBangumiCustomSetting(const std::string& title, uint64_t id) { if (id == 0) return; seasonId = id; diff --git a/wiliwili/source/presenter/dynamic_video.cpp b/wiliwili/source/presenter/dynamic_video.cpp index a08a3673..d9a4287c 100644 --- a/wiliwili/source/presenter/dynamic_video.cpp +++ b/wiliwili/source/presenter/dynamic_video.cpp @@ -38,7 +38,7 @@ void DynamicVideoRequest::requestData(bool refresh, DynamicRequestMode mode) { } } -void DynamicVideoRequest::requestVideoData(unsigned int page, const std::string &offset, int64_t mid) { +void DynamicVideoRequest::requestVideoData(unsigned int page, const std::string &offset, uint64_t mid) { if (mid == 0) { this->requestDynamicVideoList(page, offset); } else { diff --git a/wiliwili/source/presenter/video_detail.cpp b/wiliwili/source/presenter/video_detail.cpp index 79466239..a8606de4 100644 --- a/wiliwili/source/presenter/video_detail.cpp +++ b/wiliwili/source/presenter/video_detail.cpp @@ -19,7 +19,7 @@ void VideoDetail::requestData(const bilibili::VideoDetailResult& video) { this->requestVideoInfo(video.bvid); } /// 请求番剧数据 -void VideoDetail::requestData(size_t id, PGC_ID_TYPE type) { +void VideoDetail::requestData(uint64_t id, PGC_ID_TYPE type) { if (type == PGC_ID_TYPE::SEASON_ID) this->requestSeasonInfo(id, 0); else if (type == PGC_ID_TYPE::EP_ID) @@ -27,7 +27,7 @@ void VideoDetail::requestData(size_t id, PGC_ID_TYPE type) { } /// 获取番剧信息 -void VideoDetail::requestSeasonInfo(size_t seasonID, size_t epID) { +void VideoDetail::requestSeasonInfo(uint64_t seasonID, uint64_t epID) { // 重置MPV MPVCore::instance().reset(); @@ -89,7 +89,7 @@ void VideoDetail::requestSeasonInfo(size_t seasonID, size_t epID) { for (size_t i = 0; i < episodeList.size(); i++) episodeList[i].index = i; - size_t ep_id = epID; + uint64_t ep_id = epID; if (ep_id == 0) { ep_id = result.user_status.last_ep_id; episodeResult.progress = result.user_status.last_time; @@ -134,7 +134,7 @@ void VideoDetail::requestSeasonInfo(size_t seasonID, size_t epID) { }); } -void VideoDetail::requestSeasonRecommend(size_t seasonID) { +void VideoDetail::requestSeasonRecommend(uint64_t seasonID) { ASYNC_RETAIN BILI::get_season_recommend( seasonID, @@ -150,7 +150,7 @@ void VideoDetail::requestSeasonRecommend(size_t seasonID) { }); } -void VideoDetail::requestSeasonStatue(size_t seasonID) { +void VideoDetail::requestSeasonStatue(uint64_t seasonID) { ASYNC_RETAIN BILI::get_season_status( seasonID, @@ -261,7 +261,7 @@ void VideoDetail::requestVideoInfo(const std::string& bvid) { } /// 获取视频地址 -void VideoDetail::requestVideoUrl(std::string bvid, int cid, bool requestHistoryInfo) { +void VideoDetail::requestVideoUrl(const std::string& bvid, uint64_t cid, bool requestHistoryInfo) { // 重置MPV MPVCore::instance().reset(); ASYNC_RETAIN @@ -295,7 +295,7 @@ void VideoDetail::requestVideoUrl(std::string bvid, int cid, bool requestHistory } /// 获取番剧地址 -void VideoDetail::requestSeasonVideoUrl(const std::string& bvid, int cid, bool requestHistoryInfo) { +void VideoDetail::requestSeasonVideoUrl(const std::string& bvid, uint64_t cid, bool requestHistoryInfo) { // 重置MPV MPVCore::instance().reset(); @@ -330,7 +330,7 @@ void VideoDetail::requestSeasonVideoUrl(const std::string& bvid, int cid, bool r } /// 获取投屏地址 -void VideoDetail::requestCastVideoUrl(int oid, int cid, int type) { +void VideoDetail::requestCastVideoUrl(uint64_t oid, uint64_t cid, int type) { ASYNC_RETAIN brls::Logger::debug("请求投屏视频播放地址: {}/{}", oid, cid); BILI::get_video_url_cast( @@ -387,7 +387,7 @@ void VideoDetail::changeEpisode(const bilibili::SeasonEpisodeResult& i) { } /// 获取Up主的其他视频 -void VideoDetail::requestUploadedVideos(int64_t mid, int pn, int ps) { +void VideoDetail::requestUploadedVideos(uint64_t mid, int pn, int ps) { if (pn != 0) { this->userUploadedVideoRequestIndex = pn; } @@ -412,7 +412,7 @@ void VideoDetail::requestUploadedVideos(int64_t mid, int pn, int ps) { } /// 获取单个视频播放人数 -void VideoDetail::requestVideoOnline(const std::string& bvid, int cid) { +void VideoDetail::requestVideoOnline(const std::string& bvid, uint64_t cid) { brls::Logger::debug("请求当前视频在线人数: bvid: {} cid: {}", bvid, cid); ASYNC_RETAIN BILI::get_video_online( @@ -448,7 +448,7 @@ void VideoDetail::requestVideoRelationInfo(const std::string& bvid) { } /// 获取番剧分集的 点赞、投币、收藏情况 -void VideoDetail::requestVideoRelationInfo(size_t epid) { +void VideoDetail::requestVideoRelationInfo(uint64_t epid) { ASYNC_RETAIN BILI::get_video_relation( epid, @@ -469,7 +469,7 @@ void VideoDetail::requestVideoRelationInfo(size_t epid) { } /// 获取视频弹幕 -void VideoDetail::requestVideoDanmaku(int cid) { +void VideoDetail::requestVideoDanmaku(uint64_t cid) { brls::Logger::debug("请求弹幕:cid: {}", cid); ASYNC_RETAIN BILI::get_danmaku( @@ -515,7 +515,7 @@ void VideoDetail::requestVideoDanmaku(int cid) { } /// 获取视频分P详情 -void VideoDetail::requestVideoPageDetail(const std::string& bvid, int cid, bool requestVideoHistory) { +void VideoDetail::requestVideoPageDetail(const std::string& bvid, uint64_t cid, bool requestVideoHistory) { brls::Logger::debug("请求字幕:bvid: {} cid: {}", bvid, cid); ASYNC_RETAIN BILI::get_page_detail( @@ -569,7 +569,7 @@ void VideoDetail::requestVideoPageDetail(const std::string& bvid, int cid, bool } /// 上报历史记录 -void VideoDetail::reportHistory(unsigned int aid, unsigned int cid, unsigned int progress, unsigned int duration, +void VideoDetail::reportHistory(uint64_t aid, uint64_t cid, unsigned int progress, unsigned int duration, int type) { if (!REPORT_HISTORY) return; if (aid == 0 || cid == 0) return; @@ -577,7 +577,7 @@ void VideoDetail::reportHistory(unsigned int aid, unsigned int cid, unsigned int std::string mid = ProgramConfig::instance().getUserID(); std::string token = ProgramConfig::instance().getCSRF(); if (mid.empty() || token.empty()) return; - unsigned int sid = 0, epid = 0; + uint64_t sid = 0, epid = 0; if (type == 4) { sid = seasonInfo.season_id; epid = episodeResult.id; @@ -596,7 +596,7 @@ int VideoDetail::getCoinTolerate() { } /// 点赞 -void VideoDetail::beAgree(int aid) { +void VideoDetail::beAgree(uint64_t aid) { std::string csrf = ProgramConfig::instance().getCSRF(); if (csrf.empty()) return; @@ -624,7 +624,7 @@ void VideoDetail::beAgree(int aid) { } /// 投币 -void VideoDetail::addCoin(int aid, int num, bool like) { +void VideoDetail::addCoin(uint64_t aid, int num, bool like) { std::string csrf = ProgramConfig::instance().getCSRF(); if (csrf.empty()) return; if (num < 1 || num > 2) return; @@ -658,7 +658,7 @@ void VideoDetail::addCoin(int aid, int num, bool like) { } /// 收藏 -void VideoDetail::addResource(int aid, int type, bool isFavorite, std::string add, std::string del) { +void VideoDetail::addResource(uint64_t aid, int type, bool isFavorite, std::string add, std::string del) { std::string csrf = ProgramConfig::instance().getCSRF(); if (csrf.empty()) return; @@ -687,7 +687,7 @@ void VideoDetail::addResource(int aid, int type, bool isFavorite, std::string ad }); } -void VideoDetail::requestHighlightProgress(int cid) { +void VideoDetail::requestHighlightProgress(uint64_t cid) { brls::Logger::debug("请求高能进度条:cid: {}", cid); ASYNC_RETAIN BILI::get_highlight_progress( @@ -731,7 +731,7 @@ void VideoDetail::followUp(const std::string& mid, bool follow) { }); } -void VideoDetail::followSeason(size_t season, bool follow) { +void VideoDetail::followSeason(uint64_t season, bool follow) { std::string csrf = ProgramConfig::instance().getCSRF(); if (csrf.empty()) return; diff --git a/wiliwili/source/utils/activity_helper.cpp b/wiliwili/source/utils/activity_helper.cpp index eb4d90bb..c3a481cf 100644 --- a/wiliwili/source/utils/activity_helper.cpp +++ b/wiliwili/source/utils/activity_helper.cpp @@ -21,19 +21,19 @@ #include "presenter/video_detail.hpp" -void Intent::openBV(const std::string& bvid, int cid, int progress) { +void Intent::openBV(const std::string& bvid, uint64_t cid, int progress) { auto activity = new PlayerActivity(bvid, cid, progress); brls::Application::pushActivity(activity, brls::TransitionAnimation::NONE); registerFullscreen(activity); } -void Intent::openSeasonBySeasonId(int seasonId, int progress) { +void Intent::openSeasonBySeasonId(uint64_t seasonId, int progress) { auto activity = new PlayerSeasonActivity(seasonId, PGC_ID_TYPE::SEASON_ID, progress); brls::Application::pushActivity(activity, brls::TransitionAnimation::NONE); registerFullscreen(activity); } -void Intent::openSeasonByEpId(int epId, int progress) { +void Intent::openSeasonByEpId(uint64_t epId, int progress) { auto activity = new PlayerSeasonActivity(epId, PGC_ID_TYPE::EP_ID, progress); brls::Application::pushActivity(activity, brls::TransitionAnimation::NONE); registerFullscreen(activity); diff --git a/wiliwili/source/view/video_view.cpp b/wiliwili/source/view/video_view.cpp index eb3094ac..4f8fc8d8 100644 --- a/wiliwili/source/view/video_view.cpp +++ b/wiliwili/source/view/video_view.cpp @@ -1140,7 +1140,7 @@ void VideoView::showHint(const std::string& value) { void VideoView::clearHint() { this->hintBox->setVisibility(brls::Visibility::GONE); } -void VideoView::setBangumiCustomSetting(const std::string& title, unsigned int seasonId) { +void VideoView::setBangumiCustomSetting(const std::string& title, uint64_t seasonId) { this->bangumiTitle = title; this->bangumiSeasonId = seasonId; }