aboutsummaryrefslogtreecommitdiff
path: root/plugins/WatchProgress.hpp
blob: 48f549c07a8863462a31c7d21657512cdaff0289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#pragma once

#include <stdint.h>
#include <string>
#include <unordered_map>

namespace QuickMedia {
    enum class WatchedStatus {
        WATCHED,
        NOT_WATCHED
    };

    struct WatchProgress {
        int64_t time_pos_sec = 0;
        int64_t duration_sec = 0;
        time_t timestamp = 0;
        std::string thumbnail_url;

        double get_watch_ratio() const;
        bool has_finished_watching() const;
    };

    bool set_watch_progress_for_plugin(const char *plugin_name, const std::string &id, int64_t time_pos_sec, int64_t duration_sec, const std::string &thumbnail_url);
    std::unordered_map<std::string, WatchProgress> get_watch_progress_for_plugin(const char *plugin_name);
    bool toggle_watched_for_plugin_save_to_file(const char *plugin_name, const std::string &id, int64_t duration_sec, const std::string &thumbnail_url, WatchedStatus &watched_status);
}