Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize be v1.0 #54

Open
wants to merge 18 commits into
base: 34-improvement-backend-improvements-for-typing-tests-modularity-and-pathlib
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
bcf29af
add type hints, replace os with pathlib
prakash-2002-ramanathan Oct 19, 2024
9a5b773
Change directory structure, create backend folder
prakash-2002-ramanathan Oct 19, 2024
3291b21
Ensure consistent JSON communication
prakash-2002-ramanathan Oct 22, 2024
24f1799
Add tests, refactor backend and improve logs
prakash-2002-ramanathan Oct 23, 2024
7b8057b
Merge branch 'main' into reorganize-BE-v1.0
prakash-2002-ramanathan Oct 23, 2024
27053d7
Make the requested changes for PR #34 issue
prakash-2002-ramanathan Oct 31, 2024
692c722
Make final changes to give a proper proper
prakash-2002-ramanathan Oct 31, 2024
8ae4673
Merge branch 'main' into reorganize-BE-v1.0
prakash-2002-ramanathan Oct 31, 2024
af3121e
Move app.py outside of the backedn directory
prakash-2002-ramanathan Nov 6, 2024
49adcd4
remove changs in the core, fix raw print messges
prakash-2002-ramanathan Nov 6, 2024
fe80d9a
Address the todos
prakash-2002-ramanathan Nov 6, 2024
27a0c4f
Add more tests, verify tests are working, improve
prakash-2002-ramanathan Nov 8, 2024
95d411c
Change response_handler and testing
prakash-2002-ramanathan Nov 11, 2024
3e5238d
Fix the tests and the index.html to use pytest
prakash-2002-ramanathan Nov 17, 2024
5401bb0
change port to 8080
prakash-2002-ramanathan Nov 17, 2024
cfc85f3
Merge branch 'main' into reorganize-BE-v1.0
prakash-2002-ramanathan Nov 17, 2024
fd7bfc2
Fix the new frontend with the backend
prakash-2002-ramanathan Nov 17, 2024
a8d9f6e
Change port to 8080
prakash-2002-ramanathan Nov 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions MediaProcessor/src/AudioProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ AudioProcessor::AudioProcessor(const fs::path& inputVideoPath, const fs::path& o
m_processedChunksDir = m_outputPath / "processed_chunks";

m_numChunks = ConfigManager::getInstance().getOptimalThreadCount();
std::cout << "INFO: using " << m_numChunks << " threads." << std::endl;
std::cerr << "INFO: using " << m_numChunks << " threads." << std::endl;
}

bool AudioProcessor::isolateVocals() {
Expand All @@ -41,8 +41,8 @@ bool AudioProcessor::isolateVocals() {
Utils::ensureDirectoryExists(m_outputPath);
Utils::removeFileIfExists(m_outputAudioPath);

std::cout << "Input video path: " << m_inputVideoPath << std::endl;
std::cout << "Output audio path: " << m_outputAudioPath << std::endl;
std::cerr << "Input video path: " << m_inputVideoPath << std::endl;
std::cerr << "Output audio path: " << m_outputAudioPath << std::endl;

if (!extractAudio()) {
return false;
Expand Down Expand Up @@ -92,7 +92,7 @@ bool AudioProcessor::extractAudio() {
return false;
}

std::cout << "Audio extracted successfully to: " << m_outputAudioPath << std::endl;
std::cerr << "Audio extracted successfully to: " << m_outputAudioPath << std::endl;
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions MediaProcessor/src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ std::pair<std::filesystem::path, std::filesystem::path> prepareOutputPaths(

bool ensureDirectoryExists(const std::filesystem::path &path) {
if (!std::filesystem::exists(path)) {
std::cout << "Output directory does not exist, creating it: " << path << std::endl;
std::cerr << "Output directory does not exist, creating it: " << path << std::endl;
std::filesystem::create_directories(path);
return true;
}
Expand All @@ -59,7 +59,7 @@ bool ensureDirectoryExists(const std::filesystem::path &path) {

bool removeFileIfExists(const std::filesystem::path &filePath) {
if (std::filesystem::exists(filePath)) {
std::cout << "File already exists, removing it: " << filePath << std::endl;
std::cerr << "File already exists, removing it: " << filePath << std::endl;
std::filesystem::remove(filePath);
return true;
}
Expand Down
6 changes: 3 additions & 3 deletions MediaProcessor/src/VideoProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ VideoProcessor::VideoProcessor(const fs::path& videoPath, const fs::path& audioP
bool VideoProcessor::mergeMedia() {
Utils::removeFileIfExists(m_outputPath); // to avoid interactive ffmpeg prompt

std::cout << "Merging video and audio..." << std::endl;
std::cerr << "Merging video and audio..." << std::endl;

// Prepare FFmpeg command
CommandBuilder cmd;
Expand All @@ -38,15 +38,15 @@ bool VideoProcessor::mergeMedia() {

std::string ffmpegCommand = cmd.build();

std::cout << "Running FFmpeg command: " << ffmpegCommand << std::endl;
std::cerr << "Running FFmpeg command: " << ffmpegCommand << std::endl;
bool success = Utils::runCommand(ffmpegCommand);

if (!success) {
std::cerr << "Error: Failed to merge audio and video using FFmpeg." << std::endl;
return false;
}

std::cout << "Merging completed successfully." << std::endl;
std::cerr << "Merging completed successfully." << std::endl;

return true;
}
Expand Down
12 changes: 7 additions & 5 deletions MediaProcessor/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#include <filesystem>
#include <iostream>
#include <nlohmann/json.hpp>
#include <string>

#include "AudioProcessor.h"
#include "CommunicationHandler.h"
#include "ConfigManager.h"
#include "Utils.h"
#include "VideoProcessor.h"

namespace fs = std::filesystem;

using namespace MediaProcessor;

int main(int argc, char* argv[]) {
Expand All @@ -29,15 +30,16 @@ int main(int argc, char* argv[]) {
*
* Usage: <executable> <video_file_path>
*/

if (argc != 2) {
std::cerr << "Usage: " << argv[0] << " <video_file_path>" << std::endl;
if (argc != 3) {
std::cerr << "Usage: " << argv[0] << " <video_file_path> <config_file_path>" << std::endl;
return 1;
}

fs::path inputMediaPath = fs::absolute(argv[1]);
fs::path configFilePath = fs::absolute(argv[2]);

ConfigManager& configManager = ConfigManager::getInstance();
if (!configManager.loadConfig("config.json")) {
if (!configManager.loadConfig(configFilePath)) {
std::cerr << "Error: Could not load configuration." << std::endl;
return 1;
}
Expand Down
193 changes: 0 additions & 193 deletions app.py

This file was deleted.

Empty file added backend/__init__.py
Empty file.
Loading