Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
MPAI-Private
MPAI-CAE
arp
Audio Analyzer
Commits
7b580fa0
Commit
7b580fa0
authored
Apr 26, 2023
by
Matteo
Browse files
update
parent
fe415fcf
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/audio_analyzer/client.py
View file @
7b580fa0
...
...
@@ -9,8 +9,8 @@ channels = {
"AudioAnalyser"
:
grpc
.
insecure_channel
(
"[::]:50051"
),
"VideoAnalyser"
:
grpc
.
insecure_channel
(
"[::]:50052"
),
"TapeIrregularityClassifier"
:
grpc
.
insecure_channel
(
"[::]:50053"
),
"TapeAudioRestoration"
:
grpc
.
insecure_channel
(
"[::]:5005
1
"
),
#
"Packager": grpc.insecure_channel("[::]:5005
1/packager
"),
"TapeAudioRestoration"
:
grpc
.
insecure_channel
(
"[::]:5005
4
"
),
"Packager"
:
grpc
.
insecure_channel
(
"[::]:5005
5
"
),
}
def
run
(
console
:
Console
):
...
...
@@ -19,60 +19,61 @@ def run(console: Console):
video_analyser
=
arp_pb2_grpc
.
AIMStub
(
channels
[
"VideoAnalyser"
])
tape_irreg_classifier
=
arp_pb2_grpc
.
AIMStub
(
channels
[
"TapeIrregularityClassifier"
])
tape_audio_restoration
=
arp_pb2_grpc
.
AIMStub
(
channels
[
"TapeAudioRestoration"
])
packager
=
arp_pb2_grpc
.
AIMStub
(
channels
[
"Packager"
])
request
=
arp_pb2
.
InfoRequest
()
#
for a
nalyser
in [audio_analyser, video_analyser, tape_irreg_classifier]:
#
response = a
nalyser
.getInfo(request)
#
console.print("[bold]{}[/], v{}".format(response.title, response.version))
for
a
im
in
[
audio_analyser
,
video_analyser
,
tape_irreg_classifier
,
tape_audio_restoration
,
packager
]:
response
=
a
im
.
getInfo
(
request
)
console
.
print
(
"[bold]{}[/], v{}"
.
format
(
response
.
title
,
response
.
version
))
request
=
arp_pb2
.
JobRequest
(
working_dir
=
"
..
/data"
,
files_name
=
"BERIO
100
"
,
working_dir
=
"/data"
,
files_name
=
"BERIO
052
"
,
index
=
1
,
)
#
with console.status("[bold]Computing AudioAnalyser IrregularityFile 1...", spinner="bouncingBall"):
#
for result in audio_analyser.work(request):
#
if result.status == "error":
#
console.print("[bold red]Error![/] :boom:")
#
console.print(f"[italic red]{result.message}")
#
for channel in channels.values():
#
channel.close()
#
exit(os.EX_SOFTWARE)
#
console.print(result.message)
#
request.files_name = "BERIO
100
.mov"
#
with console.status("[bold]Computing VideoAnalyser IrregularityFiles...", spinner="bouncingBall"):
#
for result in video_analyser.work(request):
#
if result.status == "error":
#
console.print("[bold red]Error![/] :boom:")
#
console.print(f"[italic red]{result.message}")
#
for channel in channels.values():
#
channel.close()
#
exit(os.EX_SOFTWARE)
#
console.print(result.message)
#
request.index = 2
#
request.files_name = "BERIO
100
"
#
with console.status("[bold]Computing AudioAnalyser IrregularityFile 2...", spinner="bouncingBall"):
#
for result in audio_analyser.work(request):
#
if result.status == "error":
#
console.print("[bold red]Error![/] :boom:")
#
console.print(f"[italic red]{result.message}")
#
for channel in channels.values():
#
channel.close()
#
exit(os.EX_SOFTWARE)
#
console.print(result.message)
#
with console.status("[bold]Computing TapeIrregularityClassifier...", spinner="bouncingBall"):
#
for result in tape_irreg_classifier.work(request):
#
if result.status == "error":
#
console.print("[bold red]Error![/] :boom:")
#
console.print(f"[italic red]{result.message}")
#
for channel in channels.values():
#
channel.close()
#
exit(os.EX_SOFTWARE)
#
console.print(result.message)
with
console
.
status
(
"[bold]Computing AudioAnalyser IrregularityFile 1..."
,
spinner
=
"bouncingBall"
):
for
result
in
audio_analyser
.
work
(
request
):
if
result
.
status
==
"error"
:
console
.
print
(
"[bold red]Error![/] :boom:"
)
console
.
print
(
f
"[italic red]
{
result
.
message
}
"
)
for
channel
in
channels
.
values
():
channel
.
close
()
exit
(
os
.
EX_SOFTWARE
)
console
.
print
(
result
.
message
)
request
.
files_name
=
"BERIO
052
.mov"
with
console
.
status
(
"[bold]Computing VideoAnalyser IrregularityFiles..."
,
spinner
=
"bouncingBall"
):
for
result
in
video_analyser
.
work
(
request
):
if
result
.
status
==
"error"
:
console
.
print
(
"[bold red]Error![/] :boom:"
)
console
.
print
(
f
"[italic red]
{
result
.
message
}
"
)
for
channel
in
channels
.
values
():
channel
.
close
()
exit
(
os
.
EX_SOFTWARE
)
console
.
print
(
result
.
message
)
request
.
index
=
2
request
.
files_name
=
"BERIO
052
"
with
console
.
status
(
"[bold]Computing AudioAnalyser IrregularityFile 2..."
,
spinner
=
"bouncingBall"
):
for
result
in
audio_analyser
.
work
(
request
):
if
result
.
status
==
"error"
:
console
.
print
(
"[bold red]Error![/] :boom:"
)
console
.
print
(
f
"[italic red]
{
result
.
message
}
"
)
for
channel
in
channels
.
values
():
channel
.
close
()
exit
(
os
.
EX_SOFTWARE
)
console
.
print
(
result
.
message
)
with
console
.
status
(
"[bold]Computing TapeIrregularityClassifier..."
,
spinner
=
"bouncingBall"
):
for
result
in
tape_irreg_classifier
.
work
(
request
):
if
result
.
status
==
"error"
:
console
.
print
(
"[bold red]Error![/] :boom:"
)
console
.
print
(
f
"[italic red]
{
result
.
message
}
"
)
for
channel
in
channels
.
values
():
channel
.
close
()
exit
(
os
.
EX_SOFTWARE
)
console
.
print
(
result
.
message
)
with
console
.
status
(
"[bold]Computing TapeAudioRestoration..."
,
spinner
=
"bouncingBall"
):
for
result
in
tape_audio_restoration
.
work
(
request
):
...
...
@@ -84,10 +85,21 @@ def run(console: Console):
exit
(
os
.
EX_SOFTWARE
)
console
.
print
(
result
.
message
)
with
console
.
status
(
"[bold]Packaging..."
,
spinner
=
"bouncingBall"
):
for
result
in
packager
.
work
(
request
):
if
result
.
status
==
"error"
:
console
.
print
(
"[bold red]Error![/] :boom:"
)
console
.
print
(
f
"[italic red]
{
result
.
message
}
"
)
for
channel
in
channels
.
values
():
channel
.
close
()
exit
(
os
.
EX_SOFTWARE
)
console
.
print
(
result
.
message
)
channels
[
"AudioAnalyser"
].
close
()
channels
[
"VideoAnalyser"
].
close
()
channels
[
"TapeIrregularityClassifier"
].
close
()
channels
[
"TapeAudioRestoration"
].
close
()
channels
[
"Packager"
].
close
()
console
.
print
(
"[bold green]Success![/] :tada:"
)
...
...
src/audio_analyzer/segment_finder.py
View file @
7b580fa0
...
...
@@ -143,6 +143,8 @@ def merge_irreg_files(
"""
match
file1
.
offset
,
file2
.
offset
:
case
None
,
None
:
offset
=
0
case
None
,
_
:
offset
=
file2
.
offset
case
_
,
None
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment