forked from Paremo/foo_bbookmark
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbookmark_types.h
More file actions
108 lines (88 loc) · 2.24 KB
/
Copy pathbookmark_types.h
File metadata and controls
108 lines (88 loc) · 2.24 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#pragma once
#include <guiddef.h>
#include "pfc/int_types.h"
#include "pfc/string-lite.h"
#define DATE_BUFFER_SIZE 255
#define LOC_RETRIES 2
inline static const int kUI_CONF_VER = 2;
inline constexpr double KMin_Lapse = 2.0;
struct bookmark_t {
private:
double time = 0.0;
pfc::string8 name;
public:
bit_array_bittable sel_mask;
GUID guid_bm = pfc::guid_null;
pfc::string8 path;
pfc::string8 desc;
pfc::string8 comment;
pfc::string8 date;
pfc::string8 runtime_date;
t_uint32 subsong = 0;
bool need_playlist = true;
t_uint32 need_loc_retries = 0;
bool dyna = false;
pfc::string8 playlist;
GUID guid_playlist = pfc::guid_null;
void set_rt_time(double t) {
t = (std::max)(0.0, t);
time = t < KMin_Lapse ? 0.0 : t;
}
void set_time(double t) {
t = (std::max)(0.0, t);
time = t < KMin_Lapse ? 0.0 : t;
}
void set_exact_time(double t) {
t = (std::max)(0.0, t);
time = t;
}
const double get_time() const {
return time;
}
const pfc::string8 get_name(bool or_desc) const {
return name.get_length() ? name : or_desc ? desc : "";
}
void set_name(pfc::string8 aname) {
name = aname;
}
bool isRadio() const {
return isRadio(path);
}
//todo
bool isRadio(const pfc::string8 path) const {
return path.startsWith("https://");
}
void reset() {
*this = bookmark_t();
this->guid_bm = pfc::createGUID();
}
void swap(bookmark_t& other)
{
bookmark_t tmp = other;
other.guid_bm = this->guid_bm;
other.comment.move(this->comment);
other.playlist.move(this->playlist);
other.guid_playlist = this->guid_playlist;
other.date.move(this->date);
other.runtime_date.move(this->runtime_date);
other.name.move(this->name);
other.desc.move(this->desc);
other.path.move(this->path);
other.subsong = this->subsong;
other.time = this->time;
guid_bm = tmp.guid_bm;
comment.move(tmp.comment);
playlist.move(tmp.playlist);
guid_playlist = tmp.guid_playlist;
date.move(tmp.date);
runtime_date.move(tmp.runtime_date);
name.move(tmp.name);
desc.move(tmp.desc);
path.move(tmp.path);
subsong = tmp.subsong;
time = tmp.time;
}
};
extern void unix_str_date_to_time(pfc::string8 unix_date, time_t& out_rawtime, tm& out_tm);
extern int get_month_index(std::string name);
extern int get_wday_index(std::string name);