자잘한 에디터 버그 픽스

This commit is contained in:
2024-08-01 23:28:08 +09:00
parent 7501164625
commit 4e4856e961
7 changed files with 40 additions and 12 deletions

2
.vscode/launch.json vendored
View File

@@ -5,7 +5,7 @@
"name": "Debug",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/BumbleCee",
"program": "/home/happytanuki/BumbleCee/build/BumbleCee",
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],

BIN
live555-latest.tar.gz Normal file

Binary file not shown.

View File

@@ -6,14 +6,11 @@ commands::ICommand::ICommand(std::shared_ptr<dpp::cluster> botCluster)
}
std::shared_ptr<MusicQueue> commands::VCCommand::getQueue(const dpp::slashcommand_t& event) {
auto findResult = queueMap->find(event.command.guild_id);
if (findResult == queueMap->end())
{
FMusicQueueID queueID;
queueID.guild_id = event.command.guild_id;
queueID.shard_id = event.from->shard_id;
(*queueMap)[queueID.guild_id] = std::make_shared<MusicQueue>(queueID, botCluster);
}
return queueMap->find(event.command.guild_id)->second;
return queueMap->find(queueID.guild_id)->second;
}

View File

@@ -10,7 +10,7 @@ MusicQueue::MusicQueue(FMusicQueueID id, std::shared_ptr<dpp::cluster> botCluste
repeat = false;
this->botCluster = botCluster;
botCluster->on_voice_track_marker([this, botCluster](const dpp::voice_track_marker_t &marker)
botCluster->on_voice_track_marker([this](const dpp::voice_track_marker_t &marker)
{
std::cout << marker.track_meta << " Marker reached.\n";
@@ -18,6 +18,7 @@ MusicQueue::MusicQueue(FMusicQueueID id, std::shared_ptr<dpp::cluster> botCluste
{
std::cout << "Queue ended\n";
playMutex.unlock();
this->botCluster->get_shard(this->getId().shard_id)->disconnect_voice(this->getId().guild_id);
return;
}
@@ -111,12 +112,20 @@ FMusicQueueID MusicQueue::getId()
void MusicQueue::markerCallback()
{
if (!dpp::find_guild(id.guild_id)->voice_members.size())
{
std::cout << "voicechat is empty.";
playMutex.unlock();
return;
}
std::cout << "Music play started\n";
dpp::discord_client* joinedShard = botCluster->get_shard(id.shard_id);
if (!joinedShard)
{
std::cout << "No shard\n";
playMutex.unlock();
return;
}
@@ -133,6 +142,7 @@ void MusicQueue::markerCallback()
if (!v || !v->voiceclient || !v->voiceclient->is_ready())
{
std::cout << "not in voicechat. quit musicplay";
playMutex.unlock();
return;
}
@@ -186,6 +196,7 @@ void MusicQueue::markerCallback()
v->voiceclient->insert_marker(music.fileName + " end");
std::cout << "audio sending complete\n";
playMutex.unlock();
}
void MusicQueue::play()

File diff suppressed because one or more lines are too long

20
src/test.py Normal file
View File

@@ -0,0 +1,20 @@
import yt_dlp
import json
import sys
if len(sys.argv) != 2:
sys.exit()
ydl_opts = {
'quiet': True,
'clean_infojson': False,
'default_search': 'ytsearch',
'format': '251',
'outtmpl': {'default': 'Temp/%(id)s.temp'},
'overwrites': False,
'writeinfojson': True }
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
info = ydl.extract_info(sys.argv[1], download=False)
with open("out", "w") as f:
f.write(json.dumps(ydl.sanitize_info(info)))

Binary file not shown.