Skip to content
This repository was archived by the owner on Feb 19, 2026. It is now read-only.

Commit 31604e3

Browse files
committed
add(bms_event): more event
1 parent 7195c6c commit 31604e3

File tree

1 file changed

+28
-72
lines changed

1 file changed

+28
-72
lines changed

cli/src/options/bms_event.rs

Lines changed: 28 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,48 @@ use smol::process::Command;
77
#[derive(Debug, Clone, Copy, clap::ValueEnum)]
88
#[repr(u32)]
99
pub enum BMSEvent {
10+
BOFNT = 19,
1011
BOFTT = 20,
12+
LetsBMSEdit = 101,
13+
LetsBMSEdit2 = 102,
1114
LetsBMSEdit3 = 103,
15+
LetsBMSEdit4 = 104,
1216
}
1317

1418
impl BMSEvent {
1519
/// Event list page
1620
pub fn list_url(&self) -> &'static str {
1721
match self {
22+
BMSEvent::BOFNT => "https://manbow.nothing.sh/event/event.cgi?action=sp&event=142",
1823
BMSEvent::BOFTT => "https://manbow.nothing.sh/event/event.cgi?action=sp&event=146",
24+
BMSEvent::LetsBMSEdit => "https://venue.bmssearch.net/letsbmsedit",
25+
BMSEvent::LetsBMSEdit2 => "https://venue.bmssearch.net/letsbmsedit2",
1926
BMSEvent::LetsBMSEdit3 => "https://venue.bmssearch.net/letsbmsedit3",
27+
BMSEvent::LetsBMSEdit4 => "https://venue.bmssearch.net/letsbmsedit4",
2028
}
2129
}
2230

2331
/// Event work details page
2432
pub fn work_info_url(&self, work_num: u32) -> String {
2533
match self {
34+
BMSEvent::BOFNT => format!(
35+
"https://manbow.nothing.sh/event/event.cgi?action=More_def&num={work_num}&event=142",
36+
),
2637
BMSEvent::BOFTT => format!(
2738
"https://manbow.nothing.sh/event/event.cgi?action=More_def&num={work_num}&event=146",
2839
),
40+
BMSEvent::LetsBMSEdit => {
41+
format!("https://venue.bmssearch.net/letsbmsedit/{work_num}")
42+
}
43+
BMSEvent::LetsBMSEdit2 => {
44+
format!("https://venue.bmssearch.net/letsbmsedit2/{work_num}")
45+
}
2946
BMSEvent::LetsBMSEdit3 => {
3047
format!("https://venue.bmssearch.net/letsbmsedit3/{work_num}")
3148
}
49+
BMSEvent::LetsBMSEdit4 => {
50+
format!("https://venue.bmssearch.net/letsbmsedit4/{work_num}")
51+
}
3252
}
3353
}
3454
}
@@ -39,8 +59,12 @@ impl fmt::Display for BMSEvent {
3959
f,
4060
"{}",
4161
match self {
62+
BMSEvent::BOFNT => "BOFNT",
4263
BMSEvent::BOFTT => "BOFTT",
64+
BMSEvent::LetsBMSEdit => "LetsBMSEdit",
65+
BMSEvent::LetsBMSEdit2 => "LetsBMSEdit2",
4366
BMSEvent::LetsBMSEdit3 => "LetsBMSEdit3",
67+
BMSEvent::LetsBMSEdit4 => "LetsBMSEdit4",
4468
}
4569
)
4670
}
@@ -51,8 +75,12 @@ impl FromStr for BMSEvent {
5175

5276
fn from_str(s: &str) -> Result<Self, Self::Err> {
5377
match s.trim() {
78+
"19" | "BOFNT" => Ok(BMSEvent::BOFNT),
5479
"20" | "BOFTT" => Ok(BMSEvent::BOFTT),
80+
"101" | "LetsBMSEdit" => Ok(BMSEvent::LetsBMSEdit),
81+
"102" | "LetsBMSEdit2" => Ok(BMSEvent::LetsBMSEdit2),
5582
"103" | "LetsBMSEdit3" => Ok(BMSEvent::LetsBMSEdit3),
83+
"104" | "LetsBMSEdit4" => Ok(BMSEvent::LetsBMSEdit4),
5684
_ => Err(()),
5785
}
5886
}
@@ -79,78 +107,6 @@ pub async fn open_browser(url: &str) -> io::Result<()> {
79107
Ok(())
80108
}
81109

82-
/// Interactive BMS event browser (legacy function)
83-
pub async fn activate() {
84-
log::info!("Select BMS Event:");
85-
for event in [BMSEvent::BOFTT, BMSEvent::LetsBMSEdit3] {
86-
log::info!(" {} -> {}", event as u32, event);
87-
}
88-
89-
log::info!("Input event value (Default: 20): ");
90-
io::stdout().flush().unwrap();
91-
let mut buf = String::new();
92-
io::stdin().read_line(&mut buf).unwrap();
93-
let event = if buf.trim().is_empty() {
94-
BMSEvent::BOFTT
95-
} else {
96-
BMSEvent::from_str(&buf).unwrap_or(BMSEvent::BOFTT)
97-
};
98-
log::info!(" -> Selected Event: {event}");
99-
100-
log::info!(" !: Input \"1\": jump to work id 1. (Normal)");
101-
log::info!(" !: Input \"2 5\": jump to work id 2, 3, 4 and 5. (Special: Range)");
102-
log::info!(" !: Input \"2 5 6\": jump to work id 2, 5 and 6. (Normal)");
103-
log::info!(" !: Press Ctrl+C to Quit.");
104-
log::info!("Input id (default: Jump to List):");
105-
106-
loop {
107-
let mut line = String::new();
108-
io::stdin().read_line(&mut line).unwrap();
109-
let line = line.trim();
110-
if line.is_empty() {
111-
log::info!("Open BMS List.");
112-
open_browser(event.list_url()).await.ok();
113-
continue;
114-
}
115-
116-
// Parse input
117-
let parts: Vec<&str> = line
118-
.split_whitespace()
119-
.flat_map(|s| s.split(','))
120-
.filter(|s| !s.is_empty())
121-
.collect();
122-
123-
let nums: Result<Vec<u32>, _> = parts.iter().map(|s| s.parse::<u32>()).collect();
124-
125-
let Ok(nums) = nums else {
126-
log::info!("Please input valid number.");
127-
return;
128-
};
129-
match nums.len() {
130-
0 => continue,
131-
1 => {
132-
let id = nums[0];
133-
log::info!("Open no.{id}");
134-
open_browser(&event.work_info_url(id)).await.ok();
135-
}
136-
2 => {
137-
let (mut start, mut end) = (nums[0], nums[1]);
138-
if start > end {
139-
std::mem::swap(&mut start, &mut end);
140-
}
141-
for id in start..=end {
142-
open_browser(&event.work_info_url(id)).await.ok();
143-
}
144-
}
145-
_ => {
146-
for &id in &nums {
147-
open_browser(&event.work_info_url(id)).await.ok();
148-
}
149-
}
150-
}
151-
}
152-
}
153-
154110
/// Open BMS event list page
155111
pub async fn open_event_list(event: BMSEvent) -> io::Result<()> {
156112
log::info!("Opening BMS event list: {}", event);

0 commit comments

Comments
 (0)