mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-09 10:44:32 +08:00
Compare commits
90 Commits
clippy
...
visual-sty
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
669f3b7945 | ||
|
|
63122e1a33 | ||
|
|
c9b1afb154 | ||
|
|
6e3bd3fbed | ||
|
|
42592dd550 | ||
|
|
b2f7d72a33 | ||
|
|
2e0ce18c84 | ||
|
|
2a9a4a9263 | ||
|
|
e63fb10fdb | ||
|
|
b54941928d | ||
|
|
b85b8ffacf | ||
|
|
3ff2e9b26a | ||
|
|
4b3ffc722a | ||
|
|
5f49066829 | ||
|
|
ab2eb218d5 | ||
|
|
6212b174e9 | ||
|
|
a8a6e5708a | ||
|
|
54b060f178 | ||
|
|
8266386cd0 | ||
|
|
8bbe87ee22 | ||
|
|
d35ac0c145 | ||
|
|
a134ae1e29 | ||
|
|
6a69759b9e | ||
|
|
b9063e2966 | ||
|
|
4397a4387a | ||
|
|
32dc384524 | ||
|
|
68fa239b97 | ||
|
|
c8367fbc25 | ||
|
|
76fc4514e1 | ||
|
|
073ce2b4df | ||
|
|
5d516ba89f | ||
|
|
e819a0dcb1 | ||
|
|
ba4b583e6e | ||
|
|
5954354356 | ||
|
|
23ff232333 | ||
|
|
0bb47fcfa9 | ||
|
|
99a5682371 | ||
|
|
22ca343050 | ||
|
|
0049d20151 | ||
|
|
b9f8f4e8ac | ||
|
|
26564dd42f | ||
|
|
ec440e4568 | ||
|
|
69817f887b | ||
|
|
df21208b7c | ||
|
|
660c994c5e | ||
|
|
904cc796b0 | ||
|
|
1a9a1e1b8a | ||
|
|
2ae7078c0f | ||
|
|
0fde830a30 | ||
|
|
7c744a42e5 | ||
|
|
90cc169dec | ||
|
|
36c1e11a9e | ||
|
|
5e26a99337 | ||
|
|
53683cf90b | ||
|
|
95dcc23887 | ||
|
|
cef3163c7c | ||
|
|
cbc34dd1f6 | ||
|
|
fbd1f6bad1 | ||
|
|
f2ddf9abba | ||
|
|
8a5eaf5ba6 | ||
|
|
ddb377ac5b | ||
|
|
512a01d28c | ||
|
|
b30e275169 | ||
|
|
ee9fe5c9ed | ||
|
|
e672a352d3 | ||
|
|
361d107040 | ||
|
|
36eb047cd3 | ||
|
|
218c6172e6 | ||
|
|
8f35e4fc3c | ||
|
|
c965df39d6 | ||
|
|
53ef69f3c3 | ||
|
|
ea9ca18c8b | ||
|
|
225858261e | ||
|
|
43de43b34a | ||
|
|
96ddbe35a1 | ||
|
|
7d547ad533 | ||
|
|
13de58b845 | ||
|
|
3d8c563a4b | ||
|
|
bc75199d5a | ||
|
|
ba6e18ed91 | ||
|
|
74dbcd699b | ||
|
|
35c6af0190 | ||
|
|
827de88c8b | ||
|
|
54ca4b537d | ||
|
|
c61f327076 | ||
|
|
d569913e5a | ||
|
|
418c93be06 | ||
|
|
5acc040a89 | ||
|
|
e45b17c230 | ||
|
|
b14b6246d7 |
@@ -74,7 +74,7 @@ jobs:
|
||||
env:
|
||||
GIT_SSH_COMMAND: 'ssh -o UserKnownHostsFile=~/.ssh/known_hosts'
|
||||
run: |
|
||||
git clone --depth 1 --filter=tree:0 --sparse git@gitlab.com:sunnypilot/public/${{ vars.MODELS_GITLAB }} gitlab_docs
|
||||
git clone --depth 1 --filter=tree:0 --sparse git@gitlab.com:sunnypilot/public/docs.sunnypilot.ai2.git gitlab_docs
|
||||
cd gitlab_docs
|
||||
git checkout main
|
||||
git sparse-checkout set --no-cone models/
|
||||
@@ -191,7 +191,7 @@ jobs:
|
||||
GIT_SSH_COMMAND: 'ssh -o UserKnownHostsFile=~/.ssh/known_hosts'
|
||||
run: |
|
||||
echo "Cloning GitLab"
|
||||
git clone --depth 1 --filter=tree:0 --sparse git@gitlab.com:sunnypilot/public/${{ vars.MODELS_GITLAB }} gitlab_docs
|
||||
git clone --depth 1 --filter=tree:0 --sparse git@gitlab.com:sunnypilot/public/docs.sunnypilot.ai2.git gitlab_docs
|
||||
cd gitlab_docs
|
||||
echo "checkout models/${RECOMPILED_DIR}"
|
||||
git sparse-checkout set --no-cone models/${RECOMPILED_DIR}
|
||||
|
||||
@@ -109,7 +109,7 @@ jobs:
|
||||
GIT_SSH_COMMAND: 'ssh -o UserKnownHostsFile=~/.ssh/known_hosts'
|
||||
run: |
|
||||
echo "Cloning GitLab"
|
||||
git clone --depth 1 --filter=tree:0 --sparse git@gitlab.com:sunnypilot/public/${{ vars.MODELS_GITLAB }} gitlab_docs
|
||||
git clone --depth 1 --filter=tree:0 --sparse git@gitlab.com:sunnypilot/public/docs.sunnypilot.ai2.git gitlab_docs
|
||||
cd gitlab_docs
|
||||
echo "checkout models/${RECOMPILED_DIR}"
|
||||
git sparse-checkout set --no-cone models/${RECOMPILED_DIR}
|
||||
|
||||
@@ -156,8 +156,6 @@ jobs:
|
||||
with:
|
||||
name: models-${{ env.REF }}${{ inputs.artifact_suffix }}
|
||||
path: ${{ github.workspace }}/selfdrive/modeld/models
|
||||
- run: |
|
||||
rm -f ${{ github.workspace }}/selfdrive/modeld/models/{dmonitoring_model,big_driving_policy,big_driving_vision}.onnx
|
||||
|
||||
- name: Build Model
|
||||
run: |
|
||||
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -109,7 +109,3 @@ Pipfile
|
||||
!.idea/customTargets.xml
|
||||
!.idea/tools/*
|
||||
!.run/*
|
||||
|
||||
### clippy ###
|
||||
clippy_stats.json
|
||||
clippy.log
|
||||
|
||||
@@ -172,6 +172,14 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
{"ShowTurnSignals", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"StandstillTimer", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"TrueVEgoUI", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"VisualRadarTracks", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"VisualRadarTracksDelay", {PERSISTENT | BACKUP, FLOAT, "0.0"}},
|
||||
{"VisualWideCam", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"VisualStyle", {PERSISTENT | BACKUP, INT, "0"}},
|
||||
{"VisualStyleZoom", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"VisualStyleOverhead", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"VisualStyleOverheadZoom", {PERSISTENT | BACKUP, BOOL, "0"}},
|
||||
{"VisualStyleOverheadThreshold", {PERSISTENT | BACKUP, INT, "20"}},
|
||||
|
||||
// MADS params
|
||||
{"Mads", {PERSISTENT | BACKUP, BOOL, "1"}},
|
||||
|
||||
@@ -73,10 +73,6 @@ dependencies = [
|
||||
|
||||
# ui
|
||||
"qrcode",
|
||||
|
||||
# clippy
|
||||
"discord-py",
|
||||
"flask",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
|
||||
@@ -25,6 +25,11 @@ void AnnotatedCameraWidget::updateState(const UIState &s) {
|
||||
// update engageability/experimental mode button
|
||||
experimental_btn->updateState(s);
|
||||
dmon.updateState(s);
|
||||
if (s.scene.visual_style == 0) {
|
||||
setBackgroundColor(bg_colors[STATUS_DISENGAGED]);
|
||||
} else {
|
||||
setBackgroundColor(QColor(0, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
void AnnotatedCameraWidget::initializeGL() {
|
||||
@@ -35,7 +40,12 @@ void AnnotatedCameraWidget::initializeGL() {
|
||||
qInfo() << "OpenGL language version:" << QString((const char*)glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||
|
||||
prev_draw_t = millis_since_boot();
|
||||
setBackgroundColor(bg_colors[STATUS_DISENGAGED]);
|
||||
auto *s = uiState();
|
||||
if (s->scene.visual_style == 0) {
|
||||
setBackgroundColor(bg_colors[STATUS_DISENGAGED]);
|
||||
} else {
|
||||
setBackgroundColor(QColor(0, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
mat4 AnnotatedCameraWidget::calcFrameMatrix() {
|
||||
@@ -118,7 +128,13 @@ void AnnotatedCameraWidget::paintGL() {
|
||||
} else if (v_ego > 15) {
|
||||
wide_cam_requested = false;
|
||||
}
|
||||
// wide_cam_requested = wide_cam_requested && sm["selfdriveState"].getSelfdriveState().getExperimentalMode();
|
||||
if (s->scene.visual_wide_cam == 1) {
|
||||
wide_cam_requested = true;
|
||||
} else if (s->scene.visual_wide_cam == 2) {
|
||||
wide_cam_requested = false;
|
||||
} else {
|
||||
wide_cam_requested = wide_cam_requested && sm["selfdriveState"].getSelfdriveState().getExperimentalMode();
|
||||
}
|
||||
}
|
||||
CameraWidget::setStreamType(wide_cam_requested ? VISION_STREAM_WIDE_ROAD : VISION_STREAM_ROAD);
|
||||
CameraWidget::setFrameId(sm["modelV2"].getModelV2().getFrameId());
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "selfdrive/ui/qt/onroad/model.h"
|
||||
#include <algorithm>
|
||||
|
||||
void ModelRenderer::draw(QPainter &painter, const QRect &surface_rect) {
|
||||
auto *s = uiState();
|
||||
@@ -49,8 +50,14 @@ void ModelRenderer::update_leads(const cereal::RadarState::Reader &radar_state,
|
||||
}
|
||||
|
||||
void ModelRenderer::update_model(const cereal::ModelDataV2::Reader &model, const cereal::RadarState::LeadData::Reader &lead) {
|
||||
auto *s = uiState();
|
||||
const auto &model_position = model.getPosition();
|
||||
float max_distance = std::clamp(*(model_position.getX().end() - 1), MIN_DRAW_DISTANCE, MAX_DRAW_DISTANCE);
|
||||
float max_distance;
|
||||
if (s->scene.visual_style == 0) {
|
||||
max_distance = std::clamp(*(model_position.getX().end() - 1), MIN_DRAW_DISTANCE, MAX_DRAW_DISTANCE);
|
||||
} else {
|
||||
max_distance = std::clamp(*(model_position.getX().end() - 1), MIN_DRAW_DISTANCE, MAX_DRAW_DISTANCE);
|
||||
}
|
||||
|
||||
// update lane lines
|
||||
const auto &lane_lines = model.getLaneLines();
|
||||
@@ -58,7 +65,11 @@ void ModelRenderer::update_model(const cereal::ModelDataV2::Reader &model, const
|
||||
int max_idx = get_path_length_idx(lane_lines[0], max_distance);
|
||||
for (int i = 0; i < std::size(lane_line_vertices); i++) {
|
||||
lane_line_probs[i] = line_probs[i];
|
||||
mapLineToPolygon(lane_lines[i], 0.025 * lane_line_probs[i], 0, &lane_line_vertices[i], max_idx);
|
||||
if (s->scene.visual_style == 2) {
|
||||
mapLineToPolygon(lane_lines[i], 0.075 * lane_line_probs[i], 0, &lane_line_vertices[i], max_idx);
|
||||
} else {
|
||||
mapLineToPolygon(lane_lines[i], 0.025 * lane_line_probs[i], 0, &lane_line_vertices[i], max_idx);
|
||||
}
|
||||
}
|
||||
|
||||
// update road edges
|
||||
@@ -66,7 +77,11 @@ void ModelRenderer::update_model(const cereal::ModelDataV2::Reader &model, const
|
||||
const auto &edge_stds = model.getRoadEdgeStds();
|
||||
for (int i = 0; i < std::size(road_edge_vertices); i++) {
|
||||
road_edge_stds[i] = edge_stds[i];
|
||||
mapLineToPolygon(road_edges[i], 0.025, 0, &road_edge_vertices[i], max_idx);
|
||||
if (s->scene.visual_style == 2) {
|
||||
mapLineToPolygon(road_edges[i], 0.1, 0, &road_edge_vertices[i], max_idx);
|
||||
} else {
|
||||
mapLineToPolygon(road_edges[i], 0.025, 0, &road_edge_vertices[i], max_idx);
|
||||
}
|
||||
}
|
||||
|
||||
// update path
|
||||
@@ -79,16 +94,112 @@ void ModelRenderer::update_model(const cereal::ModelDataV2::Reader &model, const
|
||||
}
|
||||
|
||||
void ModelRenderer::drawLaneLines(QPainter &painter) {
|
||||
// lanelines
|
||||
for (int i = 0; i < std::size(lane_line_vertices); ++i) {
|
||||
painter.setBrush(QColor::fromRgbF(1.0, 1.0, 1.0, std::clamp<float>(lane_line_probs[i], 0.0, 0.7)));
|
||||
painter.drawPolygon(lane_line_vertices[i]);
|
||||
}
|
||||
auto *s = uiState();
|
||||
if (s->scene.visual_style == 2) {
|
||||
QRectF r = clip_region;
|
||||
|
||||
// road edges
|
||||
for (int i = 0; i < std::size(road_edge_vertices); ++i) {
|
||||
painter.setBrush(QColor::fromRgbF(1.0, 0, 0, std::clamp<float>(1.0 - road_edge_stds[i], 0.0, 1.0)));
|
||||
painter.drawPolygon(road_edge_vertices[i]);
|
||||
qreal horizonY = r.bottom();
|
||||
if (!road_edge_vertices[0].isEmpty() || !road_edge_vertices[1].isEmpty()) {
|
||||
qreal leftH = r.top();
|
||||
qreal rightH = r.top();
|
||||
|
||||
if (!road_edge_vertices[0].isEmpty()) {
|
||||
leftH = std::numeric_limits<qreal>::max();
|
||||
for (const QPointF &pt : road_edge_vertices[0]) {
|
||||
if (pt.y() < leftH) leftH = pt.y();
|
||||
}
|
||||
}
|
||||
|
||||
if (!road_edge_vertices[1].isEmpty()) {
|
||||
rightH = std::numeric_limits<qreal>::max();
|
||||
for (const QPointF &pt : road_edge_vertices[1]) {
|
||||
if (pt.y() < rightH) rightH = pt.y();
|
||||
}
|
||||
}
|
||||
|
||||
horizonY = std::max(leftH, rightH);
|
||||
}
|
||||
|
||||
painter.fillRect(QRectF(r.left(), horizonY + 0, r.width(), r.bottom() - (horizonY + 0)), QColor("#111111"));
|
||||
|
||||
auto buildFill = [&](const QPolygonF &edgeRibbon, bool isLeftSide) -> QPolygonF {
|
||||
if (edgeRibbon.isEmpty()) return {};
|
||||
|
||||
QMap<int, QPointF> byY;
|
||||
for (const QPointF &pt : edgeRibbon) {
|
||||
int yi = int(std::round(pt.y()));
|
||||
if (!byY.contains(yi)) {
|
||||
byY[yi] = pt;
|
||||
} else {
|
||||
if (isLeftSide) {
|
||||
if (pt.x() > byY[yi].x()) byY[yi] = pt;
|
||||
} else {
|
||||
if (pt.x() < byY[yi].x()) byY[yi] = pt;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (byY.isEmpty()) return {};
|
||||
|
||||
QPolygonF curve;
|
||||
for (auto it = byY.cbegin(); it != byY.cend(); ++it) {
|
||||
curve << it.value();
|
||||
}
|
||||
if (curve.size() < 2) return {};
|
||||
|
||||
const qreal topY = curve.first().y();
|
||||
QPolygonF fill;
|
||||
if (isLeftSide) {
|
||||
fill << QPointF(r.left(), topY);
|
||||
for (const QPointF &pt : curve) fill << pt;
|
||||
fill << QPointF(r.left(), r.bottom());
|
||||
} else {
|
||||
fill << QPointF(r.right(), topY);
|
||||
for (const QPointF &pt : curve) fill << pt;
|
||||
fill << QPointF(r.right(), r.bottom());
|
||||
}
|
||||
return fill;
|
||||
};
|
||||
|
||||
QPolygonF leftFill = buildFill(road_edge_vertices[0], true);
|
||||
QPolygonF rightFill = buildFill(road_edge_vertices[1], false);
|
||||
|
||||
if (!leftFill.isEmpty()) {
|
||||
painter.setBrush(QColor("#222222"));
|
||||
painter.drawPolygon(leftFill);
|
||||
}
|
||||
if (!rightFill.isEmpty()) {
|
||||
painter.setBrush(QColor("#222222"));
|
||||
painter.drawPolygon(rightFill);
|
||||
}
|
||||
|
||||
for (int i = 0; i < std::size(lane_line_vertices); ++i) {
|
||||
painter.setBrush(QColor::fromRgbF(0.902, 0.902, 0.902, std::clamp<float>(lane_line_probs[i], 0.0, 0.7)));
|
||||
painter.drawPolygon(lane_line_vertices[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < std::size(road_edge_vertices); ++i) {
|
||||
painter.setBrush(QColor(0x55, 0x55, 0x55, 255));
|
||||
painter.drawPolygon(road_edge_vertices[i]);
|
||||
}
|
||||
|
||||
QLinearGradient bgGrad(r.left(), horizonY - 100, r.left(), horizonY + 100);
|
||||
bgGrad.setColorAt(0.0, QColor("#000000"));
|
||||
bgGrad.setColorAt(0.5, QColor("#111111"));
|
||||
bgGrad.setColorAt(1.0, QColor("#111111"));
|
||||
painter.fillRect(QRectF(r.left(), horizonY - 200, r.width(), 200), bgGrad);
|
||||
|
||||
} else {
|
||||
// lanelines
|
||||
for (int i = 0; i < std::size(lane_line_vertices); ++i) {
|
||||
painter.setBrush(QColor::fromRgbF(1.0, 1.0, 1.0, std::clamp<float>(lane_line_probs[i], 0.0, 0.7)));
|
||||
painter.drawPolygon(lane_line_vertices[i]);
|
||||
}
|
||||
|
||||
// road edges
|
||||
for (int i = 0; i < std::size(road_edge_vertices); ++i) {
|
||||
painter.setBrush(QColor::fromRgbF(1.0, 0, 0, std::clamp<float>(1.0 - road_edge_stds[i], 0.0, 1.0)));
|
||||
painter.drawPolygon(road_edge_vertices[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,6 +286,7 @@ QColor ModelRenderer::blendColors(const QColor &start, const QColor &end, float
|
||||
|
||||
void ModelRenderer::drawLead(QPainter &painter, const cereal::RadarState::LeadData::Reader &lead_data,
|
||||
const QPointF &vd, const QRect &surface_rect) {
|
||||
auto *s = uiState();
|
||||
const float speedBuff = 10.;
|
||||
const float leadBuff = 40.;
|
||||
const float d_rel = lead_data.getDRel();
|
||||
@@ -197,20 +309,133 @@ void ModelRenderer::drawLead(QPainter &painter, const cereal::RadarState::LeadDa
|
||||
float g_yo = sz / 10;
|
||||
|
||||
QPointF glow[] = {{x + (sz * 1.35) + g_xo, y + sz + g_yo}, {x, y - g_yo}, {x - (sz * 1.35) - g_xo, y + sz + g_yo}};
|
||||
painter.setBrush(QColor(218, 202, 37, 255));
|
||||
if (s->scene.visual_style == 2) {
|
||||
painter.setBrush(QColor(0xE6, 0xE6, 0xE6, 255));
|
||||
} else {
|
||||
painter.setBrush(QColor(218, 202, 37, 255));
|
||||
}
|
||||
painter.drawPolygon(glow, std::size(glow));
|
||||
|
||||
// chevron
|
||||
QPointF chevron[] = {{x + (sz * 1.25), y + sz}, {x, y}, {x - (sz * 1.25), y + sz}};
|
||||
painter.setBrush(QColor(201, 34, 49, fillAlpha));
|
||||
if (s->scene.visual_style == 2) {
|
||||
painter.setBrush(QColor(0, 0, 0, fillAlpha));
|
||||
} else {
|
||||
painter.setBrush(QColor(201, 34, 49, fillAlpha));
|
||||
}
|
||||
painter.drawPolygon(chevron, std::size(chevron));
|
||||
}
|
||||
|
||||
// Projects a point in car to space to the corresponding point in full frame image space.
|
||||
float mapRange(float x, float in_min, float in_max, float out_min, float out_max) {
|
||||
if (in_min < in_max) {
|
||||
x = std::clamp(x, in_min, in_max);
|
||||
} else {
|
||||
x = std::clamp(x, in_max, in_min);
|
||||
}
|
||||
return out_min + (x - in_min) * (out_max - out_min) / (in_max - in_min);
|
||||
}
|
||||
|
||||
// Projects a point in car space to the corresponding point in full frame image space.
|
||||
bool ModelRenderer::mapToScreen(float in_x, float in_y, float in_z, QPointF *out) {
|
||||
auto *s = uiState();
|
||||
auto &sm = *(s->sm);
|
||||
float blend_speed_mph = fabsf(sm["carState"].getCarState().getVEgo() * 2.23694f);
|
||||
|
||||
Eigen::Vector3f input(in_x, in_y, in_z);
|
||||
|
||||
if ((s->scene.visual_style_zoom == 1 || s->scene.visual_style_zoom == 2) && s->scene.visual_style != 0) {
|
||||
float zoom_start = 20.0f;
|
||||
float zoom_end = 50.0f;
|
||||
|
||||
if (s->scene.visual_style_zoom == 2) {
|
||||
std::swap(zoom_start, zoom_end);
|
||||
}
|
||||
|
||||
float IN_X_OFFSET = mapRange(blend_speed_mph, zoom_start, zoom_end, 0.0f, 24.0f);
|
||||
float IN_Y_OFFSET = mapRange(blend_speed_mph, zoom_start, zoom_end, 1.0f, 2.0f);
|
||||
float IN_Z_OFFSET = mapRange(blend_speed_mph, zoom_start, zoom_end, 0.0f, 5.0f);
|
||||
float PITCH_DEG = mapRange(blend_speed_mph, zoom_start, zoom_end, 0.0f, 5.0f);
|
||||
|
||||
input = Eigen::Vector3f(in_x + IN_X_OFFSET, in_y / IN_Y_OFFSET, in_z + IN_Z_OFFSET);
|
||||
Eigen::AngleAxisf pitch_rot(PITCH_DEG * M_PI / 180.0f, Eigen::Vector3f::UnitY());
|
||||
input = pitch_rot * input;
|
||||
}
|
||||
|
||||
auto pt = car_space_transform * input;
|
||||
*out = QPointF(pt.x() / pt.z(), pt.y() / pt.z());
|
||||
bool normal_valid = (pt.z() > 1e-3f &&
|
||||
std::isfinite(pt.x()) && std::isfinite(pt.y()));
|
||||
QPointF normal_view;
|
||||
if (normal_valid) {
|
||||
normal_view = QPointF(pt.x() / pt.z(), pt.y() / pt.z());
|
||||
}
|
||||
|
||||
const float base_scale_x = 20.0f;
|
||||
const float base_scale_y = 15.0f;
|
||||
const float y_offset = 450.0f;
|
||||
|
||||
float factor_scale_x = 0.0f;
|
||||
if (blend_speed_mph > 0.0f) {
|
||||
if (s->scene.visual_style_overhead_zoom == 1) {
|
||||
factor_scale_x = mapRange(blend_speed_mph, 0.0f, 50.0f, 30.0f, 0.0f);
|
||||
} else if (s->scene.visual_style_overhead_zoom == 2) {
|
||||
factor_scale_x = mapRange(blend_speed_mph, 50.0f, 0.0f, 30.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
float scale_x = base_scale_x + factor_scale_x;
|
||||
float scale_y = base_scale_y;
|
||||
|
||||
QPointF topdown_view(
|
||||
clip_region.center().x() + in_y * scale_x,
|
||||
(clip_region.bottom() - y_offset) - in_x * scale_y
|
||||
);
|
||||
|
||||
if ((s->scene.visual_style_overhead == 1 || s->scene.visual_style_overhead == 2) && s->scene.visual_style != 0) {
|
||||
static float blend = 0.0f;
|
||||
static float target_blend = 0.0f;
|
||||
static double last_t = millis_since_boot();
|
||||
|
||||
const bool inverted = (s->scene.visual_style_overhead == 2);
|
||||
const float threshold = s->scene.visual_style_overhead_threshold;
|
||||
const float hysteresis = 5.0f;
|
||||
|
||||
if (!inverted) {
|
||||
if (target_blend < 0.5f && blend_speed_mph > threshold) {
|
||||
target_blend = 1.0f;
|
||||
} else if (target_blend > 0.5f && blend_speed_mph < threshold - hysteresis) {
|
||||
target_blend = 0.0f;
|
||||
}
|
||||
} else {
|
||||
if (target_blend < 0.5f && blend_speed_mph < threshold) {
|
||||
target_blend = 1.0f;
|
||||
} else if (target_blend > 0.5f && blend_speed_mph > threshold + hysteresis) {
|
||||
target_blend = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
double now = millis_since_boot();
|
||||
double dt = (now - last_t) / 1000.0;
|
||||
last_t = now;
|
||||
|
||||
const float transition_time = 1.50f;
|
||||
float step = dt / transition_time;
|
||||
|
||||
if (blend < target_blend) {
|
||||
blend = std::min(blend + step, target_blend);
|
||||
} else if (blend > target_blend) {
|
||||
blend = std::max(blend - step, target_blend);
|
||||
}
|
||||
|
||||
if (!normal_valid) return false;
|
||||
*out = QPointF(
|
||||
(1 - blend) * normal_view.x() + blend * topdown_view.x(),
|
||||
(1 - blend) * normal_view.y() + blend * topdown_view.y()
|
||||
);
|
||||
} else {
|
||||
if (!normal_valid) return false;
|
||||
*out = normal_view;
|
||||
}
|
||||
|
||||
return clip_region.contains(*out);
|
||||
}
|
||||
|
||||
|
||||
@@ -196,6 +196,7 @@ mat4 CameraWidget::calcFrameMatrix() {
|
||||
}
|
||||
|
||||
void CameraWidget::paintGL() {
|
||||
auto *s = uiState();
|
||||
glClearColor(bg.redF(), bg.greenF(), bg.blueF(), bg.alphaF());
|
||||
glClear(GL_STENCIL_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
|
||||
@@ -248,7 +249,9 @@ void CameraWidget::paintGL() {
|
||||
|
||||
glUniformMatrix4fv(program->uniformLocation("uTransform"), 1, GL_TRUE, frame_mat.v);
|
||||
glEnableVertexAttribArray(0);
|
||||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, (const void *)0);
|
||||
if (s->scene.visual_style == 0) {
|
||||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, (const void *)0);
|
||||
}
|
||||
glDisableVertexAttribArray(0);
|
||||
glBindVertexArray(0);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
@@ -11,6 +11,18 @@ VisualsPanel::VisualsPanel(QWidget *parent) : QWidget(parent) {
|
||||
param_watcher = new ParamWatcher(this);
|
||||
connect(param_watcher, &ParamWatcher::paramChanged, [=](const QString ¶m_name, const QString ¶m_value) {
|
||||
paramsRefresh();
|
||||
if (param_name == "VisualStyle") {
|
||||
visual_style_value = param_value.toInt();
|
||||
} else if (param_name == "VisualStyleOverhead") {
|
||||
visual_style_overhead_value = param_value.toInt();
|
||||
} else if (param_name == "VisualRadarTracks") {
|
||||
bool radar_tracks_enabled = param_value.toInt() != 0;
|
||||
visual_radar_tracks_delay_settings->setVisible(radar_tracks_enabled);
|
||||
}
|
||||
visual_style_zoom_settings->setVisible(visual_style_value != 0);
|
||||
visual_style_overhead_settings->setVisible(visual_style_value != 0);
|
||||
visual_style_overhead_zoom_settings->setVisible(visual_style_value != 0 && visual_style_overhead_value != 0);
|
||||
visual_style_overhead_threshold_settings->setVisible(visual_style_value != 0 && visual_style_overhead_value != 0);
|
||||
});
|
||||
|
||||
main_layout = new QStackedLayout(this);
|
||||
@@ -90,6 +102,13 @@ VisualsPanel::VisualsPanel(QWidget *parent) : QWidget(parent) {
|
||||
"",
|
||||
false,
|
||||
},
|
||||
{
|
||||
"VisualRadarTracks",
|
||||
tr("Show Radar Tracks"),
|
||||
tr("Shows what the cars radar sees."),
|
||||
"",
|
||||
false,
|
||||
},
|
||||
};
|
||||
|
||||
// Add regular toggles first
|
||||
@@ -116,6 +135,111 @@ VisualsPanel::VisualsPanel(QWidget *parent) : QWidget(parent) {
|
||||
param_watcher->addParam(param);
|
||||
}
|
||||
|
||||
// Visuals: Radar Tracks Delay
|
||||
visual_radar_tracks_delay_settings = new OptionControlSP("VisualRadarTracksDelay", tr("Adjust Visual Radar Tracks Delay"),
|
||||
tr("Delays radar tracks to better match what you see through the camera."),
|
||||
"", {0, 100}, 10, false, nullptr, true);
|
||||
|
||||
connect(visual_radar_tracks_delay_settings, &OptionControlSP::updateLabels, [=]() {
|
||||
float radar_tracks_delay_value = QString::fromStdString(params.get("VisualRadarTracksDelay")).toFloat();
|
||||
visual_radar_tracks_delay_settings->setLabel(QString::number(radar_tracks_delay_value, 'f', 1) + " s");
|
||||
});
|
||||
|
||||
float radar_tracks_delay_value = QString::fromStdString(params.get("VisualRadarTracksDelay")).toFloat();
|
||||
visual_radar_tracks_delay_settings->setLabel(QString::number(radar_tracks_delay_value, 'f', 1) + " s");
|
||||
|
||||
list->addItem(visual_radar_tracks_delay_settings);
|
||||
|
||||
// Wide Cam
|
||||
std::vector<QString> visual_wide_cam_settings_texts{tr("Auto"), tr("On"), tr("Off")};
|
||||
visual_wide_cam_settings = new ButtonParamControlSP(
|
||||
"VisualWideCam", tr("Wide Cam"), tr("Override the wide cam view regardless of experimental mode status."),
|
||||
"",
|
||||
visual_wide_cam_settings_texts,
|
||||
250);
|
||||
list->addItem(visual_wide_cam_settings);
|
||||
|
||||
// Visual Style
|
||||
std::vector<QString> visual_style_settings_texts{tr("Default"), tr("Minimal"), tr("Vision")};
|
||||
visual_style_settings = new ButtonParamControlSP(
|
||||
"VisualStyle", tr("Visual Style"),
|
||||
tr(
|
||||
"Switch between different on-road visualization layouts."
|
||||
"<ul style='margin-left: 10px; margin-top: 4px;'>"
|
||||
"<li><b>Default:</b> Standard OpenPilot layout with camera and path view.</li>"
|
||||
"<li><b>Minimal:</b> Clean interface without camera feed or extra elements.</li>"
|
||||
"<li><b>Vision:</b> Experimental layout that focuses on model perception and environment.</li>"
|
||||
"</ul>"
|
||||
),
|
||||
"",
|
||||
visual_style_settings_texts,
|
||||
380);
|
||||
list->addItem(visual_style_settings);
|
||||
|
||||
// Visual Style Zoom
|
||||
std::vector<QString> visual_style_zoom_settings_texts{tr("Disabled"), tr("Enabled"), tr("Inverted")};
|
||||
visual_style_zoom_settings = new ButtonParamControlSP(
|
||||
"VisualStyleZoom", tr("Visual Style Zoom"),
|
||||
tr(
|
||||
"Enables dynamic zooming based on driving speed in the selected visual style."
|
||||
"<ul style='margin-left: 10px; margin-top: 4px;'>"
|
||||
"<li><b>Disabled:</b> Keeps the zoom fixed.</li>"
|
||||
"<li><b>Enabled:</b> Zooms in at low speed and out at high speed.</li>"
|
||||
"<li><b>Inverted:</b> Reverses the zoom behavior.</li>"
|
||||
"</ul>"
|
||||
),
|
||||
"",
|
||||
visual_style_zoom_settings_texts,
|
||||
380);
|
||||
list->addItem(visual_style_zoom_settings);
|
||||
|
||||
// Visual Style Overhead
|
||||
std::vector<QString> visual_style_overhead_settings_texts{tr("Disabled"), tr("Enabled"), tr("Inverted")};
|
||||
visual_style_overhead_settings = new ButtonParamControlSP(
|
||||
"VisualStyleOverhead", tr("Visual Style Overhead"),
|
||||
tr(
|
||||
"Toggles an overhead (top-down) camera view for a 2D-style perspective."
|
||||
"<ul style='margin-left: 10px; margin-top: 4px;'>"
|
||||
"<li><b>Disabled:</b> Keeps the standard forward 3D view.</li>"
|
||||
"<li><b>Enabled:</b> Switches to overhead view when active.</li>"
|
||||
"<li><b>Inverted:</b> Reverses when the transition happens.</li>"
|
||||
"</ul>"
|
||||
),
|
||||
"",
|
||||
visual_style_overhead_settings_texts,
|
||||
380);
|
||||
list->addItem(visual_style_overhead_settings);
|
||||
|
||||
// Visual Style Overhead Zoom
|
||||
std::vector<QString> visual_style_overhead_zoom_settings_texts{tr("Disabled"), tr("Enabled"), tr("Inverted")};
|
||||
visual_style_overhead_zoom_settings = new ButtonParamControlSP(
|
||||
"VisualStyleOverheadZoom", tr("Visual Style Overhead Zoom"),
|
||||
tr(
|
||||
"Controls zooming behavior while in overhead mode."
|
||||
"<ul style='margin-left: 10px; margin-top: 4px;'>"
|
||||
"<li><b>Disabled:</b> Keeps a fixed zoom level in overhead mode.</li>"
|
||||
"<li><b>Enabled:</b> Zooms dynamically based on speed while overhead.</li>"
|
||||
"<li><b>Inverted:</b> Opposite zoom direction.</li>"
|
||||
"</ul>"
|
||||
),
|
||||
"",
|
||||
visual_style_overhead_zoom_settings_texts,
|
||||
380);
|
||||
list->addItem(visual_style_overhead_zoom_settings);
|
||||
|
||||
// Visual Style Overhead Threshold
|
||||
visual_style_overhead_threshold_settings = new OptionControlSP(
|
||||
"VisualStyleOverheadThreshold", tr("Visual Style Overhead Threshold"),
|
||||
tr("Sets the speed (in mph) where the display transitions between normal and overhead view."),
|
||||
"", {10, 80}, 5, false, nullptr, false);
|
||||
auto updateThresholdLabel = [=]() {
|
||||
int mph = QString::fromStdString(params.get("VisualStyleOverheadThreshold")).toInt();
|
||||
visual_style_overhead_threshold_settings->setLabel(QString("%1 mph").arg(mph));
|
||||
};
|
||||
connect(visual_style_overhead_threshold_settings, &OptionControlSP::updateLabels, updateThresholdLabel);
|
||||
updateThresholdLabel();
|
||||
list->addItem(visual_style_overhead_threshold_settings);
|
||||
|
||||
// Visuals: Display Metrics below Chevron
|
||||
std::vector<QString> chevron_info_settings_texts{tr("Off"), tr("Distance"), tr("Speed"), tr("Time"), tr("All")};
|
||||
chevron_info_settings = new ButtonParamControlSP(
|
||||
@@ -136,6 +260,19 @@ VisualsPanel::VisualsPanel(QWidget *parent) : QWidget(parent) {
|
||||
380);
|
||||
list->addItem(dev_ui_settings);
|
||||
|
||||
bool radar_tracks_enabled = QString::fromStdString(params.get("VisualRadarTracks")).toInt() != 0;
|
||||
visual_radar_tracks_delay_settings->setVisible(radar_tracks_enabled);
|
||||
param_watcher->addParam("VisualRadarTracks");
|
||||
|
||||
visual_style_value = QString::fromStdString(params.get("VisualStyle")).toInt();
|
||||
visual_style_overhead_value = QString::fromStdString(params.get("VisualStyleOverhead")).toInt();
|
||||
visual_style_zoom_settings->setVisible(visual_style_value != 0);
|
||||
visual_style_overhead_settings->setVisible(visual_style_value != 0);
|
||||
visual_style_overhead_zoom_settings->setVisible(visual_style_value != 0 && visual_style_overhead_value != 0);
|
||||
visual_style_overhead_threshold_settings->setVisible(visual_style_value != 0 && visual_style_overhead_value != 0);
|
||||
param_watcher->addParam("VisualStyle");
|
||||
param_watcher->addParam("VisualStyleOverhead");
|
||||
|
||||
sunnypilotScroller = new ScrollViewSP(list, this);
|
||||
vlayout->addWidget(sunnypilotScroller);
|
||||
|
||||
@@ -191,4 +328,19 @@ void VisualsPanel::paramsRefresh() {
|
||||
if (dev_ui_settings) {
|
||||
dev_ui_settings->refresh();
|
||||
}
|
||||
if (visual_wide_cam_settings) {
|
||||
visual_wide_cam_settings->refresh();
|
||||
}
|
||||
if (visual_style_settings) {
|
||||
visual_style_settings->refresh();
|
||||
}
|
||||
if (visual_style_zoom_settings) {
|
||||
visual_style_zoom_settings->refresh();
|
||||
}
|
||||
if (visual_style_overhead_settings) {
|
||||
visual_style_overhead_settings->refresh();
|
||||
}
|
||||
if (visual_style_overhead_zoom_settings) {
|
||||
visual_style_overhead_zoom_settings->refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,4 +32,14 @@ protected:
|
||||
ButtonParamControlSP *dev_ui_settings;
|
||||
|
||||
bool has_longitudinal_control = false;
|
||||
|
||||
OptionControlSP *visual_radar_tracks_delay_settings;
|
||||
ButtonParamControlSP *visual_wide_cam_settings;
|
||||
int visual_style_value = 0;
|
||||
int visual_style_overhead_value = 0;
|
||||
ButtonParamControlSP *visual_style_settings;
|
||||
ButtonParamControlSP *visual_style_zoom_settings;
|
||||
ButtonParamControlSP *visual_style_overhead_settings;
|
||||
ButtonParamControlSP *visual_style_overhead_zoom_settings;
|
||||
OptionControlSP *visual_style_overhead_threshold_settings;
|
||||
};
|
||||
|
||||
@@ -8,6 +8,12 @@
|
||||
#include "selfdrive/ui/sunnypilot/qt/onroad/model.h"
|
||||
|
||||
|
||||
void ModelRendererSP::drawRadarPoint(QPainter &painter, const QPointF &pos, float v_rel, float radius) {
|
||||
painter.setBrush(QColor(255, 255, 255, 200));
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.drawEllipse(pos, radius, radius);
|
||||
}
|
||||
|
||||
void ModelRendererSP::update_model(const cereal::ModelDataV2::Reader &model, const cereal::RadarState::LeadData::Reader &lead) {
|
||||
ModelRenderer::update_model(model, lead);
|
||||
const auto &model_position = model.getPosition();
|
||||
@@ -67,6 +73,26 @@ void ModelRendererSP::draw(QPainter &painter, const QRect &surface_rect) {
|
||||
const bool right_blindspot = car_state.getRightBlindspot();
|
||||
drawBlindspot(painter, surface_rect, left_blindspot, right_blindspot);
|
||||
}
|
||||
|
||||
if (s->scene.visual_radar_tracks) {
|
||||
if (sm.alive("liveTracks") && sm.rcv_frame("liveTracks") >= s->scene.started_frame) {
|
||||
const auto &tracks = sm["liveTracks"].getLiveTracks().getPoints();
|
||||
for (const auto &track : tracks) {
|
||||
if (!std::isfinite(track.getDRel()) || !std::isfinite(track.getYRel())) continue;
|
||||
float t_lag = s->scene.visual_radar_tracks_delay;
|
||||
float d_pred = track.getDRel();
|
||||
float y_pred = track.getYRel();
|
||||
if (t_lag > 0.0f) {
|
||||
d_pred += track.getVRel() * t_lag + 0.5f * track.getARel() * t_lag * t_lag;
|
||||
}
|
||||
QPointF screen_pt;
|
||||
if (mapToScreen(d_pred, -y_pred, path_offset_z, &screen_pt)) {
|
||||
drawRadarPoint(painter, screen_pt, track.getVRel(), 10.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
drawLeadStatus(painter, surface_rect.height(), surface_rect.width());
|
||||
|
||||
painter.restore();
|
||||
|
||||
@@ -28,4 +28,6 @@ private:
|
||||
|
||||
// Lead status animation
|
||||
float lead_status_alpha = 0.0f;
|
||||
|
||||
void drawRadarPoint(QPainter &painter, const QPointF &pos, float v_rel, float radius = 10.0f);
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ UIStateSP::UIStateSP(QObject *parent) : UIState(parent) {
|
||||
"wideRoadCameraState", "managerState", "selfdriveState", "longitudinalPlan",
|
||||
"modelManagerSP", "selfdriveStateSP", "longitudinalPlanSP", "backupManagerSP",
|
||||
"carControl", "gpsLocationExternal", "gpsLocation", "liveTorqueParameters",
|
||||
"carStateSP", "liveParameters", "liveMapDataSP", "carParamsSP"
|
||||
"carStateSP", "liveParameters", "liveMapDataSP", "carParamsSP", "liveTracks"
|
||||
});
|
||||
|
||||
// update timer
|
||||
@@ -44,6 +44,14 @@ UIStateSP::UIStateSP(QObject *parent) : UIState(parent) {
|
||||
});
|
||||
param_watcher->addParam("DevUIInfo");
|
||||
param_watcher->addParam("StandstillTimer");
|
||||
param_watcher->addParam("VisualRadarTracks");
|
||||
param_watcher->addParam("VisualRadarTracksDelay");
|
||||
param_watcher->addParam("VisualWideCam");
|
||||
param_watcher->addParam("VisualStyle");
|
||||
param_watcher->addParam("VisualStyleZoom");
|
||||
param_watcher->addParam("VisualStyleOverhead");
|
||||
param_watcher->addParam("VisualStyleOverheadZoom");
|
||||
param_watcher->addParam("VisualStyleOverheadThreshold");
|
||||
}
|
||||
|
||||
// This method overrides completely the update method from the parent class intentionally.
|
||||
@@ -76,6 +84,17 @@ void ui_update_params_sp(UIStateSP *s) {
|
||||
s->scene.chevron_info = std::atoi(params.get("ChevronInfo").c_str());
|
||||
s->scene.blindspot_ui = params.getBool("BlindSpot");
|
||||
s->scene.rainbow_mode = params.getBool("RainbowMode");
|
||||
|
||||
s->scene.visual_radar_tracks = QString::fromStdString(params.get("VisualRadarTracks")).toInt();
|
||||
s->scene.visual_radar_tracks_delay = QString::fromStdString(params.get("VisualRadarTracksDelay")).toFloat();
|
||||
|
||||
s->scene.visual_wide_cam = QString::fromStdString(params.get("VisualWideCam")).toInt();
|
||||
|
||||
s->scene.visual_style = QString::fromStdString(params.get("VisualStyle")).toInt();
|
||||
s->scene.visual_style_zoom = QString::fromStdString(params.get("VisualStyleZoom")).toInt();
|
||||
s->scene.visual_style_overhead = QString::fromStdString(params.get("VisualStyleOverhead")).toInt();
|
||||
s->scene.visual_style_overhead_zoom = QString::fromStdString(params.get("VisualStyleOverheadZoom")).toInt();
|
||||
s->scene.visual_style_overhead_threshold = QString::fromStdString(params.get("VisualStyleOverheadThreshold")).toInt();
|
||||
}
|
||||
|
||||
void UIStateSP::reset_onroad_sleep_timer(OnroadTimerStatusToggle toggleTimerStatus) {
|
||||
|
||||
@@ -21,4 +21,12 @@ typedef struct UISceneSP : UIScene {
|
||||
int chevron_info;
|
||||
bool blindspot_ui;
|
||||
bool rainbow_mode;
|
||||
int visual_radar_tracks = 0;
|
||||
float visual_radar_tracks_delay = 0;
|
||||
int visual_wide_cam = 0;
|
||||
int visual_style = 0;
|
||||
int visual_style_zoom = 0;
|
||||
int visual_style_overhead = 0;
|
||||
int visual_style_overhead_zoom = 0;
|
||||
int visual_style_overhead_threshold = 20.0;
|
||||
} UISceneSP;
|
||||
|
||||
@@ -1,676 +0,0 @@
|
||||
import asyncio
|
||||
import hashlib
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
import html
|
||||
from collections import deque
|
||||
from logging.handlers import RotatingFileHandler
|
||||
|
||||
import discord
|
||||
from discord import app_commands
|
||||
from discord.ext import commands
|
||||
|
||||
from openpilot.tools.lib.api import CommaApi, UnauthorizedError
|
||||
from openpilot.tools.lib.route import Route
|
||||
|
||||
import threading
|
||||
from flask import Flask, send_file, abort, make_response
|
||||
from pathlib import Path
|
||||
|
||||
if not (CLIPPY_TOKEN := os.getenv("CLIPPY_TOKEN")):
|
||||
sys.exit("❌ CLIPPY_TOKEN is missing – set it in the environment")
|
||||
|
||||
ALLOWED_GUILD_IDS = {880416502577266699, 1368811404689276958}
|
||||
|
||||
CLIPPY_BASE_URL = "https://clippy.royjr.com"
|
||||
|
||||
WORKING_DIR = os.path.expanduser("~/github/sunnypilot/tools/clip")
|
||||
CLIPS_DIR = os.path.join(WORKING_DIR, "clips")
|
||||
STATS_PATH = os.path.join(WORKING_DIR, "clippy_stats.json")
|
||||
LOG_PATH = os.path.join(WORKING_DIR, "clippy.log")
|
||||
os.makedirs(CLIPS_DIR, exist_ok=True)
|
||||
|
||||
MAX_TOTAL_JOBS = 20
|
||||
MAX_CONCURRENT_CLIPS = 3
|
||||
MAX_CONCURRENT_CLIPS_PER_USER = 3
|
||||
MAX_CLIP_DURATION = 60 * 5
|
||||
|
||||
CLIPPY_STATS_ALLOWED_ROLES = ["sunnypilot-dev"]
|
||||
CLIPPY_UNLIMITED_ALLOWED_ROLES = ["sunnypilot-dev"]
|
||||
|
||||
TAIL_LINES = 25
|
||||
tail_buffer = deque(maxlen=TAIL_LINES)
|
||||
|
||||
intents = discord.Intents.default()
|
||||
intents.message_content = True
|
||||
bot = commands.Bot(command_prefix=lambda bot, msg: [], intents=intents)
|
||||
|
||||
clip_queue = []
|
||||
clip_semaphore = asyncio.Semaphore(MAX_CONCURRENT_CLIPS)
|
||||
user_cooldowns = {}
|
||||
|
||||
|
||||
async def queue_monitor():
|
||||
while True:
|
||||
print("\033c", end="")
|
||||
w = shutil.get_terminal_size().columns
|
||||
bar = "-" * w
|
||||
print(f"{bar}\nTotal: {stats['total']} | ✅ {stats['success']} | ❌ {stats['fail']}\n{bar}")
|
||||
print("\n".join(f"{i+1:02d}. {j['status']} {j['user']}: {j['route']}" for i, j in enumerate(clip_queue)) or "No jobs in queue.")
|
||||
print(f"{bar}\n" + "\n".join(line[:w] for line in tail_buffer) + f"\n{bar}")
|
||||
await asyncio.sleep(1)
|
||||
|
||||
def start_clip_server():
|
||||
clip_dir_resolved = Path(CLIPS_DIR).resolve()
|
||||
app = Flask("clippy")
|
||||
|
||||
@app.route('/<path:filename>')
|
||||
def get_clip(filename):
|
||||
full_path = (clip_dir_resolved / filename).resolve()
|
||||
try:
|
||||
full_path.relative_to(clip_dir_resolved)
|
||||
except ValueError:
|
||||
abort(404)
|
||||
if not full_path.name.endswith(".mp4"):
|
||||
abort(404)
|
||||
try:
|
||||
if not full_path.is_file() or not full_path.samefile(full_path):
|
||||
abort(404)
|
||||
except Exception:
|
||||
abort(404)
|
||||
response = make_response(send_file(
|
||||
str(full_path),
|
||||
mimetype="video/mp4",
|
||||
as_attachment=False,
|
||||
conditional=True,
|
||||
))
|
||||
response.headers.update({
|
||||
"Cache-Control": "no-store",
|
||||
"Accept-Ranges": "bytes",
|
||||
"Content-Disposition": f'inline; filename="{filename}"',
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
})
|
||||
return response
|
||||
|
||||
@app.errorhandler(404)
|
||||
def not_found(_):
|
||||
return "clip not found", 404
|
||||
|
||||
app.run(host="127.0.0.1", port=5000)
|
||||
|
||||
def has_any_role(user, role_list):
|
||||
if isinstance(user, discord.Member):
|
||||
return any(role.name in role_list for role in user.roles)
|
||||
return False
|
||||
|
||||
def user_tag(user: discord.User) -> str:
|
||||
return f"{user.display_name} ({user.name})"
|
||||
|
||||
def load_stats():
|
||||
if os.path.exists(STATS_PATH):
|
||||
with open(STATS_PATH, "r") as f:
|
||||
return json.load(f)
|
||||
return {"total": 0, "success": 0, "fail": 0}
|
||||
|
||||
def save_stats():
|
||||
with open(STATS_PATH, "w") as f:
|
||||
json.dump(stats, f)
|
||||
|
||||
stats = load_stats()
|
||||
|
||||
|
||||
class SanitizeFilter(logging.Filter):
|
||||
def filter(self, record: logging.LogRecord) -> bool:
|
||||
if isinstance(record.msg, str):
|
||||
record.msg = re.compile(r'[\x00-\x1f\x7f-\x9f]').sub('', record.msg)
|
||||
return True
|
||||
|
||||
|
||||
class DequeHandler(logging.Handler):
|
||||
def __init__(self, buf):
|
||||
super().__init__()
|
||||
self.buf = buf
|
||||
self.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(message)s"))
|
||||
|
||||
def emit(self, record):
|
||||
try:
|
||||
self.buf.append(self.format(record))
|
||||
except Exception:
|
||||
self.handleError(record)
|
||||
|
||||
log_handler = RotatingFileHandler(LOG_PATH, maxBytes=5*1024*1024, backupCount=3)
|
||||
log_handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(message)s"))
|
||||
|
||||
root = logging.getLogger()
|
||||
root.setLevel(logging.INFO)
|
||||
root.addHandler(log_handler)
|
||||
root.addHandler(DequeHandler(tail_buffer))
|
||||
root.addFilter(SanitizeFilter())
|
||||
|
||||
|
||||
class DeletePublishedView(discord.ui.View):
|
||||
def __init__(self, message: discord.Message, author_id: int, video_path):
|
||||
super().__init__(timeout=300)
|
||||
self.message = message
|
||||
self.author_id = author_id
|
||||
self.video_path = video_path
|
||||
|
||||
@discord.ui.button(label="Unpublish Clip", style=discord.ButtonStyle.primary)
|
||||
async def unpublish(self, interaction: discord.Interaction, _button: discord.ui.Button):
|
||||
if interaction.user.id != self.author_id:
|
||||
logging.error(f"🚫 {user_tag(interaction.user)} cant unpublish {self.message.id}")
|
||||
await interaction.response.send_message("🚫 You can't unpublish this clip.", ephemeral=True)
|
||||
return
|
||||
|
||||
try:
|
||||
await self.message.delete()
|
||||
logging.info(f"🗑️ {user_tag(interaction.user)} unpublished {self.message.id}")
|
||||
await interaction.response.edit_message(content="🗑️ Unpublished clip.", view=None)
|
||||
except Exception as e:
|
||||
logging.error(f"❌ Failed to unpublish clip {self.message.id}: {e}")
|
||||
await interaction.response.send_message(f"❌ Failed to unpublish clip.", ephemeral=True)
|
||||
|
||||
@discord.ui.button(label="Unpublish + Delete Clip", style=discord.ButtonStyle.danger)
|
||||
async def delete(self, interaction: discord.Interaction, _button: discord.ui.Button):
|
||||
if interaction.user.id != self.author_id:
|
||||
logging.error(f"🚫 {user_tag(interaction.user)} cant unpublish and delete {self.message.id}")
|
||||
await interaction.response.send_message("🚫 You can't unpublish and delete this clip.", ephemeral=True)
|
||||
return
|
||||
|
||||
try:
|
||||
if not os.path.realpath(self.video_path).startswith(os.path.realpath(CLIPS_DIR) + os.sep):
|
||||
logging.error(f"❌ Unsafe delete attempt: {self.video_path}")
|
||||
await interaction.response.send_message("❌ Unsafe delete attempt.", ephemeral=True)
|
||||
return
|
||||
os.remove(self.video_path)
|
||||
await self.message.delete()
|
||||
logging.info(f"🗑️ {user_tag(interaction.user)} unpublished {self.message.id}")
|
||||
await interaction.response.edit_message(content="🗑️ Unpublished and deleted clip.", view=None)
|
||||
except Exception as e:
|
||||
logging.error(f"❌ Failed to unpublish clip {self.message.id}: {e}")
|
||||
await interaction.response.send_message(f"❌ Failed to unpublish and delete clip.", ephemeral=True)
|
||||
|
||||
|
||||
class PublishView(discord.ui.View):
|
||||
def __init__(self, route_str, title, video_path, author_id, file_size, safe_name):
|
||||
super().__init__(timeout=300)
|
||||
self.route_str = route_str
|
||||
self.title = title
|
||||
self.video_path = video_path
|
||||
self.author_id = author_id
|
||||
self.file_size = file_size
|
||||
self.safe_name = safe_name
|
||||
|
||||
@discord.ui.button(label="Publish Clip", style=discord.ButtonStyle.success)
|
||||
async def publish(self, interaction: discord.Interaction, _button: discord.ui.Button):
|
||||
if interaction.user.id != self.author_id:
|
||||
await interaction.response.send_message("🚫 You can't publish this clip.", ephemeral=True)
|
||||
return
|
||||
|
||||
if not os.path.exists(self.video_path):
|
||||
logging.error(f"❌ {user_tag(interaction.user)} failed to publish {self.route_str} – file missing")
|
||||
await interaction.response.edit_message(
|
||||
content="❌ Clip could not be published. File missing.",
|
||||
attachments=[], view=None
|
||||
)
|
||||
self.stop()
|
||||
return
|
||||
|
||||
logging.info(f"✅ {user_tag(interaction.user)} published {self.route_str}")
|
||||
|
||||
if not (1 <= self.file_size <= 9):
|
||||
published_msg = await interaction.channel.send(
|
||||
f"{interaction.user.mention} shared a [clip]({CLIPPY_BASE_URL}/{self.safe_name}.mp4) from [{self.route_str}](https://connect.comma.ai/{self.route_str})\n{self.title}"
|
||||
)
|
||||
else:
|
||||
published_msg = await interaction.channel.send(
|
||||
f"{interaction.user.mention} shared a clip from [{self.route_str}](https://connect.comma.ai/{self.route_str})\n{self.title}",
|
||||
file=discord.File(self.video_path)
|
||||
)
|
||||
await interaction.response.edit_message(
|
||||
content="✅ Clip published to channel.", attachments=[], view=DeletePublishedView(published_msg, interaction.user.id, self.video_path),
|
||||
)
|
||||
self.stop()
|
||||
|
||||
@discord.ui.button(label="Delete Clip", style=discord.ButtonStyle.danger)
|
||||
async def delete(self, interaction: discord.Interaction, _button: discord.ui.Button):
|
||||
if interaction.user.id != self.author_id:
|
||||
logging.error(f"🚫 {user_tag(interaction.user)} cant delete {self.video_path}")
|
||||
await interaction.response.send_message("🚫 You can't delete this clip.", ephemeral=True)
|
||||
return
|
||||
|
||||
try:
|
||||
if not os.path.realpath(self.video_path).startswith(os.path.realpath(CLIPS_DIR) + os.sep):
|
||||
logging.error(f"❌ Unsafe delete attempt: {self.video_path}")
|
||||
await interaction.response.send_message("❌ Unsafe delete attempt.", ephemeral=True)
|
||||
return
|
||||
os.remove(self.video_path)
|
||||
logging.info(f"🗑️ {user_tag(interaction.user)} deleted {self.route_str}")
|
||||
await interaction.response.edit_message(content="🗑️ Clip deleted.", attachments=[], view=None)
|
||||
self.stop()
|
||||
except Exception as e:
|
||||
logging.error(f"❌ Failed to delete {self.route_str}")
|
||||
await interaction.response.edit_message(content=f"❌ Failed to delete clip.", view=None)
|
||||
|
||||
|
||||
@bot.tree.command(name="clippy", description="Generate a driving clip - make sure you upload logs first!")
|
||||
@app_commands.describe(
|
||||
input="connect link or dongle/route/starttime/endtime or dongle/route/startsegment-endsegment",
|
||||
title="Title (default: none)",
|
||||
quality="Video quality (default: high)",
|
||||
wide="Use wide view if uploaded (default: true)",
|
||||
speed="Playback speed (default: 1)",
|
||||
cache="Set to false to regenerate clip if its already cached (default: true)",
|
||||
private="If true, only you will see the preview (default: true)",
|
||||
bookmarks="Automatically clip bookmarks (default: false)",
|
||||
filesize="Max filesize (MB), set to 0 for unlimited (default: 9)",
|
||||
developer="Show the developer UI (default: Off)"
|
||||
)
|
||||
@app_commands.choices(
|
||||
quality=[
|
||||
app_commands.Choice(name="high", value="high"),
|
||||
app_commands.Choice(name="low", value="low"),
|
||||
],
|
||||
developer=[
|
||||
app_commands.Choice(name="Right", value="1"),
|
||||
app_commands.Choice(name="Right & Bottom", value="2"),
|
||||
]
|
||||
)
|
||||
async def clippy(
|
||||
interaction: discord.Interaction,
|
||||
input: str,
|
||||
title: str = None,
|
||||
quality: app_commands.Choice[str] | None = None,
|
||||
wide: bool = True,
|
||||
speed: int = 1,
|
||||
cache: bool = True,
|
||||
private: bool = True,
|
||||
bookmarks: bool = False,
|
||||
filesize: int = 9,
|
||||
developer: app_commands.Choice[str] | None = None,
|
||||
):
|
||||
|
||||
if interaction.guild_id not in ALLOWED_GUILD_IDS:
|
||||
logging.error(f"❌ This bot is not available in this server {interaction.guild_id}")
|
||||
await interaction.response.send_message("❌ This bot is not available in this server.", ephemeral=True)
|
||||
return
|
||||
|
||||
if len(clip_queue) >= MAX_TOTAL_JOBS:
|
||||
await interaction.response.send_message(
|
||||
"🚫 Server busy – too many jobs in queue. Please try again later.",
|
||||
ephemeral=True
|
||||
)
|
||||
return
|
||||
|
||||
user_id = interaction.user.id
|
||||
if not has_any_role(interaction.user, CLIPPY_UNLIMITED_ALLOWED_ROLES):
|
||||
if user_cooldowns.get(user_id, 0) >= MAX_CONCURRENT_CLIPS_PER_USER:
|
||||
logging.error(f"🚫 {user_tag(interaction.user)} hit the cooldown limit")
|
||||
await interaction.response.send_message(
|
||||
"🚫 You already have a clip running. Wait for it to finish.",
|
||||
ephemeral=True
|
||||
)
|
||||
return
|
||||
|
||||
user_cooldowns[user_id] = user_cooldowns.get(user_id, 0) + 1
|
||||
|
||||
try:
|
||||
await interaction.response.defer(ephemeral=True)
|
||||
|
||||
quality_value = quality.value if quality else "high"
|
||||
title_cmd = title[:80] if title else ""
|
||||
title = f"> ### **{html.unescape(title[:80])}**" if title else ""
|
||||
stats["total"] += 1
|
||||
|
||||
# ── fast‑fail validation ────────────────────────────────────────────────────
|
||||
def fail(msg: str):
|
||||
stats["fail"] += 1
|
||||
save_stats()
|
||||
return interaction.followup.send(f"❌ {msg}", ephemeral=True)
|
||||
|
||||
input = input.removeprefix("https://connect.comma.ai/")
|
||||
|
||||
if bookmarks:
|
||||
match = re.match(r'^([a-z0-9]+)/([a-zA-Z0-9\-]+)$', input)
|
||||
if not match:
|
||||
logging.error(f"❌ {user_tag(interaction.user)} entered bad input {input}")
|
||||
await fail("Use connect link, `dongle/route/starttime/endtime` or `dongle/route/startsegment-endsegment` (endsegment optional).\n```\n--- CONNECT ---\nhttps://connect.comma.ai/a2a0ccea32023010/2023-07-27--13-01-19/5/10\n\n--- EXAMPLES ---\na2a0ccea32023010/2023-07-27--13-01-19/0 segment 0\na2a0ccea32023010/2023-07-27--13-01-19/0-1 segments 0 through 1\na2a0ccea32023010/2023-07-27--13-01-19/5/10 from 5 to 10 seconds\na2a0ccea32023010/2023-07-27--13-01-19 when using bookmark option\n```")
|
||||
return
|
||||
else:
|
||||
dongle, route = match.groups()
|
||||
start = 0
|
||||
end = 0
|
||||
else:
|
||||
|
||||
match = re.match(r'^([a-z0-9]+)/([a-zA-Z0-9\-]+)/(\d+)/(\d+)$', input)
|
||||
if not match:
|
||||
match = re.match(r"^([a-z0-9]+)/([A-Za-z0-9\-]+)/(\d+)(?:-(\d+))?$", input)
|
||||
if not match:
|
||||
logging.error(f"❌ {user_tag(interaction.user)} entered bad input {input}")
|
||||
await fail("Use connect link, `dongle/route/starttime/endtime` or `dongle/route/startsegment-endsegment` (endsegment optional).\n```\n--- CONNECT ---\nhttps://connect.comma.ai/a2a0ccea32023010/2023-07-27--13-01-19/5/10\n\n--- EXAMPLES ---\na2a0ccea32023010/2023-07-27--13-01-19/0 segment 0\na2a0ccea32023010/2023-07-27--13-01-19/0-1 segments 0 through 1\na2a0ccea32023010/2023-07-27--13-01-19/5/10 from 5 to 10 seconds\na2a0ccea32023010/2023-07-27--13-01-19 when using bookmark option\n```")
|
||||
return
|
||||
else:
|
||||
dongle, route, seg_start, seg_end = match.groups()
|
||||
|
||||
if int(seg_start) == 0:
|
||||
# in_start = 2 # fix for 2s
|
||||
in_start = 0
|
||||
else:
|
||||
in_start = int(seg_start) * 60
|
||||
|
||||
if seg_end is None:
|
||||
in_end = 60 if int(seg_start) == 0 else in_start + 60
|
||||
else:
|
||||
in_end = 60 if int(seg_end) == 0 else (int(seg_end) + 1) * 60
|
||||
else:
|
||||
dongle, route, in_start, in_end = match.groups()
|
||||
|
||||
start = int(in_start)
|
||||
end = int(in_end)
|
||||
|
||||
# fix for 2s
|
||||
# if start < 2 or end <= start:
|
||||
# await fail("Start must be at least 2 and end must be greater than start.")
|
||||
# return
|
||||
|
||||
if end <= start:
|
||||
logging.error(f"❌ {user_tag(interaction.user)} entered bad times {input}")
|
||||
await fail("End must be greater than start time.")
|
||||
return
|
||||
duration = end - start
|
||||
if duration > MAX_CLIP_DURATION:
|
||||
logging.error(f"❌ {user_tag(interaction.user)} hit the max duration limit {input}")
|
||||
await fail(f"Clips must be {int(MAX_CLIP_DURATION / 60)} minutes or less.")
|
||||
return
|
||||
|
||||
status_msg = await interaction.followup.send(
|
||||
"🕐 Waiting in queue..", ephemeral=private
|
||||
)
|
||||
|
||||
if speed == 0:
|
||||
speed = 1
|
||||
if speed > 1:
|
||||
end = start + int(duration / speed)
|
||||
elif speed < 1:
|
||||
end = start + int(duration / speed)
|
||||
if bookmarks:
|
||||
route_str = f"{dongle}/{route}"
|
||||
connect_route_str = f"{dongle}/{route}"
|
||||
base = f"{dongle}_{route}_bookmarks_{quality_value}"
|
||||
else:
|
||||
route_str = f"{dongle}/{route}/{start}/{end}"
|
||||
connect_start = 1 if start == 0 else start
|
||||
connect_route_str = f"{dongle}/{route}/{connect_start}/{end}"
|
||||
base = f"{dongle}_{route}_{start}_{end}_{quality_value}"
|
||||
if wide:
|
||||
base += "_wide"
|
||||
if speed:
|
||||
base += f"_{speed}"
|
||||
base += f"_s{filesize}"
|
||||
clean_base = re.sub(r'[^A-Za-z0-9_-]+', '_', base)
|
||||
if title_cmd:
|
||||
title_hash = hashlib.sha1(title_cmd.encode()).hexdigest()[:10]
|
||||
safe_name = f"{clean_base}_{title_hash}"
|
||||
else:
|
||||
safe_name = clean_base
|
||||
|
||||
safe_name = re.sub(r'[^a-zA-Z0-9_-]', '_', safe_name)
|
||||
|
||||
if any(job["route"] == safe_name for job in clip_queue):
|
||||
await status_msg.edit(content="❌ That clip is already in the queue or processing – wait for it to finish.")
|
||||
return
|
||||
|
||||
try:
|
||||
logs = CommaApi().get(f"/v1/route/{dongle}|{route}/files").get("logs")
|
||||
|
||||
segments = [
|
||||
re.search(r'/(\d+)/rlog\.(?:zst|bz2)', url).group(1)
|
||||
for url in logs
|
||||
if re.search(r'/(\d+)/rlog\.(?:zst|bz2)', url)
|
||||
]
|
||||
|
||||
startsegment = start // 60
|
||||
endsegment = (end - 1) // 60
|
||||
|
||||
segment_set = set(int(s) for s in segments)
|
||||
if bookmarks:
|
||||
missing = False
|
||||
else:
|
||||
missing = [i for i in range(startsegment, endsegment + 1) if i not in segment_set]
|
||||
|
||||
if missing:
|
||||
logging.error(f"❌ {user_tag(interaction.user)} segments missing {missing}")
|
||||
await status_msg.edit(content=f"❌ You need to upload the missing logs for segments `{missing}` using [connect.comma.ai](https://connect.comma.ai/{connect_route_str})")
|
||||
return
|
||||
else:
|
||||
if bookmarks:
|
||||
logging.info(f"🕐 {user_tag(interaction.user)} getting bookmarks {route_str}")
|
||||
await status_msg.edit(content=f"🕐 Getting bookmarks")
|
||||
else:
|
||||
logging.info(f"☑️ {user_tag(interaction.user)} segments present {route_str}")
|
||||
await status_msg.edit(content=f"☑️ All required segments are present.")
|
||||
|
||||
except UnauthorizedError as e:
|
||||
logging.error(f"❌ {user_tag(interaction.user)} unauthorized: {e}")
|
||||
await status_msg.edit(content=f"❌ You need to make the route public using [connect.comma.ai](https://connect.comma.ai/{route_str}). `/clippy-auth` is no longer supported.")
|
||||
return
|
||||
|
||||
except Exception as e:
|
||||
logging.error(f"❌ {user_tag(interaction.user)} unexpected error: {e}")
|
||||
await status_msg.edit(content=f"❌ Error: unexpected error")
|
||||
return
|
||||
|
||||
if bookmarks:
|
||||
try:
|
||||
route = Route(route_str)
|
||||
user_flags_at_time = []
|
||||
|
||||
for segment in route.segments:
|
||||
for event in segment.events:
|
||||
if event['type'] == 'user_flag':
|
||||
user_flags_at_time.append(round(event['route_offset_millis'] / 1000))
|
||||
|
||||
except Exception as e:
|
||||
logging.error(f"❌ {user_tag(interaction.user)} unauthorized: {e}")
|
||||
await status_msg.edit(content=f"❌ You need to make the route public using [connect.comma.ai](https://connect.comma.ai/{route_str}). `/clippy-auth` is no longer supported.")
|
||||
return
|
||||
|
||||
if len(user_flags_at_time) == 0:
|
||||
logging.error(f"❌ {user_tag(interaction.user)} no bookmarks found")
|
||||
await status_msg.edit(content=f"❌ No bookmarks found")
|
||||
return
|
||||
else:
|
||||
bookmarklinks = ''
|
||||
for user_flag_at_time in user_flags_at_time:
|
||||
bookmarklinks += f"```{connect_route_str}/{user_flag_at_time - 10}/{user_flag_at_time + 5}```"
|
||||
logging.info(f"✅ {user_tag(interaction.user)} {len(user_flags_at_time)} bookmarks found! - {user_flags_at_time}")
|
||||
await status_msg.edit(content=f"✅ {len(user_flags_at_time)} bookmarks found! - {user_flags_at_time}{bookmarklinks}")
|
||||
return
|
||||
|
||||
full_path = os.path.join(CLIPS_DIR, f"{safe_name}.mp4")
|
||||
|
||||
clip_queue.append({"user": interaction.user.display_name,
|
||||
"route": safe_name,
|
||||
"duration": duration,
|
||||
"status": "🕐"})
|
||||
save_stats()
|
||||
if private:
|
||||
logging.info(f"🕐 {user_tag(interaction.user)} queued (PRIVATE) {route_str}")
|
||||
else:
|
||||
logging.info(f"🕐 {user_tag(interaction.user)} queued {route_str}")
|
||||
|
||||
if os.path.exists(full_path) and cache:
|
||||
stats["success"] += 1
|
||||
save_stats()
|
||||
for j in clip_queue:
|
||||
if j["route"] == safe_name:
|
||||
j["status"] = "✅"
|
||||
|
||||
if private:
|
||||
logging.info(f"📁 {user_tag(interaction.user)} used cache (PRIVATE) {route_str}")
|
||||
await status_msg.edit(content="📁 Used cached clip.")
|
||||
if not (1 <= filesize <= 9):
|
||||
await interaction.followup.send(
|
||||
content=f"Preview for [`{route_str}`]({CLIPPY_BASE_URL}/{safe_name}.mp4)\n{title}",
|
||||
view=PublishView(route_str, title, full_path, interaction.user.id, filesize, safe_name),
|
||||
ephemeral=True
|
||||
)
|
||||
else:
|
||||
await interaction.followup.send(
|
||||
content=f"Preview for `{route_str}`\n{title}",
|
||||
file=discord.File(full_path),
|
||||
view=PublishView(route_str, title, full_path, interaction.user.id, filesize, safe_name),
|
||||
ephemeral=True
|
||||
)
|
||||
else:
|
||||
logging.info(f"📁 {user_tag(interaction.user)} used cache {route_str}")
|
||||
|
||||
if not (1 <= filesize <= 9):
|
||||
published_msg = await interaction.channel.send(
|
||||
f"{interaction.user.mention} shared a [clip]({CLIPPY_BASE_URL}/{safe_name}.mp4) from [{route_str}](https://connect.comma.ai/{route_str})\n{title}"
|
||||
)
|
||||
else:
|
||||
published_msg = await interaction.channel.send(
|
||||
f"{interaction.user.mention} shared a clip from [{route_str}](https://connect.comma.ai/{route_str})\n{title}",
|
||||
file=discord.File(full_path)
|
||||
)
|
||||
await status_msg.edit(
|
||||
content="📁 Used cached clip.", attachments=[], view=DeletePublishedView(published_msg, interaction.user.id, full_path),
|
||||
)
|
||||
|
||||
else:
|
||||
async with clip_semaphore:
|
||||
for j in clip_queue:
|
||||
if j["route"] == safe_name:
|
||||
j["status"] = "🔄"
|
||||
logging.info(f"🔄 {user_tag(interaction.user)} processing {route_str}")
|
||||
await status_msg.edit(content=f"🔄 Processing {j['duration']}s clip..")
|
||||
|
||||
cmd = ["python3", "run.py", route_str, "-q", quality_value, "-x", str(speed), "-o", full_path]
|
||||
if not (in_start and in_end):
|
||||
if in_start != 0: # fix for 2s
|
||||
cmd += ["-s", str(start), "-e", str(end)]
|
||||
|
||||
if title_cmd:
|
||||
cmd += ["-t", str(title_cmd)]
|
||||
|
||||
if wide:
|
||||
cmd += ["-w"]
|
||||
|
||||
if filesize:
|
||||
cmd += ["-f", str(filesize)]
|
||||
|
||||
if developer:
|
||||
dev_mode = int(developer.value)
|
||||
else:
|
||||
dev_mode = 0
|
||||
cmd += ["-z", str(dev_mode)]
|
||||
|
||||
proc = await asyncio.create_subprocess_exec(
|
||||
*cmd, cwd=WORKING_DIR,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE
|
||||
)
|
||||
stdout, stderr = await proc.communicate()
|
||||
clean_err = "\n".join(stderr.decode().splitlines()[3:]) if stderr else ""
|
||||
|
||||
if proc.returncode != 0 or not os.path.exists(full_path):
|
||||
for j in clip_queue:
|
||||
if j["route"] == safe_name:
|
||||
j["status"] = "❌"
|
||||
stats["fail"] += 1
|
||||
save_stats()
|
||||
logging.error(f"❌ {user_tag(interaction.user)} failed {route_str}\n{clean_err}")
|
||||
|
||||
if clean_err == "clip.py: error: failed to get route: Unauthorized. Authenticate with tools/lib/auth.py":
|
||||
await status_msg.edit(content=f"❌ You need to make the route public using [connect.comma.ai](https://connect.comma.ai/{route_str}). `/clippy-auth` is no longer supported.")
|
||||
elif clean_err == "clip.py: error: failed to get route: 404:The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.":
|
||||
await status_msg.edit(content="❌ This route does not exist, please try another.")
|
||||
else:
|
||||
await status_msg.edit(content="❌ Clip failed to generate.")
|
||||
else:
|
||||
for j in clip_queue:
|
||||
if j["route"] == safe_name:
|
||||
j["status"] = "✅"
|
||||
stats["success"] += 1
|
||||
save_stats()
|
||||
|
||||
if private:
|
||||
logging.info(f"✅ {user_tag(interaction.user)} success (PRIVATE) {route_str}")
|
||||
await status_msg.edit(content="✅ Clip ready.")
|
||||
|
||||
if not (1 <= filesize <= 9):
|
||||
await interaction.followup.send(
|
||||
content=f"Preview for [`{route_str}`]({CLIPPY_BASE_URL}/{safe_name}.mp4)\n{title}",
|
||||
view=PublishView(route_str, title, full_path, interaction.user.id, filesize, safe_name),
|
||||
ephemeral=True
|
||||
)
|
||||
else:
|
||||
await interaction.followup.send(
|
||||
content=f"Preview for `{route_str}`\n{title}",
|
||||
file=discord.File(full_path),
|
||||
view=PublishView(route_str, title, full_path, interaction.user.id, filesize, safe_name),
|
||||
ephemeral=True
|
||||
)
|
||||
else:
|
||||
logging.info(f"✅ {user_tag(interaction.user)} success {route_str}")
|
||||
|
||||
if not (1 <= filesize <= 9):
|
||||
published_msg = await interaction.channel.send(
|
||||
f"{interaction.user.mention} shared a [clip]({CLIPPY_BASE_URL}/{safe_name}.mp4) from [{route_str}](https://connect.comma.ai/{route_str})\n{title}"
|
||||
)
|
||||
else:
|
||||
published_msg = await interaction.channel.send(
|
||||
f"{interaction.user.mention} shared a clip from [{route_str}](https://connect.comma.ai/{route_str})\n{title}",
|
||||
file=discord.File(full_path)
|
||||
)
|
||||
await status_msg.edit(
|
||||
content="✅ Clip ready.", attachments=[], view=DeletePublishedView(published_msg, interaction.user.id, full_path),
|
||||
)
|
||||
|
||||
await asyncio.sleep(1)
|
||||
clip_queue[:] = [j for j in clip_queue if j["route"] != safe_name]
|
||||
|
||||
finally:
|
||||
if user_id in user_cooldowns:
|
||||
user_cooldowns[user_id] = max(0, user_cooldowns[user_id] - 1)
|
||||
clip_queue[:] = [j for j in clip_queue if j["route"] != safe_name]
|
||||
|
||||
|
||||
@bot.tree.command(name="clippy-stats", description="View clippy stats")
|
||||
async def clippy_stats(interaction: discord.Interaction):
|
||||
|
||||
if interaction.guild_id not in ALLOWED_GUILD_IDS:
|
||||
logging.error(f"❌ This bot is not available in this server {interaction.guild_id}")
|
||||
await interaction.response.send_message("❌ This bot is not available in this server.", ephemeral=True)
|
||||
return
|
||||
|
||||
if not has_any_role(interaction.user, CLIPPY_STATS_ALLOWED_ROLES):
|
||||
logging.error(f"🚫 {user_tag(interaction.user)} not allowed to use /clippy-stats")
|
||||
await interaction.response.send_message("🚫 You don't have permission.", ephemeral=True)
|
||||
return
|
||||
|
||||
stat = f"Total: {stats['total']} | ✅ {stats['success']} | ❌ {stats['fail']}"
|
||||
queue = "\n".join(f"{j['status']} {j['user']}: {j['route']}" for j in clip_queue) or "No active jobs."
|
||||
tail = "\n".join(list(tail_buffer)[-5:][::-1]) or "[no log records yet]"
|
||||
|
||||
content = f"```{stat}``````{queue}``````{tail}"
|
||||
await interaction.response.send_message(content[:1997] + "```", ephemeral=True)
|
||||
logging.info(f"✅ {user_tag(interaction.user)} used /clippy-stats")
|
||||
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
await bot.tree.sync()
|
||||
for guild in bot.guilds:
|
||||
logging.info(f"Connected to guild: {guild.name} ({guild.id})")
|
||||
await bot.change_presence(activity=discord.Game(name="your clips"))
|
||||
asyncio.create_task(queue_monitor())
|
||||
print(f"Logged in as {bot.user}")
|
||||
|
||||
threading.Thread(target=start_clip_server, daemon=True).start()
|
||||
bot.run(CLIPPY_TOKEN)
|
||||
@@ -28,7 +28,7 @@ DEMO_ROUTE = 'a2a0ccea32023010/2023-07-27--13-01-19'
|
||||
FRAMERATE = 20
|
||||
PIXEL_DEPTH = '24'
|
||||
RESOLUTION = '2160x1080'
|
||||
SECONDS_TO_WARM = 0.5 # fix for 2s
|
||||
SECONDS_TO_WARM = 2
|
||||
PROC_WAIT_SECONDS = 30*10
|
||||
|
||||
OPENPILOT_FONT = str(Path(BASEDIR, 'selfdrive/assets/fonts/Inter-Regular.ttf').resolve())
|
||||
@@ -104,9 +104,8 @@ def parse_args(parser: ArgumentParser):
|
||||
args.end = int(parts[3])
|
||||
if args.end <= args.start:
|
||||
parser.error(f'end ({args.end}) must be greater than start ({args.start})')
|
||||
# fix for 2s
|
||||
# if args.start < SECONDS_TO_WARM:
|
||||
# parser.error(f'start must be greater than {SECONDS_TO_WARM}s to allow the UI time to warm up')
|
||||
if args.start < SECONDS_TO_WARM:
|
||||
parser.error(f'start must be greater than {SECONDS_TO_WARM}s to allow the UI time to warm up')
|
||||
|
||||
try:
|
||||
args.route = Route(args.route, data_dir=args.data_dir)
|
||||
@@ -114,16 +113,16 @@ def parse_args(parser: ArgumentParser):
|
||||
parser.error(f'failed to get route: {e}')
|
||||
|
||||
# FIXME: length isn't exactly max segment seconds, simplify to replay exiting at end of data
|
||||
# length = round(args.route.max_seg_number * 60)
|
||||
# if args.start >= length:
|
||||
# parser.error(f'start ({args.start}s) cannot be after end of route ({length}s)')
|
||||
# if args.end > length:
|
||||
# parser.error(f'end ({args.end}s) cannot be after end of route ({length}s)')
|
||||
length = round(args.route.max_seg_number * 60)
|
||||
if args.start >= length:
|
||||
parser.error(f'start ({args.start}s) cannot be after end of route ({length}s)')
|
||||
if args.end > length:
|
||||
parser.error(f'end ({args.end}s) cannot be after end of route ({length}s)')
|
||||
|
||||
return args
|
||||
|
||||
|
||||
def populate_car_params(lr: LogReader, developer: int):
|
||||
def populate_car_params(lr: LogReader):
|
||||
init_data = lr.first('initData')
|
||||
assert init_data is not None
|
||||
|
||||
@@ -132,14 +131,10 @@ def populate_car_params(lr: LogReader, developer: int):
|
||||
for cp in entries:
|
||||
key, value = cp.key, cp.value
|
||||
try:
|
||||
if key == "OSMDownloadProgress":
|
||||
continue
|
||||
params.put(key, params.cpp2python(key, value))
|
||||
except UnknownKeyName:
|
||||
# forks of openpilot may have other Params keys configured. ignore these
|
||||
pass
|
||||
if developer is not None:
|
||||
params.put("DevUIInfo", developer)
|
||||
logger.warning(f"unknown Params key '{key}', skipping")
|
||||
logger.debug('persisted CarParams')
|
||||
|
||||
|
||||
@@ -184,7 +179,6 @@ def wait_for_frames(procs: list[Popen]):
|
||||
def clip(
|
||||
data_dir: str | None,
|
||||
quality: Literal['low', 'high'],
|
||||
wide: bool,
|
||||
prefix: str,
|
||||
route: Route,
|
||||
out: str,
|
||||
@@ -193,9 +187,8 @@ def clip(
|
||||
speed: int,
|
||||
target_mb: int,
|
||||
title: str | None,
|
||||
developer: int,
|
||||
):
|
||||
logger.info(f'clipping route {route.name.canonical_name}, start={start} end={end} quality={quality} wide={wide} target_filesize={target_mb}MB')
|
||||
logger.info(f'clipping route {route.name.canonical_name}, start={start} end={end} quality={quality} target_filesize={target_mb}MB')
|
||||
lr = get_logreader(route)
|
||||
|
||||
begin_at = max(start - SECONDS_TO_WARM, 0)
|
||||
@@ -231,6 +224,8 @@ def clip(
|
||||
'-draw_mouse', '0',
|
||||
'-i', display,
|
||||
'-c:v', 'libx264',
|
||||
'-maxrate', f'{bit_rate_kbps}k',
|
||||
'-bufsize', f'{bit_rate_kbps*2}k',
|
||||
'-crf', '23',
|
||||
'-filter:v', ','.join(overlays),
|
||||
'-preset', 'ultrafast',
|
||||
@@ -239,19 +234,12 @@ def clip(
|
||||
'-movflags', '+faststart',
|
||||
'-f', 'mp4',
|
||||
'-t', str(duration),
|
||||
out,
|
||||
]
|
||||
|
||||
if target_mb > 0:
|
||||
ffmpeg_cmd += ['-maxrate', f'{bit_rate_kbps}k']
|
||||
ffmpeg_cmd += ['-bufsize', f'{bit_rate_kbps*2}k']
|
||||
|
||||
ffmpeg_cmd.append(out)
|
||||
|
||||
replay_cmd = [REPLAY, '-c', '1', '-s', str(begin_at), '--prefix', prefix]
|
||||
replay_cmd = [REPLAY, '--ecam', '-c', '1', '-s', str(begin_at), '--prefix', prefix]
|
||||
if data_dir:
|
||||
replay_cmd.extend(['--data_dir', data_dir])
|
||||
if wide:
|
||||
replay_cmd.append('--ecam')
|
||||
if quality == 'low':
|
||||
replay_cmd.append('--qcam')
|
||||
replay_cmd.append(route.name.canonical_name)
|
||||
@@ -260,7 +248,7 @@ def clip(
|
||||
xvfb_cmd = ['Xvfb', display, '-terminate', '-screen', '0', f'{RESOLUTION}x{PIXEL_DEPTH}']
|
||||
|
||||
with OpenpilotPrefix(prefix, shared_download_cache=True):
|
||||
populate_car_params(lr, developer)
|
||||
populate_car_params(lr)
|
||||
env = os.environ.copy()
|
||||
env['DISPLAY'] = display
|
||||
|
||||
@@ -274,7 +262,7 @@ def clip(
|
||||
with managed_proc(ffmpeg_cmd, env) as ffmpeg_proc:
|
||||
procs.append(ffmpeg_proc)
|
||||
logger.info(f'recording in progress ({duration}s)...')
|
||||
ffmpeg_proc.wait((duration * 2) + PROC_WAIT_SECONDS)
|
||||
ffmpeg_proc.wait(duration + PROC_WAIT_SECONDS)
|
||||
check_for_failure(procs)
|
||||
logger.info(f'recording complete: {Path(out).resolve()}')
|
||||
|
||||
@@ -291,18 +279,15 @@ def main():
|
||||
p.add_argument('-o', '--output', help='output clip to (.mp4)', type=validate_output_file, default=DEFAULT_OUTPUT)
|
||||
p.add_argument('-p', '--prefix', help='openpilot prefix', default=f'clip_{randint(100, 99999)}')
|
||||
p.add_argument('-q', '--quality', help='quality of camera (low = qcam, high = hevc)', choices=['low', 'high'], default='high')
|
||||
p.add_argument('-w', '--wide', help='enable wide view if uploaded', action='store_true',)
|
||||
p.add_argument('-x', '--speed', help='record the clip at this speed multiple', type=int, default=1)
|
||||
p.add_argument('-s', '--start', help='start clipping at <start> seconds', type=int)
|
||||
p.add_argument('-t', '--title', help='overlay this title on the video (e.g. "Chill driving across the Golden Gate Bridge")', type=validate_title)
|
||||
p.add_argument('-z', '--developer', help='developer', type=int, default=0)
|
||||
args = parse_args(p)
|
||||
exit_code = 1
|
||||
try:
|
||||
clip(
|
||||
data_dir=args.data_dir,
|
||||
quality=args.quality,
|
||||
wide=args.wide,
|
||||
prefix=args.prefix,
|
||||
route=args.route,
|
||||
out=args.output,
|
||||
@@ -311,7 +296,6 @@ def main():
|
||||
speed=args.speed,
|
||||
target_mb=args.file_size,
|
||||
title=args.title,
|
||||
developer=args.developer,
|
||||
)
|
||||
exit_code = 0
|
||||
except KeyboardInterrupt as e:
|
||||
|
||||
@@ -191,7 +191,6 @@ void Replay::startStream(const std::shared_ptr<Segment> segment) {
|
||||
auto bytes = words.asBytes();
|
||||
Params().put("CarParams", (const char *)bytes.begin(), bytes.size());
|
||||
Params().put("CarParamsPersistent", (const char *)bytes.begin(), bytes.size());
|
||||
publishMessage(&(*it));
|
||||
} else {
|
||||
rWarning("failed to read CarParams from current segment");
|
||||
}
|
||||
|
||||
63
uv.lock
generated
63
uv.lock
generated
@@ -195,15 +195,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/5b/64/63dbfdd83b31200ac58820a7951ddfdeed1fbee9285b0f3eae12d1357155/azure_storage_blob-12.26.0-py3-none-any.whl", hash = "sha256:8c5631b8b22b4f53ec5fff2f3bededf34cfef111e2af613ad42c9e6de00a77fe", size = 412907, upload-time = "2025-07-16T21:34:09.367Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "blinker"
|
||||
version = "1.9.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/21/28/9b3f50ce0e048515135495f198351908d99540d69bfdc8c1d15b73dc55ce/blinker-1.9.0.tar.gz", hash = "sha256:b4ce2265a7abece45e7cc896e98dbebe6cead56bcf805a3d23136d145f5445bf", size = 22460, upload-time = "2024-11-08T17:25:47.436Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/10/cb/f2ad4230dc2eb1a74edf38f1a38b9b52277f75bef262d8908e60d957e13c/blinker-1.9.0-py3-none-any.whl", hash = "sha256:ba0efaa9080b619ff2f3459d1d500c57bddea4a6b424b60a91141db6fd2f08bc", size = 8458, upload-time = "2024-11-08T17:25:46.184Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "casadi"
|
||||
version = "3.7.1"
|
||||
@@ -484,18 +475,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/47/ef/4cb333825d10317a36a1154341ba37e6e9c087bac99c1990ef07ffdb376f/dictdiffer-0.9.0-py2.py3-none-any.whl", hash = "sha256:442bfc693cfcadaf46674575d2eba1c53b42f5e404218ca2c2ff549f2df56595", size = 16754, upload-time = "2021-07-22T13:24:26.783Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "discord-py"
|
||||
version = "2.5.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "aiohttp" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/7f/dd/5817c7af5e614e45cdf38cbf6c3f4597590c442822a648121a34dee7fa0f/discord_py-2.5.2.tar.gz", hash = "sha256:01cd362023bfea1a4a1d43f5280b5ef00cad2c7eba80098909f98bf28e578524", size = 1054879, upload-time = "2025-03-05T01:15:29.798Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/57/a8/dc908a0fe4cd7e3950c9fa6906f7bf2e5d92d36b432f84897185e1b77138/discord_py-2.5.2-py3-none-any.whl", hash = "sha256:81f23a17c50509ffebe0668441cb80c139e74da5115305f70e27ce821361295a", size = 1155105, upload-time = "2025-03-05T01:15:27.323Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dnspython"
|
||||
version = "2.7.0"
|
||||
@@ -544,23 +523,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/42/14/42b2651a2f46b022ccd948bca9f2d5af0fd8929c4eec235b8d6d844fbe67/filelock-3.19.1-py3-none-any.whl", hash = "sha256:d38e30481def20772f5baf097c122c3babc4fcdb7e14e57049eb9d88c6dc017d", size = 15988, upload-time = "2025-08-14T16:56:01.633Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flask"
|
||||
version = "3.1.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "blinker" },
|
||||
{ name = "click" },
|
||||
{ name = "itsdangerous" },
|
||||
{ name = "jinja2" },
|
||||
{ name = "markupsafe" },
|
||||
{ name = "werkzeug" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/c0/de/e47735752347f4128bcf354e0da07ef311a78244eba9e3dc1d4a5ab21a98/flask-3.1.1.tar.gz", hash = "sha256:284c7b8f2f58cb737f0cf1c30fd7eaf0ccfcde196099d24ecede3fc2005aa59e", size = 753440, upload-time = "2025-05-13T15:01:17.447Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/3d/68/9d4508e893976286d2ead7f8f571314af6c2037af34853a30fd769c02e9d/flask-3.1.1-py3-none-any.whl", hash = "sha256:07aae2bb5eaf77993ef57e357491839f5fd9f4dc281593a81a9e4d79a24f295c", size = 103305, upload-time = "2025-05-13T15:01:15.591Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fonttools"
|
||||
version = "4.59.2"
|
||||
@@ -743,15 +705,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/15/aa/0aca39a37d3c7eb941ba736ede56d689e7be91cab5d9ca846bde3999eba6/isodate-0.7.2-py3-none-any.whl", hash = "sha256:28009937d8031054830160fce6d409ed342816b543597cece116d966c6d99e15", size = 22320, upload-time = "2024-10-08T23:04:09.501Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itsdangerous"
|
||||
version = "2.2.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/9c/cb/8ac0172223afbccb63986cc25049b154ecfb5e85932587206f42317be31d/itsdangerous-2.2.0.tar.gz", hash = "sha256:e0050c0b7da1eea53ffaf149c0cfbb5c6e2e2b69c4bef22c81fa6eb73e5f6173", size = 54410, upload-time = "2024-04-16T21:28:15.614Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/04/96/92447566d16df59b2a776c0fb82dbc4d9e07cd95062562af01e408583fc4/itsdangerous-2.2.0-py3-none-any.whl", hash = "sha256:c6242fc49e35958c8b15141343aa660db5fc54d4f13a1db01a3f5891b98700ef", size = 16234, upload-time = "2024-04-16T21:28:14.499Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jeepney"
|
||||
version = "0.9.0"
|
||||
@@ -1308,8 +1261,6 @@ dependencies = [
|
||||
{ name = "cffi" },
|
||||
{ name = "crcmod" },
|
||||
{ name = "cython" },
|
||||
{ name = "discord-py" },
|
||||
{ name = "flask" },
|
||||
{ name = "dearpygui" },
|
||||
{ name = "future-fstrings" },
|
||||
{ name = "inputs" },
|
||||
@@ -1404,8 +1355,6 @@ requires-dist = [
|
||||
{ name = "dbus-next", marker = "extra == 'dev'" },
|
||||
{ name = "dearpygui", specifier = ">=2.1.0" },
|
||||
{ name = "dictdiffer", marker = "extra == 'dev'" },
|
||||
{ name = "discord-py" },
|
||||
{ name = "flask" },
|
||||
{ name = "future-fstrings" },
|
||||
{ name = "hypothesis", marker = "extra == 'testing'", specifier = "==6.47.*" },
|
||||
{ name = "inputs" },
|
||||
@@ -4993,18 +4942,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/5a/84/44687a29792a70e111c5c477230a72c4b957d88d16141199bf9acb7537a3/websocket_client-1.8.0-py3-none-any.whl", hash = "sha256:17b44cc997f5c498e809b22cdf2d9c7a9e71c02c8cc2b6c56e7c2d1239bfa526", size = 58826, upload-time = "2024-04-23T22:16:14.422Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "werkzeug"
|
||||
version = "3.1.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "markupsafe" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/9f/69/83029f1f6300c5fb2471d621ab06f6ec6b3324685a2ce0f9777fd4a8b71e/werkzeug-3.1.3.tar.gz", hash = "sha256:60723ce945c19328679790e3282cc758aa4a6040e4bb330f53d30fa546d44746", size = 806925, upload-time = "2024-11-08T15:52:18.093Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/52/24/ab44c871b0f07f491e5d2ad12c9bd7358e527510618cb1b803a88e986db1/werkzeug-3.1.3-py3-none-any.whl", hash = "sha256:54b78bf3716d19a65be4fceccc0d1d7b89e608834989dfae50ea87564639213e", size = 224498, upload-time = "2024-11-08T15:52:16.132Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xattr"
|
||||
version = "1.2.0"
|
||||
|
||||
Reference in New Issue
Block a user