add item types enum
This commit is contained in:
parent
8ea69d5453
commit
b18698604b
3 changed files with 22 additions and 4 deletions
|
|
@ -11,7 +11,9 @@ tokio = { version = "1.20.0", features = ["macros", "rt-multi-thread"] }
|
||||||
futures = "0.3.21"
|
futures = "0.3.21"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0.82"
|
serde_json = "1.0.82"
|
||||||
serde_with = { version = "3.0.0", default-features = false, features = ["macros"] }
|
serde_with = { version = "3.0.0", default-features = false, features = [
|
||||||
|
"macros",
|
||||||
|
] }
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
log = "0.4.17"
|
log = "0.4.17"
|
||||||
env_logger = "0.10.0"
|
env_logger = "0.10.0"
|
||||||
|
|
@ -24,3 +26,4 @@ num_enum = "0.6.1"
|
||||||
path_macro = "1.0.0"
|
path_macro = "1.0.0"
|
||||||
intl_pluralrules = "7.0.2"
|
intl_pluralrules = "7.0.2"
|
||||||
unic-langid = "0.9.1"
|
unic-langid = "0.9.1"
|
||||||
|
ordered_hash_map = { version = "0.2.0", features = ["serde"] }
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use futures::{stream, StreamExt};
|
use futures::{stream, StreamExt};
|
||||||
|
use ordered_hash_map::OrderedHashMap;
|
||||||
use path_macro::path;
|
use path_macro::path;
|
||||||
use rustypipe::{
|
use rustypipe::{
|
||||||
client::RustyPipe,
|
client::RustyPipe,
|
||||||
|
|
@ -170,7 +171,7 @@ pub fn write_samples_to_dict() {
|
||||||
dict_entry.months = BTreeMap::new();
|
dict_entry.months = BTreeMap::new();
|
||||||
|
|
||||||
if collect_nd_tokens {
|
if collect_nd_tokens {
|
||||||
dict_entry.timeago_nd_tokens = BTreeMap::new();
|
dict_entry.timeago_nd_tokens = OrderedHashMap::new();
|
||||||
}
|
}
|
||||||
|
|
||||||
for datestr_table in &datestr_tables {
|
for datestr_table in &datestr_tables {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
|
use ordered_hash_map::OrderedHashMap;
|
||||||
use rustypipe::{client::YTContext, model::AlbumType, param::Language};
|
use rustypipe::{client::YTContext, model::AlbumType, param::Language};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::{serde_as, DefaultOnError, VecSkipError};
|
use serde_with::{serde_as, DefaultOnError, VecSkipError};
|
||||||
|
|
@ -18,7 +19,7 @@ pub struct DictEntry {
|
||||||
///
|
///
|
||||||
/// Identifiers: `Y`(ear), `M`(month), `W`(eek), `D`(ay),
|
/// Identifiers: `Y`(ear), `M`(month), `W`(eek), `D`(ay),
|
||||||
/// `h`(our), `m`(inute), `s`(econd)
|
/// `h`(our), `m`(inute), `s`(econd)
|
||||||
pub timeago_tokens: BTreeMap<String, String>,
|
pub timeago_tokens: OrderedHashMap<String, String>,
|
||||||
/// Order in which to parse numeric date components. Formatted as
|
/// Order in which to parse numeric date components. Formatted as
|
||||||
/// a string of date identifiers (Y, M, D).
|
/// a string of date identifiers (Y, M, D).
|
||||||
///
|
///
|
||||||
|
|
@ -34,7 +35,7 @@ pub struct DictEntry {
|
||||||
/// Tokens for parsing date strings with no digits (e.g. Today, Tomorrow)
|
/// Tokens for parsing date strings with no digits (e.g. Today, Tomorrow)
|
||||||
///
|
///
|
||||||
/// Format: Parsed token -> \[Quantity\] Identifier
|
/// Format: Parsed token -> \[Quantity\] Identifier
|
||||||
pub timeago_nd_tokens: BTreeMap<String, String>,
|
pub timeago_nd_tokens: OrderedHashMap<String, String>,
|
||||||
/// Are commas (instead of points) used as decimal separators?
|
/// Are commas (instead of points) used as decimal separators?
|
||||||
pub comma_decimal: bool,
|
pub comma_decimal: bool,
|
||||||
/// Tokens for parsing decimal prefixes (K, M, B, ...)
|
/// Tokens for parsing decimal prefixes (K, M, B, ...)
|
||||||
|
|
@ -49,6 +50,10 @@ pub struct DictEntry {
|
||||||
///
|
///
|
||||||
/// Format: Parsed text -> Album type
|
/// Format: Parsed text -> Album type
|
||||||
pub album_types: BTreeMap<String, AlbumType>,
|
pub album_types: BTreeMap<String, AlbumType>,
|
||||||
|
/// Names of item types (Song, Video, Artist, Playlist)
|
||||||
|
///
|
||||||
|
/// Format: Parsed text -> Item type
|
||||||
|
pub item_types: BTreeMap<String, ExtItemType>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parsed TimeAgo string, contains amount and time unit.
|
/// Parsed TimeAgo string, contains amount and time unit.
|
||||||
|
|
@ -99,6 +104,15 @@ impl TimeUnit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
pub enum ExtItemType {
|
||||||
|
Track,
|
||||||
|
Video,
|
||||||
|
Episode,
|
||||||
|
Playlist,
|
||||||
|
Artist,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct QBrowse<'a> {
|
pub struct QBrowse<'a> {
|
||||||
|
|
|
||||||
Reference in a new issue