Skip to content

Conversation

@emmr253
Copy link

@emmr253 emmr253 commented Dec 10, 2025

No description provided.

import "./App.css";
import LimelightTable from "./LimelightTable";

function App() {

Check failure

Code scanning / ESLint

Enforce naming conventions for everything across a codebase Error

Function name App must match one of the following formats: camelCase
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider making this a variable: const App: FC = () => {}


function App() {
const [message, setMessage] = useState("Loading...");
const [robotOnline, setRobotOnline] = useState(false);

Check failure

Code scanning / ESLint

Enforce naming conventions for everything across a codebase Error

Variable name robotOnline must have one of the following prefixes: is, should, has, can, includes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isRobotOnline


useEffect(() => {
fetch("http://localhost:5000/")
.then((res) => res.text())

Check failure

Code scanning / ESLint

Require any function or method that returns a Promise to be marked async Error

Functions that return promises must be async.
fetch("http://localhost:5000/")
.then((res) => res.text())
.then(setMessage)
.catch((e) => {

Check failure

Code scanning / ESLint

Enforce typing arguments in Promise rejection callbacks as `unknown` Error

Prefer the safe : unknown for a catch callback variable.
Comment on lines 21 to 30
const interval = setInterval(async () => {
try {
const res = await fetch("http://localhost:4590/");
const text = await res.text();
setMessage(text);
setRobotOnline(text.includes("Welcome"));
} catch {
setRobotOnline(false);
}
}, 2000);

Check failure

Code scanning / ESLint

Disallow Promises in places not designed to handle them Error

Promise returned in function argument where a void return was expected.

// Logging
this.ffmpegProcess.stderr?.on("data", (data) => {
console.log(data.toString());

Check warning

Code scanning / ESLint

Disallow member access on a value with type `any` Warning

Unsafe member access .toString on an any value.

const app = express();
const port = 5000;
app.use(cors());

Check warning

Code scanning / ESLint

Disallow calling a value with type `any` Warning

Unsafe call of a(n) error type typed value.
import "./App.css";
import LimelightTable from "./LimelightTable";

function App() {

Check warning

Code scanning / ESLint

Require explicit return and argument types on exported functions' and classes' public class methods Warning

Missing return type on function.
import './index.css'
import App from './App'

createRoot(document.getElementById('root')!).render(

Check warning

Code scanning / ESLint

Disallow non-null assertions using the `!` postfix operator Warning

Forbidden non-null assertion.
import './index.css'
import App from './App'

createRoot(document.getElementById('root')!).render(

Check warning

Code scanning / ESLint

Disallow non-null assertions using the `!` postfix operator Warning

Forbidden non-null assertion.
@Kovler10 Kovler10 changed the title doesn't run but good enough for now limelight-recorder Dec 14, 2025
Copy link
Contributor

@YoniKiriaty YoniKiriaty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Comment on lines +42 to +124
function startRecording() {
if (ffmpegProcessLeft || ffmpegProcessObject || ffmpegProcessRight) {
return;
}

let sessionDir: string;

try {
sessionDir = createSessionFolder();
} catch (err) {
console.error(err);
return;
}

ffmpegProcessLeft = new RecordingProcess(
"left",
path.join(sessionDir, "left.mp4")
);
ffmpegProcessLeft.startRecording();

ffmpegProcessObject = new RecordingProcess(
"object",
path.join(sessionDir, "object.mp4")
);
ffmpegProcessObject.startRecording();

ffmpegProcessRight = new RecordingProcess(
"right",
path.join(sessionDir, "right.mp4")
);
ffmpegProcessRight.startRecording();

console.log(`Recording started in ${sessionDir}`);
}

function stopRecording() {
// Stop left camera
if (ffmpegProcessLeft) {
ffmpegProcessLeft.stopRecording();
ffmpegProcessLeft = null;
console.log("Stopped recording: left");
}

// Stop object camera
if (ffmpegProcessObject) {
ffmpegProcessObject.stopRecording();
ffmpegProcessObject = null;
console.log("Stopped recording: object");
}

// Stop right camera
if (ffmpegProcessRight) {
ffmpegProcessRight.stopRecording();
ffmpegProcessRight = null;
console.log("Stopped recording: right");
}
}

const oneSecond = 1000;
async function pingRobot(robotIp: string) {
const result = await ping.promise.probe(robotIp, { timeout: 10 });
return result;
}
// --- PING CAMERAS ---
setInterval(() => {
async function pingCameras () {
const robotIp = "10.45.90.2";
const isUp = await pingRobot(robotIp).then((res) => res);

if (isUp.alive) {
console.log(`Robot at ${robotIp} is online.`);
startRecording();
}

if (!isUp.alive) {
console.log(`Robot at ${robotIp} is offline.`);
stopRecording();
}
}
pingCameras().catch(() => {
console.error("Couldnt ping cameras");
})
}, oneSecond); No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider making this a function in another file and importing and using it, as using it in the main file is kind of a lot.

Comment on lines +18 to +28
function createSessionFolder(): string {
if (!fs.existsSync(USB_ROOT)) {
throw new Error("USB drive not connected");
}

const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
const sessionDir = path.join(USB_ROOT, `recording-${timestamp}`);

fs.mkdirSync(sessionDir, { recursive: true });
return sessionDir;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider moving this too

Comment on lines +49 to +54
try {
sessionDir = createSessionFolder();
} catch (err) {
console.error(err);
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider moving this try catch into the createSessionFolder function, and return undefined in the createSessionFolder, then return if sessionDir is undefined

Comment on lines +56 to +72
ffmpegProcessLeft = new RecordingProcess(
"left",
path.join(sessionDir, "left.mp4")
);
ffmpegProcessLeft.startRecording();

ffmpegProcessObject = new RecordingProcess(
"object",
path.join(sessionDir, "object.mp4")
);
ffmpegProcessObject.startRecording();

ffmpegProcessRight = new RecordingProcess(
"right",
path.join(sessionDir, "right.mp4")
);
ffmpegProcessRight.startRecording();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code is repetitive. consider using an object to descripe the ffmpegProcesss. Initializing it as {left: undefined, object: undefined, right: undefined}, and then iterating over the object to initialize these.

Comment on lines +79 to +97
if (ffmpegProcessLeft) {
ffmpegProcessLeft.stopRecording();
ffmpegProcessLeft = null;
console.log("Stopped recording: left");
}

// Stop object camera
if (ffmpegProcessObject) {
ffmpegProcessObject.stopRecording();
ffmpegProcessObject = null;
console.log("Stopped recording: object");
}

// Stop right camera
if (ffmpegProcessRight) {
ffmpegProcessRight.stopRecording();
ffmpegProcessRight = null;
console.log("Stopped recording: right");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as iterating here

Comment on lines +17 to +18
const zero = 0;
const one = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const zero = 0;
const one = 1;
const leftCameraIndex = 0;
const objectCameraIndex = 1;

Comment on lines +11 to +15
declare module "react" {
interface InputHTMLAttributes<T> extends HTMLAttributes<T> {
webkitdirectory?: boolean;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't webkitdirectory already in HTMLAttributes?

Comment on lines +27 to +33
await fetch(`http://localhost:5000/record/start/${camera}`, {
method: "POST",
});
} else if (!robotOnline) {
await fetch(`http://localhost:5000/record/stop/${camera}`, {
method: "POST",
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure these ports are the correct ones

const zero = 0;
const one = 1;

async function doThingy(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider naming this something indicative

}

const LimelightTable: React.FC<LimelightTableProps> = ({ robotOnline }) => {
const cameraStatuses = [false, false, false];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider having this as an object: {left: false, object: false, right: false}

@YoniKiriaty YoniKiriaty added the project-init A PR to start off a project label Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

project-init A PR to start off a project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants