Merge branch 'develop'

This commit is contained in:
Jarosław Wieczorek 2020-12-22 11:40:43 +01:00
commit b9ff22a1ad
39 changed files with 4451 additions and 500 deletions

10
.gitignore vendored
View File

@ -5,7 +5,7 @@ __pycache__/
# C extensions
*.so
out/*
# Distribution / packaging
.Python
build/
@ -135,4 +135,10 @@ dmypy.json
.pytype/
# Cython debug symbols
cython_debug/
cython_debug/
# project_files
src/sounds/*
node_modules/

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

24
Dockerfile Normal file
View File

@ -0,0 +1,24 @@
FROM alpine:3.9 AS build
WORKDIR /opt/app/MagicPodcast
# Install Python and external dependencies, including headers and GCC
RUN apk add --no-cache python3 python3-dev py3-pip libffi libffi-dev musl-dev gcc
# Install Pipenv
RUN pip3 install pipenv
# Create a virtual environment and activate it
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH" VIRTUAL_ENV="/opt/venv"
# Install dependencies into the virtual environment with Pipenv
COPY Pipfile Pipfile.lock /opt/app/MagicPodcast
RUN pipenv install --deploy
FROM alpine:3.9
WORKDIR /opt/app/MagicPodcast
# Install Python and external runtime dependencies only
RUN apk add --no-cache python3 libffi
# Copy the virtual environment from the previous image
COPY --from=build /opt/venv /opt/venv
# Activate the virtual environment
ENV PATH="/opt/venv/bin:$PATH" VIRTUAL_ENV="/opt/venv"
# Copy your application
COPY . /opt/app/MagicPodcast

18
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,18 @@
pipeline {
agent { docker { image 'python:3.9' } }
stages {
stage('build') {
steps {
sh 'pip install pipenv'
sh 'pipenv shell --python 3.9'
sh 'pipenv run pip install -r requirements.txt'
}
}
stage('test') {
steps {
sh './run_tests.sh'
}
}
}
}

View File

@ -4,6 +4,12 @@ verify_ssl = true
name = "pypi"
[packages]
pyqt5 = "*"
flask = "*"
pipfile-requirements = "*"
pylama = "*"
ffmpeg = "*"
pip = "*"
[dev-packages]

207
Pipfile.lock generated
View File

@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "a36a5392bb1e8bbc06bfaa0761e52593cf2d83b486696bf54667ba8da616c839"
"sha256": "a59428c79a266fc1237cdd4e74b0803bb5f39803495f1fc6c134df7333cdc2bc"
},
"pipfile-spec": 6,
"requires": {
@ -15,6 +15,209 @@
}
]
},
"default": {},
"default": {
"click": {
"hashes": [
"sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a",
"sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"version": "==7.1.2"
},
"ffmpeg": {
"hashes": [
"sha256:6931692c890ff21d39938433c2189747815dca0c60ddc7f9bb97f199dba0b5b9"
],
"index": "pypi",
"version": "==1.4"
},
"flask": {
"hashes": [
"sha256:4efa1ae2d7c9865af48986de8aeb8504bf32c7f3d6fdc9353d34b21f4b127060",
"sha256:8a4fdd8936eba2512e9c85df320a37e694c93945b33ef33c89946a340a238557"
],
"index": "pypi",
"version": "==1.1.2"
},
"itsdangerous": {
"hashes": [
"sha256:321b033d07f2a4136d3ec762eac9f16a10ccd60f53c0c91af90217ace7ba1f19",
"sha256:b12271b2047cb23eeb98c8b5622e2e5c5e9abd9784a153e9d8ef9cb4dd09d749"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==1.1.0"
},
"jinja2": {
"hashes": [
"sha256:89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0",
"sha256:f0a4641d3cf955324a89c04f3d94663aa4d638abe8f733ecd3582848e1c37035"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"version": "==2.11.2"
},
"markupsafe": {
"hashes": [
"sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473",
"sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161",
"sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235",
"sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5",
"sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42",
"sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff",
"sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b",
"sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1",
"sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e",
"sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183",
"sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66",
"sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b",
"sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1",
"sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15",
"sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1",
"sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e",
"sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b",
"sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905",
"sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735",
"sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d",
"sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e",
"sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d",
"sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c",
"sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21",
"sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2",
"sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5",
"sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b",
"sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6",
"sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f",
"sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f",
"sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2",
"sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7",
"sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==1.1.1"
},
"mccabe": {
"hashes": [
"sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42",
"sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"
],
"version": "==0.6.1"
},
"packaging": {
"hashes": [
"sha256:24e0da08660a87484d1602c30bb4902d74816b6985b93de36926f5bc95741858",
"sha256:78598185a7008a470d64526a8059de9aaa449238f280fc9eb6b13ba6c4109093"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==20.8"
},
"pipfile-requirements": {
"hashes": [
"sha256:d47591d46d8bfecf9257967992feae31fa83aff7ab6417373c7de5ea92ab849f",
"sha256:dc2ff7515ce35f8b37a500e87e7b9cd39f0f5c18eb6024543366eb6d4226869b"
],
"index": "pypi",
"version": "==0.3.0"
},
"pycodestyle": {
"hashes": [
"sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367",
"sha256:c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==2.6.0"
},
"pydocstyle": {
"hashes": [
"sha256:19b86fa8617ed916776a11cd8bc0197e5b9856d5433b777f51a3defe13075325",
"sha256:aca749e190a01726a4fb472dd4ef23b5c9da7b9205c0a7857c06533de13fd678"
],
"markers": "python_version >= '3.5'",
"version": "==5.1.1"
},
"pyflakes": {
"hashes": [
"sha256:0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92",
"sha256:35b2d75ee967ea93b55750aa9edbbf72813e06a66ba54438df2cfac9e3c27fc8"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==2.2.0"
},
"pylama": {
"hashes": [
"sha256:9bae53ef9c1a431371d6a8dca406816a60d547147b60a4934721898f553b7d8f",
"sha256:fd61c11872d6256b019ef1235be37b77c922ef37ac9797df6bd489996dddeb15"
],
"index": "pypi",
"version": "==7.7.1"
},
"pyparsing": {
"hashes": [
"sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1",
"sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"
],
"markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==2.4.7"
},
"pyqt5": {
"hashes": [
"sha256:29889845688a54d62820585ad5b2e0200a36b304ff3d7a555e95599f110ba4ce",
"sha256:372b08dc9321d1201e4690182697c5e7ffb2e0770e6b4a45519025134b12e4fc",
"sha256:894ca4ae767a8d6cf5903784b71f755073c78cb8c167eecf6e4ed6b3b055ac6a",
"sha256:ea24f24b7679bf393dd2e4f53fe0ce65021be18304c1ff7a226c2fc5c356d0da",
"sha256:faaecb76ec65e12673a968e7f5bc02495957e6996f0a3fa0d98895f9e4113746"
],
"index": "pypi",
"version": "==5.15.2"
},
"pyqt5-sip": {
"hashes": [
"sha256:0304ca9114b9817a270f67f421355075b78ff9fc25ac58ffd72c2601109d2194",
"sha256:0cd969be528c27bbd4755bd323dff4a79a8fdda28215364e6ce3e069cb56c2a9",
"sha256:2f35e82fd7ec1e1f6716e9154721c7594956a4f5bd4f826d8c6a6453833cc2f0",
"sha256:30e944db9abee9cc757aea16906d4198129558533eb7fadbe48c5da2bd18e0bd",
"sha256:34dcd29be47553d5f016ff86e89e24cbc5eebae92eb2f96fb32d2d7ba028c43c",
"sha256:5a011aeff89660622a6d5c3388d55a9d76932f3b82c95e82fc31abd8b1d2990d",
"sha256:6c1ebee60f1d2b3c70aff866b7933d8d8d7646011f7c32f9321ee88c290aa4f9",
"sha256:7b81382ce188d63890a0e35abe0f9bb946cabc873a31873b73583b0fc84ac115",
"sha256:832fd60a264de4134c2824d393320838f3ab648180c9c357ec58a74524d24507",
"sha256:84ba7746762bd223bed22428e8561aa267a229c28344c2d28c5d5d3f8970cffb",
"sha256:9312ec47cac4e33c11503bc1cbeeb0bdae619620472f38e2078c5a51020a930f",
"sha256:a1b8ef013086e224b8e86c93f880f776d01b59195bdfa2a8e0b23f0480678fec",
"sha256:a29e2ac399429d3b7738f73e9081e50783e61ac5d29344e0802d0dcd6056c5a2",
"sha256:b6d42250baec52a5f77de64e2951d001c5501c3a2df2179f625b241cbaec3369",
"sha256:bb5a87b66fc1445915104ee97f7a20a69decb42f52803e3b0795fa17ff88226c",
"sha256:c317ab1263e6417c498b81f5c970a9b1af7acefab1f80b4cc0f2f8e661f29fc5",
"sha256:c9800729badcb247765e4ffe2241549d02da1fa435b9db224845bc37c3e99cb0",
"sha256:c9d6d448c29dc6606bb7974696608f81f4316c8234f7c7216396ed110075e777",
"sha256:da9c9f1e65b9d09e73bd75befc82961b6b61b5a3b9d0a7c832168e1415f163c6",
"sha256:ed897c58acf4a3cdca61469daa31fe6e44c33c6c06a37c3f21fab31780b3b86a",
"sha256:f168f0a7f32b81bfeffdf003c36f25d81c97dee5eb67072a5183e761fe250f13"
],
"markers": "python_version >= '3.5'",
"version": "==12.8.1"
},
"snowballstemmer": {
"hashes": [
"sha256:209f257d7533fdb3cb73bdbd24f436239ca3b2fa67d56f6ff88e86be08cc5ef0",
"sha256:df3bac3df4c2c01363f3dd2cfa78cce2840a79b9f1c2d2de9ce8d31683992f52"
],
"version": "==2.0.0"
},
"toml": {
"hashes": [
"sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b",
"sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"
],
"markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==0.10.2"
},
"werkzeug": {
"hashes": [
"sha256:2de2a5db0baeae7b2d2664949077c2ac63fbd16d98da0ff71837f7d1dea3fd43",
"sha256:6c80b1e5ad3665290ea39320b91e1be1e0d5f60652b964a3070216de83d2e47c"
],
"markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"version": "==1.0.1"
}
},
"develop": {}
}

56
find-loudness.ts Normal file
View File

@ -0,0 +1,56 @@
import { createReadStream } from "fs";
export type SwapPoint = {
position_start: number;
duration: number;
loud: boolean;
label: string;
};
export default async function (
file: import("fs").PathLike,
threshold_at_point: number,
inertia_samples: number,
label: string
): Promise<SwapPoint[]> {
const stream = createReadStream(file);
let position = 0;
const results: SwapPoint[] = [];
let last_swap_position = 0;
let keep_loud_until = 0;
let was_loud_last_time = false;
return new Promise((resolve, reject) => {
stream.on("readable", () => {
let chunk: Buffer | null;
while ((chunk = stream.read()) !== null) {
for (let i = 0; i < chunk.byteLength; i++) {
position++;
const byte = chunk[i];
const volume = Math.abs(byte - 128);
if (position >= keep_loud_until) {
const is_loud: boolean = volume > threshold_at_point;
if (is_loud != was_loud_last_time) {
const swap_point = {
position_start: last_swap_position,
duration: position - last_swap_position,
loud: was_loud_last_time,
label,
};
results.push(swap_point);
last_swap_position = position;
was_loud_last_time = is_loud;
}
}
if (volume > threshold_at_point) {
keep_loud_until = position + inertia_samples;
}
}
}
});
stream.on("end", () => {
resolve(results);
});
stream.on("error", reject);
});
}

98
generate-demuxer.ts Normal file
View File

@ -0,0 +1,98 @@
const yargs = require('yargs');
const argv = yargs
.command('tmp_dir', 'Path to temporary dir', {
description: 'the year to check for',
alias: 'tmp',
type: 'string',
}
)
.argv;
//console.log("The current temporary dir is: ${argv.tmp_dir}");
import findLoudness, { SwapPoint } from "./find-loudness";
const graph_density = 8000;
const threshold_at_point = 1;
const inertia_s = 0.3;
const inertia_samples = inertia_s * graph_density;
const s = (n: number) => n / graph_density;
const minutes = (units: number) => Math.floor(s(units) / 60);
const hours = (units: number) => Math.floor(units / graph_density / 60 / 60);
const formatTime = (units: number) =>
`${hours(units)}:${minutes(units)}:${Math.floor(s(units) % 60)}`;
type Mode = { left: boolean; right: boolean };
async function run() {
const [left_breaks, right_breaks] = await Promise.all([
findLoudness(argv.tmp_dir + "/leftraw",
threshold_at_point,
inertia_samples,
"left"
),
findLoudness(
argv.tmp_dir + "/rightraw",
threshold_at_point,
inertia_samples,
"right"
),
]);
const merged = [...left_breaks, ...right_breaks].sort((a, b) =>
a.position_start < b.position_start
? -1
: a.position_start > b.position_start
? 1
: 0
);
// console.log("left breaks:", left_breaks);
// console.log(`right_breaks`, right_breaks);
// console.log(`merged`, merged);
function new_mode(m: Mode, s: SwapPoint): Mode {
return { ...m, [s.label]: s.loud };
}
function mode_to_string(mode: Mode) {
if (mode.left && mode.right) {
return "both";
}
for (const side of ["left", "right"]) {
if (mode[side as keyof Mode]) {
return side;
}
}
return "none";
}
console.log("file", `${argv.tmp_dir}/pics/none.png`);
let last_point = 0;
let mode: Mode = { left: false, right: false };
let last_file;
let total = 0;
for (let i = 2; i < merged.length; i++) {
const point = merged[i];
mode = new_mode(mode, point);
const file = `${argv.tmp_dir}/pics/${mode_to_string(mode)}.png`;
const duration = (point.position_start - last_point) / graph_density;
console.log(
"duration",
(point.position_start - last_point) / graph_density
);
console.log("file", file);
last_point = point.position_start;
last_file = file;
total += duration * graph_density;
}
console.log("duration", merged[merged.length - 1].duration / graph_density);
console.log("file", last_file);
console.error(total, formatTime(total));
}
run();

43
generate.sh Normal file
View File

@ -0,0 +1,43 @@
#!/bin/bash
tmp_dir=$1
audio_left=$2
audio_right=$3
both_image=$4
none_image=$5
left_image=$6
right_image=$7
aresample=$8
echo "tmp_dir: $1";
echo "audio_left: $2";
echo "audio_right: $3";
echo "both_image: $4";
echo "none_image: $5";
echo "left_image: $6";
echo "right_image: $7";
echo "aresample: $8";
echo "dzielimy mp3 na dwa osobne wav"
ffmpeg -i $audio_left -map_channel 0.0.0 $tmp_dir/left.wav -map_channel 0.0.1 $tmp_dir/right.wav
echo "na dwóch wątkach generujemy surowe pliki"
ffmpeg -i $tmp_dir/left.wav -ac 1 -filter:a aresample=$aresample -map 0:a -c:a pcm_u8 -f data - > $tmp_dir/leftraw &
ffmpeg -i $tmp_dir/right.wav -ac 1 -filter:a aresample=$aresample -map 0:a -c:a pcm_u8 -f data - > $tmp_dir/rightraw &
# czekamy aż obydwa wątki się zakończą
wait;
echo "generating the demuxers...";
# generuje ścieżki do złożenia przez ffmpega:
mkdir -p ./out
ts-node generate-demuxer.ts --tmp_dir=$tmp_dir > ./out/demuxer.txt
echo "generowanie całości"
ffmpeg -y -f concat -safe 0 -i ./out/demuxer.txt -r 30 -tune stillimage -vsync vfr -pix_fmt yuv420p ./out/video.mp4
# ^ daję safe 0 aby przyjmowało bezwzględne ścieżki
echo "łączenie video z dźwiękiem:"
ffmpeg -i ./out/video.mp4 -i $audio_left -ac 1 -tune stillimage ./out/video-and-audio.mp4

View File

@ -1,9 +1,12 @@
#!/bin/bash
for file in $(ls ./src/ui)
for file in ./src/gui/ui/*.ui
do
output_file=$(echo $file | sed -e 's/\..*$//')
pipenv run python -m PyQt5.uic.pyuic -x ./src/ui/$file -o ./src/python/ui/$output_file'_ui.py'
echo "$file"
[[ -e "$file" ]] || break
output_file="$(basename -s .ui "$file")"
echo "$output_file";
pipenv run python -m PyQt5.uic.pyuic -x "$file" -o ./src/python/ui/"$output_file"'_ui.py';
done;

10
main.py
View File

@ -0,0 +1,10 @@
from src.python.classes.mainwindow import MainWindow
from PyQt5.QtWidgets import QApplication
import sys
if __name__ == '__main__':
app = QApplication(sys.argv)
w = MainWindow()
w.show()
sys.exit(app.exec_())

2528
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

18
package.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "vizualizer",
"version": "1.0.0",
"description": "ffmpeg -i odcinek1-kuba.wav -ac 1 -filter:a aresample=8000 -map 0:a -c:a pcm_s16le -f data - | hexdump",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "^14.0.1"
},
"dependencies": {
"editly": "^0.3.0",
"yargs": "^16.2.0"
}
}

9
pylama.ini Normal file
View File

@ -0,0 +1,9 @@
[pylama]
linters = pep8,pyflakes
format = pylint
skip = *_ui.py
#ignore = E201,E202,E231,E701
[pep8]
max_line_length = 200

19
requirements.txt Normal file
View File

@ -0,0 +1,19 @@
click==7.1.2
ffmpeg==1.4
Flask==1.1.2
itsdangerous==1.1.0
Jinja2==2.11.2
MarkupSafe==1.1.1
mccabe==0.6.1
packaging==20.8
pipfile-requirements==0.3.0
pycodestyle==2.6.0
pydocstyle==5.1.1
pyflakes==2.2.0
pylama==7.7.1
pyparsing==2.4.7
PyQt5==5.15.2
PyQt5-sip==12.8.1
snowballstemmer==2.0.0
toml==0.10.2
Werkzeug==1.0.1

5
run_tests.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
pipenv run python -m unittest discover -s ./tests/ -p 'test_*.py'

View File

BIN
src/gui/images/both.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 MiB

BIN
src/gui/images/left.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 MiB

View File

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

BIN
src/gui/images/none.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 MiB

BIN
src/gui/images/right.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 MiB

0
src/gui/ui/__init__.py Normal file
View File

710
src/gui/ui/mainwindow.ui Normal file
View File

@ -0,0 +1,710 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>554</width>
<height>745</height>
</rect>
</property>
<property name="windowTitle">
<string>MagicPodcast</string>
</property>
<widget class="QWidget" name="central_widget">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="h_layout_select_audio_1">
<item>
<widget class="QLineEdit" name="line_edit_audio_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>Plik audio 1 rozmówcy</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="line_edit_name_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>Imię 1 rozmówcy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_audio_1">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Dodaj audio 1</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="h_layout_select_audio_2">
<item>
<widget class="QLineEdit" name="line_edit_audio_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>Plik audio 2 rozmówcy</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="line_edit_name_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>Imię 2 rozmówcy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_audio_2">
<property name="minimumSize">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Dodaj audio 2</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="check_box_connected_channels">
<property name="text">
<string>Zaznacz jeśli kanały rozmówców są połączone w jednym nagraniu</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="h_line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="w_layout_avatars_1_and_2">
<item>
<layout class="QVBoxLayout" name="w_layout_avatar_1">
<item>
<widget class="QLabel" name="preview_label_avatar_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>150</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>150</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string>Podgląd - rozmówcy aktywni</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="path" stdset="0">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_select_avatar_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>35</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>Rozmówcy - aktywni</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="h_spacer_1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="w_layout_avatar_2">
<item>
<widget class="QLabel" name="preview_label_avatar_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>150</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>150</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string>Podgląd - rozmówcy nieaktywni</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="path" stdset="0">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_select_avatar_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>35</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>Rozmówcy - nieaktywni</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="v_spacer_1">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="w_layout_avatars_3_and_4">
<item>
<layout class="QVBoxLayout" name="w_layout_avatar_3">
<item>
<widget class="QLabel" name="preview_label_avatar_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>150</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>150</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string>Podgląd - 1 rozmówca aktywny</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="path" stdset="0">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_select_avatar_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>35</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>Pierwszy rozmówca - aktywny</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="h_spacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="w_layout_avatar_4">
<item>
<widget class="QLabel" name="preview_label_avatar_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>150</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>150</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string>Podgląd - 2 rozmówca aktywny</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="path" stdset="0">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_select_avatar_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>35</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>35</height>
</size>
</property>
<property name="text">
<string>Drugi rozmówca - aktywny</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="Line" name="h_line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="h_layout_threshold">
<item>
<widget class="QLabel" name="label_threshold_description">
<property name="minimumSize">
<size>
<width>200</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>250</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>Poziom wykrywania głosu:</string>
</property>
</widget>
</item>
<item>
<widget class="QLCDNumber" name="lcd_number_of_threshold">
<property name="minimumSize">
<size>
<width>0</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>50</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="smallDecimalPoint">
<bool>false</bool>
</property>
<property name="digitCount">
<number>3</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Filled</enum>
</property>
<property name="intValue" stdset="0">
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QSlider" name="h_slider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="Line" name="h_line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="h_layout_preview_or_generate">
<item>
<widget class="QPushButton" name="button_preview">
<property name="text">
<string>Podgląd</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="button_generate">
<property name="text">
<string>Wygeneruj podcast</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
<zorder>h_line</zorder>
<zorder>h_line_2</zorder>
<zorder>h_slider</zorder>
<zorder>h_line_3</zorder>
<zorder>v_spacer_1</zorder>
<zorder>check_box_connected_channels</zorder>
</widget>
<widget class="QMenuBar" name="menu_bar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>554</width>
<height>32</height>
</rect>
</property>
<widget class="QMenu" name="menu_project">
<property name="title">
<string>Projekt</string>
</property>
<addaction name="action_new"/>
<addaction name="action_open"/>
<addaction name="action_save"/>
<addaction name="action_save_as"/>
<addaction name="separator"/>
<addaction name="action_settings"/>
<addaction name="action_about"/>
<addaction name="separator"/>
<addaction name="action_exit"/>
</widget>
<addaction name="menu_project"/>
</widget>
<widget class="QStatusBar" name="status_bar"/>
<action name="action_new">
<property name="text">
<string>Nowy projekt</string>
</property>
<property name="toolTip">
<string>Kliknij, aby utwórzyć nowy projekt</string>
</property>
<property name="shortcut">
<string>Ctrl+N</string>
</property>
</action>
<action name="action_open">
<property name="text">
<string>Otwórz projekt</string>
</property>
<property name="toolTip">
<string>Kliknij, aby otworzyć istniejący projekt</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
</property>
</action>
<action name="action_save">
<property name="text">
<string>Zapisz projekt</string>
</property>
<property name="toolTip">
<string>Kliknij, aby zapisać aktualny projekt</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
<action name="action_save_as">
<property name="text">
<string>Zapisz projekt jako</string>
</property>
<property name="toolTip">
<string>Kliknij, aby zapisać projekt jako</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+S</string>
</property>
</action>
<action name="action_exit">
<property name="text">
<string>Zamknij program</string>
</property>
<property name="toolTip">
<string>Kliknij, aby zakończyć działanie programu</string>
</property>
<property name="shortcut">
<string>Ctrl+W</string>
</property>
</action>
<action name="action_settings">
<property name="text">
<string>Ustawienia</string>
</property>
<property name="toolTip">
<string>Kliknij, aby przejść do ustawień programu</string>
</property>
<property name="shortcut">
<string>Ctrl+U</string>
</property>
</action>
<action name="action_about">
<property name="text">
<string>O programie MagicPodcast</string>
</property>
<property name="toolTip">
<string>Kliknij, aby wyświetlić informacje dotyczące programu MagicPodcast</string>
</property>
<property name="shortcut">
<string>Ctrl+I</string>
</property>
</action>
</widget>
<resources/>
<connections>
<connection>
<sender>action_exit</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>430</x>
<y>387</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>dialog</class>
<widget class="QDialog" name="dialog">
<property name="windowModality">
<enum>Qt::NonModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>782</width>
<height>356</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QVBoxLayout" name="vertical_layout">
<item>
<widget class="QGraphicsView" name="graphics_view"/>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="range_silder">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBothSides</enum>
</property>
<property name="tickInterval">
<number>1</number>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontal_layout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Początek fragmentu</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="line_edit"/>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Koniec fragemntu</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="line_edit_2"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontal_layout_3">
<item>
<widget class="QPushButton" name="push_button">
<property name="text">
<string>start</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="push_button_2">
<property name="text">
<string>stop</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="push_button_3">
<property name="text">
<string>zakończ</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

0
src/python/__init__.py Normal file
View File

View File

View File

@ -1,9 +1,177 @@
from pyqt5 import *
from src.python.ui import Ui_MainWindow
class MainWindow(Ui_MainWindow):
def init(self):
super()
from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import QMainWindow, QLabel,\
QFileDialog, QDialog, QDialogButtonBox, QVBoxLayout, QCheckBox
from PyQt5.QtCore import Qt
from src.python.ui.mainwindow_ui import Ui_MainWindow
import tempfile
import subprocess
import os
import shutil
class MainWindow(QMainWindow, Ui_MainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent=parent)
self.setupUi(self)
self.setup_logic()
self.setup_detail()
self.aresample = 8000
self.test_data()
def setup_logic(self):
self.button_audio_1.clicked.connect(lambda: self.open_audio_import(audio_number=1))
self.button_audio_2.clicked.connect(lambda: self.open_audio_import(audio_number=2))
self.check_box_connected_channels.stateChanged.connect(self.channels_connected)
self.button_select_avatar_1.clicked.connect(lambda: self.open_image_import(image_number=1))
self.button_select_avatar_2.clicked.connect(lambda: self.open_image_import(image_number=2))
self.button_select_avatar_3.clicked.connect(lambda: self.open_image_import(image_number=3))
self.button_select_avatar_4.clicked.connect(lambda: self.open_image_import(image_number=4))
self.button_generate.clicked.connect(self.generate_video_podcast)
self.check_box_connected_channels.setChecked(True)
def setup_detail(self):
self.line_edit_name_1.setDisabled(True)
self.line_edit_name_2.setDisabled(True)
def create_custom_dialog(self, title: str, msg: str):
dialog = QDialog()
dialog.setWindowTitle(title)
label = QLabel()
label.setText(msg)
label.setObjectName('message_box')
buttons = QDialogButtonBox.Ok
button_box = QDialogButtonBox(buttons)
button_box.accepted.connect(dialog.accept)
layout = QVBoxLayout()
layout.addWidget(label)
layout.addWidget(button_box)
dialog.setLayout(layout)
return dialog
def test_data(self):
self.line_edit_audio_1.setText('./src/sounds/oba_kanały.mp3')
self.preview_label_avatar_1.setProperty('path', './src/gui/images/both.png')
self.preview_label_avatar_2.setProperty('path', './src/gui/images/none.png')
self.preview_label_avatar_3.setProperty('path', './src/gui/images/left.png')
self.preview_label_avatar_4.setProperty('path', './src/gui/images/right.png')
def open_image_import(self, image_number: int):
dialog = QFileDialog()
dialog.setOption(dialog.DontUseNativeDialog, True)
dialog.setFileMode(QFileDialog.ExistingFile)
file_formats = "All Files (*);;JPG (*.jpg);;PNG (*.png)"
file, _ = dialog.getOpenFileName(self, "QFileDialog.getOpenFileName()", "", file_formats, options=dialog.options())
if not file:
msg = "[!] Nie wybrano żadnego pliku."
dialog = self.create_custom_dialog(title='Ostrzeżenie', msg=msg)
dialog.exec_()
if file and not file.lower().endswith('.jpg') and not file.lower().endswith('.png'):
msg = F"[!] Plik {file} nie jest plikiem jpg/png."
dialog = self.create_custom_dialog(title='Błąd', msg=msg)
dialog.exec_()
else:
if file:
pixmap = QPixmap(file)
scaled_pixmap = pixmap.scaled(pixmap.size(), Qt.KeepAspectRatio)
if image_number == 1:
self.preview_label_avatar_1.setProperty('path', file)
self.preview_label_avatar_1.setPixmap(scaled_pixmap)
elif image_number == 2:
self.preview_label_avatar_2.setProperty('path', file)
self.preview_label_avatar_2.setPixmap(scaled_pixmap)
elif image_number == 3:
self.preview_label_avatar_3.setProperty('path', file)
self.preview_label_avatar_3.setPixmap(scaled_pixmap)
elif image_number == 4:
self.preview_label_avatar_4.setProperty('path', file)
self.preview_label_avatar_4.setPixmap(scaled_pixmap)
print(F"[*] Zaimportowano garfikę {image_number} z pliku: '{file}'.")
print(F"[*] Rodzielczość grafiki: {pixmap.width()}x{pixmap.height()}")
def open_audio_import(self, audio_number: int):
dialog = QFileDialog()
dialog.setOption(dialog.DontUseNativeDialog, True)
dialog.setFileMode(QFileDialog.ExistingFile)
file_formats = "All Files (*);;mp3 (*.mp3);;wav (*.wav)"
file, _ = dialog.getOpenFileName(self, "QFileDialog.getOpenFileName()", "", file_formats, options=dialog.options())
if not file:
msg = "[!] Nie wybrano żadnego pliku."
dialog = self.create_custom_dialog(title='Ostrzeżenie', msg=msg)
dialog.exec_()
elif not file.lower().endswith('.mp3') and not file.lower().endswith('.wav'):
msg = F"[!] Plik {file} nie jest plikiem mp3/wav."
dialog = self.create_custom_dialog(title='Błąd', msg=msg)
dialog.exec_()
else:
if audio_number == 1:
self.line_edit_audio_1.setText(file)
elif audio_number == 2:
self.line_edit_audio_2.setText(file)
print(F"[*] Zaimportowano ścieżkę {audio_number} pliku: '{file}'.")
def channels_connected(self, checked):
print(checked)
if checked:
self.button_audio_2.setDisabled(True)
self.line_edit_audio_2.setDisabled(True)
self.line_edit_audio_1.setPlaceholderText("Plik audio rozmówców")
else:
self.button_audio_2.setDisabled(False)
self.line_edit_audio_2.setDisabled(False)
self.line_edit_audio_1.setPlaceholderText("Plik audio 1 rozmówcy")
def generate_video_podcast(self):
# TODO: Change to pure python
"""Generate podcast based on values from UI."""
audio_1 = self.line_edit_audio_1.text()
audio_2 = self.line_edit_audio_2.text()
both_image = self.preview_label_avatar_1.property('path')
none_image = self.preview_label_avatar_2.property('path')
left_image = self.preview_label_avatar_3.property('path')
right_image = self.preview_label_avatar_4.property('path')
with tempfile.TemporaryDirectory() as tmp_dir_name:
print('[*] Created temporary directory', tmp_dir_name)
pics_dir = tmp_dir_name + "/pics/"
print(f'[*] Created pics directory in {tmp_dir_name}')
os.mkdir(pics_dir)
print(f'[*] Copy images to {pics_dir}')
shutil.copy(both_image, pics_dir + "both.png")
shutil.copy(none_image, pics_dir + "none.png")
shutil.copy(left_image, pics_dir + "left.png")
shutil.copy(right_image, pics_dir + "right.png")
print(f'[*] Images in {pics_dir}: {os.listdir(pics_dir)}')
echo_temp_dir_name = subprocess.check_output(["echo", tmp_dir_name]).decode('utf-8')
ech = subprocess.check_output(["bash", "./generate.sh",
tmp_dir_name,
audio_1, audio_2,
both_image, none_image,
left_image, right_image,
str(self.aresample)]).decode('utf-8')
print(echo_temp_dir_name)
print(ech)
pass

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './src/ui/mainwindow.ui'
# Form implementation generated from reading ui file './src/gui/ui/mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
@ -14,77 +14,200 @@ from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(861, 775)
MainWindow.resize(554, 745)
self.central_widget = QtWidgets.QWidget(MainWindow)
self.central_widget.setMinimumSize(QtCore.QSize(700, 540))
self.central_widget.setMinimumSize(QtCore.QSize(0, 0))
self.central_widget.setObjectName("central_widget")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.central_widget)
self.verticalLayout_2.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.h_layout_select_audio1 = QtWidgets.QHBoxLayout()
self.h_layout_select_audio1.setObjectName("h_layout_select_audio1")
self.line_edit_audio1 = QtWidgets.QLineEdit(self.central_widget)
self.line_edit_audio1.setText("")
self.line_edit_audio1.setObjectName("line_edit_audio1")
self.h_layout_select_audio1.addWidget(self.line_edit_audio1)
self.line_edit_name1 = QtWidgets.QLineEdit(self.central_widget)
self.line_edit_name1.setText("")
self.line_edit_name1.setObjectName("line_edit_name1")
self.h_layout_select_audio1.addWidget(self.line_edit_name1)
self.push_button_audio1 = QtWidgets.QPushButton(self.central_widget)
self.push_button_audio1.setObjectName("push_button_audio1")
self.h_layout_select_audio1.addWidget(self.push_button_audio1)
self.verticalLayout_2.addLayout(self.h_layout_select_audio1)
self.h_layout_select_audio2 = QtWidgets.QHBoxLayout()
self.h_layout_select_audio2.setObjectName("h_layout_select_audio2")
self.line_edit_audio2 = QtWidgets.QLineEdit(self.central_widget)
self.line_edit_audio2.setText("")
self.line_edit_audio2.setObjectName("line_edit_audio2")
self.h_layout_select_audio2.addWidget(self.line_edit_audio2)
self.line_edit_name2 = QtWidgets.QLineEdit(self.central_widget)
self.line_edit_name2.setText("")
self.line_edit_name2.setObjectName("line_edit_name2")
self.h_layout_select_audio2.addWidget(self.line_edit_name2)
self.push_button_audio2 = QtWidgets.QPushButton(self.central_widget)
self.push_button_audio2.setObjectName("push_button_audio2")
self.h_layout_select_audio2.addWidget(self.push_button_audio2)
self.verticalLayout_2.addLayout(self.h_layout_select_audio2)
self.h_line3 = QtWidgets.QFrame(self.central_widget)
self.h_line3.setFrameShape(QtWidgets.QFrame.HLine)
self.h_line3.setFrameShadow(QtWidgets.QFrame.Sunken)
self.h_line3.setObjectName("h_line3")
self.verticalLayout_2.addWidget(self.h_line3)
self.v_layout_avatars = QtWidgets.QVBoxLayout()
self.v_layout_avatars.setObjectName("v_layout_avatars")
self.h_layout_avatars_preview = QtWidgets.QHBoxLayout()
self.h_layout_avatars_preview.setObjectName("h_layout_avatars_preview")
self.label_avatar_1 = QtWidgets.QLabel(self.central_widget)
self.label_avatar_1.setMinimumSize(QtCore.QSize(100, 100))
self.label_avatar_1.setAlignment(QtCore.Qt.AlignCenter)
self.label_avatar_1.setObjectName("label_avatar_1")
self.h_layout_avatars_preview.addWidget(self.label_avatar_1)
self.label_avatar_2 = QtWidgets.QLabel(self.central_widget)
self.label_avatar_2.setMinimumSize(QtCore.QSize(100, 100))
self.label_avatar_2.setAlignment(QtCore.Qt.AlignCenter)
self.label_avatar_2.setObjectName("label_avatar_2")
self.h_layout_avatars_preview.addWidget(self.label_avatar_2)
self.v_layout_avatars.addLayout(self.h_layout_avatars_preview)
self.h_layout_avatars_buttons = QtWidgets.QHBoxLayout()
self.h_layout_avatars_buttons.setObjectName("h_layout_avatars_buttons")
self.push_button_select_avatar1 = QtWidgets.QPushButton(self.central_widget)
self.push_button_select_avatar1.setObjectName("push_button_select_avatar1")
self.h_layout_avatars_buttons.addWidget(self.push_button_select_avatar1)
self.push_button_select_avatar2 = QtWidgets.QPushButton(self.central_widget)
self.push_button_select_avatar2.setMinimumSize(QtCore.QSize(0, 0))
self.push_button_select_avatar2.setObjectName("push_button_select_avatar2")
self.h_layout_avatars_buttons.addWidget(self.push_button_select_avatar2)
self.v_layout_avatars.addLayout(self.h_layout_avatars_buttons)
self.verticalLayout_2.addLayout(self.v_layout_avatars)
self.h_line2 = QtWidgets.QFrame(self.central_widget)
self.h_line2.setFrameShape(QtWidgets.QFrame.HLine)
self.h_line2.setFrameShadow(QtWidgets.QFrame.Sunken)
self.h_line2.setObjectName("h_line2")
self.verticalLayout_2.addWidget(self.h_line2)
self.verticalLayout = QtWidgets.QVBoxLayout(self.central_widget)
self.verticalLayout.setObjectName("verticalLayout")
self.h_layout_select_audio_1 = QtWidgets.QHBoxLayout()
self.h_layout_select_audio_1.setObjectName("h_layout_select_audio_1")
self.line_edit_audio_1 = QtWidgets.QLineEdit(self.central_widget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.line_edit_audio_1.sizePolicy().hasHeightForWidth())
self.line_edit_audio_1.setSizePolicy(sizePolicy)
self.line_edit_audio_1.setMinimumSize(QtCore.QSize(200, 0))
self.line_edit_audio_1.setText("")
self.line_edit_audio_1.setObjectName("line_edit_audio_1")
self.h_layout_select_audio_1.addWidget(self.line_edit_audio_1)
self.line_edit_name_1 = QtWidgets.QLineEdit(self.central_widget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.line_edit_name_1.sizePolicy().hasHeightForWidth())
self.line_edit_name_1.setSizePolicy(sizePolicy)
self.line_edit_name_1.setMinimumSize(QtCore.QSize(150, 0))
self.line_edit_name_1.setText("")
self.line_edit_name_1.setObjectName("line_edit_name_1")
self.h_layout_select_audio_1.addWidget(self.line_edit_name_1)
self.button_audio_1 = QtWidgets.QPushButton(self.central_widget)
self.button_audio_1.setMinimumSize(QtCore.QSize(120, 0))
self.button_audio_1.setObjectName("button_audio_1")
self.h_layout_select_audio_1.addWidget(self.button_audio_1)
self.verticalLayout.addLayout(self.h_layout_select_audio_1)
self.h_layout_select_audio_2 = QtWidgets.QHBoxLayout()
self.h_layout_select_audio_2.setObjectName("h_layout_select_audio_2")
self.line_edit_audio_2 = QtWidgets.QLineEdit(self.central_widget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.line_edit_audio_2.sizePolicy().hasHeightForWidth())
self.line_edit_audio_2.setSizePolicy(sizePolicy)
self.line_edit_audio_2.setMinimumSize(QtCore.QSize(200, 0))
self.line_edit_audio_2.setText("")
self.line_edit_audio_2.setObjectName("line_edit_audio_2")
self.h_layout_select_audio_2.addWidget(self.line_edit_audio_2)
self.line_edit_name_2 = QtWidgets.QLineEdit(self.central_widget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.line_edit_name_2.sizePolicy().hasHeightForWidth())
self.line_edit_name_2.setSizePolicy(sizePolicy)
self.line_edit_name_2.setMinimumSize(QtCore.QSize(150, 0))
self.line_edit_name_2.setText("")
self.line_edit_name_2.setObjectName("line_edit_name_2")
self.h_layout_select_audio_2.addWidget(self.line_edit_name_2)
self.button_audio_2 = QtWidgets.QPushButton(self.central_widget)
self.button_audio_2.setMinimumSize(QtCore.QSize(120, 0))
self.button_audio_2.setObjectName("button_audio_2")
self.h_layout_select_audio_2.addWidget(self.button_audio_2)
self.verticalLayout.addLayout(self.h_layout_select_audio_2)
self.check_box_connected_channels = QtWidgets.QCheckBox(self.central_widget)
self.check_box_connected_channels.setObjectName("check_box_connected_channels")
self.verticalLayout.addWidget(self.check_box_connected_channels)
self.h_line = QtWidgets.QFrame(self.central_widget)
self.h_line.setFrameShape(QtWidgets.QFrame.HLine)
self.h_line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.h_line.setObjectName("h_line")
self.verticalLayout.addWidget(self.h_line)
self.w_layout_avatars_1_and_2 = QtWidgets.QHBoxLayout()
self.w_layout_avatars_1_and_2.setObjectName("w_layout_avatars_1_and_2")
self.w_layout_avatar_1 = QtWidgets.QVBoxLayout()
self.w_layout_avatar_1.setObjectName("w_layout_avatar_1")
self.preview_label_avatar_1 = QtWidgets.QLabel(self.central_widget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.preview_label_avatar_1.sizePolicy().hasHeightForWidth())
self.preview_label_avatar_1.setSizePolicy(sizePolicy)
self.preview_label_avatar_1.setMinimumSize(QtCore.QSize(0, 150))
self.preview_label_avatar_1.setMaximumSize(QtCore.QSize(300, 150))
self.preview_label_avatar_1.setFrameShape(QtWidgets.QFrame.Box)
self.preview_label_avatar_1.setScaledContents(True)
self.preview_label_avatar_1.setAlignment(QtCore.Qt.AlignCenter)
self.preview_label_avatar_1.setProperty("path", "")
self.preview_label_avatar_1.setObjectName("preview_label_avatar_1")
self.w_layout_avatar_1.addWidget(self.preview_label_avatar_1)
self.button_select_avatar_1 = QtWidgets.QPushButton(self.central_widget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.button_select_avatar_1.sizePolicy().hasHeightForWidth())
self.button_select_avatar_1.setSizePolicy(sizePolicy)
self.button_select_avatar_1.setMinimumSize(QtCore.QSize(200, 35))
self.button_select_avatar_1.setMaximumSize(QtCore.QSize(16777215, 35))
self.button_select_avatar_1.setObjectName("button_select_avatar_1")
self.w_layout_avatar_1.addWidget(self.button_select_avatar_1)
self.w_layout_avatars_1_and_2.addLayout(self.w_layout_avatar_1)
spacerItem = QtWidgets.QSpacerItem(5, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.w_layout_avatars_1_and_2.addItem(spacerItem)
self.w_layout_avatar_2 = QtWidgets.QVBoxLayout()
self.w_layout_avatar_2.setObjectName("w_layout_avatar_2")
self.preview_label_avatar_2 = QtWidgets.QLabel(self.central_widget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.preview_label_avatar_2.sizePolicy().hasHeightForWidth())
self.preview_label_avatar_2.setSizePolicy(sizePolicy)
self.preview_label_avatar_2.setMinimumSize(QtCore.QSize(0, 150))
self.preview_label_avatar_2.setMaximumSize(QtCore.QSize(300, 150))
self.preview_label_avatar_2.setFrameShape(QtWidgets.QFrame.Box)
self.preview_label_avatar_2.setScaledContents(True)
self.preview_label_avatar_2.setAlignment(QtCore.Qt.AlignCenter)
self.preview_label_avatar_2.setProperty("path", "")
self.preview_label_avatar_2.setObjectName("preview_label_avatar_2")
self.w_layout_avatar_2.addWidget(self.preview_label_avatar_2)
self.button_select_avatar_2 = QtWidgets.QPushButton(self.central_widget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.button_select_avatar_2.sizePolicy().hasHeightForWidth())
self.button_select_avatar_2.setSizePolicy(sizePolicy)
self.button_select_avatar_2.setMinimumSize(QtCore.QSize(200, 35))
self.button_select_avatar_2.setMaximumSize(QtCore.QSize(16777215, 35))
self.button_select_avatar_2.setObjectName("button_select_avatar_2")
self.w_layout_avatar_2.addWidget(self.button_select_avatar_2)
self.w_layout_avatars_1_and_2.addLayout(self.w_layout_avatar_2)
self.verticalLayout.addLayout(self.w_layout_avatars_1_and_2)
spacerItem1 = QtWidgets.QSpacerItem(5, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.verticalLayout.addItem(spacerItem1)
self.w_layout_avatars_3_and_4 = QtWidgets.QHBoxLayout()
self.w_layout_avatars_3_and_4.setObjectName("w_layout_avatars_3_and_4")
self.w_layout_avatar_3 = QtWidgets.QVBoxLayout()
self.w_layout_avatar_3.setObjectName("w_layout_avatar_3")
self.preview_label_avatar_3 = QtWidgets.QLabel(self.central_widget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.preview_label_avatar_3.sizePolicy().hasHeightForWidth())
self.preview_label_avatar_3.setSizePolicy(sizePolicy)
self.preview_label_avatar_3.setMinimumSize(QtCore.QSize(0, 150))
self.preview_label_avatar_3.setMaximumSize(QtCore.QSize(300, 150))
self.preview_label_avatar_3.setFrameShape(QtWidgets.QFrame.Box)
self.preview_label_avatar_3.setTextFormat(QtCore.Qt.RichText)
self.preview_label_avatar_3.setScaledContents(True)
self.preview_label_avatar_3.setAlignment(QtCore.Qt.AlignCenter)
self.preview_label_avatar_3.setProperty("path", "")
self.preview_label_avatar_3.setObjectName("preview_label_avatar_3")
self.w_layout_avatar_3.addWidget(self.preview_label_avatar_3)
self.button_select_avatar_3 = QtWidgets.QPushButton(self.central_widget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.button_select_avatar_3.sizePolicy().hasHeightForWidth())
self.button_select_avatar_3.setSizePolicy(sizePolicy)
self.button_select_avatar_3.setMinimumSize(QtCore.QSize(200, 35))
self.button_select_avatar_3.setMaximumSize(QtCore.QSize(16777215, 35))
self.button_select_avatar_3.setObjectName("button_select_avatar_3")
self.w_layout_avatar_3.addWidget(self.button_select_avatar_3)
self.w_layout_avatars_3_and_4.addLayout(self.w_layout_avatar_3)
spacerItem2 = QtWidgets.QSpacerItem(5, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
self.w_layout_avatars_3_and_4.addItem(spacerItem2)
self.w_layout_avatar_4 = QtWidgets.QVBoxLayout()
self.w_layout_avatar_4.setObjectName("w_layout_avatar_4")
self.preview_label_avatar_4 = QtWidgets.QLabel(self.central_widget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.preview_label_avatar_4.sizePolicy().hasHeightForWidth())
self.preview_label_avatar_4.setSizePolicy(sizePolicy)
self.preview_label_avatar_4.setMinimumSize(QtCore.QSize(0, 150))
self.preview_label_avatar_4.setMaximumSize(QtCore.QSize(300, 150))
self.preview_label_avatar_4.setFrameShape(QtWidgets.QFrame.Box)
self.preview_label_avatar_4.setScaledContents(True)
self.preview_label_avatar_4.setAlignment(QtCore.Qt.AlignCenter)
self.preview_label_avatar_4.setProperty("path", "")
self.preview_label_avatar_4.setObjectName("preview_label_avatar_4")
self.w_layout_avatar_4.addWidget(self.preview_label_avatar_4)
self.button_select_avatar_4 = QtWidgets.QPushButton(self.central_widget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.button_select_avatar_4.sizePolicy().hasHeightForWidth())
self.button_select_avatar_4.setSizePolicy(sizePolicy)
self.button_select_avatar_4.setMinimumSize(QtCore.QSize(200, 35))
self.button_select_avatar_4.setMaximumSize(QtCore.QSize(16777215, 35))
self.button_select_avatar_4.setObjectName("button_select_avatar_4")
self.w_layout_avatar_4.addWidget(self.button_select_avatar_4)
self.w_layout_avatars_3_and_4.addLayout(self.w_layout_avatar_4)
self.verticalLayout.addLayout(self.w_layout_avatars_3_and_4)
self.h_line_2 = QtWidgets.QFrame(self.central_widget)
self.h_line_2.setFrameShape(QtWidgets.QFrame.HLine)
self.h_line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
self.h_line_2.setObjectName("h_line_2")
self.verticalLayout.addWidget(self.h_line_2)
self.h_layout_threshold = QtWidgets.QHBoxLayout()
self.h_layout_threshold.setObjectName("h_layout_threshold")
self.label_threshold_description = QtWidgets.QLabel(self.central_widget)
@ -93,7 +216,7 @@ class Ui_MainWindow(object):
self.label_threshold_description.setObjectName("label_threshold_description")
self.h_layout_threshold.addWidget(self.label_threshold_description)
self.lcd_number_of_threshold = QtWidgets.QLCDNumber(self.central_widget)
self.lcd_number_of_threshold.setMinimumSize(QtCore.QSize(100, 50))
self.lcd_number_of_threshold.setMinimumSize(QtCore.QSize(0, 30))
self.lcd_number_of_threshold.setMaximumSize(QtCore.QSize(200, 50))
self.lcd_number_of_threshold.setFrameShape(QtWidgets.QFrame.Box)
self.lcd_number_of_threshold.setFrameShadow(QtWidgets.QFrame.Raised)
@ -103,32 +226,33 @@ class Ui_MainWindow(object):
self.lcd_number_of_threshold.setProperty("intValue", 0)
self.lcd_number_of_threshold.setObjectName("lcd_number_of_threshold")
self.h_layout_threshold.addWidget(self.lcd_number_of_threshold)
self.verticalLayout_2.addLayout(self.h_layout_threshold)
self.verticalLayout.addLayout(self.h_layout_threshold)
self.h_slider = QtWidgets.QSlider(self.central_widget)
self.h_slider.setOrientation(QtCore.Qt.Horizontal)
self.h_slider.setObjectName("h_slider")
self.verticalLayout_2.addWidget(self.h_slider)
self.h_line = QtWidgets.QFrame(self.central_widget)
self.h_line.setFrameShape(QtWidgets.QFrame.HLine)
self.h_line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.h_line.setObjectName("h_line")
self.verticalLayout_2.addWidget(self.h_line)
self.verticalLayout.addWidget(self.h_slider)
self.h_line_3 = QtWidgets.QFrame(self.central_widget)
self.h_line_3.setFrameShape(QtWidgets.QFrame.HLine)
self.h_line_3.setFrameShadow(QtWidgets.QFrame.Sunken)
self.h_line_3.setObjectName("h_line_3")
self.verticalLayout.addWidget(self.h_line_3)
self.h_layout_preview_or_generate = QtWidgets.QHBoxLayout()
self.h_layout_preview_or_generate.setObjectName("h_layout_preview_or_generate")
self.push_button_preview = QtWidgets.QPushButton(self.central_widget)
self.push_button_preview.setObjectName("push_button_preview")
self.h_layout_preview_or_generate.addWidget(self.push_button_preview)
self.push_button_generate = QtWidgets.QPushButton(self.central_widget)
self.push_button_generate.setObjectName("push_button_generate")
self.h_layout_preview_or_generate.addWidget(self.push_button_generate)
self.verticalLayout_2.addLayout(self.h_layout_preview_or_generate)
self.h_line2.raise_()
self.button_preview = QtWidgets.QPushButton(self.central_widget)
self.button_preview.setObjectName("button_preview")
self.h_layout_preview_or_generate.addWidget(self.button_preview)
self.button_generate = QtWidgets.QPushButton(self.central_widget)
self.button_generate.setObjectName("button_generate")
self.h_layout_preview_or_generate.addWidget(self.button_generate)
self.verticalLayout.addLayout(self.h_layout_preview_or_generate)
self.h_line.raise_()
self.h_line3.raise_()
self.h_line_2.raise_()
self.h_slider.raise_()
self.h_line_3.raise_()
self.check_box_connected_channels.raise_()
MainWindow.setCentralWidget(self.central_widget)
self.menu_bar = QtWidgets.QMenuBar(MainWindow)
self.menu_bar.setGeometry(QtCore.QRect(0, 0, 861, 32))
self.menu_bar.setGeometry(QtCore.QRect(0, 0, 554, 32))
self.menu_bar.setObjectName("menu_bar")
self.menu_project = QtWidgets.QMenu(self.menu_bar)
self.menu_project.setObjectName("menu_project")
@ -168,19 +292,24 @@ class Ui_MainWindow(object):
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MagicPodcast"))
self.line_edit_audio1.setPlaceholderText(_translate("MainWindow", "Plik audio pierwszego rozmówcy"))
self.line_edit_name1.setPlaceholderText(_translate("MainWindow", "Imię pierwszego rozmówcy"))
self.push_button_audio1.setText(_translate("MainWindow", "Dodaj audio 1"))
self.line_edit_audio2.setPlaceholderText(_translate("MainWindow", "Plik audio drugiego rozmówcy"))
self.line_edit_name2.setPlaceholderText(_translate("MainWindow", "Imię drugieo rozmówcy"))
self.push_button_audio2.setText(_translate("MainWindow", "Dodaj audio 2"))
self.label_avatar_1.setText(_translate("MainWindow", "TextLabel"))
self.label_avatar_2.setText(_translate("MainWindow", "TextLabel"))
self.push_button_select_avatar1.setText(_translate("MainWindow", "Wybierz grafikę dla pierwszego rozmówcy"))
self.push_button_select_avatar2.setText(_translate("MainWindow", "Wybierz grafikę dla drugiego rozmówcy"))
self.line_edit_audio_1.setPlaceholderText(_translate("MainWindow", "Plik audio 1 rozmówcy"))
self.line_edit_name_1.setPlaceholderText(_translate("MainWindow", "Imię 1 rozmówcy"))
self.button_audio_1.setText(_translate("MainWindow", "Dodaj audio 1"))
self.line_edit_audio_2.setPlaceholderText(_translate("MainWindow", "Plik audio 2 rozmówcy"))
self.line_edit_name_2.setPlaceholderText(_translate("MainWindow", "Imię 2 rozmówcy"))
self.button_audio_2.setText(_translate("MainWindow", "Dodaj audio 2"))
self.check_box_connected_channels.setText(_translate("MainWindow", "Zaznacz jeśli kanały rozmówców są połączone w jednym nagraniu"))
self.preview_label_avatar_1.setText(_translate("MainWindow", "Podgląd - rozmówcy aktywni"))
self.button_select_avatar_1.setText(_translate("MainWindow", "Rozmówcy - aktywni"))
self.preview_label_avatar_2.setText(_translate("MainWindow", "Podgląd - rozmówcy nieaktywni"))
self.button_select_avatar_2.setText(_translate("MainWindow", "Rozmówcy - nieaktywni"))
self.preview_label_avatar_3.setText(_translate("MainWindow", "Podgląd - 1 rozmówca aktywny"))
self.button_select_avatar_3.setText(_translate("MainWindow", "Pierwszy rozmówca - aktywny"))
self.preview_label_avatar_4.setText(_translate("MainWindow", "Podgląd - 2 rozmówca aktywny"))
self.button_select_avatar_4.setText(_translate("MainWindow", "Drugi rozmówca - aktywny"))
self.label_threshold_description.setText(_translate("MainWindow", "Poziom wykrywania głosu:"))
self.push_button_preview.setText(_translate("MainWindow", "Podgląd"))
self.push_button_generate.setText(_translate("MainWindow", "Wygeneruj podcast"))
self.button_preview.setText(_translate("MainWindow", "Podgląd"))
self.button_generate.setText(_translate("MainWindow", "Wygeneruj podcast"))
self.menu_project.setTitle(_translate("MainWindow", "Projekt"))
self.action_new.setText(_translate("MainWindow", "Nowy projekt"))
self.action_new.setToolTip(_translate("MainWindow", "Kliknij, aby utwórzyć nowy projekt"))

View File

@ -0,0 +1,91 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './src/gui/ui/preview_dialog.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_dialog(object):
def setupUi(self, dialog):
dialog.setObjectName("dialog")
dialog.setWindowModality(QtCore.Qt.NonModal)
dialog.resize(782, 356)
self.verticalLayout = QtWidgets.QVBoxLayout(dialog)
self.verticalLayout.setObjectName("verticalLayout")
self.vertical_layout = QtWidgets.QVBoxLayout()
self.vertical_layout.setObjectName("vertical_layout")
self.graphics_view = QtWidgets.QGraphicsView(dialog)
self.graphics_view.setObjectName("graphics_view")
self.vertical_layout.addWidget(self.graphics_view)
self.line = QtWidgets.QFrame(dialog)
self.line.setFrameShape(QtWidgets.QFrame.HLine)
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line.setObjectName("line")
self.vertical_layout.addWidget(self.line)
self.range_silder = QtWidgets.QSlider(dialog)
self.range_silder.setOrientation(QtCore.Qt.Horizontal)
self.range_silder.setTickPosition(QtWidgets.QSlider.TicksBothSides)
self.range_silder.setTickInterval(1)
self.range_silder.setObjectName("range_silder")
self.vertical_layout.addWidget(self.range_silder)
self.line_2 = QtWidgets.QFrame(dialog)
self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line_2.setObjectName("line_2")
self.vertical_layout.addWidget(self.line_2)
self.horizontal_layout_2 = QtWidgets.QHBoxLayout()
self.horizontal_layout_2.setObjectName("horizontal_layout_2")
self.label = QtWidgets.QLabel(dialog)
self.label.setObjectName("label")
self.horizontal_layout_2.addWidget(self.label)
self.line_edit = QtWidgets.QLineEdit(dialog)
self.line_edit.setObjectName("line_edit")
self.horizontal_layout_2.addWidget(self.line_edit)
self.label_2 = QtWidgets.QLabel(dialog)
self.label_2.setObjectName("label_2")
self.horizontal_layout_2.addWidget(self.label_2)
self.line_edit_2 = QtWidgets.QLineEdit(dialog)
self.line_edit_2.setObjectName("line_edit_2")
self.horizontal_layout_2.addWidget(self.line_edit_2)
self.vertical_layout.addLayout(self.horizontal_layout_2)
self.horizontal_layout_3 = QtWidgets.QHBoxLayout()
self.horizontal_layout_3.setObjectName("horizontal_layout_3")
self.push_button = QtWidgets.QPushButton(dialog)
self.push_button.setObjectName("push_button")
self.horizontal_layout_3.addWidget(self.push_button)
self.push_button_2 = QtWidgets.QPushButton(dialog)
self.push_button_2.setObjectName("push_button_2")
self.horizontal_layout_3.addWidget(self.push_button_2)
self.push_button_3 = QtWidgets.QPushButton(dialog)
self.push_button_3.setObjectName("push_button_3")
self.horizontal_layout_3.addWidget(self.push_button_3)
self.vertical_layout.addLayout(self.horizontal_layout_3)
self.verticalLayout.addLayout(self.vertical_layout)
self.retranslateUi(dialog)
QtCore.QMetaObject.connectSlotsByName(dialog)
def retranslateUi(self, dialog):
_translate = QtCore.QCoreApplication.translate
dialog.setWindowTitle(_translate("dialog", "Dialog"))
self.label.setText(_translate("dialog", "Początek fragmentu"))
self.label_2.setText(_translate("dialog", "Koniec fragemntu"))
self.push_button.setText(_translate("dialog", "start"))
self.push_button_2.setText(_translate("dialog", "stop"))
self.push_button_3.setText(_translate("dialog", "zakończ"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
dialog = QtWidgets.QDialog()
ui = Ui_dialog()
ui.setupUi(dialog)
dialog.show()
sys.exit(app.exec_())

View File

@ -1,386 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>861</width>
<height>775</height>
</rect>
</property>
<property name="windowTitle">
<string>MagicPodcast</string>
</property>
<widget class="QWidget" name="central_widget">
<property name="minimumSize">
<size>
<width>700</width>
<height>540</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item>
<layout class="QHBoxLayout" name="h_layout_select_audio1">
<item>
<widget class="QLineEdit" name="line_edit_audio1">
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>Plik audio pierwszego rozmówcy</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="line_edit_name1">
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>Imię pierwszego rozmówcy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="push_button_audio1">
<property name="text">
<string>Dodaj audio 1</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="h_layout_select_audio2">
<item>
<widget class="QLineEdit" name="line_edit_audio2">
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>Plik audio drugiego rozmówcy</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="line_edit_name2">
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>Imię drugieo rozmówcy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="push_button_audio2">
<property name="text">
<string>Dodaj audio 2</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="h_line3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="v_layout_avatars">
<item>
<layout class="QHBoxLayout" name="h_layout_avatars_preview">
<item>
<widget class="QLabel" name="label_avatar_1">
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_avatar_2">
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="h_layout_avatars_buttons">
<item>
<widget class="QPushButton" name="push_button_select_avatar1">
<property name="text">
<string>Wybierz grafikę dla pierwszego rozmówcy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="push_button_select_avatar2">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Wybierz grafikę dla drugiego rozmówcy</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="Line" name="h_line2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="h_layout_threshold">
<item>
<widget class="QLabel" name="label_threshold_description">
<property name="minimumSize">
<size>
<width>200</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>250</width>
<height>50</height>
</size>
</property>
<property name="text">
<string>Poziom wykrywania głosu:</string>
</property>
</widget>
</item>
<item>
<widget class="QLCDNumber" name="lcd_number_of_threshold">
<property name="minimumSize">
<size>
<width>100</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>50</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="smallDecimalPoint">
<bool>false</bool>
</property>
<property name="digitCount">
<number>3</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Filled</enum>
</property>
<property name="intValue" stdset="0">
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QSlider" name="h_slider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="Line" name="h_line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="h_layout_preview_or_generate">
<item>
<widget class="QPushButton" name="push_button_preview">
<property name="text">
<string>Podgląd</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="push_button_generate">
<property name="text">
<string>Wygeneruj podcast</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
<zorder>h_line2</zorder>
<zorder>h_line</zorder>
<zorder>h_line3</zorder>
<zorder>h_slider</zorder>
<zorder>verticalLayoutWidget</zorder>
</widget>
<widget class="QMenuBar" name="menu_bar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>861</width>
<height>32</height>
</rect>
</property>
<widget class="QMenu" name="menu_project">
<property name="title">
<string>Projekt</string>
</property>
<addaction name="action_new"/>
<addaction name="action_open"/>
<addaction name="action_save"/>
<addaction name="action_save_as"/>
<addaction name="separator"/>
<addaction name="action_settings"/>
<addaction name="action_about"/>
<addaction name="separator"/>
<addaction name="action_exit"/>
</widget>
<addaction name="menu_project"/>
</widget>
<widget class="QStatusBar" name="status_bar"/>
<action name="action_new">
<property name="text">
<string>Nowy projekt</string>
</property>
<property name="toolTip">
<string>Kliknij, aby utwórzyć nowy projekt</string>
</property>
<property name="shortcut">
<string>Ctrl+N</string>
</property>
</action>
<action name="action_open">
<property name="text">
<string>Otwórz projekt</string>
</property>
<property name="toolTip">
<string>Kliknij, aby otworzyć istniejący projekt</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
</property>
</action>
<action name="action_save">
<property name="text">
<string>Zapisz projekt</string>
</property>
<property name="toolTip">
<string>Kliknij, aby zapisać aktualny projekt</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
</property>
</action>
<action name="action_save_as">
<property name="text">
<string>Zapisz projekt jako</string>
</property>
<property name="toolTip">
<string>Kliknij, aby zapisać projekt jako</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+S</string>
</property>
</action>
<action name="action_exit">
<property name="text">
<string>Zamknij program</string>
</property>
<property name="toolTip">
<string>Kliknij, aby zakończyć działanie programu</string>
</property>
<property name="shortcut">
<string>Ctrl+W</string>
</property>
</action>
<action name="action_settings">
<property name="text">
<string>Ustawienia</string>
</property>
<property name="toolTip">
<string>Kliknij, aby przejść do ustawień programu</string>
</property>
<property name="shortcut">
<string>Ctrl+U</string>
</property>
</action>
<action name="action_about">
<property name="text">
<string>O programie MagicPodcast</string>
</property>
<property name="toolTip">
<string>Kliknij, aby wyświetlić informacje dotyczące programu MagicPodcast</string>
</property>
<property name="shortcut">
<string>Ctrl+I</string>
</property>
</action>
</widget>
<resources/>
<connections>
<connection>
<sender>action_exit</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>430</x>
<y>387</y>
</hint>
</hints>
</connection>
</connections>
</ui>

0
tests/__init__.py Normal file
View File

View File

View File

@ -0,0 +1,32 @@
from src.python.ui.mainwindow_ui import Ui_MainWindow
from src.python.classes.mainwindow import MainWindow
import unittest
from PyQt5.QtWidgets import QApplication, QDialog, QLabel
import sys
class Test_Ui_MainWindow(unittest.TestCase):
app = QApplication(sys.argv)
def setUp(self) -> None:
pass
def tearDown(self) -> None:
pass
def test_create_mainwindow(self):
ui_mainwindow = Ui_MainWindow()
self.assertIsInstance(ui_mainwindow, Ui_MainWindow)
def test_create_dialog(self):
mainwindow = MainWindow()
title = "test create dialog"
msg = "test msg"
dialog: QDialog = mainwindow.create_custom_dialog(title=title, msg=msg)
self.assertIsInstance(dialog, QDialog)
self.assertEqual(dialog.windowTitle(), title)
self.assertEqual(dialog.findChild(QLabel, name='message_box').text(), msg)
if __name__ == '__main__':
unittest.main()

View File

View File

@ -0,0 +1,9 @@
from unittest.mock import Mock
class TestMockMainwindown(Mock):
def __init__(self, module_name=''):
self.module_name = 'Test'
def test_nothing(self):
print(self.module_name)

14
tsconfig.json Normal file
View File

@ -0,0 +1,14 @@
{
"compilerOptions": {
"moduleResolution": "node",
"noImplicitAny": true,
"noImplicitThis": true,
"sourceMap": true,
"module": "commonjs",
"target": "es6",
"allowJs": false,
"strictNullChecks": true,
"esModuleInterop": true,
"outDir": "build"
}
}

26
window.ts Normal file
View File

@ -0,0 +1,26 @@
export default class Window {
length: number;
buffer: number[] = [];
constructor(length: number) {
this.length = length;
}
push(element: number) {
if (this.buffer.length == this.length) {
this.buffer.shift();
}
this.buffer.push(element);
}
sum() {
return this.buffer.reduce((a, b) => a + b, 0);
}
clear() {
this.buffer = [];
}
isFull() {
return this.buffer.length == this.length;
}
}