Compare commits
28 Commits
plugin_mig
...
39395fd846
| Author | SHA1 | Date | |
|---|---|---|---|
| 39395fd846 | |||
| 510b92f669 | |||
| aefb3f2648 | |||
| a613b26ba8 | |||
| 7a471041e7 | |||
| ab57d8ef22 | |||
| 69c9d80a82 | |||
| 8c83819a17 | |||
| ad07bf7fe6 | |||
| bc40f9abe3 | |||
| e7f649ae0b | |||
| e34903b20f | |||
| 192c959d39 | |||
| 60123d7450 | |||
| 8265951bd4 | |||
| 757d5ef1a7 | |||
| d78c49d0ad | |||
| 089023e7cf | |||
| db97747f2e | |||
| 1e7141c43f | |||
| 8fda2a03af | |||
| 47cdaa76b6 | |||
| d49ac95fa2 | |||
| f2718282c7 | |||
| 86e30e6ec3 | |||
| b8f26496a0 | |||
| a761b81dd1 | |||
| c1948182ec |
70
.github/upgrades/dotnet-upgrade-plan.md
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
# .NET 8.0 Upgrade Plan
|
||||||
|
|
||||||
|
## Execution Steps
|
||||||
|
|
||||||
|
Execute steps below sequentially one by one in the order they are listed.
|
||||||
|
|
||||||
|
1. Validate that an .NET 8.0 SDK required for this upgrade is installed on the machine and if not, help to get it installed.
|
||||||
|
2. Ensure that the SDK version specified in global.json files is compatible with the .NET 8.0 upgrade.
|
||||||
|
3. Upgrade ClipTrimDotNet\ClipTrimDotNet.csproj
|
||||||
|
4. Run unit tests to validate upgrade in the projects listed below:
|
||||||
|
- ClientTest\ClientTest.csproj
|
||||||
|
|
||||||
|
## Settings
|
||||||
|
|
||||||
|
This section contains settings and data used by execution steps.
|
||||||
|
|
||||||
|
### Excluded projects
|
||||||
|
|
||||||
|
| Project name | Description |
|
||||||
|
|:-----------------------------------------------|:---------------------------:|
|
||||||
|
|
||||||
|
### Aggregate NuGet packages modifications across all projects
|
||||||
|
|
||||||
|
NuGet packages used across all selected projects or their dependencies that need version update in projects that reference them.
|
||||||
|
|
||||||
|
| Package Name | Current Version | New Version | Description |
|
||||||
|
|:------------------------------------|:---------------:|:-----------:|:----------------------------------------------|
|
||||||
|
| Microsoft.Bcl.AsyncInterfaces | 10.0.2 | 8.0.0 | Recommended for .NET 8.0 |
|
||||||
|
| Microsoft.Extensions.DependencyInjection | 10.0.2 | 8.0.1 | Recommended for .NET 8.0 |
|
||||||
|
| Microsoft.Extensions.DependencyInjection.Abstractions | 10.0.2 | 8.0.2 | Recommended for .NET 8.0 |
|
||||||
|
| Microsoft.Extensions.Logging | 10.0.2 | 8.0.1 | Recommended for .NET 8.0 |
|
||||||
|
| Microsoft.Extensions.Logging.Abstractions | 10.0.2 | 8.0.3 | Recommended for .NET 8.0 |
|
||||||
|
| Microsoft.Extensions.Options | 10.0.2 | 8.0.2 | Recommended for .NET 8.0 |
|
||||||
|
| Microsoft.Extensions.Primitives | 10.0.2 | 8.0.0 | Recommended for .NET 8.0 |
|
||||||
|
| System.Diagnostics.DiagnosticSource | 10.0.2 | 8.0.1 | Recommended for .NET 8.0 |
|
||||||
|
| System.Drawing.Common | 9.0.10 | 8.0.24 | Recommended for .NET 8.0 |
|
||||||
|
| System.IO.Pipelines | 10.0.2 | 8.0.0 | Recommended for .NET 8.0 |
|
||||||
|
| System.Security.AccessControl | 4.7.0 | 6.0.1 | Recommended for .NET 8.0 |
|
||||||
|
| System.Text.Encodings.Web | 10.0.2 | 8.0.0 | Recommended for .NET 8.0 |
|
||||||
|
| System.Text.Json | 10.0.2 | 8.0.6 | Recommended for .NET 8.0 |
|
||||||
|
| Microsoft.Win32.Registry | 4.7.0 | | Functionality included with framework |
|
||||||
|
| System.Buffers | 4.6.1 | | Functionality included with framework |
|
||||||
|
| System.IO | 4.3.0 | | Functionality included with framework |
|
||||||
|
| System.Memory | 4.6.3 | | Functionality included with framework |
|
||||||
|
| System.Net.Http | 4.3.4 | | Functionality included with framework |
|
||||||
|
| System.Numerics.Vectors | 4.6.1 | | Functionality included with framework |
|
||||||
|
| System.Runtime | 4.3.0 | | Functionality included with framework |
|
||||||
|
| System.Security.Cryptography.Algorithms | 4.3.0 | | Functionality included with framework |
|
||||||
|
| System.Security.Cryptography.Encoding | 4.3.0 | | Functionality included with framework |
|
||||||
|
| System.Security.Cryptography.Primitives | 4.3.0 | | Functionality included with framework |
|
||||||
|
| System.Security.Cryptography.X509Certificates | 4.3.0 | | Functionality included with framework |
|
||||||
|
| System.Security.Principal.Windows | 4.7.0 | | Functionality included with framework |
|
||||||
|
| System.Threading.Tasks.Extensions | 4.6.3 | | Functionality included with framework |
|
||||||
|
| System.ValueTuple | 4.6.1 | | Functionality included with framework |
|
||||||
|
|
||||||
|
### Project upgrade details
|
||||||
|
|
||||||
|
#### ClipTrimDotNet\ClipTrimDotNet.csproj modifications
|
||||||
|
|
||||||
|
Project properties changes:
|
||||||
|
- Target framework should be changed from `.NETFramework,Version=v4.8` to `net8.0`
|
||||||
|
- Project file should be converted to SDK-style
|
||||||
|
|
||||||
|
NuGet packages changes:
|
||||||
|
- Update all packages listed in the NuGet packages table above as recommended
|
||||||
|
- Remove packages whose functionality is now included with the framework
|
||||||
|
|
||||||
|
Other changes:
|
||||||
|
- Ensure compatibility with .NET 8.0 APIs and features
|
||||||
|
- Update code as needed for breaking changes
|
||||||
1
audio-service/.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
recordings/
|
recordings/
|
||||||
|
__pycache__/
|
||||||
@ -2,12 +2,112 @@
|
|||||||
{
|
{
|
||||||
"name": "Uncategorized",
|
"name": "Uncategorized",
|
||||||
"id": 0,
|
"id": 0,
|
||||||
"clips": []
|
"clips": [
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_195932.wav",
|
||||||
|
"name": "Clip 20260226_195932",
|
||||||
|
"playbackType": "playOverlap",
|
||||||
|
"volume": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260228_165611.wav",
|
||||||
|
"name": "Clip 20260228_165611",
|
||||||
|
"playbackType": "playStop",
|
||||||
|
"volume": 1.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260228_165646.wav",
|
||||||
|
"name": "Clip 20260228_165646",
|
||||||
|
"playbackType": "playStop",
|
||||||
|
"volume": 1.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260228_190355.wav",
|
||||||
|
"name": "Clip 20260228_190355",
|
||||||
|
"playbackType": "playStop",
|
||||||
|
"volume": 1.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260228_190357.wav",
|
||||||
|
"name": "Clip 20260228_190357",
|
||||||
|
"playbackType": "playStop",
|
||||||
|
"volume": 1.0
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Test",
|
"name": "Test",
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"clips": []
|
"clips": [
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_183812.wav",
|
||||||
|
"name": "Clip 20260226_183812",
|
||||||
|
"playbackType": "playStop",
|
||||||
|
"volume": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_183607.wav",
|
||||||
|
"name": "Clip 20260226_183607",
|
||||||
|
"playbackType": "playStop",
|
||||||
|
"volume": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_183822.wav",
|
||||||
|
"name": "Clip 20260226_183822",
|
||||||
|
"playbackType": "playStop",
|
||||||
|
"volume": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_184028.wav",
|
||||||
|
"name": "Clip 20260226_184028",
|
||||||
|
"playbackType": "playStop",
|
||||||
|
"volume": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_184030.wav",
|
||||||
|
"name": "Clip 20260226_184030",
|
||||||
|
"playbackType": "playStop",
|
||||||
|
"volume": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_184032.wav",
|
||||||
|
"name": "Clip 20260226_184032",
|
||||||
|
"playbackType": "playStop",
|
||||||
|
"volume": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_184037.wav",
|
||||||
|
"name": "Clip 20260226_184037",
|
||||||
|
"playbackType": "playStop",
|
||||||
|
"volume": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_184040.wav",
|
||||||
|
"name": "Clip 20260226_184040",
|
||||||
|
"playbackType": "playStop",
|
||||||
|
"volume": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_184041.wav",
|
||||||
|
"name": "Clip 20260226_184041",
|
||||||
|
"playbackType": "playStop",
|
||||||
|
"volume": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_184042.wav",
|
||||||
|
"name": "Clip 20260226_184042",
|
||||||
|
"playbackType": "playStop",
|
||||||
|
"volume": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260228_092721.wav",
|
||||||
|
"name": "Clip 20260228_092721",
|
||||||
|
"playbackType": "playStop",
|
||||||
|
"volume": 1,
|
||||||
|
"startTime": 6.438382145377559,
|
||||||
|
"endTime": 14.277258292166426
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "New",
|
"name": "New",
|
||||||
@ -17,16 +117,28 @@
|
|||||||
"endTime": 30,
|
"endTime": 30,
|
||||||
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260220_193822.wav",
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260220_193822.wav",
|
||||||
"name": "Pee pee\npoo poo",
|
"name": "Pee pee\npoo poo",
|
||||||
|
"playbackType": "playOverlap",
|
||||||
|
"startTime": 27.64044943820222,
|
||||||
|
"volume": 0.31
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"endTime": 30,
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260220_200442.wav",
|
||||||
|
"name": "Test",
|
||||||
|
"playbackType": "playOverlap",
|
||||||
|
"startTime": 26.14685314685314,
|
||||||
|
"volume": 0.64
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260228_085116.wav",
|
||||||
|
"name": "pp",
|
||||||
"playbackType": "playStop",
|
"playbackType": "playStop",
|
||||||
"startTime": 27.756510985786615,
|
|
||||||
"volume": 1
|
"volume": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"endTime": 28.597210828548004,
|
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260228_120955.wav",
|
||||||
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260220_200442.wav",
|
"name": "nose",
|
||||||
"name": "Clip 20260220_200442",
|
|
||||||
"playbackType": "playStop",
|
"playbackType": "playStop",
|
||||||
"startTime": 26.1853978671042,
|
|
||||||
"volume": 1
|
"volume": 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
sounddevice==0.5.1
|
Flask==3.1.3
|
||||||
numpy==1.22.3
|
flask_cors==6.0.2
|
||||||
python-osc==1.9.3
|
flask_socketio==5.6.1
|
||||||
scipy==1.10.1
|
numpy==2.4.2
|
||||||
comtypes==1.4.8
|
scipy==1.17.1
|
||||||
pycaw==20240210
|
sounddevice==0.5.5
|
||||||
Flask==3.1.2
|
|
||||||
|
|||||||
@ -1,10 +1,17 @@
|
|||||||
{
|
{
|
||||||
"input_device": {
|
"input_device": {
|
||||||
"default_samplerate": 44100.0,
|
"channels": 2,
|
||||||
"index": 1,
|
"default_samplerate": 48000,
|
||||||
"max_input_channels": 8,
|
"index": 55,
|
||||||
"name": "VM Mic mix (VB-Audio Voicemeete"
|
"name": "VM Mic mix (VB-Audio Voicemeeter VAIO)"
|
||||||
},
|
},
|
||||||
"save_path": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings",
|
"save_path": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings",
|
||||||
"recording_length": 30
|
"recording_length": 30,
|
||||||
|
"output_device": {
|
||||||
|
"channels": 2,
|
||||||
|
"default_samplerate": 48000,
|
||||||
|
"index": 45,
|
||||||
|
"name": "VM to Discord (VB-Audio Voicemeeter VAIO)"
|
||||||
|
},
|
||||||
|
"http_port": 5010
|
||||||
}
|
}
|
||||||
64
audio-service/src/audio_clip.py
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import scipy.signal
|
||||||
|
import scipy.io.wavfile as wavfile
|
||||||
|
import numpy as np
|
||||||
|
import os
|
||||||
|
|
||||||
|
class AudioClip:
|
||||||
|
def __init__(self, metadata, target_sample_rate=44100):
|
||||||
|
"""
|
||||||
|
metadata: dict with keys 'filename', 'start', 'end' (seconds)
|
||||||
|
target_sample_rate: sample rate for playback
|
||||||
|
"""
|
||||||
|
self.metadata = metadata
|
||||||
|
self.file_path = metadata['filename']
|
||||||
|
self.start = metadata.get('startTime', 0)
|
||||||
|
self.end = metadata.get('endTime', None)
|
||||||
|
self.target_sample_rate = target_sample_rate
|
||||||
|
self.volume = metadata.get('volume', 1.0)
|
||||||
|
self.finished = False
|
||||||
|
self.audio_data, self.sample_rate = self._load_and_process_audio()
|
||||||
|
print(f"AudioClip created for {self.file_path} with start={self.start}s, end={self.end}s, sample_rate={self.sample_rate}Hz, length={len(self.audio_data)/self.sample_rate:.2f}s")
|
||||||
|
self.position = 0 # sample index for playback
|
||||||
|
|
||||||
|
def _load_and_process_audio(self):
|
||||||
|
# Load audio file
|
||||||
|
sample_rate, data = wavfile.read(self.file_path)
|
||||||
|
# Convert to float32
|
||||||
|
if data.dtype != np.float32:
|
||||||
|
data = data.astype(np.float32) / np.max(np.abs(data))
|
||||||
|
# Convert to mono if needed
|
||||||
|
if len(data.shape) > 1:
|
||||||
|
data = np.mean(data, axis=1)
|
||||||
|
# Resample if needed
|
||||||
|
if sample_rate != self.target_sample_rate:
|
||||||
|
num_samples = int(len(data) * self.target_sample_rate / sample_rate)
|
||||||
|
data = scipy.signal.resample(data, num_samples)
|
||||||
|
sample_rate = self.target_sample_rate
|
||||||
|
# Cache only the clip region
|
||||||
|
start_sample = int(self.start * sample_rate)
|
||||||
|
end_sample = int(self.end * sample_rate) if self.end else len(data)
|
||||||
|
cached = data[start_sample:end_sample]
|
||||||
|
cached *= self.volume # Apply volume
|
||||||
|
return cached, sample_rate
|
||||||
|
|
||||||
|
def get_samples(self, num_samples):
|
||||||
|
# Return next chunk for playback
|
||||||
|
if self.position >= len(self.audio_data):
|
||||||
|
self.finished = True
|
||||||
|
return np.zeros(num_samples, dtype=np.float32)
|
||||||
|
end_pos = min(self.position + num_samples, len(self.audio_data))
|
||||||
|
chunk = self.audio_data[self.position:end_pos]
|
||||||
|
self.position = end_pos
|
||||||
|
if self.position >= len(self.audio_data):
|
||||||
|
self.finished = True
|
||||||
|
# Pad if chunk is short
|
||||||
|
if len(chunk) < num_samples:
|
||||||
|
chunk = np.pad(chunk, (0, num_samples - len(chunk)), mode='constant')
|
||||||
|
return chunk
|
||||||
|
|
||||||
|
def is_finished(self):
|
||||||
|
return self.finished
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
self.position = 0
|
||||||
|
self.finished = False
|
||||||
168
audio-service/src/audio_io.py
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
import sounddevice as sd
|
||||||
|
import numpy as np
|
||||||
|
import os
|
||||||
|
from datetime import datetime
|
||||||
|
import scipy.io.wavfile as wavfile
|
||||||
|
from metadata_manager import MetaDataManager
|
||||||
|
from audio_clip import AudioClip
|
||||||
|
|
||||||
|
|
||||||
|
# AudioClip class for clip playback
|
||||||
|
|
||||||
|
|
||||||
|
class AudioIO:
|
||||||
|
_instance = None
|
||||||
|
|
||||||
|
def __new__(cls, *args, **kwargs):
|
||||||
|
if cls._instance is None:
|
||||||
|
# print("Creating new AudioRecorder instance")
|
||||||
|
cls._instance = super().__new__(cls)
|
||||||
|
cls._instance.init()
|
||||||
|
return cls._instance
|
||||||
|
def init(self):
|
||||||
|
self.duration = 30
|
||||||
|
self.channels = 2
|
||||||
|
self.input_sample_rate = 44100
|
||||||
|
self.output_sample_rate = 44100
|
||||||
|
self.buffer = np.zeros((int(self.duration * self.input_sample_rate), self.channels), dtype=np.float32)
|
||||||
|
self.recordings_dir = "recordings"
|
||||||
|
|
||||||
|
sd.default.latency = 'low'
|
||||||
|
|
||||||
|
self.socket = None
|
||||||
|
|
||||||
|
self.in_stream = sd.InputStream(
|
||||||
|
callback=self.record_callback
|
||||||
|
)
|
||||||
|
|
||||||
|
self.out_stream = sd.OutputStream(
|
||||||
|
callback=self.playback_callback,
|
||||||
|
latency=3
|
||||||
|
)
|
||||||
|
|
||||||
|
self.clip_map = {}
|
||||||
|
|
||||||
|
|
||||||
|
def refresh_streams(self):
|
||||||
|
was_active = self.in_stream.active
|
||||||
|
if was_active:
|
||||||
|
self.in_stream.stop()
|
||||||
|
self.out_stream.stop()
|
||||||
|
|
||||||
|
self.buffer = np.zeros((int(self.duration * self.input_sample_rate), self.channels), dtype=np.float32)
|
||||||
|
# print(f"AudioRecorder initialized with duration={self.duration}s, sample_rate={self.sample_rate}Hz, channels={self.channels}")
|
||||||
|
self.in_stream = sd.InputStream(
|
||||||
|
callback=self.record_callback
|
||||||
|
)
|
||||||
|
|
||||||
|
self.out_stream = sd.OutputStream(
|
||||||
|
callback=self.playback_callback
|
||||||
|
)
|
||||||
|
|
||||||
|
if was_active:
|
||||||
|
self.in_stream.start()
|
||||||
|
self.out_stream.start()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def record_callback(self, indata, frames, time, status):
|
||||||
|
if status:
|
||||||
|
# print(f"Recording status: {status}")
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Circular buffer implementation
|
||||||
|
self.buffer = np.roll(self.buffer, -frames, axis=0)
|
||||||
|
self.buffer[-frames:] = indata
|
||||||
|
|
||||||
|
def playback_callback(self, outdata, frames, time, status):
|
||||||
|
if status:
|
||||||
|
# print(f"Playback status: {status}")
|
||||||
|
pass
|
||||||
|
|
||||||
|
outdata.fill(0)
|
||||||
|
|
||||||
|
# Iterate over a copy of the items to avoid modifying the dictionary during iteration
|
||||||
|
for clip_id, clip_list in list(self.clip_map.items()):
|
||||||
|
for clip in clip_list[:]: # Iterate over a copy of the list
|
||||||
|
if not clip.is_finished():
|
||||||
|
samples = clip.get_samples(frames)
|
||||||
|
outdata[:] += samples.reshape(-1, 1) # Mix into output
|
||||||
|
if clip.is_finished():
|
||||||
|
self.clip_map[clip_id].remove(clip)
|
||||||
|
if len(self.clip_map[clip_id]) == 0:
|
||||||
|
del self.clip_map[clip_id]
|
||||||
|
break # Exit inner loop since the key is deleted
|
||||||
|
|
||||||
|
|
||||||
|
def save_last_n_seconds(self):
|
||||||
|
# Create output directory if it doesn't exist
|
||||||
|
os.makedirs(self.recordings_dir, exist_ok=True)
|
||||||
|
|
||||||
|
# Generate filename with timestamp
|
||||||
|
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||||
|
filename = os.path.join(self.recordings_dir, f"audio_capture_{timestamp}.wav")
|
||||||
|
|
||||||
|
# Normalize audio to prevent clipping
|
||||||
|
audio_data = self.buffer / np.max(np.abs(self.buffer)) * .5
|
||||||
|
|
||||||
|
# Convert float32 to int16 for WAV file
|
||||||
|
audio_data_int16 = (audio_data * 32767).astype(np.int16)
|
||||||
|
|
||||||
|
# Write buffer to file
|
||||||
|
wavfile.write(filename, int(self.input_sample_rate), audio_data_int16)
|
||||||
|
|
||||||
|
meta = MetaDataManager()
|
||||||
|
|
||||||
|
clip_metadata = {
|
||||||
|
"filename": filename,
|
||||||
|
"name": f"Clip {timestamp}",
|
||||||
|
"playbackType":"playStop",
|
||||||
|
"volume": 1.0,
|
||||||
|
}
|
||||||
|
|
||||||
|
meta.add_clip_to_collection("Uncategorized", clip_metadata )
|
||||||
|
self.socket.emit('new_clip', clip_metadata)
|
||||||
|
|
||||||
|
return clip_metadata
|
||||||
|
|
||||||
|
def set_buffer_duration(self, duration):
|
||||||
|
self.duration = duration
|
||||||
|
self.buffer = np.zeros((int(duration * self.input_sample_rate), self.channels), dtype=np.float32)
|
||||||
|
|
||||||
|
def set_recording_directory(self, directory):
|
||||||
|
self.recordings_dir = directory
|
||||||
|
|
||||||
|
def start_recording(self):
|
||||||
|
if(self.in_stream.active):
|
||||||
|
# print("Already recording")
|
||||||
|
return
|
||||||
|
# print('number of channels', self.channels)
|
||||||
|
|
||||||
|
self.in_stream.start()
|
||||||
|
self.out_stream.start()
|
||||||
|
self.output_sample_rate = self.out_stream.samplerate
|
||||||
|
self.input_sample_rate = self.in_stream.samplerate
|
||||||
|
|
||||||
|
def stop_recording(self):
|
||||||
|
if(not self.in_stream.active):
|
||||||
|
# print("Already stopped")
|
||||||
|
return
|
||||||
|
|
||||||
|
self.in_stream.stop()
|
||||||
|
self.out_stream.stop()
|
||||||
|
|
||||||
|
def is_recording(self):
|
||||||
|
return self.in_stream.active
|
||||||
|
|
||||||
|
def play_clip(self, clip_metadata):
|
||||||
|
print(f"Playing clip: {clip_metadata}")
|
||||||
|
clip_id = clip_metadata.get("filename")
|
||||||
|
if clip_metadata.get("playbackType") == "playStop":
|
||||||
|
if clip_id in self.clip_map:
|
||||||
|
del self.clip_map[clip_id]
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
self.clip_map[clip_id] = []
|
||||||
|
if clip_id not in self.clip_map:
|
||||||
|
self.clip_map[clip_id] = []
|
||||||
|
self.clip_map[clip_id].append(AudioClip(clip_metadata, target_sample_rate=self.output_sample_rate))
|
||||||
@ -1,156 +0,0 @@
|
|||||||
import sounddevice as sd
|
|
||||||
import numpy as np
|
|
||||||
import os
|
|
||||||
from datetime import datetime
|
|
||||||
import scipy.io.wavfile as wavfile
|
|
||||||
from metadata_manager import MetaDataManager
|
|
||||||
|
|
||||||
class AudioRecorder:
|
|
||||||
_instance = None
|
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
|
||||||
if cls._instance is None:
|
|
||||||
print("Creating new AudioRecorder instance")
|
|
||||||
cls._instance = super().__new__(cls)
|
|
||||||
cls._instance.init()
|
|
||||||
return cls._instance
|
|
||||||
def init(self):
|
|
||||||
"""
|
|
||||||
Initialize audio recorder with configurable parameters.
|
|
||||||
|
|
||||||
:param duration: Length of audio buffer in seconds
|
|
||||||
:param sample_rate: Audio sample rate (if None, use default device sample rate)
|
|
||||||
:param channels: Number of audio channels
|
|
||||||
"""
|
|
||||||
print(f"Initializing AudioRecorder")
|
|
||||||
self.duration = 30
|
|
||||||
self.sample_rate = 44100
|
|
||||||
self.channels = 2
|
|
||||||
self.buffer = np.zeros((int(self.duration * self.sample_rate), self.channels), dtype=np.float32)
|
|
||||||
self.recordings_dir = "recordings"
|
|
||||||
self.stream = sd.InputStream(
|
|
||||||
samplerate=self.sample_rate,
|
|
||||||
channels=self.channels,
|
|
||||||
callback=self.record_callback
|
|
||||||
)
|
|
||||||
|
|
||||||
def refresh_stream(self):
|
|
||||||
"""
|
|
||||||
Refresh the audio stream with updated parameters.
|
|
||||||
"""
|
|
||||||
was_active = self.stream.active
|
|
||||||
if was_active:
|
|
||||||
self.stream.stop()
|
|
||||||
|
|
||||||
self.buffer = np.zeros((int(self.duration * self.sample_rate), self.channels), dtype=np.float32)
|
|
||||||
|
|
||||||
self.stream = sd.InputStream(
|
|
||||||
samplerate=self.sample_rate,
|
|
||||||
channels=self.channels,
|
|
||||||
callback=self.record_callback
|
|
||||||
)
|
|
||||||
|
|
||||||
if was_active:
|
|
||||||
self.stream.start()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def record_callback(self, indata, frames, time, status):
|
|
||||||
"""
|
|
||||||
Circular buffer callback for continuous recording.
|
|
||||||
|
|
||||||
:param indata: Input audio data
|
|
||||||
:param frames: Number of frames
|
|
||||||
:param time: Timestamp
|
|
||||||
:param status: Recording status
|
|
||||||
"""
|
|
||||||
if status:
|
|
||||||
print(f"Recording status: {status}")
|
|
||||||
|
|
||||||
# Circular buffer implementation
|
|
||||||
self.buffer = np.roll(self.buffer, -frames, axis=0)
|
|
||||||
self.buffer[-frames:] = indata
|
|
||||||
|
|
||||||
def save_last_n_seconds(self):
|
|
||||||
"""
|
|
||||||
Save the last n seconds of audio to a file.
|
|
||||||
|
|
||||||
:param output_dir: Directory to save recordings
|
|
||||||
:return: Path to saved audio file
|
|
||||||
"""
|
|
||||||
# Create output directory if it doesn't exist
|
|
||||||
os.makedirs(self.recordings_dir, exist_ok=True)
|
|
||||||
|
|
||||||
# Generate filename with timestamp
|
|
||||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
|
||||||
filename = os.path.join(self.recordings_dir, f"audio_capture_{timestamp}.wav")
|
|
||||||
|
|
||||||
# Normalize audio to prevent clipping
|
|
||||||
audio_data = self.buffer / np.max(np.abs(self.buffer)) * .5
|
|
||||||
|
|
||||||
# Convert float32 to int16 for WAV file
|
|
||||||
audio_data_int16 = (audio_data * 32767).astype(np.int16)
|
|
||||||
|
|
||||||
# Write buffer to file
|
|
||||||
wavfile.write(filename, int(self.sample_rate), audio_data_int16)
|
|
||||||
|
|
||||||
meta = MetaDataManager()
|
|
||||||
|
|
||||||
clip_metadata = {
|
|
||||||
"filename": filename,
|
|
||||||
"name": f"Clip {timestamp}",
|
|
||||||
"playbackType":"playStop",
|
|
||||||
"volume": 1.0,
|
|
||||||
}
|
|
||||||
|
|
||||||
meta.add_clip_to_collection("Uncategorized", clip_metadata )
|
|
||||||
|
|
||||||
|
|
||||||
return clip_metadata
|
|
||||||
|
|
||||||
def set_buffer_duration(self, duration):
|
|
||||||
"""
|
|
||||||
Set the duration of the audio buffer.
|
|
||||||
|
|
||||||
:param duration: New buffer duration in seconds
|
|
||||||
"""
|
|
||||||
self.duration = duration
|
|
||||||
self.buffer = np.zeros((int(duration * self.sample_rate), self.channels), dtype=np.float32)
|
|
||||||
|
|
||||||
def set_recording_directory(self, directory):
|
|
||||||
"""
|
|
||||||
Set the directory where recordings will be saved.
|
|
||||||
|
|
||||||
:param directory: Path to the recordings directory
|
|
||||||
"""
|
|
||||||
self.recordings_dir = directory
|
|
||||||
|
|
||||||
def start_recording(self):
|
|
||||||
"""
|
|
||||||
Start continuous audio recording with circular buffer.
|
|
||||||
"""
|
|
||||||
if(self.stream.active):
|
|
||||||
print("Already recording")
|
|
||||||
return
|
|
||||||
print('number of channels', self.channels)
|
|
||||||
|
|
||||||
self.stream.start()
|
|
||||||
|
|
||||||
def stop_recording(self):
|
|
||||||
"""
|
|
||||||
Stop continuous audio recording with circular buffer.
|
|
||||||
"""
|
|
||||||
if(not self.stream.active):
|
|
||||||
print("Already stopped")
|
|
||||||
return
|
|
||||||
|
|
||||||
self.stream.stop()
|
|
||||||
|
|
||||||
def is_recording(self):
|
|
||||||
"""
|
|
||||||
Check if the audio stream is currently active.
|
|
||||||
|
|
||||||
:return: True if recording, False otherwise
|
|
||||||
"""
|
|
||||||
return self.stream.active
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from audio_recorder import AudioRecorder
|
from audio_io import AudioIO
|
||||||
from windows_audio import WindowsAudioManager
|
from windows_audio import WindowsAudioManager
|
||||||
import sounddevice as sd
|
import sounddevice as sd
|
||||||
from metadata_manager import MetaDataManager
|
from metadata_manager import MetaDataManager
|
||||||
@ -14,13 +14,30 @@ from routes.recording import recording_bp
|
|||||||
from routes.device import device_bp
|
from routes.device import device_bp
|
||||||
from routes.metadata import metadata_bp
|
from routes.metadata import metadata_bp
|
||||||
from routes.settings import settings_bp
|
from routes.settings import settings_bp
|
||||||
from flask_socketio import SocketIO
|
from flask_socketio import SocketIO, emit
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
CORS(app)
|
CORS(app)
|
||||||
# socketio = SocketIO(app, cors_allowed_origins="*")
|
socketio = SocketIO(app, cors_allowed_origins="*", logger=True, engineio_logger=True, async_mode='eventlet')
|
||||||
# CORS(socketio)
|
|
||||||
|
@socketio.on('connect')
|
||||||
|
def handle_connect():
|
||||||
|
print("Client connected")
|
||||||
|
emit('full_data', MetaDataManager().collections)
|
||||||
|
|
||||||
|
@socketio.on('record_clip')
|
||||||
|
def record_clip():
|
||||||
|
io = AudioIO()
|
||||||
|
io.save_last_n_seconds();
|
||||||
|
|
||||||
|
@socketio.on('play_clip')
|
||||||
|
def play_clip(data):
|
||||||
|
io = AudioIO()
|
||||||
|
print(f"Received play_clip event with data: {data}")
|
||||||
|
if data:
|
||||||
|
io.play_clip(data)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Create argument parser
|
# Create argument parser
|
||||||
@ -36,33 +53,41 @@ def main():
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
audio_manager = WindowsAudioManager()
|
audio_manager = WindowsAudioManager()
|
||||||
settings = SettingsManager()
|
settings = SettingsManager()
|
||||||
|
meta = MetaDataManager()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Ensure save path exists
|
# Ensure save path exists
|
||||||
os.makedirs(settings.get_settings('save_path'), exist_ok=True)
|
os.makedirs(settings.get_settings('save_path'), exist_ok=True)
|
||||||
|
|
||||||
|
|
||||||
|
io = AudioIO()
|
||||||
|
io.start_recording()
|
||||||
|
|
||||||
|
# settings.socket = socketio
|
||||||
|
io.socket = socketio
|
||||||
|
meta.socket = socketio
|
||||||
|
|
||||||
# Register blueprints
|
# Register blueprints
|
||||||
app.register_blueprint(recording_bp)
|
app.register_blueprint(recording_bp)
|
||||||
app.register_blueprint(device_bp)
|
app.register_blueprint(device_bp)
|
||||||
app.register_blueprint(metadata_bp)
|
app.register_blueprint(metadata_bp)
|
||||||
app.register_blueprint(settings_bp)
|
app.register_blueprint(settings_bp)
|
||||||
app.run(host='127.0.0.1', port=args.osc_port, debug=False, use_reloader=True)
|
print(f"Starting Flask server on port {settings.get_settings('http_port')}")
|
||||||
# socketio.run(app, host='127.0.0.1', port=args.osc_port, debug=False, use_reloader=True)
|
# app.run(host='127.0.0.1', port=settings.get_settings('http_port'), debug=False, use_reloader=True)
|
||||||
|
socketio.run(app, host='127.0.0.1', port=settings.get_settings('http_port'), debug=False, use_reloader=True, allow_unsafe_werkzeug=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Run the OSC server
|
# Run the OSC server
|
||||||
try:
|
# try:
|
||||||
print(f"Starting OSC Recording Server on port {args.osc_port}")
|
# print(f"Starting OSC Recording Server on port {args.osc_port}")
|
||||||
|
# # osc_server.run_server()
|
||||||
|
# except KeyboardInterrupt:
|
||||||
|
# print("\nServer stopped by user.")
|
||||||
# osc_server.run_server()
|
# except Exception as e:
|
||||||
except KeyboardInterrupt:
|
# print(f"Error starting server: {e}")
|
||||||
print("\nServer stopped by user.")
|
# sys.exit(1)
|
||||||
except Exception as e:
|
|
||||||
print(f"Error starting server: {e}")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@ -10,6 +10,7 @@ class MetaDataManager:
|
|||||||
cls._instance.init()
|
cls._instance.init()
|
||||||
return cls._instance
|
return cls._instance
|
||||||
def init(self):
|
def init(self):
|
||||||
|
self.socket = None
|
||||||
# read metadata file from executing directory
|
# read metadata file from executing directory
|
||||||
self.metadata_file = os.path.join(os.getcwd(), "metadata.json")
|
self.metadata_file = os.path.join(os.getcwd(), "metadata.json")
|
||||||
if os.path.exists(self.metadata_file):
|
if os.path.exists(self.metadata_file):
|
||||||
@ -40,6 +41,8 @@ class MetaDataManager:
|
|||||||
if collection is None:
|
if collection is None:
|
||||||
raise ValueError(f"Collection '{collection_name}' does not exist.")
|
raise ValueError(f"Collection '{collection_name}' does not exist.")
|
||||||
collection["clips"].append(clip_metadata)
|
collection["clips"].append(clip_metadata)
|
||||||
|
if not self.socket is None:
|
||||||
|
self.socket.emit('collection_updated', collection)
|
||||||
self.save_metadata()
|
self.save_metadata()
|
||||||
|
|
||||||
def remove_clip_from_collection(self, collection_name, clip_metadata):
|
def remove_clip_from_collection(self, collection_name, clip_metadata):
|
||||||
@ -55,11 +58,18 @@ class MetaDataManager:
|
|||||||
clip for clip in collection["clips"]
|
clip for clip in collection["clips"]
|
||||||
if clip.get("filename") != clip_metadata.get("filename")
|
if clip.get("filename") != clip_metadata.get("filename")
|
||||||
]
|
]
|
||||||
|
if not self.socket is None:
|
||||||
|
self.socket.emit('collection_updated', collection)
|
||||||
self.save_metadata()
|
self.save_metadata()
|
||||||
|
|
||||||
|
|
||||||
def move_clip_to_collection(self, source_collection, target_collection, clip_metadata):
|
def move_clip_to_collection(self, source_collection, target_collection, clip_metadata):
|
||||||
self.remove_clip_from_collection(source_collection, clip_metadata)
|
self.remove_clip_from_collection(source_collection, clip_metadata)
|
||||||
self.add_clip_to_collection(target_collection, clip_metadata)
|
self.add_clip_to_collection(target_collection, clip_metadata)
|
||||||
|
if not self.socket is None:
|
||||||
|
self.socket.emit('collection_updated', source_collection)
|
||||||
|
self.socket.emit('collection_updated', target_collection)
|
||||||
|
|
||||||
|
|
||||||
def edit_clip_in_collection(self, collection_name, new_clip_metadata):
|
def edit_clip_in_collection(self, collection_name, new_clip_metadata):
|
||||||
collection = next((c for c in self.collections if c.get("name") == collection_name), None)
|
collection = next((c for c in self.collections if c.get("name") == collection_name), None)
|
||||||
@ -71,6 +81,8 @@ class MetaDataManager:
|
|||||||
raise ValueError(f"Clip with filename '{new_clip_metadata.get('filename')}' not found in collection '{collection_name}'.")
|
raise ValueError(f"Clip with filename '{new_clip_metadata.get('filename')}' not found in collection '{collection_name}'.")
|
||||||
|
|
||||||
collection["clips"][index] = new_clip_metadata
|
collection["clips"][index] = new_clip_metadata
|
||||||
|
if not self.socket is None:
|
||||||
|
self.socket.emit('collection_updated', collection)
|
||||||
self.save_metadata()
|
self.save_metadata()
|
||||||
|
|
||||||
def get_collections(self):
|
def get_collections(self):
|
||||||
@ -93,6 +105,8 @@ class MetaDataManager:
|
|||||||
raise ValueError("New order contains clips that do not exist in the collection.")
|
raise ValueError("New order contains clips that do not exist in the collection.")
|
||||||
|
|
||||||
collection["clips"] = new_order
|
collection["clips"] = new_order
|
||||||
|
if not self.socket is None:
|
||||||
|
self.socket.emit('collection_updated', collection)
|
||||||
self.save_metadata()
|
self.save_metadata()
|
||||||
|
|
||||||
def save_metadata(self):
|
def save_metadata(self):
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
from flask import Blueprint, request, jsonify
|
from flask import Blueprint, request, jsonify
|
||||||
from windows_audio import WindowsAudioManager
|
from windows_audio import WindowsAudioManager
|
||||||
from audio_recorder import AudioRecorder
|
from audio_io import AudioIO
|
||||||
|
|
||||||
device_bp = Blueprint('device', __name__)
|
device_bp = Blueprint('device', __name__)
|
||||||
|
|
||||||
audio_manager = WindowsAudioManager()
|
audio_manager = WindowsAudioManager()
|
||||||
recorder = AudioRecorder()
|
recorder = AudioIO()
|
||||||
|
|
||||||
# @device_bp.route('/device/set', methods=['POST'])
|
# @device_bp.route('/device/set', methods=['POST'])
|
||||||
# def set_audio_device():
|
# def set_audio_device():
|
||||||
@ -19,13 +19,13 @@ recorder = AudioRecorder()
|
|||||||
# except Exception as e:
|
# except Exception as e:
|
||||||
# return jsonify({'status': 'error', 'message': str(e)}), 400
|
# return jsonify({'status': 'error', 'message': str(e)}), 400
|
||||||
|
|
||||||
@device_bp.route('/device/get', methods=['GET'])
|
# @device_bp.route('/device/get', methods=['GET'])
|
||||||
def get_audio_device():
|
# def get_audio_device():
|
||||||
try:
|
# try:
|
||||||
device_info = audio_manager.get_default_device('input')
|
# device_info = audio_manager.get_default_device('input')
|
||||||
return jsonify({'status': 'success', 'device_info': device_info})
|
# return jsonify({'status': 'success', 'device_info': device_info})
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
return jsonify({'status': 'error', 'message': str(e)}), 400
|
# return jsonify({'status': 'error', 'message': str(e)}), 400
|
||||||
|
|
||||||
@device_bp.route('/device/list', methods=['GET'])
|
@device_bp.route('/device/list', methods=['GET'])
|
||||||
def list_audio_devices():
|
def list_audio_devices():
|
||||||
|
|||||||
@ -91,10 +91,16 @@ def edit_clip_in_collection():
|
|||||||
meta_manager = MetaDataManager()
|
meta_manager = MetaDataManager()
|
||||||
collection_name = request.json.get('name')
|
collection_name = request.json.get('name')
|
||||||
clip_metadata = request.json.get('clip')
|
clip_metadata = request.json.get('clip')
|
||||||
print(f"Received request to edit clip in collection '{collection_name}': {clip_metadata}")
|
# print(f"Received request to edit clip in collection '{collection_name}': {clip_metadata}")
|
||||||
try:
|
try:
|
||||||
meta_manager.edit_clip_in_collection(collection_name, clip_metadata)
|
meta_manager.edit_clip_in_collection(collection_name, clip_metadata)
|
||||||
collections = meta_manager.collections
|
collections = meta_manager.collections
|
||||||
return jsonify({'status': 'success', 'collections': collections})
|
return jsonify({'status': 'success', 'collections': collections})
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
return jsonify({'status': 'error', 'message': str(e)}), 400
|
return jsonify({'status': 'error', 'message': str(e)}), 400
|
||||||
|
|
||||||
|
|
||||||
|
@metadata_bp.route('/ws/test', methods=['POST'])
|
||||||
|
def test_websocket():
|
||||||
|
MetaDataManager().socket.emit('test_event', {'data': 'Test message from metadata route'})
|
||||||
|
return jsonify({'status': 'success'})
|
||||||
@ -1,36 +1,36 @@
|
|||||||
|
|
||||||
from flask import Blueprint, request, jsonify
|
from flask import Blueprint, request, jsonify
|
||||||
from audio_recorder import AudioRecorder
|
from audio_io import AudioIO
|
||||||
import os
|
import os
|
||||||
|
|
||||||
recording_bp = Blueprint('recording', __name__)
|
recording_bp = Blueprint('recording', __name__)
|
||||||
|
|
||||||
@recording_bp.route('/record/start', methods=['POST'])
|
@recording_bp.route('/record/start', methods=['POST'])
|
||||||
def start_recording():
|
def start_recording():
|
||||||
recorder = AudioRecorder()
|
recorder = AudioIO()
|
||||||
print('HTTP: Starting audio recording')
|
print('HTTP: Starting audio recording')
|
||||||
recorder.start_recording()
|
recorder.start_recording()
|
||||||
return jsonify({'status': 'recording started'})
|
return jsonify({'status': 'recording started'})
|
||||||
|
|
||||||
@recording_bp.route('/record/stop', methods=['POST'])
|
@recording_bp.route('/record/stop', methods=['POST'])
|
||||||
def stop_recording():
|
def stop_recording():
|
||||||
recorder = AudioRecorder()
|
recorder = AudioIO()
|
||||||
print('HTTP: Stopping audio recording')
|
# print('HTTP: Stopping audio recording')
|
||||||
recorder.stop_recording()
|
recorder.stop_recording()
|
||||||
return jsonify({'status': 'recording stopped'})
|
return jsonify({'status': 'recording stopped'})
|
||||||
|
|
||||||
@recording_bp.route('/record/save', methods=['POST'])
|
@recording_bp.route('/record/save', methods=['POST'])
|
||||||
def save_recording():
|
def save_recording():
|
||||||
recorder = AudioRecorder()
|
recorder = AudioIO()
|
||||||
print('HTTP: Saving audio recording')
|
# print('HTTP: Saving audio recording')
|
||||||
saved_file = recorder.save_last_n_seconds()
|
saved_file = recorder.save_last_n_seconds()
|
||||||
return jsonify({'status': 'recording saved', 'file': saved_file})
|
return jsonify({'status': 'recording saved', 'file': saved_file})
|
||||||
|
|
||||||
|
|
||||||
@recording_bp.route('/record/status', methods=['GET'])
|
@recording_bp.route('/record/status', methods=['GET'])
|
||||||
def recording_status():
|
def recording_status():
|
||||||
recorder = AudioRecorder()
|
recorder = AudioIO()
|
||||||
print('HTTP: Checking recording status')
|
# print('HTTP: Checking recording status')
|
||||||
status = 'recording' if recorder.is_recording() else 'stopped'
|
status = 'recording' if recorder.is_recording() else 'stopped'
|
||||||
return jsonify({'status': status})
|
return jsonify({'status': status})
|
||||||
|
|
||||||
@ -45,8 +45,12 @@ def recording_delete():
|
|||||||
|
|
||||||
@recording_bp.route('/playback/start', methods=['POST'])
|
@recording_bp.route('/playback/start', methods=['POST'])
|
||||||
def playback_start():
|
def playback_start():
|
||||||
print('HTTP: Starting audio playback')
|
print(f"Playing clip")
|
||||||
|
# print('HTTP: Starting audio playback')
|
||||||
|
clip = request.json
|
||||||
try:
|
try:
|
||||||
|
io = AudioIO()
|
||||||
|
io.play_clip(clip)
|
||||||
# os.remove(filename)
|
# os.remove(filename)
|
||||||
return jsonify({'status': 'success'})
|
return jsonify({'status': 'success'})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
@ -16,10 +16,17 @@ def get_setting(name):
|
|||||||
else:
|
else:
|
||||||
return jsonify({'status': 'error', 'message': f'Setting "{name}" not found'}), 404
|
return jsonify({'status': 'error', 'message': f'Setting "{name}" not found'}), 404
|
||||||
|
|
||||||
@settings_bp.route('/settings/<name>', methods=['POST'])
|
@settings_bp.route('/settings/update', methods=['POST'])
|
||||||
def set_setting(name):
|
def set_all_settings():
|
||||||
value = request.json.get('value')
|
settings = request.json.get('settings')
|
||||||
if value is None:
|
print (f"Received settings update: {settings}")
|
||||||
return jsonify({'status': 'error', 'message': 'Value is required'}), 400
|
if settings is None:
|
||||||
|
return jsonify({'status': 'error', 'message': 'Settings are required'}), 400
|
||||||
|
try:
|
||||||
|
for name, value in settings.items():
|
||||||
|
print(f"Updating setting '{name}' to '{value}'")
|
||||||
SettingsManager().set_settings(name, value)
|
SettingsManager().set_settings(name, value)
|
||||||
return jsonify({'status': 'success', 'name': name, 'value': value})
|
return jsonify({'status': 'success', 'settings': settings})
|
||||||
|
except ValueError as e:
|
||||||
|
return jsonify({'status': 'error', 'message': str(e)}), 400
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
from audio_recorder import AudioRecorder
|
from audio_io import AudioIO
|
||||||
from windows_audio import WindowsAudioManager
|
from windows_audio import WindowsAudioManager
|
||||||
|
|
||||||
class SettingsManager:
|
class SettingsManager:
|
||||||
@ -13,6 +13,7 @@ class SettingsManager:
|
|||||||
return cls._instance
|
return cls._instance
|
||||||
def init(self):
|
def init(self):
|
||||||
# read settings file from executing directory
|
# read settings file from executing directory
|
||||||
|
print("Initializing SettingsManager", os.getcwd())
|
||||||
self.settings_file = os.path.join(os.getcwd(), "settings.json")
|
self.settings_file = os.path.join(os.getcwd(), "settings.json")
|
||||||
if os.path.exists(self.settings_file):
|
if os.path.exists(self.settings_file):
|
||||||
with open(self.settings_file, "r") as f:
|
with open(self.settings_file, "r") as f:
|
||||||
@ -20,21 +21,49 @@ class SettingsManager:
|
|||||||
else:
|
else:
|
||||||
self.settings = {
|
self.settings = {
|
||||||
"input_device": None,
|
"input_device": None,
|
||||||
|
"output_device": None,
|
||||||
"save_path": os.path.join(os.getcwd(), "recordings"),
|
"save_path": os.path.join(os.getcwd(), "recordings"),
|
||||||
"recording_length": 15
|
"recording_length": 15
|
||||||
}
|
}
|
||||||
audio_manager = WindowsAudioManager()
|
audio_manager = WindowsAudioManager()
|
||||||
|
|
||||||
devices = audio_manager.list_audio_devices('input')
|
input_devices = audio_manager.list_audio_devices('input')
|
||||||
print(f"Available input devices: {self.settings}")
|
output_devices = audio_manager.list_audio_devices('output')
|
||||||
input = self.settings["input_device"]
|
# print("Available input devices:")
|
||||||
|
# for i, dev in enumerate(input_devices):
|
||||||
|
# print(i, dev['name'])
|
||||||
|
# print("Available output devices:")
|
||||||
|
# for i, dev in enumerate(output_devices):
|
||||||
|
# print(i, dev['name'])
|
||||||
|
# print(f"Available input devices: {input_devices}")
|
||||||
|
# print(f"Available output devices: {output_devices}")
|
||||||
|
input = None
|
||||||
|
output = None
|
||||||
|
|
||||||
|
if("input_device" in self.settings):
|
||||||
|
input = self.settings["input_device"]
|
||||||
|
if("output_device" in self.settings):
|
||||||
|
output = self.settings["output_device"]
|
||||||
#see if input device is in "devices", if not set to the first index
|
#see if input device is in "devices", if not set to the first index
|
||||||
if input is not None and any(d['name'] == input["name"] for d in devices):
|
if input is not None and any(d['name'] == input["name"] for d in input_devices):
|
||||||
print(f"Using saved input device index: {input}")
|
# print(f"Using saved input device index: {input}")
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
input = devices[0] if devices else None
|
input = input_devices[0] if input_devices else None
|
||||||
self.settings["input_device"] = input
|
self.settings["input_device"] = input
|
||||||
|
|
||||||
|
#see if output device is in "devices", if not set to the first index
|
||||||
|
if output is not None and any(d['name'] == output["name"] for d in output_devices):
|
||||||
|
# print(f"Using saved output device index: {output}")
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
output = output_devices[0] if output_devices else None
|
||||||
|
self.settings["output_device"] = output
|
||||||
|
|
||||||
|
if not "http_port" in self.settings:
|
||||||
|
self.settings["http_port"] = 5010
|
||||||
|
|
||||||
|
|
||||||
self.save_settings()
|
self.save_settings()
|
||||||
|
|
||||||
|
|
||||||
@ -48,6 +77,8 @@ class SettingsManager:
|
|||||||
return self.settings
|
return self.settings
|
||||||
|
|
||||||
def set_settings(self, name, value):
|
def set_settings(self, name, value):
|
||||||
|
if(name not in self.settings):
|
||||||
|
raise ValueError(f"Setting '{name}' not found.")
|
||||||
self.settings[name] = value
|
self.settings[name] = value
|
||||||
self.save_settings()
|
self.save_settings()
|
||||||
|
|
||||||
@ -57,13 +88,14 @@ class SettingsManager:
|
|||||||
json.dump(self.settings, f, indent=4)
|
json.dump(self.settings, f, indent=4)
|
||||||
|
|
||||||
def refresh_settings(self):
|
def refresh_settings(self):
|
||||||
recorder = AudioRecorder()
|
recorder = AudioIO()
|
||||||
# Update recorder parameters based on new setting
|
# Update recorder parameters based on new setting
|
||||||
recorder.set_buffer_duration(self.get_settings('recording_length'))
|
recorder.set_buffer_duration(self.get_settings('recording_length'))
|
||||||
recorder.recordings_dir = self.get_settings('save_path')
|
recorder.recordings_dir = self.get_settings('save_path')
|
||||||
|
|
||||||
audio_manager = WindowsAudioManager()
|
audio_manager = WindowsAudioManager()
|
||||||
audio_manager.set_default_input_device(self.get_settings('input_device')['index'])
|
audio_manager.set_default_input_device(self.get_settings('input_device')['index'])
|
||||||
|
audio_manager.set_default_output_device(self.get_settings('output_device')['index'])
|
||||||
|
|
||||||
recorder.refresh_stream()
|
recorder.refresh_streams()
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
import sounddevice as sd
|
import sounddevice as sd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import comtypes
|
|
||||||
import comtypes.client
|
|
||||||
from comtypes import CLSCTX_ALL
|
|
||||||
from pycaw.pycaw import AudioUtilities, IAudioEndpointVolume
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
class WindowsAudioManager:
|
class WindowsAudioManager:
|
||||||
@ -18,7 +14,19 @@ class WindowsAudioManager:
|
|||||||
"""
|
"""
|
||||||
Initialize Windows audio device and volume management.
|
Initialize Windows audio device and volume management.
|
||||||
"""
|
"""
|
||||||
self.devices = sd.query_devices()
|
host_apis = sd.query_hostapis()
|
||||||
|
wasapi_device_indexes = None
|
||||||
|
for api in host_apis:
|
||||||
|
if api['name'].lower() == 'Windows WASAPI'.lower():
|
||||||
|
wasapi_device_indexes = api['devices']
|
||||||
|
break
|
||||||
|
# print(f"Host APIs: {host_apis}")
|
||||||
|
# print(f"WASAPI Device Indexes: {wasapi_device_indexes}")
|
||||||
|
wasapi_device_indexes = set(wasapi_device_indexes) if wasapi_device_indexes is not None else set()
|
||||||
|
self.devices = [dev for dev in sd.query_devices() if dev['index'] in wasapi_device_indexes]
|
||||||
|
# self.devices = sd.query_devices()
|
||||||
|
# print(f"devices: {self.devices}")
|
||||||
|
|
||||||
self.default_input = sd.default.device[0]
|
self.default_input = sd.default.device[0]
|
||||||
self.default_output = sd.default.device[1]
|
self.default_output = sd.default.device[1]
|
||||||
|
|
||||||
@ -34,7 +42,7 @@ class WindowsAudioManager:
|
|||||||
{
|
{
|
||||||
'index': dev['index'],
|
'index': dev['index'],
|
||||||
'name': dev['name'],
|
'name': dev['name'],
|
||||||
'max_input_channels': dev['max_input_channels'],
|
'channels': dev['max_input_channels'],
|
||||||
'default_samplerate': dev['default_samplerate']
|
'default_samplerate': dev['default_samplerate']
|
||||||
}
|
}
|
||||||
for dev in self.devices if dev['max_input_channels'] > 0
|
for dev in self.devices if dev['max_input_channels'] > 0
|
||||||
@ -44,7 +52,7 @@ class WindowsAudioManager:
|
|||||||
{
|
{
|
||||||
'index': dev['index'],
|
'index': dev['index'],
|
||||||
'name': dev['name'],
|
'name': dev['name'],
|
||||||
'max_output_channels': dev['max_output_channels'],
|
'channels': dev['max_output_channels'],
|
||||||
'default_samplerate': dev['default_samplerate']
|
'default_samplerate': dev['default_samplerate']
|
||||||
}
|
}
|
||||||
for dev in self.devices if dev['max_output_channels'] > 0
|
for dev in self.devices if dev['max_output_channels'] > 0
|
||||||
@ -69,7 +77,7 @@ class WindowsAudioManager:
|
|||||||
|
|
||||||
def set_default_input_device(self, device_index):
|
def set_default_input_device(self, device_index):
|
||||||
if(device_index is None):
|
if(device_index is None):
|
||||||
return self.get_current_input_device_sample_rate()
|
return 0
|
||||||
"""
|
"""
|
||||||
Set the default input audio device.
|
Set the default input audio device.
|
||||||
|
|
||||||
@ -83,41 +91,18 @@ class WindowsAudioManager:
|
|||||||
device_info = sd.query_devices(device_index)
|
device_info = sd.query_devices(device_index)
|
||||||
return device_info['default_samplerate']
|
return device_info['default_samplerate']
|
||||||
|
|
||||||
def get_current_input_device_sample_rate(self):
|
def set_default_output_device(self, device_index):
|
||||||
|
if(device_index is None):
|
||||||
|
return self.get_current_output_device_sample_rate()
|
||||||
"""
|
"""
|
||||||
Get the sample rate of the current input device.
|
Set the default output audio device.
|
||||||
|
|
||||||
:return: Sample rate of the current input device
|
:param device_index: Index of the audio device
|
||||||
|
:return: Sample rate of the selected device
|
||||||
"""
|
"""
|
||||||
device_info = sd.query_devices(self.default_input)
|
sd.default.device[1] = device_index
|
||||||
|
self.default_output = device_index
|
||||||
|
|
||||||
|
# Get the sample rate of the selected device
|
||||||
|
device_info = sd.query_devices(device_index)
|
||||||
return device_info['default_samplerate']
|
return device_info['default_samplerate']
|
||||||
|
|
||||||
def get_system_volume(self):
|
|
||||||
"""
|
|
||||||
Get the system master volume.
|
|
||||||
|
|
||||||
:return: Current system volume (0.0 to 1.0)
|
|
||||||
"""
|
|
||||||
devices = AudioUtilities.GetSpeakers()
|
|
||||||
interface = devices.Activate(
|
|
||||||
IAudioEndpointVolume._iid_,
|
|
||||||
CLSCTX_ALL,
|
|
||||||
None
|
|
||||||
)
|
|
||||||
volume = interface.QueryInterface(IAudioEndpointVolume)
|
|
||||||
return volume.GetMasterVolumeLevelScalar()
|
|
||||||
|
|
||||||
def set_system_volume(self, volume_level):
|
|
||||||
"""
|
|
||||||
Set the system master volume.
|
|
||||||
|
|
||||||
:param volume_level: Volume level (0.0 to 1.0)
|
|
||||||
"""
|
|
||||||
devices = AudioUtilities.GetSpeakers()
|
|
||||||
interface = devices.Activate(
|
|
||||||
IAudioEndpointVolume._iid_,
|
|
||||||
CLSCTX_ALL,
|
|
||||||
None
|
|
||||||
)
|
|
||||||
volume = interface.QueryInterface(IAudioEndpointVolume)
|
|
||||||
volume.SetMasterVolumeLevelScalar(volume_level, None)
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
const tailwindcss = require('@tailwindcss/postcss');
|
const tailwindcss = require('tailwindcss');
|
||||||
const autoprefixer = require('autoprefixer');
|
const autoprefixer = require('autoprefixer');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 361 KiB After Width: | Height: | Size: 164 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
electron-ui/assets/tray_icon.png
Normal file
|
After Width: | Height: | Size: 780 B |
|
Before Width: | Height: | Size: 194 KiB After Width: | Height: | Size: 164 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 1.4 KiB |
BIN
electron-ui/dll_err.txt
Normal file
70
electron-ui/package-lock.json
generated
@ -1,10 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "electron-react-boilerplate",
|
"name": "cliptrim-ui",
|
||||||
|
"version": "2.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "electron-react-boilerplate",
|
"name": "cliptrim-ui",
|
||||||
|
"version": "2.0.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -18,7 +20,6 @@
|
|||||||
"@mui/icons-material": "^7.3.7",
|
"@mui/icons-material": "^7.3.7",
|
||||||
"@mui/material": "^7.3.7",
|
"@mui/material": "^7.3.7",
|
||||||
"@reduxjs/toolkit": "^2.11.2",
|
"@reduxjs/toolkit": "^2.11.2",
|
||||||
"@tailwindcss/cli": "^4.1.18",
|
|
||||||
"@tailwindcss/postcss": "^4.1.18",
|
"@tailwindcss/postcss": "^4.1.18",
|
||||||
"@wavesurfer/react": "^1.0.12",
|
"@wavesurfer/react": "^1.0.12",
|
||||||
"electron-debug": "^4.1.0",
|
"electron-debug": "^4.1.0",
|
||||||
@ -4627,8 +4628,10 @@
|
|||||||
"version": "2.5.6",
|
"version": "2.5.6",
|
||||||
"resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.6.tgz",
|
"resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.6.tgz",
|
||||||
"integrity": "sha512-tmmZ3lQxAe/k/+rNnXQRawJ4NjxO2hqiOLTHvWchtGZULp4RyFeh6aU4XdOYBFe2KE1oShQTv4AblOs2iOrNnQ==",
|
"integrity": "sha512-tmmZ3lQxAe/k/+rNnXQRawJ4NjxO2hqiOLTHvWchtGZULp4RyFeh6aU4XdOYBFe2KE1oShQTv4AblOs2iOrNnQ==",
|
||||||
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"detect-libc": "^2.0.3",
|
"detect-libc": "^2.0.3",
|
||||||
"is-glob": "^4.0.3",
|
"is-glob": "^4.0.3",
|
||||||
@ -4665,6 +4668,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@ -4685,6 +4689,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@ -4705,6 +4710,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@ -4725,6 +4731,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@ -4745,6 +4752,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@ -4765,6 +4773,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@ -4785,6 +4794,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@ -4805,6 +4815,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@ -4825,6 +4836,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@ -4845,6 +4857,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@ -4865,6 +4878,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@ -4885,6 +4899,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"ia32"
|
"ia32"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@ -4905,6 +4920,7 @@
|
|||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@ -4922,13 +4938,17 @@
|
|||||||
"version": "7.1.1",
|
"version": "7.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz",
|
||||||
"integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==",
|
"integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==",
|
||||||
"license": "MIT"
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"optional": true
|
||||||
},
|
},
|
||||||
"node_modules/@parcel/watcher/node_modules/picomatch": {
|
"node_modules/@parcel/watcher/node_modules/picomatch": {
|
||||||
"version": "4.0.3",
|
"version": "4.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
|
||||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"optional": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@ -5560,37 +5580,6 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@tailwindcss/cli": {
|
|
||||||
"version": "4.1.18",
|
|
||||||
"resolved": "https://registry.npmjs.org/@tailwindcss/cli/-/cli-4.1.18.tgz",
|
|
||||||
"integrity": "sha512-sMZ+lZbDyxwjD2E0L7oRUjJ01Ffjtme5OtjvvnC+cV4CEDcbqzbp25TCpxHj6kWLU9+DlqJOiNgSOgctC2aZmg==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@parcel/watcher": "^2.5.1",
|
|
||||||
"@tailwindcss/node": "4.1.18",
|
|
||||||
"@tailwindcss/oxide": "4.1.18",
|
|
||||||
"enhanced-resolve": "^5.18.3",
|
|
||||||
"mri": "^1.2.0",
|
|
||||||
"picocolors": "^1.1.1",
|
|
||||||
"tailwindcss": "4.1.18"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"tailwindcss": "dist/index.mjs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@tailwindcss/cli/node_modules/enhanced-resolve": {
|
|
||||||
"version": "5.19.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.19.0.tgz",
|
|
||||||
"integrity": "sha512-phv3E1Xl4tQOShqSte26C7Fl84EwUdZsyOuSSk9qtAGyyQs2s3jJzComh+Abf4g187lUUAvH+H26omrqia2aGg==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"graceful-fs": "^4.2.4",
|
|
||||||
"tapable": "^2.3.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10.13.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@tailwindcss/node": {
|
"node_modules/@tailwindcss/node": {
|
||||||
"version": "4.1.18",
|
"version": "4.1.18",
|
||||||
"resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.1.18.tgz",
|
"resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.1.18.tgz",
|
||||||
@ -15402,6 +15391,7 @@
|
|||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||||
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
|
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
@ -15467,6 +15457,7 @@
|
|||||||
"version": "4.0.3",
|
"version": "4.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
|
||||||
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
|
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
|
||||||
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"is-extglob": "^2.1.1"
|
"is-extglob": "^2.1.1"
|
||||||
@ -18552,15 +18543,6 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mri": {
|
|
||||||
"version": "1.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz",
|
|
||||||
"integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mrmime": {
|
"node_modules/mrmime": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz",
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "electron-react-boilerplate",
|
"name": "cliptrim-ui",
|
||||||
"description": "A foundation for scalable desktop apps",
|
"description": "A foundation for scalable desktop apps",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"electron",
|
"electron",
|
||||||
@ -12,27 +12,7 @@
|
|||||||
"hot",
|
"hot",
|
||||||
"reload"
|
"reload"
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/electron-react-boilerplate/electron-react-boilerplate#readme",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/electron-react-boilerplate/electron-react-boilerplate.git"
|
|
||||||
},
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": {
|
|
||||||
"name": "Electron React Boilerplate Maintainers",
|
|
||||||
"email": "electronreactboilerplate@gmail.com",
|
|
||||||
"url": "https://electron-react-boilerplate.js.org"
|
|
||||||
},
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Amila Welihinda",
|
|
||||||
"email": "amilajack@gmail.com",
|
|
||||||
"url": "https://github.com/amilajack"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"main": "./.erb/dll/main.bundle.dev.js",
|
"main": "./.erb/dll/main.bundle.dev.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "concurrently \"npm run build:main\" \"npm run build:renderer\"",
|
"build": "concurrently \"npm run build:main\" \"npm run build:renderer\"",
|
||||||
@ -42,14 +22,15 @@
|
|||||||
"postinstall": "ts-node .erb/scripts/check-native-dep.js && electron-builder install-app-deps && npm run build:dll",
|
"postinstall": "ts-node .erb/scripts/check-native-dep.js && electron-builder install-app-deps && npm run build:dll",
|
||||||
"lint": "cross-env NODE_ENV=development eslint . --ext .js,.jsx,.ts,.tsx",
|
"lint": "cross-env NODE_ENV=development eslint . --ext .js,.jsx,.ts,.tsx",
|
||||||
"lint:fix": "cross-env NODE_ENV=development eslint . --ext .js,.jsx,.ts,.tsx --fix",
|
"lint:fix": "cross-env NODE_ENV=development eslint . --ext .js,.jsx,.ts,.tsx --fix",
|
||||||
"package": "ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never && npm run build:dll",
|
"package": "ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder --win",
|
||||||
"rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir release/app",
|
"rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir release/app",
|
||||||
"prestart": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true NODE_OPTIONS=\"-r ts-node/register --no-warnings\" webpack --config ./.erb/configs/webpack.config.main.dev.ts",
|
"prestart": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true NODE_OPTIONS=\"-r ts-node/register --no-warnings\" webpack --config ./.erb/configs/webpack.config.main.dev.ts",
|
||||||
"start": "ts-node ./.erb/scripts/check-port-in-use.js && npm run prestart && npm run start:renderer",
|
"start": "ts-node ./.erb/scripts/check-port-in-use.js && npm run prestart && npm run start:renderer",
|
||||||
"start:main": "concurrently -k -P \"cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --watch --config ./.erb/configs/webpack.config.main.dev.ts\" \"electronmon . -- {@}\" --",
|
"start:main": "concurrently -k -P \"cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --watch --config ./.erb/configs/webpack.config.main.dev.ts\" \"electronmon . -- {@}\" --",
|
||||||
"start:preload": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true NODE_OPTIONS=\"-r ts-node/register --no-warnings\" webpack --config ./.erb/configs/webpack.config.preload.dev.ts",
|
"start:preload": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true NODE_OPTIONS=\"-r ts-node/register --no-warnings\" webpack --config ./.erb/configs/webpack.config.preload.dev.ts",
|
||||||
"start:renderer": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true NODE_OPTIONS=\"-r ts-node/register --no-warnings\" webpack serve --config ./.erb/configs/webpack.config.renderer.dev.ts",
|
"start:renderer": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true NODE_OPTIONS=\"-r ts-node/register --no-warnings\" webpack serve --config ./.erb/configs/webpack.config.renderer.dev.ts",
|
||||||
"test": "jest"
|
"test": "jest",
|
||||||
|
"build:win": "electron-builder --win"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"extends browserslist-config-erb"
|
"extends browserslist-config-erb"
|
||||||
@ -111,7 +92,6 @@
|
|||||||
"@mui/icons-material": "^7.3.7",
|
"@mui/icons-material": "^7.3.7",
|
||||||
"@mui/material": "^7.3.7",
|
"@mui/material": "^7.3.7",
|
||||||
"@reduxjs/toolkit": "^2.11.2",
|
"@reduxjs/toolkit": "^2.11.2",
|
||||||
"@tailwindcss/cli": "^4.1.18",
|
|
||||||
"@tailwindcss/postcss": "^4.1.18",
|
"@tailwindcss/postcss": "^4.1.18",
|
||||||
"@wavesurfer/react": "^1.0.12",
|
"@wavesurfer/react": "^1.0.12",
|
||||||
"electron-debug": "^4.1.0",
|
"electron-debug": "^4.1.0",
|
||||||
@ -195,9 +175,10 @@
|
|||||||
"webpack-dev-server": "^5.2.0",
|
"webpack-dev-server": "^5.2.0",
|
||||||
"webpack-merge": "^6.0.1"
|
"webpack-merge": "^6.0.1"
|
||||||
},
|
},
|
||||||
|
"version": "2.0.0",
|
||||||
"build": {
|
"build": {
|
||||||
"productName": "ElectronReact",
|
"productName": "ClipTrim",
|
||||||
"appId": "org.erb.ElectronReact",
|
"appId": "com.michalcourson.cliptrimserivce",
|
||||||
"asar": true,
|
"asar": true,
|
||||||
"afterSign": ".erb/scripts/notarize.js",
|
"afterSign": ".erb/scripts/notarize.js",
|
||||||
"asarUnpack": "**\\*.{node,dll}",
|
"asarUnpack": "**\\*.{node,dll}",
|
||||||
@ -238,7 +219,8 @@
|
|||||||
"win": {
|
"win": {
|
||||||
"target": [
|
"target": [
|
||||||
"nsis"
|
"nsis"
|
||||||
]
|
],
|
||||||
|
"icon": "build/icon.ico"
|
||||||
},
|
},
|
||||||
"linux": {
|
"linux": {
|
||||||
"target": [
|
"target": [
|
||||||
@ -252,13 +234,15 @@
|
|||||||
"output": "release/build"
|
"output": "release/build"
|
||||||
},
|
},
|
||||||
"extraResources": [
|
"extraResources": [
|
||||||
|
{
|
||||||
|
"from": "../audio-service",
|
||||||
|
"to": "audio-service",
|
||||||
|
"filter": [
|
||||||
|
"**/*"
|
||||||
|
]
|
||||||
|
},
|
||||||
"./assets/**"
|
"./assets/**"
|
||||||
],
|
]
|
||||||
"publish": {
|
|
||||||
"provider": "github",
|
|
||||||
"owner": "electron-react-boilerplate",
|
|
||||||
"repo": "electron-react-boilerplate"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"collective": {
|
"collective": {
|
||||||
"url": "https://opencollective.com/electron-react-boilerplate-594"
|
"url": "https://opencollective.com/electron-react-boilerplate-594"
|
||||||
|
|||||||
8
electron-ui/release/app/package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "electron-react-boilerplate",
|
"name": "cliptrim",
|
||||||
"version": "4.6.0",
|
"version": "2.0.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "electron-react-boilerplate",
|
"name": "cliptrim",
|
||||||
"version": "4.6.0",
|
"version": "2.0.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "electron-react-boilerplate",
|
"name": "cliptrim",
|
||||||
"version": "4.6.0",
|
"version": "2.0.0",
|
||||||
"description": "A foundation for scalable desktop apps",
|
"description": "Clip and trim",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": {
|
|
||||||
"name": "Electron React Boilerplate Maintainers",
|
|
||||||
"email": "electronreactboilerplate@gmail.com",
|
|
||||||
"url": "https://github.com/electron-react-boilerplate"
|
|
||||||
},
|
|
||||||
"main": "./dist/main/main.js",
|
"main": "./dist/main/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"rebuild": "node -r ts-node/register ../../.erb/scripts/electron-rebuild.js",
|
"rebuild": "node -r ts-node/register ../../.erb/scripts/electron-rebuild.js",
|
||||||
|
|||||||
16
electron-ui/settings.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"input_device": {
|
||||||
|
"index": 49,
|
||||||
|
"name": "Microphone (Logi C615 HD WebCam)",
|
||||||
|
"channels": 1,
|
||||||
|
"default_samplerate": 48000.0
|
||||||
|
},
|
||||||
|
"output_device": {
|
||||||
|
"index": 40,
|
||||||
|
"name": "Speakers (Realtek(R) Audio)",
|
||||||
|
"channels": 2,
|
||||||
|
"default_samplerate": 48000.0
|
||||||
|
},
|
||||||
|
"save_path": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\electron-ui\\recordings",
|
||||||
|
"recording_length": 15
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
BIN
electron-ui/src/assets/tray_icon.png
Normal file
|
After Width: | Height: | Size: 780 B |
@ -1,5 +1,7 @@
|
|||||||
const AudioChannels = {
|
const AudioChannels = {
|
||||||
LOAD_AUDIO_BUFFER: 'audio:loadAudioBuffer',
|
LOAD_AUDIO_BUFFER: 'audio:loadAudioBuffer',
|
||||||
|
GET_PORT: 'audio:getPort',
|
||||||
|
RESTART_SERVICE: 'audio:restartService',
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export default AudioChannels;
|
export default AudioChannels;
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import { ipcMain } from 'electron';
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import AudioChannels from './channels';
|
import AudioChannels from './channels';
|
||||||
import { LoadAudioBufferArgs, LoadAudioBufferResult } from './types';
|
import { LoadAudioBufferArgs, LoadAudioBufferResult } from './types';
|
||||||
|
import PythonSubprocessManager from '../../main/service';
|
||||||
|
|
||||||
export default function registerAudioIpcHandlers() {
|
export default function registerAudioIpcHandlers() {
|
||||||
ipcMain.handle(
|
ipcMain.handle(
|
||||||
@ -15,4 +16,25 @@ export default function registerAudioIpcHandlers() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ipcMain.handle(AudioChannels.GET_PORT, async () => {
|
||||||
|
try {
|
||||||
|
if (PythonSubprocessManager.instance?.portNumber) {
|
||||||
|
return { port: PythonSubprocessManager.instance.portNumber };
|
||||||
|
}
|
||||||
|
|
||||||
|
return { error: 'Port number not available yet.' };
|
||||||
|
} catch (err: any) {
|
||||||
|
return { error: err.message };
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle(AudioChannels.RESTART_SERVICE, async () => {
|
||||||
|
try {
|
||||||
|
PythonSubprocessManager.instance?.restart();
|
||||||
|
return { success: true };
|
||||||
|
} catch (err: any) {
|
||||||
|
return { success: false, error: err.message };
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,3 +6,22 @@ export interface LoadAudioBufferResult {
|
|||||||
buffer?: Buffer;
|
buffer?: Buffer;
|
||||||
error?: string;
|
error?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface GetPortResult {
|
||||||
|
port?: number;
|
||||||
|
error?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SetPortArgs {
|
||||||
|
port: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SetPortResult {
|
||||||
|
success: boolean;
|
||||||
|
error?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RestartServiceResult {
|
||||||
|
success: boolean;
|
||||||
|
error?: string;
|
||||||
|
}
|
||||||
|
|||||||
@ -10,12 +10,15 @@
|
|||||||
*/
|
*/
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { app, BrowserWindow, shell, ipcMain } from 'electron';
|
import { app, BrowserWindow, shell, ipcMain, Tray, Menu } from 'electron';
|
||||||
import { autoUpdater } from 'electron-updater';
|
import { autoUpdater } from 'electron-updater';
|
||||||
import log from 'electron-log';
|
import log from 'electron-log';
|
||||||
import MenuBuilder from './menu';
|
import MenuBuilder from './menu';
|
||||||
import { resolveHtmlPath } from './util';
|
import { resolveHtmlPath } from './util';
|
||||||
import registerFileIpcHandlers from '../ipc/audio/main';
|
import registerFileIpcHandlers from '../ipc/audio/main';
|
||||||
|
import PythonSubprocessManager from './service';
|
||||||
|
|
||||||
|
const pythonManager = new PythonSubprocessManager('src/main.py');
|
||||||
|
|
||||||
class AppUpdater {
|
class AppUpdater {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -25,7 +28,8 @@ class AppUpdater {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mainWindow: BrowserWindow | null = null;
|
let mainWindow: BrowserWindow;
|
||||||
|
let tray: Tray | null = null;
|
||||||
|
|
||||||
ipcMain.on('ipc-example', async (event, arg) => {
|
ipcMain.on('ipc-example', async (event, arg) => {
|
||||||
const msgTemplate = (pingPong: string) => `IPC test: ${pingPong}`;
|
const msgTemplate = (pingPong: string) => `IPC test: ${pingPong}`;
|
||||||
@ -75,7 +79,7 @@ const createWindow = async () => {
|
|||||||
show: false,
|
show: false,
|
||||||
width: 1024,
|
width: 1024,
|
||||||
height: 728,
|
height: 728,
|
||||||
icon: getAssetPath('icon.png'),
|
icon: getAssetPath('icon.png'), // Set app icon
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: app.isPackaged
|
preload: app.isPackaged
|
||||||
? path.join(__dirname, 'preload.js')
|
? path.join(__dirname, 'preload.js')
|
||||||
@ -96,12 +100,15 @@ const createWindow = async () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow.on('closed', () => {
|
mainWindow.on('close', (event) => {
|
||||||
mainWindow = null;
|
console.log('close event triggered');
|
||||||
|
event.preventDefault();
|
||||||
|
mainWindow.hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
const menuBuilder = new MenuBuilder(mainWindow);
|
const menuBuilder = new MenuBuilder(mainWindow);
|
||||||
menuBuilder.buildMenu();
|
menuBuilder.buildMenu();
|
||||||
|
registerFileIpcHandlers();
|
||||||
|
|
||||||
// Open urls in the user's browser
|
// Open urls in the user's browser
|
||||||
mainWindow.webContents.setWindowOpenHandler((edata) => {
|
mainWindow.webContents.setWindowOpenHandler((edata) => {
|
||||||
@ -109,10 +116,31 @@ const createWindow = async () => {
|
|||||||
return { action: 'deny' };
|
return { action: 'deny' };
|
||||||
});
|
});
|
||||||
|
|
||||||
registerFileIpcHandlers();
|
|
||||||
// Remove this if your app does not use auto updates
|
// Remove this if your app does not use auto updates
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
new AppUpdater();
|
new AppUpdater();
|
||||||
|
console.log('asset path: ', getAssetPath('tray_icon.png'));
|
||||||
|
tray = new Tray(getAssetPath('tray_icon.png'));
|
||||||
|
const contextMenu = Menu.buildFromTemplate([
|
||||||
|
{
|
||||||
|
label: 'Show',
|
||||||
|
click: () => {
|
||||||
|
mainWindow?.show();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Quit',
|
||||||
|
click: () => {
|
||||||
|
pythonManager.stop();
|
||||||
|
app.quit();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
tray.setToolTip('ClipTrim');
|
||||||
|
tray.setContextMenu(contextMenu);
|
||||||
|
tray.on('double-click', () => {
|
||||||
|
mainWindow?.show();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,14 +150,17 @@ const createWindow = async () => {
|
|||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
// Respect the OSX convention of having the application in memory even
|
// Respect the OSX convention of having the application in memory even
|
||||||
// after all windows have been closed
|
// after all windows have been closed
|
||||||
if (process.platform !== 'darwin') {
|
// pythonManager.stop();
|
||||||
app.quit();
|
// Do not quit app, keep tray active
|
||||||
}
|
// if (process.platform !== 'darwin') {
|
||||||
|
// app.quit();
|
||||||
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
app
|
app
|
||||||
.whenReady()
|
.whenReady()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
pythonManager.start();
|
||||||
createWindow();
|
createWindow();
|
||||||
app.on('activate', () => {
|
app.on('activate', () => {
|
||||||
// On macOS it's common to re-create a window in the app when the
|
// On macOS it's common to re-create a window in the app when the
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
// Disable no-unused-vars, broken for spread args
|
// Disable no-unused-vars, broken for spread args
|
||||||
/* eslint no-unused-vars: off */
|
/* eslint no-unused-vars: off */
|
||||||
import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron';
|
import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron';
|
||||||
import FileChannels from '../ipc/audio/channels';
|
import { LoadAudioBufferArgs } from '../ipc/audio/types';
|
||||||
import { LoadAudioBufferArgs, ReadTextArgs } from '../ipc/audio/types';
|
|
||||||
import AudioChannels from '../ipc/audio/channels';
|
import AudioChannels from '../ipc/audio/channels';
|
||||||
// import '../ipc/file/preload'; // Import file API preload to ensure it runs and exposes the API
|
// import '../ipc/file/preload'; // Import file API preload to ensure it runs and exposes the API
|
||||||
|
|
||||||
@ -41,10 +40,8 @@ const audioHandler = {
|
|||||||
filePath,
|
filePath,
|
||||||
} satisfies LoadAudioBufferArgs),
|
} satisfies LoadAudioBufferArgs),
|
||||||
|
|
||||||
readText: (filePath: string) =>
|
getPort: () => ipcRenderer.invoke(AudioChannels.GET_PORT),
|
||||||
ipcRenderer.invoke(AudioChannels.READ_TEXT, {
|
restartService: () => ipcRenderer.invoke(AudioChannels.RESTART_SERVICE),
|
||||||
filePath,
|
|
||||||
} satisfies ReadTextArgs),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
contextBridge.exposeInMainWorld('audio', audioHandler);
|
contextBridge.exposeInMainWorld('audio', audioHandler);
|
||||||
|
|||||||
79
electron-ui/src/main/service.ts
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
import { spawn, ChildProcessWithoutNullStreams } from 'child_process';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
|
export default class PythonSubprocessManager {
|
||||||
|
// eslint-disable-next-line no-use-before-define
|
||||||
|
public static instance: PythonSubprocessManager | null = null;
|
||||||
|
|
||||||
|
private process: ChildProcessWithoutNullStreams | null = null;
|
||||||
|
|
||||||
|
private scriptPath: string;
|
||||||
|
|
||||||
|
private working_dir: string = path.join(
|
||||||
|
__dirname,
|
||||||
|
'..',
|
||||||
|
'..',
|
||||||
|
'..',
|
||||||
|
'audio-service',
|
||||||
|
);
|
||||||
|
|
||||||
|
public portNumber: number | null = null;
|
||||||
|
|
||||||
|
constructor(scriptPath: string) {
|
||||||
|
this.scriptPath = scriptPath;
|
||||||
|
PythonSubprocessManager.instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
start(args: string[] = []): void {
|
||||||
|
if (this.process) {
|
||||||
|
throw new Error('Process already running.');
|
||||||
|
}
|
||||||
|
console.log(`Using Python working directory at: ${this.working_dir}`);
|
||||||
|
console.log(`Starting Python subprocess with script: ${this.scriptPath}`);
|
||||||
|
this.process = spawn(
|
||||||
|
'venv/Scripts/python.exe',
|
||||||
|
[this.scriptPath, ...args],
|
||||||
|
{
|
||||||
|
cwd: this.working_dir,
|
||||||
|
detached: false,
|
||||||
|
stdio: 'pipe',
|
||||||
|
},
|
||||||
|
);
|
||||||
|
this.process.stdout.on('data', (data: Buffer) => {
|
||||||
|
// console.log(`Python stdout: ${data.toString()}`);
|
||||||
|
});
|
||||||
|
this.process.stderr.on('data', (data: Buffer) => {
|
||||||
|
// console.error(`Python stderr: ${data.toString()}`);
|
||||||
|
const lines = data.toString().split('\n');
|
||||||
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
|
for (const line of lines) {
|
||||||
|
const match = line.match(/Running on .*:(\d+)/);
|
||||||
|
if (match) {
|
||||||
|
const port = parseInt(match[1], 10);
|
||||||
|
console.log(`Detected port: ${port}`);
|
||||||
|
this.portNumber = port;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.process.on('exit', () => {
|
||||||
|
console.log('Python subprocess exited.');
|
||||||
|
this.process = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
stop(): void {
|
||||||
|
if (this.process) {
|
||||||
|
this.process.kill();
|
||||||
|
this.process = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
restart(args: string[] = []): void {
|
||||||
|
this.stop();
|
||||||
|
this.start(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
isHealthy(): boolean {
|
||||||
|
return !!this.process && !this.process.killed;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -67,32 +67,11 @@ const metadataSlice = createSlice({
|
|||||||
targetState.clips.push(clip);
|
targetState.clips.push(clip);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addNewClips(state, action) {
|
addNewClip(state, action) {
|
||||||
const { collections } = action.payload;
|
const { clip } = action.payload;
|
||||||
Object.keys(collections).forEach((collection) => {
|
state.collections.forEach((collection) => {
|
||||||
const collectionState = state.collections.find(
|
if (collection.name === 'Uncategorized') {
|
||||||
(col) => col.name === collection,
|
collection.clips.push(clip);
|
||||||
);
|
|
||||||
if (!collectionState) {
|
|
||||||
state.collections.push({
|
|
||||||
name: collection,
|
|
||||||
id: Date.now(),
|
|
||||||
clips: [],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const existingFilenames = new Set(
|
|
||||||
state.collections
|
|
||||||
.find((col) => col.name === collection)
|
|
||||||
?.clips.map((clip) => clip.filename) || [],
|
|
||||||
);
|
|
||||||
const newClips = collections[collection].filter(
|
|
||||||
(clip: ClipMetadata) => !existingFilenames.has(clip.filename),
|
|
||||||
);
|
|
||||||
// const collectionState = state.collections.find(
|
|
||||||
// (col) => col.name === collection,
|
|
||||||
// );
|
|
||||||
if (collectionState) {
|
|
||||||
collectionState.clips.push(...newClips);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -113,6 +92,6 @@ export type RootState = ReturnType<AppStore['getState']>;
|
|||||||
// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}
|
// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}
|
||||||
export type AppDispatch = AppStore['dispatch'];
|
export type AppDispatch = AppStore['dispatch'];
|
||||||
|
|
||||||
export const { setCollections, addNewClips, addCollection } =
|
export const { setCollections, addNewClip, addCollection } =
|
||||||
metadataSlice.actions;
|
metadataSlice.actions;
|
||||||
export default metadataSlice.reducer;
|
export default metadataSlice.reducer;
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
@tailwind base;
|
@tailwind base;
|
||||||
@tailwind components;
|
@tailwind components;
|
||||||
@tailwind utilities;
|
@tailwind utilities;
|
||||||
|
/* @import 'tailwindcss/base';
|
||||||
|
@import 'tailwindcss/components';
|
||||||
|
@import 'tailwindcss/utilities'; */
|
||||||
/*
|
/*
|
||||||
* @NOTE: Prepend a `~` to css file paths that are in your node_modules
|
* @NOTE: Prepend a `~` to css file paths that are in your node_modules
|
||||||
* See https://github.com/webpack-contrib/sass-loader#imports
|
* See https://github.com/webpack-contrib/sass-loader#imports
|
||||||
|
|||||||
@ -2,14 +2,20 @@ import { MemoryRouter as Router, Routes, Route } from 'react-router-dom';
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
import Dialog from '@mui/material/Dialog';
|
import Dialog from '@mui/material/Dialog';
|
||||||
|
|
||||||
|
import { ThemeProvider, createTheme } from '@mui/material/styles';
|
||||||
import DialogTitle from '@mui/material/DialogTitle';
|
import DialogTitle from '@mui/material/DialogTitle';
|
||||||
import DialogContent from '@mui/material/DialogContent';
|
import DialogContent from '@mui/material/DialogContent';
|
||||||
import DialogActions from '@mui/material/DialogActions';
|
import DialogActions from '@mui/material/DialogActions';
|
||||||
|
import io from 'socket.io-client';
|
||||||
// import 'tailwindcss/tailwind.css';
|
// import 'tailwindcss/tailwind.css';
|
||||||
import './App.css';
|
import './App.css';
|
||||||
import ClipList from './components/ClipList';
|
import ClipList from './components/ClipList';
|
||||||
import { useAppDispatch, useAppSelector } from './hooks';
|
import { useAppDispatch, useAppSelector } from './hooks';
|
||||||
import { store } from '../redux/main';
|
import { store } from '../redux/main';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import SettingsPage from './Settings';
|
||||||
|
import { apiFetch, getBaseUrl } from './api';
|
||||||
|
|
||||||
function MainPage() {
|
function MainPage() {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
@ -21,20 +27,47 @@ function MainPage() {
|
|||||||
);
|
);
|
||||||
const [newCollectionOpen, setNewCollectionOpen] = useState(false);
|
const [newCollectionOpen, setNewCollectionOpen] = useState(false);
|
||||||
const [newCollectionName, setNewCollectionName] = useState<string>('');
|
const [newCollectionName, setNewCollectionName] = useState<string>('');
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [socket, setSocket] = useState<any>(null);
|
||||||
|
|
||||||
|
useEffect(() => {}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchMetadata = async () => {
|
const initializeSocket = async () => {
|
||||||
try {
|
const baseUrl = await getBaseUrl();
|
||||||
const response = await fetch('http://localhost:5010/meta');
|
const newSocket = io(baseUrl);
|
||||||
const data = await response.json();
|
setSocket(newSocket);
|
||||||
dispatch({ type: 'metadata/setAllData', payload: data });
|
newSocket.on('connect', () => {
|
||||||
} catch (error) {
|
console.log('Connected to WebSocket server');
|
||||||
console.error('Error fetching metadata:', error);
|
});
|
||||||
}
|
newSocket.on('full_data', (data: any) => {
|
||||||
|
console.log('Received full_data from server:', data);
|
||||||
|
dispatch({
|
||||||
|
type: 'metadata/setAllData',
|
||||||
|
payload: { collections: data },
|
||||||
|
});
|
||||||
|
});
|
||||||
|
newSocket.on('new_clip', (data: any) => {
|
||||||
|
console.log('Received new_clips from server:', data);
|
||||||
|
dispatch({
|
||||||
|
type: 'metadata/addNewClip',
|
||||||
|
payload: { clip: data },
|
||||||
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
fetchMetadata();
|
initializeSocket();
|
||||||
const intervalId = setInterval(fetchMetadata, 5000);
|
// const fetchMetadata = async () => {
|
||||||
return () => clearInterval(intervalId);
|
// try {
|
||||||
|
// const response = await apiFetch('meta');
|
||||||
|
// const data = await response.json();
|
||||||
|
// dispatch({ type: 'metadata/setAllData', payload: data });
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error('Error fetching metadata:', error);
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// fetchMetadata();
|
||||||
|
// const intervalId = setInterval(fetchMetadata, 5000);
|
||||||
|
// return () => clearInterval(intervalId);
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -137,6 +170,22 @@ function MainPage() {
|
|||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
{/* Settings Button at Bottom Left */}
|
||||||
|
<div className="mt-auto mb-2">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="w-full rounded px-4 py-2 bg-neutral-800 text-offwhite hover:bg-plumDark text-left"
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
bottom: 16,
|
||||||
|
left: 8,
|
||||||
|
width: 'calc(100% - 16px)',
|
||||||
|
}}
|
||||||
|
onClick={() => navigate('/settings')}
|
||||||
|
>
|
||||||
|
⚙️ Settings
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
{/* Main Content */}
|
{/* Main Content */}
|
||||||
<div
|
<div
|
||||||
@ -150,13 +199,39 @@ function MainPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
|
const theme = createTheme({
|
||||||
|
colorSchemes: {
|
||||||
|
light: false,
|
||||||
|
dark: {
|
||||||
|
palette: {
|
||||||
|
primary: {
|
||||||
|
main: '#6e44ba', // plum
|
||||||
|
dark: '#6e44ba', // plum
|
||||||
|
contrastText: '#ffffff',
|
||||||
|
},
|
||||||
|
secondary: {
|
||||||
|
main: '#4f3186', // plumDark
|
||||||
|
dark: '#4f3186', // plumDark
|
||||||
|
contrastText: '#ffffff',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// colorSchemes: {
|
||||||
|
// light: false,
|
||||||
|
// dark: true,
|
||||||
|
// },
|
||||||
|
});
|
||||||
return (
|
return (
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
|
<ThemeProvider theme={theme}>
|
||||||
<Router>
|
<Router>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<MainPage />} />
|
<Route path="/" element={<MainPage />} />
|
||||||
|
<Route path="/settings" element={<SettingsPage />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</Router>
|
</Router>
|
||||||
|
</ThemeProvider>
|
||||||
</Provider>
|
</Provider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
274
electron-ui/src/renderer/Settings.tsx
Normal file
@ -0,0 +1,274 @@
|
|||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
import './App.css';
|
||||||
|
import TextField from '@mui/material/TextField';
|
||||||
|
import Select from '@mui/material/Select';
|
||||||
|
import MenuItem from '@mui/material/MenuItem';
|
||||||
|
import { apiFetch } from './api';
|
||||||
|
|
||||||
|
type AudioDevice = {
|
||||||
|
index: number;
|
||||||
|
name: string;
|
||||||
|
default_sample_rate: number;
|
||||||
|
channels: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
type Settings = {
|
||||||
|
http_port: number;
|
||||||
|
input_device: AudioDevice;
|
||||||
|
output_device: AudioDevice;
|
||||||
|
recording_length: number;
|
||||||
|
save_path: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const defaultSettings: Settings = {
|
||||||
|
http_port: 0,
|
||||||
|
input_device: { index: 0, name: '', default_sample_rate: 0, channels: 0 },
|
||||||
|
output_device: { index: 0, name: '', default_sample_rate: 0, channels: 0 },
|
||||||
|
recording_length: 0,
|
||||||
|
save_path: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
async function fetchAudioDevices(
|
||||||
|
type: 'input' | 'output',
|
||||||
|
): Promise<AudioDevice[]> {
|
||||||
|
// Replace with actual backend call
|
||||||
|
// Example: return window.api.getAudioDevices();
|
||||||
|
return apiFetch(`device/list?device_type=${type}`)
|
||||||
|
.then((res) => res.json())
|
||||||
|
.then((data) => data.devices as AudioDevice[])
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Error fetching audio devices:', error);
|
||||||
|
return [];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchSettings(): Promise<Settings> {
|
||||||
|
// Replace with actual backend call
|
||||||
|
// Example: return window.api.getAudioDevices();
|
||||||
|
console.log('Fetching settings from backend...');
|
||||||
|
return apiFetch('settings')
|
||||||
|
.then((res) => res.json())
|
||||||
|
.then((data) => data.settings as Settings)
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Error fetching settings:', error);
|
||||||
|
return defaultSettings;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const sendSettingsToBackend = async (settings: Settings) => {
|
||||||
|
// Replace with actual backend call
|
||||||
|
// Example: window.api.updateSettings(settings);
|
||||||
|
console.log('Settings updated:', settings);
|
||||||
|
await apiFetch('settings/update', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ settings }),
|
||||||
|
})
|
||||||
|
.then((res) => res.json())
|
||||||
|
.then((data) => {
|
||||||
|
console.log('Settings update response:', data);
|
||||||
|
if (data.status === 'success') {
|
||||||
|
window.audio.restartService();
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Error updating settings:', error);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function SettingsPage() {
|
||||||
|
const [settings, setSettings] = useState<Settings>(defaultSettings);
|
||||||
|
const [inputDevices, setInputDevices] = useState<AudioDevice[]>([]);
|
||||||
|
const [outputDevices, setOutputDevices] = useState<AudioDevice[]>([]);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetchSettings()
|
||||||
|
.then((fetchedSettings) => {
|
||||||
|
console.log('Fetched settings:', fetchedSettings);
|
||||||
|
setSettings(fetchedSettings);
|
||||||
|
return null;
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
return fetchAudioDevices('input');
|
||||||
|
})
|
||||||
|
.then((devices) => {
|
||||||
|
setInputDevices(devices);
|
||||||
|
// console.log('Input devices:', devices);
|
||||||
|
return fetchAudioDevices('output');
|
||||||
|
})
|
||||||
|
.then((devices) => {
|
||||||
|
setOutputDevices(devices);
|
||||||
|
|
||||||
|
// console.log('Output devices:', devices);
|
||||||
|
return devices;
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Error fetching audio devices:', error);
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {}, [settings]);
|
||||||
|
|
||||||
|
const handleChange = () => {
|
||||||
|
sendSettingsToBackend(settings);
|
||||||
|
// const { name, value } = e.target;
|
||||||
|
// setSettings((prev) => ({
|
||||||
|
// ...prev,
|
||||||
|
// [name]: value,
|
||||||
|
// }));
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleFolderChange = async () => {
|
||||||
|
// Replace with actual folder picker
|
||||||
|
// Example: const folder = await window.api.selectFolder();
|
||||||
|
// const folder = window.prompt(
|
||||||
|
// 'Enter output folder path:',
|
||||||
|
// settings.outputFolder,
|
||||||
|
// );
|
||||||
|
// if (folder !== null) {
|
||||||
|
// setSettings((prev) => ({
|
||||||
|
// ...prev,
|
||||||
|
// outputFolder: folder,
|
||||||
|
// }));
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="min-w-screen min-h-screen bg-midnight text-offwhite flex items-center justify-center relative">
|
||||||
|
<div className="w-3/4 min-w-[600px] max-w-[800px] self-start flex flex-col font-sans bg-midnight text-offwhite p-6 rounded-lg relative">
|
||||||
|
{/* X Close Button */}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="absolute top-6 right-6 text-3xl font-bold text-offwhite bg-transparent hover:text-plumDark"
|
||||||
|
aria-label="Close settings"
|
||||||
|
onClick={() => navigate('/')}
|
||||||
|
>
|
||||||
|
×
|
||||||
|
</button>
|
||||||
|
<span className="text-2xl font-bold mb-4">Settings</span>
|
||||||
|
<div className="mb-4 flex justify-between">
|
||||||
|
<span>HTTP Port:</span>
|
||||||
|
<TextField
|
||||||
|
variant="standard"
|
||||||
|
type="text"
|
||||||
|
name="httpPort"
|
||||||
|
value={settings.http_port}
|
||||||
|
onBlur={() => handleChange()}
|
||||||
|
onChange={(e) => {
|
||||||
|
if (!Number.isNaN(Number(e.target.value))) {
|
||||||
|
setSettings((prev) => ({
|
||||||
|
...prev,
|
||||||
|
http_port: Number(e.target.value),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
className="ml-2 text-white w-[150px]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="mb-4 flex justify-between">
|
||||||
|
<span>Input Audio Device:</span>
|
||||||
|
<Select
|
||||||
|
variant="standard"
|
||||||
|
name="inputDevice"
|
||||||
|
value={settings.input_device.index}
|
||||||
|
onChange={(e) => {
|
||||||
|
const newDevice = inputDevices.find(
|
||||||
|
(dev) => dev.index === Number(e.target.value),
|
||||||
|
);
|
||||||
|
console.log('Selected input device index:', newDevice);
|
||||||
|
if (newDevice) {
|
||||||
|
setSettings((prev) => ({
|
||||||
|
...prev,
|
||||||
|
input_device: newDevice,
|
||||||
|
}));
|
||||||
|
sendSettingsToBackend({
|
||||||
|
...settings,
|
||||||
|
input_device: newDevice,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
className="ml-2 w-64"
|
||||||
|
>
|
||||||
|
{inputDevices.map((dev) => (
|
||||||
|
<MenuItem key={dev.index} value={dev.index}>
|
||||||
|
{dev.name}
|
||||||
|
</MenuItem>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
<div className="mb-4 flex justify-between">
|
||||||
|
<span>Output Audio Device:</span>
|
||||||
|
<Select
|
||||||
|
variant="standard"
|
||||||
|
name="outputDevice"
|
||||||
|
value={settings.output_device.index}
|
||||||
|
onChange={(e) => {
|
||||||
|
const newDevice = outputDevices.find(
|
||||||
|
(dev) => dev.index === Number(e.target.value),
|
||||||
|
);
|
||||||
|
if (newDevice) {
|
||||||
|
setSettings((prev) => ({
|
||||||
|
...prev,
|
||||||
|
output_device: newDevice,
|
||||||
|
}));
|
||||||
|
sendSettingsToBackend({
|
||||||
|
...settings,
|
||||||
|
output_device: newDevice,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
className="ml-2 w-64"
|
||||||
|
>
|
||||||
|
{outputDevices.map((dev) => (
|
||||||
|
<MenuItem key={dev.index} value={dev.index}>
|
||||||
|
{dev.name}
|
||||||
|
</MenuItem>
|
||||||
|
))}
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
<div className="mb-4 flex justify-between">
|
||||||
|
<span>Recording Length (seconds):</span>
|
||||||
|
<TextField
|
||||||
|
variant="standard"
|
||||||
|
type="text"
|
||||||
|
name="recordingLength"
|
||||||
|
value={settings.recording_length}
|
||||||
|
onChange={(e) => {
|
||||||
|
if (!Number.isNaN(Number(e.target.value))) {
|
||||||
|
setSettings((prev) => ({
|
||||||
|
...prev,
|
||||||
|
recording_length: Number(e.target.value),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
onBlur={() => handleChange()}
|
||||||
|
className="ml-2 w-[150px]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="mb-4 flex justify-between">
|
||||||
|
<span>Clip Output Folder:</span>
|
||||||
|
<div className="flex justify-end">
|
||||||
|
<TextField
|
||||||
|
variant="standard"
|
||||||
|
type="text"
|
||||||
|
name="savePath"
|
||||||
|
value={settings.save_path}
|
||||||
|
className="ml-2 w-[300px]"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={handleFolderChange}
|
||||||
|
className="ml-2 px-3 py-1 rounded bg-plumDark text-offwhite hover:bg-plum"
|
||||||
|
>
|
||||||
|
...
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
13
electron-ui/src/renderer/api.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
export const getBaseUrl = async () => {
|
||||||
|
const port = await window.audio.getPort();
|
||||||
|
if (port.error || !port.port) {
|
||||||
|
return `http://localhost:5010`;
|
||||||
|
}
|
||||||
|
// You can store the base URL in localStorage, a config file, or state
|
||||||
|
return `http://localhost:${port.port}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
export async function apiFetch(endpoint: string, options = {}) {
|
||||||
|
const url = `${await getBaseUrl()}/${endpoint}`;
|
||||||
|
return fetch(url, options);
|
||||||
|
}
|
||||||
@ -9,6 +9,9 @@ import Dialog from '@mui/material/Dialog';
|
|||||||
import DialogTitle from '@mui/material/DialogTitle';
|
import DialogTitle from '@mui/material/DialogTitle';
|
||||||
import DialogContent from '@mui/material/DialogContent';
|
import DialogContent from '@mui/material/DialogContent';
|
||||||
import DialogActions from '@mui/material/DialogActions';
|
import DialogActions from '@mui/material/DialogActions';
|
||||||
|
import Slider from '@mui/material/Slider';
|
||||||
|
import ToggleButton from '@mui/material/ToggleButton';
|
||||||
|
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
|
||||||
import { useWavesurfer } from '@wavesurfer/react';
|
import { useWavesurfer } from '@wavesurfer/react';
|
||||||
import RegionsPlugin from 'wavesurfer.js/dist/plugins/regions.esm.js';
|
import RegionsPlugin from 'wavesurfer.js/dist/plugins/regions.esm.js';
|
||||||
import ZoomPlugin from 'wavesurfer.js/dist/plugins/zoom.esm.js';
|
import ZoomPlugin from 'wavesurfer.js/dist/plugins/zoom.esm.js';
|
||||||
@ -19,8 +22,10 @@ import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward';
|
|||||||
import DeleteIcon from '@mui/icons-material/Delete';
|
import DeleteIcon from '@mui/icons-material/Delete';
|
||||||
import { useSortable } from '@dnd-kit/sortable';
|
import { useSortable } from '@dnd-kit/sortable';
|
||||||
import { CSS } from '@dnd-kit/utilities';
|
import { CSS } from '@dnd-kit/utilities';
|
||||||
import { ClipMetadata } from '../../redux/types';
|
import { ClipMetadata, PlaybackType } from '../../redux/types';
|
||||||
import { useAppSelector } from '../hooks';
|
import { useAppSelector } from '../hooks';
|
||||||
|
import PlayStopIcon from './playStopIcon';
|
||||||
|
import PlayOverlapIcon from './playOverlapIcon';
|
||||||
|
|
||||||
export interface AudioTrimmerProps {
|
export interface AudioTrimmerProps {
|
||||||
metadata: ClipMetadata;
|
metadata: ClipMetadata;
|
||||||
@ -39,10 +44,13 @@ export default function AudioTrimmer({
|
|||||||
useSortable({ id: metadata.filename });
|
useSortable({ id: metadata.filename });
|
||||||
|
|
||||||
// Dialog state for editing name
|
// Dialog state for editing name
|
||||||
|
const rootRef = useRef<HTMLDivElement | null>(null);
|
||||||
|
const [isVisible, setIsVisible] = useState(false);
|
||||||
const [editDialogOpen, setEditDialogOpen] = useState(false);
|
const [editDialogOpen, setEditDialogOpen] = useState(false);
|
||||||
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
||||||
const [dropdownOpen, setDropdownOpen] = useState(false);
|
const [dropdownOpen, setDropdownOpen] = useState(false);
|
||||||
const [nameInput, setNameInput] = useState<string>(metadata.name);
|
const [nameInput, setNameInput] = useState<string>(metadata.name);
|
||||||
|
const [volumeInput, setVolumeInput] = useState<number>(metadata.volume ?? 1);
|
||||||
const collectionNames = useAppSelector((state) =>
|
const collectionNames = useAppSelector((state) =>
|
||||||
state.collections.map((col) => col.name),
|
state.collections.map((col) => col.name),
|
||||||
);
|
);
|
||||||
@ -196,25 +204,42 @@ export default function AudioTrimmer({
|
|||||||
}, [onRegionCreated, onRegionUpdated, plugins]);
|
}, [onRegionCreated, onRegionUpdated, plugins]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let url: string | null = null;
|
const node = rootRef.current;
|
||||||
|
if (!node) return;
|
||||||
|
const observer = new window.IntersectionObserver(
|
||||||
|
([entry]) => {
|
||||||
|
if (entry.isIntersecting) {
|
||||||
|
setIsVisible(true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ threshold: 0.1 },
|
||||||
|
);
|
||||||
|
observer.observe(node);
|
||||||
|
// eslint-disable-next-line consistent-return
|
||||||
|
return () => {
|
||||||
|
observer.disconnect();
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isVisible) return;
|
||||||
|
let cancelled = false;
|
||||||
async function fetchAudio() {
|
async function fetchAudio() {
|
||||||
// console.log('Loading audio buffer for file:', filename);
|
|
||||||
const buffer = await window.audio.loadAudioBuffer(metadata.filename);
|
const buffer = await window.audio.loadAudioBuffer(metadata.filename);
|
||||||
// console.log('Received buffer:', buffer.buffer);
|
if (cancelled) return;
|
||||||
if (buffer.buffer && !buffer.error) {
|
if (buffer.buffer && !buffer.error) {
|
||||||
const audioData = buffer.buffer
|
const audioData = buffer.buffer
|
||||||
? new Uint8Array(buffer.buffer)
|
? new Uint8Array(buffer.buffer)
|
||||||
: buffer;
|
: buffer;
|
||||||
url = URL.createObjectURL(new Blob([audioData]));
|
wavesurfer?.loadBlob(new Blob([audioData]));
|
||||||
// console.log('Created blob URL:', url);
|
|
||||||
setBlobUrl(url);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fetchAudio();
|
fetchAudio();
|
||||||
|
// eslint-disable-next-line consistent-return
|
||||||
return () => {
|
return () => {
|
||||||
if (url) URL.revokeObjectURL(url);
|
cancelled = true;
|
||||||
};
|
};
|
||||||
}, [metadata.filename]);
|
}, [isVisible, metadata.filename, wavesurfer]);
|
||||||
|
|
||||||
const onPlayPause = () => {
|
const onPlayPause = () => {
|
||||||
if (wavesurfer === null) return;
|
if (wavesurfer === null) return;
|
||||||
@ -223,6 +248,7 @@ export default function AudioTrimmer({
|
|||||||
} else {
|
} else {
|
||||||
const allRegions = (plugins[0] as RegionsPlugin).getRegions();
|
const allRegions = (plugins[0] as RegionsPlugin).getRegions();
|
||||||
if (allRegions.length > 0) {
|
if (allRegions.length > 0) {
|
||||||
|
wavesurfer.setVolume(metadata.volume ?? 1);
|
||||||
wavesurfer.play(allRegions[0].start, allRegions[0].end);
|
wavesurfer.play(allRegions[0].start, allRegions[0].end);
|
||||||
} else {
|
} else {
|
||||||
wavesurfer.play();
|
wavesurfer.play();
|
||||||
@ -238,7 +264,10 @@ export default function AudioTrimmer({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
ref={setNodeRef}
|
ref={(el) => {
|
||||||
|
setNodeRef(el);
|
||||||
|
rootRef.current = el;
|
||||||
|
}}
|
||||||
style={{
|
style={{
|
||||||
transform: CSS.Transform.toString(transform),
|
transform: CSS.Transform.toString(transform),
|
||||||
transition,
|
transition,
|
||||||
@ -401,12 +430,74 @@ export default function AudioTrimmer({
|
|||||||
<div className="m-1 wavesurfer-scroll-container">
|
<div className="m-1 wavesurfer-scroll-container">
|
||||||
<div ref={containerRef} className="wavesurfer-inner" />
|
<div ref={containerRef} className="wavesurfer-inner" />
|
||||||
</div>
|
</div>
|
||||||
<div className="grid justify-items-stretch grid-cols-2 text-neutral-500">
|
<div className="flex justify-between mt-2">
|
||||||
<div className="m-1 flex justify-start">
|
<span className="w-1/5 flex-none text-sm text-neutral-500 self-center">
|
||||||
<text className="text-sm ">
|
|
||||||
Clip: {formatTime(metadata.startTime ?? 0)} -{' '}
|
Clip: {formatTime(metadata.startTime ?? 0)} -{' '}
|
||||||
{formatTime(metadata.endTime ?? 0)}
|
{formatTime(metadata.endTime ?? 0)}
|
||||||
</text>
|
</span>
|
||||||
|
<div className="w-3/5 flex-1 flex justify-center items-center">
|
||||||
|
<Slider
|
||||||
|
value={volumeInput}
|
||||||
|
min={0}
|
||||||
|
max={1}
|
||||||
|
step={0.01}
|
||||||
|
onChange={(e, newValue) => setVolumeInput(newValue as number)}
|
||||||
|
onChangeCommitted={(e, newValue) => {
|
||||||
|
const newVolume = newValue as number;
|
||||||
|
console.log('Volume change:', newVolume);
|
||||||
|
if (onSave) onSave({ ...metadata, volume: newVolume });
|
||||||
|
}}
|
||||||
|
color="secondary"
|
||||||
|
className="p-0 m-0"
|
||||||
|
/>
|
||||||
|
{/* <input
|
||||||
|
type="range"
|
||||||
|
min={0}
|
||||||
|
max={1}
|
||||||
|
step={0.01}
|
||||||
|
value={volumeInput}
|
||||||
|
onChange={(e) => {
|
||||||
|
const newVolume = parseFloat(e.target.value);
|
||||||
|
setVolumeInput(newVolume);
|
||||||
|
}}
|
||||||
|
onDragEnd={(e) => {
|
||||||
|
console.log('Volume change:');
|
||||||
|
// const newVolume = parseFloat(e.target.value);
|
||||||
|
// if (onSave) onSave({ ...metadata, volume: newVolume });
|
||||||
|
}}
|
||||||
|
className="mx-2 w-full accent-plum"
|
||||||
|
aria-label="Volume slider"
|
||||||
|
/> */}
|
||||||
|
</div>
|
||||||
|
<div className="w-1/5 flex justify-end text-sm text-neutral-500">
|
||||||
|
<ToggleButtonGroup value={metadata.playbackType}>
|
||||||
|
<ToggleButton
|
||||||
|
value="playStop"
|
||||||
|
color="primary"
|
||||||
|
onClick={() => {
|
||||||
|
if (onSave)
|
||||||
|
onSave({
|
||||||
|
...metadata,
|
||||||
|
playbackType: PlaybackType.PlayStop,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<PlayStopIcon />
|
||||||
|
</ToggleButton>
|
||||||
|
<ToggleButton
|
||||||
|
value="playOverlap"
|
||||||
|
color="primary"
|
||||||
|
onClick={() => {
|
||||||
|
if (onSave)
|
||||||
|
onSave({
|
||||||
|
...metadata,
|
||||||
|
playbackType: PlaybackType.PlayOverlap,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<PlayOverlapIcon />
|
||||||
|
</ToggleButton>
|
||||||
|
</ToggleButtonGroup>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import { restrictToVerticalAxis } from '@dnd-kit/modifiers';
|
|||||||
import AudioTrimmer from './AudioTrimer';
|
import AudioTrimmer from './AudioTrimer';
|
||||||
import { ClipMetadata } from '../../redux/types';
|
import { ClipMetadata } from '../../redux/types';
|
||||||
import { useAppDispatch, useAppSelector } from '../hooks';
|
import { useAppDispatch, useAppSelector } from '../hooks';
|
||||||
|
import { apiFetch } from '../api';
|
||||||
|
|
||||||
export interface ClipListProps {
|
export interface ClipListProps {
|
||||||
collection: string;
|
collection: string;
|
||||||
@ -31,6 +32,33 @@ export default function ClipList({ collection }: ClipListProps) {
|
|||||||
useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
|
useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const handleDrop = (event: React.DragEvent<HTMLDivElement>) => {
|
||||||
|
event.preventDefault();
|
||||||
|
console.log('Files dropped:', event.dataTransfer.files);
|
||||||
|
const files = Array.from(event.dataTransfer.files).filter((file) =>
|
||||||
|
file.type.startsWith('audio/'),
|
||||||
|
);
|
||||||
|
if (files.length > 0) {
|
||||||
|
const formData = new FormData();
|
||||||
|
files.forEach((file) => formData.append('files', file));
|
||||||
|
|
||||||
|
// todo send the file to the backend and add to the collection
|
||||||
|
|
||||||
|
// fetch('http://localhost:5010/file/upload', {
|
||||||
|
// method: 'POST',
|
||||||
|
// body: formData,
|
||||||
|
// })
|
||||||
|
// .then((res) => res.json())
|
||||||
|
// .catch((err) => console.error('Error uploading files:', err));
|
||||||
|
// Implement your onDrop logic here
|
||||||
|
// onDrop(files, selectedCollection);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDragOver = (event: React.DragEvent<HTMLDivElement>) => {
|
||||||
|
event.preventDefault();
|
||||||
|
};
|
||||||
|
|
||||||
async function handleDragEnd(event: any) {
|
async function handleDragEnd(event: any) {
|
||||||
const { active, over } = event;
|
const { active, over } = event;
|
||||||
if (active.id !== over?.id) {
|
if (active.id !== over?.id) {
|
||||||
@ -50,9 +78,7 @@ export default function ClipList({ collection }: ClipListProps) {
|
|||||||
payload: { collection, newMetadata },
|
payload: { collection, newMetadata },
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await apiFetch('meta/collection/clips/reorder', {
|
||||||
'http://localhost:5010/meta/collection/clips/reorder',
|
|
||||||
{
|
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@ -61,8 +87,7 @@ export default function ClipList({ collection }: ClipListProps) {
|
|||||||
name: collection,
|
name: collection,
|
||||||
clips: newMetadata.clips,
|
clips: newMetadata.clips,
|
||||||
}),
|
}),
|
||||||
},
|
});
|
||||||
);
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
console.log('handle reorder return:', data.collections);
|
console.log('handle reorder return:', data.collections);
|
||||||
dispatch({ type: 'metadata/setAllData', payload: data });
|
dispatch({ type: 'metadata/setAllData', payload: data });
|
||||||
@ -78,7 +103,7 @@ export default function ClipList({ collection }: ClipListProps) {
|
|||||||
type: 'metadata/deleteClip',
|
type: 'metadata/deleteClip',
|
||||||
payload: { collection, clip: meta },
|
payload: { collection, clip: meta },
|
||||||
});
|
});
|
||||||
fetch('http://localhost:5010/meta/collection/clips/remove', {
|
apiFetch('meta/collection/clips/remove', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@ -99,7 +124,7 @@ export default function ClipList({ collection }: ClipListProps) {
|
|||||||
type: 'metadata/moveClip',
|
type: 'metadata/moveClip',
|
||||||
payload: { sourceCollection: collection, targetCollection, clip: meta },
|
payload: { sourceCollection: collection, targetCollection, clip: meta },
|
||||||
});
|
});
|
||||||
fetch('http://localhost:5010/meta/collection/clips/move', {
|
apiFetch('meta/collection/clips/move', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@ -120,9 +145,7 @@ export default function ClipList({ collection }: ClipListProps) {
|
|||||||
type: 'metadata/editClip',
|
type: 'metadata/editClip',
|
||||||
payload: { collection, clip: meta },
|
payload: { collection, clip: meta },
|
||||||
});
|
});
|
||||||
const response = await fetch(
|
const response = await apiFetch('meta/collection/clips/edit', {
|
||||||
'http://localhost:5010/meta/collection/clips/edit',
|
|
||||||
{
|
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@ -131,8 +154,7 @@ export default function ClipList({ collection }: ClipListProps) {
|
|||||||
name: collection,
|
name: collection,
|
||||||
clip: meta,
|
clip: meta,
|
||||||
}),
|
}),
|
||||||
},
|
});
|
||||||
);
|
|
||||||
await response.json();
|
await response.json();
|
||||||
// console.log('handle clip save return:', data.collections);
|
// console.log('handle clip save return:', data.collections);
|
||||||
dispatch({
|
dispatch({
|
||||||
@ -145,7 +167,11 @@ export default function ClipList({ collection }: ClipListProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-full flex flex-col justify-start bg-midnight text-offwhite">
|
<div
|
||||||
|
className="min-h-full flex flex-col justify-start bg-midnight text-offwhite"
|
||||||
|
onDrop={handleDrop}
|
||||||
|
onDragOver={handleDragOver}
|
||||||
|
>
|
||||||
<DndContext
|
<DndContext
|
||||||
sensors={sensors}
|
sensors={sensors}
|
||||||
collisionDetection={closestCenter}
|
collisionDetection={closestCenter}
|
||||||
|
|||||||
29
electron-ui/src/renderer/components/playOverlapIcon.tsx
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
export default function PlayOverlapIcon({
|
||||||
|
size = 24,
|
||||||
|
color = 'currentColor',
|
||||||
|
}: {
|
||||||
|
size?: number;
|
||||||
|
color?: string;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<svg
|
||||||
|
width={size}
|
||||||
|
height={size}
|
||||||
|
viewBox="0 0 32 24"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
{/* Filled play arrow */}
|
||||||
|
<polygon points="4,4 4,20 16,12" fill={color} />
|
||||||
|
{/* Outlined play arrow (underneath and to the right) */}
|
||||||
|
<polygon
|
||||||
|
points="12,4 12,20 24,12"
|
||||||
|
fill="none"
|
||||||
|
stroke={color}
|
||||||
|
strokeWidth={1}
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
23
electron-ui/src/renderer/components/playStopIcon.tsx
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
export default function PlayStopIcon({
|
||||||
|
size = 24,
|
||||||
|
color = 'currentColor',
|
||||||
|
}: {
|
||||||
|
size?: number;
|
||||||
|
color?: string;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<svg
|
||||||
|
width={size}
|
||||||
|
height={size}
|
||||||
|
viewBox="0 0 48 24"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
aria-label="Play/Stop Icon"
|
||||||
|
>
|
||||||
|
{/* Play Arrow */}
|
||||||
|
<polygon points="4,4 20,12 4,20" fill={color} />
|
||||||
|
{/* Stop Square */}
|
||||||
|
<rect x="28" y="4" width="16" height="16" rx="2" fill={color} />
|
||||||
|
</svg>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -6,7 +6,7 @@
|
|||||||
http-equiv="Content-Security-Policy"
|
http-equiv="Content-Security-Policy"
|
||||||
content="script-src 'self' 'unsafe-inline'"
|
content="script-src 'self' 'unsafe-inline'"
|
||||||
/>
|
/>
|
||||||
<title>Hello Electron React!</title>
|
<title>ClipTrim</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|||||||
4
electron-ui/src/renderer/preload.d.ts
vendored
@ -1,10 +1,10 @@
|
|||||||
import { ElectronHandler, FileHandler } from '../main/preload';
|
import { ElectronHandler, AudioHandler } from '../main/preload';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
interface Window {
|
interface Window {
|
||||||
electron: ElectronHandler;
|
electron: ElectronHandler;
|
||||||
audio: FileHandler;
|
audio: AudioHandler;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1
stream_deck_plugin/.gitignore
vendored
@ -5,3 +5,4 @@ ClipTrimDotNet/bin/
|
|||||||
ClipTrimDotNet/obj/
|
ClipTrimDotNet/obj/
|
||||||
ClipTrimDotNet/dist/
|
ClipTrimDotNet/dist/
|
||||||
ClipTrimDotNet/node_modules/
|
ClipTrimDotNet/node_modules/
|
||||||
|
.vs/
|
||||||
@ -1,96 +0,0 @@
|
|||||||
{
|
|
||||||
"Version": 1,
|
|
||||||
"WorkspaceRootPath": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\",
|
|
||||||
"Documents": [
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|c:\\users\\mickl\\desktop\\cliptrim-ui\\cliptrimapp\\stream_deck_plugin\\cliptrimdotnet\\client\\cliptrimclient.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
|
||||||
"RelativeMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|solutionrelative:cliptrimdotnet\\client\\cliptrimclient.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|c:\\users\\mickl\\desktop\\cliptrim-ui\\cliptrimapp\\stream_deck_plugin\\cliptrimdotnet\\player.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
|
||||||
"RelativeMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|solutionrelative:cliptrimdotnet\\player.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|c:\\users\\mickl\\desktop\\cliptrim-ui\\cliptrimapp\\stream_deck_plugin\\cliptrimdotnet\\profileswitcher.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
|
||||||
"RelativeMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|solutionrelative:cliptrimdotnet\\profileswitcher.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|c:\\users\\mickl\\desktop\\cliptrim-ui\\cliptrimapp\\stream_deck_plugin\\cliptrimdotnet\\client\\collectionmetadata.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
|
||||||
"RelativeMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|solutionrelative:cliptrimdotnet\\client\\collectionmetadata.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"DocumentGroupContainers": [
|
|
||||||
{
|
|
||||||
"Orientation": 0,
|
|
||||||
"VerticalTabListWidth": 256,
|
|
||||||
"DocumentGroups": [
|
|
||||||
{
|
|
||||||
"DockedWidth": 297,
|
|
||||||
"SelectedChildIndex": 2,
|
|
||||||
"Children": [
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{57d563b6-44a5-47df-85be-f4199ad6b651}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 2,
|
|
||||||
"Title": "ProfileSwitcher.cs",
|
|
||||||
"DocumentMoniker": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\ProfileSwitcher.cs",
|
|
||||||
"RelativeDocumentMoniker": "ClipTrimDotNet\\ProfileSwitcher.cs",
|
|
||||||
"ToolTip": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\ProfileSwitcher.cs",
|
|
||||||
"RelativeToolTip": "ClipTrimDotNet\\ProfileSwitcher.cs",
|
|
||||||
"ViewState": "AgIAAFkAAAAAAAAAAAAlwG8AAABKAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
|
||||||
"WhenOpened": "2026-02-21T15:06:24.045Z",
|
|
||||||
"EditorCaption": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 0,
|
|
||||||
"Title": "ClipTrimClient.cs",
|
|
||||||
"DocumentMoniker": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\Client\\ClipTrimClient.cs",
|
|
||||||
"RelativeDocumentMoniker": "ClipTrimDotNet\\Client\\ClipTrimClient.cs",
|
|
||||||
"ToolTip": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\Client\\ClipTrimClient.cs",
|
|
||||||
"RelativeToolTip": "ClipTrimDotNet\\Client\\ClipTrimClient.cs",
|
|
||||||
"ViewState": "AgIAAEgAAAAAAAAAAAAuwGMAAAAJAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
|
||||||
"WhenOpened": "2026-02-21T15:03:49.814Z",
|
|
||||||
"EditorCaption": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 3,
|
|
||||||
"Title": "CollectionMetaData.cs",
|
|
||||||
"DocumentMoniker": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\Client\\CollectionMetaData.cs",
|
|
||||||
"RelativeDocumentMoniker": "ClipTrimDotNet\\Client\\CollectionMetaData.cs",
|
|
||||||
"ToolTip": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\Client\\CollectionMetaData.cs",
|
|
||||||
"RelativeToolTip": "ClipTrimDotNet\\Client\\CollectionMetaData.cs",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
|
||||||
"WhenOpened": "2026-02-21T15:03:47.862Z",
|
|
||||||
"EditorCaption": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 1,
|
|
||||||
"Title": "Player.cs",
|
|
||||||
"DocumentMoniker": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\Player.cs",
|
|
||||||
"RelativeDocumentMoniker": "ClipTrimDotNet\\Player.cs",
|
|
||||||
"ToolTip": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\Player.cs*",
|
|
||||||
"RelativeToolTip": "ClipTrimDotNet\\Player.cs*",
|
|
||||||
"ViewState": "AgIAAHIAAAAAAAAAAAA3wIYAAABMAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
|
||||||
"WhenOpened": "2026-02-21T15:00:23.762Z",
|
|
||||||
"EditorCaption": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{cce594b6-0c39-4442-ba28-10c64ac7e89f}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,113 +0,0 @@
|
|||||||
{
|
|
||||||
"Version": 1,
|
|
||||||
"WorkspaceRootPath": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\",
|
|
||||||
"Documents": [
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|c:\\users\\mickl\\desktop\\cliptrim-ui\\cliptrimapp\\stream_deck_plugin\\cliptrimdotnet\\wavplayer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
|
||||||
"RelativeMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|solutionrelative:cliptrimdotnet\\wavplayer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|c:\\users\\mickl\\desktop\\cliptrim-ui\\cliptrimapp\\stream_deck_plugin\\cliptrimdotnet\\player.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
|
||||||
"RelativeMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|solutionrelative:cliptrimdotnet\\player.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|c:\\users\\mickl\\desktop\\cliptrim-ui\\cliptrimapp\\stream_deck_plugin\\cliptrimdotnet\\profileswitcher.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
|
||||||
"RelativeMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|solutionrelative:cliptrimdotnet\\profileswitcher.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|c:\\users\\mickl\\desktop\\cliptrim-ui\\cliptrimapp\\stream_deck_plugin\\cliptrimdotnet\\client\\cliptrimclient.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
|
||||||
"RelativeMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|solutionrelative:cliptrimdotnet\\client\\cliptrimclient.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"AbsoluteMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|c:\\users\\mickl\\desktop\\cliptrim-ui\\cliptrimapp\\stream_deck_plugin\\cliptrimdotnet\\client\\collectionmetadata.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
|
||||||
"RelativeMoniker": "D:0:0:{4635D874-69C0-4010-BE46-77EF92EB1553}|ClipTrimDotNet\\ClipTrimDotNet.csproj|solutionrelative:cliptrimdotnet\\client\\collectionmetadata.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"DocumentGroupContainers": [
|
|
||||||
{
|
|
||||||
"Orientation": 0,
|
|
||||||
"VerticalTabListWidth": 256,
|
|
||||||
"DocumentGroups": [
|
|
||||||
{
|
|
||||||
"DockedWidth": 297,
|
|
||||||
"SelectedChildIndex": 1,
|
|
||||||
"Children": [
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{57d563b6-44a5-47df-85be-f4199ad6b651}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 0,
|
|
||||||
"Title": "WavPlayer.cs",
|
|
||||||
"DocumentMoniker": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\WavPlayer.cs",
|
|
||||||
"RelativeDocumentMoniker": "ClipTrimDotNet\\WavPlayer.cs",
|
|
||||||
"ToolTip": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\WavPlayer.cs",
|
|
||||||
"RelativeToolTip": "ClipTrimDotNet\\WavPlayer.cs",
|
|
||||||
"ViewState": "AgIAALYAAAAAAAAAAAAAALsAAAANAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
|
||||||
"WhenOpened": "2026-02-21T15:16:26.477Z",
|
|
||||||
"EditorCaption": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 2,
|
|
||||||
"Title": "ProfileSwitcher.cs",
|
|
||||||
"DocumentMoniker": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\ProfileSwitcher.cs",
|
|
||||||
"RelativeDocumentMoniker": "ClipTrimDotNet\\ProfileSwitcher.cs",
|
|
||||||
"ToolTip": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\ProfileSwitcher.cs",
|
|
||||||
"RelativeToolTip": "ClipTrimDotNet\\ProfileSwitcher.cs",
|
|
||||||
"ViewState": "AgIAAG8AAAAAAAAAAAAWwG8AAABKAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
|
||||||
"WhenOpened": "2026-02-21T15:06:24.045Z",
|
|
||||||
"EditorCaption": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 3,
|
|
||||||
"Title": "ClipTrimClient.cs",
|
|
||||||
"DocumentMoniker": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\Client\\ClipTrimClient.cs",
|
|
||||||
"RelativeDocumentMoniker": "ClipTrimDotNet\\Client\\ClipTrimClient.cs",
|
|
||||||
"ToolTip": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\Client\\ClipTrimClient.cs",
|
|
||||||
"RelativeToolTip": "ClipTrimDotNet\\Client\\ClipTrimClient.cs",
|
|
||||||
"ViewState": "AgIAAEgAAAAAAAAAAAAuwGIAAAApAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
|
||||||
"WhenOpened": "2026-02-21T15:03:49.814Z",
|
|
||||||
"EditorCaption": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 4,
|
|
||||||
"Title": "CollectionMetaData.cs",
|
|
||||||
"DocumentMoniker": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\Client\\CollectionMetaData.cs",
|
|
||||||
"RelativeDocumentMoniker": "ClipTrimDotNet\\Client\\CollectionMetaData.cs",
|
|
||||||
"ToolTip": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\Client\\CollectionMetaData.cs",
|
|
||||||
"RelativeToolTip": "ClipTrimDotNet\\Client\\CollectionMetaData.cs",
|
|
||||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
|
||||||
"WhenOpened": "2026-02-21T15:03:47.862Z",
|
|
||||||
"EditorCaption": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Document",
|
|
||||||
"DocumentIndex": 1,
|
|
||||||
"Title": "Player.cs",
|
|
||||||
"DocumentMoniker": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\Player.cs",
|
|
||||||
"RelativeDocumentMoniker": "ClipTrimDotNet\\Player.cs",
|
|
||||||
"ToolTip": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\stream_deck_plugin\\ClipTrimDotNet\\Player.cs",
|
|
||||||
"RelativeToolTip": "ClipTrimDotNet\\Player.cs",
|
|
||||||
"ViewState": "AgIAAHoAAAAAAAAAAAAswIwAAAAbAAAAAAAAAA==",
|
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
|
||||||
"WhenOpened": "2026-02-21T15:00:23.762Z",
|
|
||||||
"EditorCaption": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"$type": "Bookmark",
|
|
||||||
"Name": "ST:0:0:{cce594b6-0c39-4442-ba28-10c64ac7e89f}"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||||
@ -17,6 +17,26 @@
|
|||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-10.0.0.2" newVersion="10.0.0.2" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-10.0.0.2" newVersion="10.0.0.2" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-10.0.0.2" newVersion="10.0.0.2" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-10.0.0.2" newVersion="10.0.0.2" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-10.0.0.2" newVersion="10.0.0.2" />
|
||||||
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Serialization;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace ClipTrimDotNet.Client
|
namespace ClipTrimDotNet.Client
|
||||||
{
|
{
|
||||||
@ -16,27 +19,35 @@ namespace ClipTrimDotNet.Client
|
|||||||
public class ClipMetadata
|
public class ClipMetadata
|
||||||
{
|
{
|
||||||
[JsonProperty(PropertyName = "filename")]
|
[JsonProperty(PropertyName = "filename")]
|
||||||
|
[JsonPropertyName("filename")]
|
||||||
|
|
||||||
public string Filename { get; set; }
|
public string Filename { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[JsonProperty(PropertyName = "name")]
|
[JsonProperty(PropertyName = "name")]
|
||||||
|
[JsonPropertyName("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[JsonProperty(PropertyName = "volume")]
|
[JsonProperty(PropertyName = "volume")]
|
||||||
|
[JsonPropertyName("volume")]
|
||||||
public double Volume { get; set; } = 1.0;
|
public double Volume { get; set; } = 1.0;
|
||||||
|
|
||||||
|
|
||||||
[JsonProperty(PropertyName = "startTime")]
|
[JsonProperty(PropertyName = "startTime")]
|
||||||
|
[JsonPropertyName("startTime")]
|
||||||
public double StartTime { get; set; } = 0.0;
|
public double StartTime { get; set; } = 0.0;
|
||||||
|
|
||||||
|
|
||||||
[JsonProperty(PropertyName = "endTime")]
|
[JsonProperty(PropertyName = "endTime")]
|
||||||
|
[JsonPropertyName("endTime")]
|
||||||
public double EndTime { get; set; } = 0.0;
|
public double EndTime { get; set; } = 0.0;
|
||||||
|
|
||||||
|
|
||||||
[JsonProperty(PropertyName = "playbackType")]
|
[JsonProperty(PropertyName = "playbackType")]
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
[System.Text.Json.Serialization.JsonConverter(typeof(JsonStringEnumConverter))]
|
||||||
|
[JsonPropertyName("playbackType")]
|
||||||
public PlaybackType PlaybackType { get; set; } = PlaybackType.playStop;
|
public PlaybackType PlaybackType { get; set; } = PlaybackType.playStop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,16 @@
|
|||||||
using System;
|
using BarRaider.SdTools;
|
||||||
|
using ClipTrimDotNet.Keys;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using SocketIOClient;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||||
|
|
||||||
namespace ClipTrimDotNet.Client
|
namespace ClipTrimDotNet.Client
|
||||||
{
|
{
|
||||||
@ -23,87 +29,258 @@ namespace ClipTrimDotNet.Client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private HttpClient httpClient;
|
//private HttpClient httpClient;
|
||||||
|
private SocketIO? socket;
|
||||||
|
|
||||||
|
public string HostName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
//return $"http://localhost:5010/";
|
||||||
|
return $"http://localhost:{GlobalSettings.Instance.PortNumber}/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? currentHostname = null;
|
||||||
|
|
||||||
|
void CreateSocket()
|
||||||
|
{
|
||||||
|
Logger.Instance.LogMessage(TracingLevel.INFO, $"Starting ClipTrimClient on port {HostName}");
|
||||||
|
socket = new SocketIO(new Uri(HostName));
|
||||||
|
currentHostname = HostName;
|
||||||
|
socket.Options.AutoUpgrade = false;
|
||||||
|
//socket.Options.Path = "/socket.io";
|
||||||
|
socket.Options.ConnectionTimeout = TimeSpan.FromSeconds(10);
|
||||||
|
socket.Options.Reconnection = true;
|
||||||
|
socket.On("full_data", ctx =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var response = ctx.GetValue<List<CollectionMetaData>>(0);
|
||||||
|
Logger.Instance.LogMessage(TracingLevel.INFO, $"full_data event {JsonConvert.SerializeObject(response)}");
|
||||||
|
Collections = response!;
|
||||||
|
Player.TickAll();
|
||||||
|
PageNavigator.TickAll();
|
||||||
|
//Logger.Instance.LogMessage(TracingLevel.INFO, $"Collections {JsonConvert.SerializeObject(Collections)}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Instance.LogMessage(TracingLevel.INFO, $"full_data error {ex.ToString()}");
|
||||||
|
}
|
||||||
|
return Task.CompletedTask;
|
||||||
|
});
|
||||||
|
socket.On("collection_updated", ctx =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var response = ctx.GetValue<CollectionMetaData>(0)!;
|
||||||
|
Logger.Instance.LogMessage(TracingLevel.INFO, $"collection_updated event {JsonConvert.SerializeObject(response)}");
|
||||||
|
int index = Collections.FindIndex(x => x.Id == response.Id);
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
Collections[index] = response;
|
||||||
|
Player.TickAll();
|
||||||
|
PageNavigator.TickAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
});
|
||||||
|
|
||||||
|
socket.OnConnected += (sender, e) =>
|
||||||
|
{
|
||||||
|
Logger.Instance.LogMessage(TracingLevel.INFO, $"Socket connected: {e}");
|
||||||
|
};
|
||||||
|
|
||||||
|
socket.OnDisconnected += (sender, e) =>
|
||||||
|
{
|
||||||
|
Logger.Instance.LogMessage(TracingLevel.INFO, $"Socket disconnected: {e}");
|
||||||
|
Task.Run(async () => await Connect());
|
||||||
|
};
|
||||||
|
Task.Run(async () => await Connect());
|
||||||
|
}
|
||||||
|
|
||||||
public ClipTrimClient()
|
public ClipTrimClient()
|
||||||
{
|
{
|
||||||
httpClient = new HttpClient()
|
//httpClient = new HttpClient()
|
||||||
{
|
//{
|
||||||
BaseAddress = new Uri("http://localhost:5010/"),
|
// BaseAddress = new Uri("http://localhost:5010/"),
|
||||||
Timeout = TimeSpan.FromSeconds(10)
|
// Timeout = TimeSpan.FromSeconds(10)
|
||||||
};
|
//};
|
||||||
Task.Run(ShortPoll);
|
CreateSocket();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ShortPoll()
|
public async Task Connect()
|
||||||
{
|
{
|
||||||
while (true)
|
if (socket is null) return;
|
||||||
|
while (!socket.Connected)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await socket.ConnectAsync();
|
||||||
|
}
|
||||||
|
catch
|
||||||
{
|
{
|
||||||
await GetMetadata();
|
|
||||||
await Task.Delay(TimeSpan.FromSeconds(5)); await Task.Delay(TimeSpan.FromSeconds(5));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<CollectionMetaData> Collections { get; private set; } = new List<CollectionMetaData>();
|
public List<CollectionMetaData> Collections { get; private set; } = new List<CollectionMetaData>();
|
||||||
public CollectionMetaData? SelectedCollection { get; private set; }
|
public int SelectedCollection { get; private set; } = -1;
|
||||||
public int PageIndex { get; private set; } = 0;
|
|
||||||
private async Task GetMetadata()
|
public Dictionary<int, int> CollectionIndexes { get; private set; } = new();
|
||||||
|
public int PageIndex
|
||||||
{
|
{
|
||||||
try
|
get
|
||||||
{
|
{
|
||||||
var response = await httpClient.GetAsync("meta");
|
if (SelectedCollection == -1) return 0;
|
||||||
if (response.IsSuccessStatusCode)
|
if (!CollectionIndexes.ContainsKey(SelectedCollection))
|
||||||
{
|
{
|
||||||
var json = await response.Content.ReadAsStringAsync();
|
CollectionIndexes[SelectedCollection] = 0;
|
||||||
dynamic collections = JsonConvert.DeserializeObject(json);
|
}
|
||||||
collections = collections.collections;
|
return CollectionIndexes[SelectedCollection];
|
||||||
Collections = JsonConvert.DeserializeObject<List<CollectionMetaData>>(collections.ToString());
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (SelectedCollection == -1) return;
|
||||||
|
CollectionIndexes[SelectedCollection] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
public bool PageMode { get; set; } = false;
|
||||||
|
|
||||||
|
public int PageCount
|
||||||
{
|
{
|
||||||
//Logger.Instance.LogMessage(TracingLevel.INFO, $"Error pinging ClipTrim API: {ex.Message}");
|
get
|
||||||
return;
|
{
|
||||||
|
if (SelectedCollection == -1) return 0;
|
||||||
|
var collection = Collections[SelectedCollection];
|
||||||
|
return (collection.Clips.Count - 1) / 10 + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public bool CanPageUp
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if(PageMode) return false;
|
||||||
|
if (SelectedCollection == -1) return false;
|
||||||
|
return PageCount - PageIndex > 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CanPageDown
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (PageMode) return false;
|
||||||
|
return PageIndex > 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PageDown()
|
||||||
|
{
|
||||||
|
if (CanPageDown)
|
||||||
|
{
|
||||||
|
PageIndex--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PageUp()
|
||||||
|
{
|
||||||
|
if (CanPageUp)
|
||||||
|
{
|
||||||
|
PageIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
public List<string> GetCollectionNames()
|
public List<string> GetCollectionNames()
|
||||||
{
|
{
|
||||||
//await GetMetadata();
|
//await GetMetadata();
|
||||||
return Collections.Select(x => x.Name).ToList();
|
return Collections.Where(x => x.Name != "Uncategorized").Select(x => x.Name).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSelectedCollectionByName(string name)
|
public string GetCurrentCollectionName()
|
||||||
{
|
{
|
||||||
var collection = Collections.FirstOrDefault(x => x.Name == name);
|
if (SelectedCollection == -1) return "";
|
||||||
if (collection != null)
|
return Collections[SelectedCollection].Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetPlayerStringByCoordinateIndex(int index)
|
||||||
{
|
{
|
||||||
SelectedCollection = collection;
|
if (PageMode)
|
||||||
PageIndex = 0;
|
{
|
||||||
|
int pageNumber = index + 1;
|
||||||
|
if(pageNumber <= PageCount)
|
||||||
|
{
|
||||||
|
return pageNumber.ToString();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var collection = GetClipByPagedIndex(index);
|
||||||
|
return collection?.Name ?? "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ClipMetadata? GetClipByPagedIndex(int index)
|
public ClipMetadata? GetClipByPagedIndex(int index)
|
||||||
{
|
{
|
||||||
if (SelectedCollection == null) return null;
|
SelectedCollection = Collections.FindIndex(x => x.Name == GlobalSettings.Instance.ProfileName);
|
||||||
|
if (SelectedCollection == -1) return null;
|
||||||
int clipIndex = PageIndex * 10 + index;
|
int clipIndex = PageIndex * 10 + index;
|
||||||
if (clipIndex >= 0 && clipIndex < SelectedCollection.Clips.Count)
|
var collection = Collections[SelectedCollection];
|
||||||
|
if (clipIndex >= 0 && clipIndex < collection.Clips.Count)
|
||||||
{
|
{
|
||||||
return SelectedCollection.Clips[clipIndex];
|
return collection.Clips[clipIndex];
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void PlayClip(ClipMetadata? metadata)
|
public async void PlayClip(int index)
|
||||||
{
|
{
|
||||||
|
if (PageMode)
|
||||||
|
{
|
||||||
|
if(index < 0 || index >= PageCount) return;
|
||||||
|
PageIndex = index;
|
||||||
|
PageMode = false;
|
||||||
|
Player.TickAll();
|
||||||
|
PageNavigator.TickAll();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (socket is null) return;
|
||||||
|
var metadata = GetClipByPagedIndex(index);
|
||||||
if (metadata == null) return;
|
if (metadata == null) return;
|
||||||
|
//Logger.Instance.LogMessage(TracingLevel.INFO, $"playing clip:");
|
||||||
|
await socket.EmitAsync("play_clip", new List<object>() { metadata });
|
||||||
|
}
|
||||||
|
|
||||||
var response = await httpClient.PostAsync("playback/start", new StringContent(JsonConvert.SerializeObject(metadata), Encoding.UTF8, "application/json"));
|
}
|
||||||
if (!response.IsSuccessStatusCode)
|
|
||||||
|
public async void SaveClip()
|
||||||
{
|
{
|
||||||
//Logger.Instance.LogMessage(TracingLevel.INFO, $"Error playing clip: {response.ReasonPhrase}");
|
if (socket is null) return;
|
||||||
|
await socket.EmitAsync("record_clip", new List<object>() { });
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void CheckPort()
|
||||||
|
{
|
||||||
|
if (socket is null) return;
|
||||||
|
//Logger.Instance.LogMessage(TracingLevel.INFO, $"Checking port {socket}");
|
||||||
|
if (currentHostname != HostName)
|
||||||
|
{
|
||||||
|
//Logger.Instance.LogMessage(TracingLevel.INFO, $"port {socket}");
|
||||||
|
if (socket.Connected)
|
||||||
|
{
|
||||||
|
await socket.DisconnectAsync();
|
||||||
|
}
|
||||||
|
socket.Dispose();
|
||||||
|
CreateSocket();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ClipTrimDotNet.Client
|
namespace ClipTrimDotNet.Client
|
||||||
@ -10,14 +11,17 @@ namespace ClipTrimDotNet.Client
|
|||||||
public class CollectionMetaData
|
public class CollectionMetaData
|
||||||
{
|
{
|
||||||
[JsonProperty(PropertyName = "name")]
|
[JsonProperty(PropertyName = "name")]
|
||||||
|
[JsonPropertyName("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[JsonProperty(PropertyName = "clips")]
|
[JsonProperty(PropertyName = "clips")]
|
||||||
|
[JsonPropertyName("clips")]
|
||||||
public List<ClipMetadata> Clips { get; set; } = new List<ClipMetadata>();
|
public List<ClipMetadata> Clips { get; set; } = new List<ClipMetadata>();
|
||||||
|
|
||||||
|
|
||||||
[JsonProperty(PropertyName = "id")]
|
[JsonProperty(PropertyName = "id")]
|
||||||
|
[JsonPropertyName("id")]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,147 +1,110 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
<ProjectGuid>{4635D874-69C0-4010-BE46-77EF92EB1553}</ProjectGuid>
|
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RootNamespace>ClipTrimDotNet</RootNamespace>
|
<LangVersion>10</LangVersion>
|
||||||
<AssemblyName>ClipTrimDotNet</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
|
||||||
<LangVersion>8</LangVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
|
||||||
<Deterministic>true</Deterministic>
|
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<TargetFrameworkProfile />
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<PreBuildEvent>npm run stop</PreBuildEvent>
|
||||||
|
<PostBuildEvent>npm run start</PostBuildEvent>
|
||||||
|
<AssemblyTitle>ClipTrimDotNet</AssemblyTitle>
|
||||||
|
<Product>ClipTrimDotNet</Product>
|
||||||
|
<Copyright>Copyright © 2020</Copyright>
|
||||||
|
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||||
|
<FileVersion>1.0.0.0</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\com.michal-courson.cliptrim.sdPlugin\</OutputPath>
|
<OutputPath>bin\Debug\com.michal-courson.cliptrim.sdPlugin\</OutputPath>
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\ClipTrimDotNet.sdPlugin\</OutputPath>
|
<OutputPath>bin\Release\ClipTrimDotNet.sdPlugin\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="CommandLine, Version=2.9.1.0, Culture=neutral, PublicKeyToken=5a870481e358d379, processorArchitecture=MSIL">
|
<None Remove="Images\app_icon.png" />
|
||||||
<HintPath>..\packages\CommandLineParser.2.9.1\lib\net461\CommandLine.dll</HintPath>
|
<None Remove="Images\back.png" />
|
||||||
</Reference>
|
<None Remove="Images\category_icon.png" />
|
||||||
<Reference Include="Microsoft.Win32.Registry, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<None Remove="Images\collection.png" />
|
||||||
<HintPath>..\packages\Microsoft.Win32.Registry.4.7.0\lib\net461\Microsoft.Win32.Registry.dll</HintPath>
|
<None Remove="Images\collection_icon.png" />
|
||||||
</Reference>
|
<None Remove="Images\page_nav.png" />
|
||||||
<Reference Include="NAudio, Version=2.2.1.0, Culture=neutral, PublicKeyToken=e279aa5131008a41, processorArchitecture=MSIL">
|
<None Remove="Images\page_nav_icon.png" />
|
||||||
<HintPath>..\packages\NAudio.2.2.1\lib\net472\NAudio.dll</HintPath>
|
<None Remove="Images\player.png" />
|
||||||
</Reference>
|
<None Remove="Images\player_icon.png" />
|
||||||
<Reference Include="NAudio.Asio, Version=2.2.1.0, Culture=neutral, PublicKeyToken=e279aa5131008a41, processorArchitecture=MSIL">
|
<None Remove="Images\record.png" />
|
||||||
<HintPath>..\packages\NAudio.Asio.2.2.1\lib\netstandard2.0\NAudio.Asio.dll</HintPath>
|
<None Remove="Images\record_icon.png" />
|
||||||
</Reference>
|
<None Remove="manifest.json" />
|
||||||
<Reference Include="NAudio.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=e279aa5131008a41, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\NAudio.Core.2.2.1\lib\netstandard2.0\NAudio.Core.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="NAudio.Midi, Version=2.2.1.0, Culture=neutral, PublicKeyToken=e279aa5131008a41, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\NAudio.Midi.2.2.1\lib\netstandard2.0\NAudio.Midi.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="NAudio.Wasapi, Version=2.2.1.0, Culture=neutral, PublicKeyToken=e279aa5131008a41, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\NAudio.Wasapi.2.2.1\lib\netstandard2.0\NAudio.Wasapi.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="NAudio.WinForms, Version=2.2.1.0, Culture=neutral, PublicKeyToken=e279aa5131008a41, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\NAudio.WinForms.2.2.1\lib\net472\NAudio.WinForms.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="NAudio.WinMM, Version=2.2.1.0, Culture=neutral, PublicKeyToken=e279aa5131008a41, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\NAudio.WinMM.2.2.1\lib\netstandard2.0\NAudio.WinMM.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\Newtonsoft.Json.13.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="NLog, Version=6.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\NLog.6.0.5\lib\net46\NLog.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="StreamDeckTools, Version=6.3.2.0, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\StreamDeck-Tools.6.3.2\lib\netstandard2.0\StreamDeckTools.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Configuration" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Drawing" />
|
|
||||||
<Reference Include="System.Drawing.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\System.Drawing.Common.9.0.10\lib\net462\System.Drawing.Common.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.IO.Compression" />
|
|
||||||
<Reference Include="System.Runtime.Serialization" />
|
|
||||||
<Reference Include="System.Security.AccessControl, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\System.Security.AccessControl.4.7.0\lib\net461\System.Security.AccessControl.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.Security.Principal.Windows, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\System.Security.Principal.Windows.4.7.0\lib\net461\System.Security.Principal.Windows.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System.ServiceModel" />
|
|
||||||
<Reference Include="System.Transactions" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="BaseTest.cs" />
|
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
||||||
<Compile Include="Client\ClipMetadata.cs" />
|
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
|
||||||
<Compile Include="Client\ClipTrimClient.cs" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.2" />
|
||||||
<Compile Include="Client\CollectionMetaData.cs" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.2" />
|
||||||
<Compile Include="GlobalSettings.cs" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.2" />
|
||||||
<Compile Include="Player.cs" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.2" />
|
||||||
<Compile Include="ProfileSwitcher.cs" />
|
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.2" />
|
||||||
<Compile Include="Program.cs" />
|
<PackageReference Include="Microsoft.Extensions.Primitives" Version="10.0.2" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
<Compile Include="WavPlayer.cs" />
|
<PackageReference Include="NLog" Version="6.0.5" />
|
||||||
|
<PackageReference Include="SocketIOClient" Version="4.0.0.2" />
|
||||||
|
<PackageReference Include="SocketIOClient.Common" Version="4.0.0" />
|
||||||
|
<PackageReference Include="SocketIOClient.Serializer" Version="4.0.0.1" />
|
||||||
|
<PackageReference Include="SocketIOClient.Serializer.NewtonsoftJson" Version="4.0.0.1" />
|
||||||
|
<PackageReference Include="StreamDeck-Tools" Version="6.3.2" />
|
||||||
|
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="10.0.2" />
|
||||||
|
<PackageReference Include="System.Drawing.Common" Version="9.0.10" />
|
||||||
|
<PackageReference Include="System.IO.Pipelines" Version="10.0.2" />
|
||||||
|
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.2" />
|
||||||
|
<PackageReference Include="System.Security.AccessControl" Version="6.0.1" />
|
||||||
|
<PackageReference Include="System.Text.Encodings.Web" Version="10.0.2" />
|
||||||
|
<PackageReference Include="System.Text.Json" Version="10.0.2" />
|
||||||
|
<PackageReference Include="System.Configuration.ConfigurationManager" Version="10.0.3" />
|
||||||
|
<PackageReference Include="CoreWCF.Primitives" Version="1.8.0" />
|
||||||
|
<PackageReference Include="CoreWCF.ConfigurationManager" Version="1.8.0" />
|
||||||
|
<PackageReference Include="CoreWCF.Http" Version="1.8.0" />
|
||||||
|
<PackageReference Include="CoreWCF.WebHttp" Version="1.8.0" />
|
||||||
|
<PackageReference Include="CoreWCF.NetTcp" Version="1.8.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Update="DialLayout.json">
|
||||||
<None Include="DialLayout.json">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="manifest.json">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="!!README!!.txt" />
|
<Content Include="!!README!!.txt" />
|
||||||
<Content Include="Images\categoryIcon%402x.png">
|
<Content Include="Images\app_icon.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Images\categoryIcon.png">
|
<Content Include="Images\back.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Images\icon%402x.png">
|
<Content Include="Images\category_icon.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Images\icon.png">
|
<Content Include="Images\collection.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Images\pluginAction%402x.png">
|
<Content Include="Images\collection_icon.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Images\pluginAction.png">
|
<Content Include="Images\page_nav.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Images\pluginIcon%402x.png">
|
<Content Include="Images\page_nav_icon.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Images\pluginIcon.png">
|
<Content Include="Images\player_icon.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="Images\record.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="Images\player.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="Images\record_icon.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="manifest.json">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="package.json" />
|
<Content Include="package.json" />
|
||||||
@ -152,11 +115,4 @@
|
|||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<PreBuildEvent>npm run stop</PreBuildEvent>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<PostBuildEvent>npm run start</PostBuildEvent>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
@ -7,32 +7,9 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using BarRaider.SdTools.Wrappers;
|
using BarRaider.SdTools.Wrappers;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using NAudio.MediaFoundation;
|
|
||||||
|
|
||||||
namespace ClipTrimDotNet
|
namespace ClipTrimDotNet
|
||||||
{
|
{
|
||||||
public class FileEntry
|
|
||||||
{
|
|
||||||
public FileEntry()
|
|
||||||
{
|
|
||||||
Volume = 1.0;
|
|
||||||
Playtype = "Play/Overlap";
|
|
||||||
}
|
|
||||||
[JsonProperty(PropertyName = "Volume")]
|
|
||||||
public double Volume { get; set; }
|
|
||||||
[JsonProperty(PropertyName = "Playtype")]
|
|
||||||
public string Playtype { get; set; }
|
|
||||||
}
|
|
||||||
public class CollectionEntry
|
|
||||||
{
|
|
||||||
public CollectionEntry()
|
|
||||||
{
|
|
||||||
Files = new Dictionary<string, FileEntry>();
|
|
||||||
}
|
|
||||||
[JsonProperty(PropertyName = "Files")]
|
|
||||||
public Dictionary<string, FileEntry> Files { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class GlobalSettings
|
public class GlobalSettings
|
||||||
{
|
{
|
||||||
public static GlobalSettings? _inst;
|
public static GlobalSettings? _inst;
|
||||||
@ -51,59 +28,22 @@ namespace ClipTrimDotNet
|
|||||||
public static GlobalSettings CreateDefaultSettings()
|
public static GlobalSettings CreateDefaultSettings()
|
||||||
{
|
{
|
||||||
GlobalSettings instance = new GlobalSettings();
|
GlobalSettings instance = new GlobalSettings();
|
||||||
instance.BasePath = null;
|
|
||||||
instance.ProfileName = null;
|
instance.ProfileName = null;
|
||||||
instance.Collections = new Dictionary<string, CollectionEntry>();
|
instance.PortNumber = 5010;
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[FilenameProperty]
|
|
||||||
[JsonProperty(PropertyName = "basePath")]
|
|
||||||
public string? BasePath { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty(PropertyName = "profileName")]
|
[JsonProperty(PropertyName = "profileName")]
|
||||||
public string? ProfileName { get; set; }
|
public string? ProfileName { get; set; }
|
||||||
|
|
||||||
[JsonProperty(PropertyName = "outputDevice")]
|
[JsonProperty(PropertyName = "portNumber")]
|
||||||
public string? OutputDevice { get; set; }
|
public int? PortNumber { get; set; }
|
||||||
|
|
||||||
[JsonProperty(PropertyName = "collections")]
|
|
||||||
public Dictionary<string, CollectionEntry> Collections { get; set; }
|
|
||||||
|
|
||||||
public void SetCurrentProfile(string profile)
|
public void SetCurrentProfile(string profile)
|
||||||
{
|
{
|
||||||
ProfileName = profile;
|
ProfileName = profile;
|
||||||
if(!Collections.ContainsKey(profile))
|
|
||||||
{
|
|
||||||
Collections.Add(profile, new CollectionEntry());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileEntry GetFileOptionsInCurrentProfile(string filename)
|
|
||||||
{
|
|
||||||
if(!Collections.TryGetValue(ProfileName, out CollectionEntry collection))
|
|
||||||
{
|
|
||||||
return new FileEntry();
|
|
||||||
}
|
|
||||||
if(!collection.Files.TryGetValue(filename, out FileEntry file))
|
|
||||||
{
|
|
||||||
return new FileEntry();
|
|
||||||
}
|
|
||||||
Logger.Instance.LogMessage(TracingLevel.INFO, "fetched file settings " + filename + JsonConvert.SerializeObject(file));
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetFileOptionsCurrentProfile(string filename, FileEntry file)
|
|
||||||
{
|
|
||||||
Logger.Instance.LogMessage(TracingLevel.INFO, "SetFileOptionsCurrentProfile ");
|
|
||||||
if (!Collections.TryGetValue(ProfileName, out CollectionEntry collection))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Logger.Instance.LogMessage(TracingLevel.INFO, "SetFileOptionsCurrentProfile 2");
|
|
||||||
//collection.Files[filename] = file;
|
|
||||||
Collections[ProfileName].Files[filename] = file;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
stream_deck_plugin/ClipTrimDotNet/Images/app_icon.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
stream_deck_plugin/ClipTrimDotNet/Images/app_icon.psd
Normal file
BIN
stream_deck_plugin/ClipTrimDotNet/Images/back.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
stream_deck_plugin/ClipTrimDotNet/Images/back.psd
Normal file
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
BIN
stream_deck_plugin/ClipTrimDotNet/Images/category_icon.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
stream_deck_plugin/ClipTrimDotNet/Images/collection.png
Normal file
|
After Width: | Height: | Size: 464 B |
BIN
stream_deck_plugin/ClipTrimDotNet/Images/collection.psd
Normal file
BIN
stream_deck_plugin/ClipTrimDotNet/Images/collection_icon.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
stream_deck_plugin/ClipTrimDotNet/Images/collection_icon.psd
Normal file
|
Before Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 7.5 KiB |
BIN
stream_deck_plugin/ClipTrimDotNet/Images/page_nav.png
Normal file
|
After Width: | Height: | Size: 484 B |
BIN
stream_deck_plugin/ClipTrimDotNet/Images/page_nav.psd
Normal file
BIN
stream_deck_plugin/ClipTrimDotNet/Images/page_nav_icon.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
stream_deck_plugin/ClipTrimDotNet/Images/page_nav_icon.psd
Normal file
BIN
stream_deck_plugin/ClipTrimDotNet/Images/player.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
stream_deck_plugin/ClipTrimDotNet/Images/player.psd
Normal file
BIN
stream_deck_plugin/ClipTrimDotNet/Images/player_icon.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |