2 Commits

Author SHA1 Message Date
7a471041e7 port selection on plugin 2026-02-28 17:01:59 -05:00
ab57d8ef22 socket in client, new set of icons 2026-02-28 11:17:37 -05:00
47 changed files with 214 additions and 100 deletions

View File

@ -8,6 +8,18 @@
"name": "Clip 20260226_195932", "name": "Clip 20260226_195932",
"playbackType": "playOverlap", "playbackType": "playOverlap",
"volume": 1 "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
} }
] ]
}, },
@ -16,14 +28,14 @@
"id": 1, "id": 1,
"clips": [ "clips": [
{ {
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_183607.wav", "filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_183812.wav",
"name": "Clip 20260226_183607", "name": "Clip 20260226_183812",
"playbackType": "playStop", "playbackType": "playStop",
"volume": 1 "volume": 1
}, },
{ {
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_183812.wav", "filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_183607.wav",
"name": "Clip 20260226_183812", "name": "Clip 20260226_183607",
"playbackType": "playStop", "playbackType": "playStop",
"volume": 1 "volume": 1
}, },
@ -76,18 +88,12 @@
"volume": 1 "volume": 1
}, },
{ {
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_184043.wav", "filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260228_092721.wav",
"name": "Clip 20260226_184043", "name": "Clip 20260228_092721",
"playbackType": "playStop", "playbackType": "playStop",
"volume": 1 "volume": 1,
}, "startTime": 6.438382145377559,
{ "endTime": 14.277258292166426
"endTime": 14.772566995768694,
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260226_194441.wav",
"name": "Test",
"playbackType": "playStop",
"startTime": 9.8548571932299,
"volume": 0.6
} }
] ]
}, },
@ -110,6 +116,18 @@
"playbackType": "playOverlap", "playbackType": "playOverlap",
"startTime": 26.14685314685314, "startTime": 26.14685314685314,
"volume": 0.64 "volume": 0.64
},
{
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260228_085116.wav",
"name": "pp",
"playbackType": "playStop",
"volume": 1
},
{
"filename": "C:\\Users\\mickl\\Desktop\\cliptrim-ui\\ClipTrimApp\\audio-service\\recordings\\audio_capture_20260228_120955.wav",
"name": "nose",
"playbackType": "playStop",
"volume": 1
} }
] ]
} }

View File

@ -121,7 +121,7 @@ class AudioIO:
} }
meta.add_clip_to_collection("Uncategorized", clip_metadata ) meta.add_clip_to_collection("Uncategorized", clip_metadata )
self.socket.emit('new_clip', clip_metadata)
return clip_metadata return clip_metadata

View File

@ -18,6 +18,8 @@ import { resolveHtmlPath } from './util';
import registerFileIpcHandlers from '../ipc/audio/main'; import registerFileIpcHandlers from '../ipc/audio/main';
import PythonSubprocessManager from './service'; import PythonSubprocessManager from './service';
const pythonManager = new PythonSubprocessManager('src/main.py');
class AppUpdater { class AppUpdater {
constructor() { constructor() {
log.transports.file.level = 'info'; log.transports.file.level = 'info';
@ -124,6 +126,7 @@ 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
pythonManager.stop();
if (process.platform !== 'darwin') { if (process.platform !== 'darwin') {
app.quit(); app.quit();
} }
@ -132,8 +135,7 @@ app.on('window-all-closed', () => {
app app
.whenReady() .whenReady()
.then(() => { .then(() => {
const pythonManager = new PythonSubprocessManager('src/main.py'); // pythonManager.start();
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

View File

@ -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;

View File

@ -7,6 +7,7 @@ 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';
@ -14,7 +15,7 @@ import { useAppDispatch, useAppSelector } from './hooks';
import { store } from '../redux/main'; import { store } from '../redux/main';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
import SettingsPage from './Settings'; import SettingsPage from './Settings';
import apiFetch from './api'; import { apiFetch, getBaseUrl } from './api';
function MainPage() { function MainPage() {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
@ -27,20 +28,46 @@ 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 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 apiFetch('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(() => {

View File

@ -5,7 +5,7 @@ import './App.css';
import TextField from '@mui/material/TextField'; import TextField from '@mui/material/TextField';
import Select from '@mui/material/Select'; import Select from '@mui/material/Select';
import MenuItem from '@mui/material/MenuItem'; import MenuItem from '@mui/material/MenuItem';
import apiFetch from './api'; import { apiFetch } from './api';
type AudioDevice = { type AudioDevice = {
index: number; index: number;

View File

@ -1,4 +1,4 @@
const getBaseUrl = async () => { export const getBaseUrl = async () => {
const port = await window.audio.getPort(); const port = await window.audio.getPort();
if (port.error || !port.port) { if (port.error || !port.port) {
return `http://localhost:5010`; return `http://localhost:5010`;
@ -7,7 +7,7 @@ const getBaseUrl = async () => {
return `http://localhost:${port.port}`; return `http://localhost:${port.port}`;
}; };
export default async function apiFetch(endpoint: string, options = {}) { export async function apiFetch(endpoint: string, options = {}) {
const url = `${await getBaseUrl()}/${endpoint}`; const url = `${await getBaseUrl()}/${endpoint}`;
return fetch(url, options); return fetch(url, options);
} }

View File

@ -15,7 +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'; import { apiFetch } from '../api';
export interface ClipListProps { export interface ClipListProps {
collection: string; collection: string;

View File

@ -30,20 +30,26 @@ namespace ClipTrimDotNet.Client
} }
//private HttpClient httpClient; //private HttpClient httpClient;
private SocketIO socket; private SocketIO? socket;
public int PortNumber { get; set; } = 5010; public string HostName
public ClipTrimClient()
{ {
//httpClient = new HttpClient() get
//{ {
// BaseAddress = new Uri("http://localhost:5010/"), //return $"http://localhost:5010/";
// Timeout = TimeSpan.FromSeconds(10) return $"http://localhost:{GlobalSettings.Instance.PortNumber}/";
//}; }
Logger.Instance.LogMessage(TracingLevel.INFO, $"Starting ClipTrimClient on port {PortNumber}"); }
socket = new SocketIO(new Uri($"http://localhost:5010/"));
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.AutoUpgrade = false;
//socket.Options.Path = "/socket.io";
socket.Options.ConnectionTimeout = TimeSpan.FromSeconds(10); socket.Options.ConnectionTimeout = TimeSpan.FromSeconds(10);
socket.Options.Reconnection = true; socket.Options.Reconnection = true;
socket.On("full_data", ctx => socket.On("full_data", ctx =>
@ -53,6 +59,8 @@ namespace ClipTrimDotNet.Client
var response = ctx.GetValue<List<CollectionMetaData>>(0); var response = ctx.GetValue<List<CollectionMetaData>>(0);
Logger.Instance.LogMessage(TracingLevel.INFO, $"full_data event {JsonConvert.SerializeObject(response)}"); Logger.Instance.LogMessage(TracingLevel.INFO, $"full_data event {JsonConvert.SerializeObject(response)}");
Collections = response!; Collections = response!;
Player.TickAll();
PageNavigator.TickAll();
//Logger.Instance.LogMessage(TracingLevel.INFO, $"Collections {JsonConvert.SerializeObject(Collections)}"); //Logger.Instance.LogMessage(TracingLevel.INFO, $"Collections {JsonConvert.SerializeObject(Collections)}");
} }
catch (Exception ex) catch (Exception ex)
@ -71,6 +79,8 @@ namespace ClipTrimDotNet.Client
if (index != -1) if (index != -1)
{ {
Collections[index] = response; Collections[index] = response;
Player.TickAll();
PageNavigator.TickAll();
} }
} }
catch catch
@ -81,6 +91,11 @@ namespace ClipTrimDotNet.Client
return Task.CompletedTask; return Task.CompletedTask;
}); });
socket.OnConnected += (sender, e) =>
{
Logger.Instance.LogMessage(TracingLevel.INFO, $"Socket connected: {e}");
};
socket.OnDisconnected += (sender, e) => socket.OnDisconnected += (sender, e) =>
{ {
Logger.Instance.LogMessage(TracingLevel.INFO, $"Socket disconnected: {e}"); Logger.Instance.LogMessage(TracingLevel.INFO, $"Socket disconnected: {e}");
@ -89,8 +104,19 @@ namespace ClipTrimDotNet.Client
Task.Run(async () => await Connect()); Task.Run(async () => await Connect());
} }
public ClipTrimClient()
{
//httpClient = new HttpClient()
//{
// BaseAddress = new Uri("http://localhost:5010/"),
// Timeout = TimeSpan.FromSeconds(10)
//};
CreateSocket();
}
public async Task Connect() public async Task Connect()
{ {
if (socket is null) return;
while (!socket.Connected) while (!socket.Connected)
{ {
try try
@ -176,6 +202,12 @@ namespace ClipTrimDotNet.Client
return Collections.Where(x => x.Name != "Uncategorized").Select(x => x.Name).ToList(); return Collections.Where(x => x.Name != "Uncategorized").Select(x => x.Name).ToList();
} }
public string GetCurrentCollectionName()
{
if (SelectedCollection == -1) return "";
return Collections[SelectedCollection].Name;
}
public string GetPlayerStringByCoordinateIndex(int index) public string GetPlayerStringByCoordinateIndex(int index)
{ {
if (PageMode) if (PageMode)
@ -221,9 +253,10 @@ namespace ClipTrimDotNet.Client
} }
else else
{ {
if (socket is null) return;
var metadata = GetClipByPagedIndex(index); var metadata = GetClipByPagedIndex(index);
if (metadata == null) return; if (metadata == null) return;
Logger.Instance.LogMessage(TracingLevel.INFO, $"playing clip:"); //Logger.Instance.LogMessage(TracingLevel.INFO, $"playing clip:");
await socket.EmitAsync("play_clip", new List<object>() { metadata }); await socket.EmitAsync("play_clip", new List<object>() { metadata });
} }
@ -231,7 +264,24 @@ namespace ClipTrimDotNet.Client
public async void SaveClip() public async void SaveClip()
{ {
if (socket is null) return;
await socket.EmitAsync("record_clip", new List<object>() { }); 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();
}
}
} }
} }

View File

@ -20,6 +20,20 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\ClipTrimDotNet.sdPlugin\</OutputPath> <OutputPath>bin\Release\ClipTrimDotNet.sdPlugin\</OutputPath>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Remove="Images\app_icon.png" />
<None Remove="Images\back.png" />
<None Remove="Images\category_icon.png" />
<None Remove="Images\collection.png" />
<None Remove="Images\collection_icon.png" />
<None Remove="Images\page_nav.png" />
<None Remove="Images\page_nav_icon.png" />
<None Remove="Images\player.png" />
<None Remove="Images\player_icon.png" />
<None Remove="Images\record.png" />
<None Remove="Images\record_icon.png" />
<None Remove="manifest.json" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" /> <PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" /> <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
@ -54,34 +68,43 @@
<None Update="DialLayout.json"> <None Update="DialLayout.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Update="manifest.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</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" />

View File

@ -29,6 +29,7 @@ namespace ClipTrimDotNet
{ {
GlobalSettings instance = new GlobalSettings(); GlobalSettings instance = new GlobalSettings();
instance.ProfileName = null; instance.ProfileName = null;
instance.PortNumber = 5010;
return instance; return instance;
} }
@ -36,6 +37,9 @@ namespace ClipTrimDotNet
[JsonProperty(PropertyName = "profileName")] [JsonProperty(PropertyName = "profileName")]
public string? ProfileName { get; set; } public string? ProfileName { get; set; }
[JsonProperty(PropertyName = "portNumber")]
public int? PortNumber { get; set; }
public void SetCurrentProfile(string profile) public void SetCurrentProfile(string profile)
{ {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -68,7 +68,7 @@ namespace ClipTrimDotNet.Keys
await Connection.SetTitleAsync(ClipTrimClient.Instance.CanPageDown ? "<" : ""); await Connection.SetTitleAsync(ClipTrimClient.Instance.CanPageDown ? "<" : "");
break; break;
case 1: case 1:
await Connection.SetTitleAsync((ClipTrimClient.Instance.PageIndex + 1).ToString()); await Connection.SetTitleAsync(ClipTrimClient.Instance.GetCurrentCollectionName() + "\n" + (ClipTrimClient.Instance.PageIndex + 1).ToString());
break; break;
case 2: case 2:
await Connection.SetTitleAsync(ClipTrimClient.Instance.CanPageUp ? ">" : ""); await Connection.SetTitleAsync(ClipTrimClient.Instance.CanPageUp ? ">" : "");

View File

@ -60,7 +60,7 @@ namespace ClipTrimDotNet.Keys
private async void SetTitle() private async void SetTitle()
{ {
await Connection.SetTitleAsync(settings.ProfileName + " B"); await Connection.SetTitleAsync(settings.ProfileName);
} }
private async void Connection_OnSendToPlugin(object? sender, SDEventReceivedEventArgs<BarRaider.SdTools.Events.SendToPlugin> e) private async void Connection_OnSendToPlugin(object? sender, SDEventReceivedEventArgs<BarRaider.SdTools.Events.SendToPlugin> e)
@ -90,6 +90,8 @@ namespace ClipTrimDotNet.Keys
public override async void KeyPressed(KeyPayload payload) public override async void KeyPressed(KeyPayload payload)
{ {
GlobalSettings.Instance.SetCurrentProfile(settings.ProfileName??""); GlobalSettings.Instance.SetCurrentProfile(settings.ProfileName??"");
ClipTrimClient.Instance.PageMode = false;
PageNavigator.TickAll();
await Connection.SetGlobalSettingsAsync(JObject.FromObject(GlobalSettings.Instance)); await Connection.SetGlobalSettingsAsync(JObject.FromObject(GlobalSettings.Instance));
await Connection.SwitchProfileAsync("ClipTrim"); await Connection.SwitchProfileAsync("ClipTrim");
@ -107,6 +109,7 @@ namespace ClipTrimDotNet.Keys
public override void ReceivedSettings(ReceivedSettingsPayload payload) public override void ReceivedSettings(ReceivedSettingsPayload payload)
{ {
//Logger.Instance.LogMessage(TracingLevel.INFO, $"ProfileSwitcher received settings {JsonConvert.SerializeObject(payload.Settings)}");
Tools.AutoPopulateSettings(settings, payload.Settings); Tools.AutoPopulateSettings(settings, payload.Settings);
SaveSettings(); SaveSettings();
} }
@ -114,6 +117,7 @@ namespace ClipTrimDotNet.Keys
public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload) public override void ReceivedGlobalSettings(ReceivedGlobalSettingsPayload payload)
{ {
Tools.AutoPopulateSettings(GlobalSettings.Instance, payload.Settings); Tools.AutoPopulateSettings(GlobalSettings.Instance, payload.Settings);
ClipTrimClient.Instance.CheckPort();
//if (payload.Settings == null || payload.Settings.Count == 0) //if (payload.Settings == null || payload.Settings.Count == 0)
//{ //{
// var inst = GlobalSettings.Instance; // var inst = GlobalSettings.Instance;

View File

@ -13,7 +13,7 @@ namespace ClipTrimDotNet
{ {
// Uncomment this line of code to allow for debugging // Uncomment this line of code to allow for debugging
//while (!System.Diagnostics.Debugger.IsAttached) { System.Threading.Thread.Sleep(100); } //while (!System.Diagnostics.Debugger.IsAttached) { System.Threading.Thread.Sleep(100); }
Client.ClipTrimClient.Instance.PortNumber = 5010; //Client.ClipTrimClient.Instance.PortNumber = 5010;
SDWrapper.Run(args); SDWrapper.Run(args);
} }
} }

View File

@ -16,6 +16,13 @@
show-refresh="true" show-refresh="true"
placeholder="Select a ClipTrim page"></sdpi-select> placeholder="Select a ClipTrim page"></sdpi-select>
</sdpi-item> </sdpi-item>
<sdpi-item>
<sdpi-textfield
global="true"
setting="portNumber"
placeholder="Port Number"
pattern="[0-9]+"></sdpi-textfield>
</sdpi-item>
<!--<sdpi-item label="Base Path"> <!--<sdpi-item label="Base Path">
<sdpi-file setting="basePath" <sdpi-file setting="basePath"
global="true" global="true"

View File

@ -2,11 +2,11 @@
"Actions": [ "Actions": [
{ {
"Icon": "Images/icon", "Icon": "Images/player_icon",
"Name": "Player", "Name": "Player",
"States": [ "States": [
{ {
"Image": "Images/pluginAction", "Image": "Images/player",
"TitleAlignment": "middle", "TitleAlignment": "middle",
"FontSize": 11 "FontSize": 11
} }
@ -17,26 +17,26 @@
"PropertyInspectorPath": "PropertyInspector/file_player.html" "PropertyInspectorPath": "PropertyInspector/file_player.html"
}, },
{ {
"Icon": "Images/icon", "Icon": "Images/collection_icon",
"Name": "Profile Switcher", "Name": "Collection Selector",
"States": [ "States": [
{ {
"Image": "Images/pluginAction", "Image": "Images/collection",
"TitleAlignment": "middle", "TitleAlignment": "middle",
"FontSize": 11 "FontSize": 11
} }
], ],
"SupportedInMultiActions": false, "SupportedInMultiActions": false,
"Tooltip": "Selects which sub folder to use and opens effect profile", "Tooltip": "Selects which collection to use",
"UUID": "com.michal-courson.cliptrim.profile-switcher", "UUID": "com.michal-courson.cliptrim.profile-switcher",
"PropertyInspectorPath": "PropertyInspector/profile_swticher.html" "PropertyInspectorPath": "PropertyInspector/profile_swticher.html"
}, },
{ {
"Icon": "Images/icon", "Icon": "Images/page_nav_icon",
"Name": "Page Navigator", "Name": "Page Navigator",
"States": [ "States": [
{ {
"Image": "Images/pluginAction", "Image": "Images/page_nav",
"TitleAlignment": "middle", "TitleAlignment": "middle",
"FontSize": 16 "FontSize": 16
} }
@ -47,11 +47,11 @@
"PropertyInspectorPath": "PropertyInspector/file_player.html" "PropertyInspectorPath": "PropertyInspector/file_player.html"
}, },
{ {
"Icon": "Images/icon", "Icon": "Images/record_icon",
"Name": "Save Clip", "Name": "Save Clip",
"States": [ "States": [
{ {
"Image": "Images/pluginAction", "Image": "Images/record",
"TitleAlignment": "middle", "TitleAlignment": "middle",
"FontSize": 16 "FontSize": 16
} }
@ -65,11 +65,11 @@
"Author": "Michal Courson", "Author": "Michal Courson",
"Name": "ClipTrimDotNet", "Name": "ClipTrimDotNet",
"Description": "Pairs with cliptrim for easy voice recording and trimming", "Description": "Pairs with cliptrim for easy voice recording and trimming",
"Icon": "Images/pluginIcon", "Icon": "Images/app_icon",
"Version": "0.1.0.0", "Version": "0.1.0.0",
"CodePath": "ClipTrimDotNet.exe", "CodePath": "ClipTrimDotNet.exe",
"Category": "ClipTrimDotNet", "Category": "ClipTrim",
"CategoryIcon": "Images/categoryIcon", "CategoryIcon": "Images/category_icon",
"UUID": "com.michal-courson.cliptrim", "UUID": "com.michal-courson.cliptrim",
"OS": [ "OS": [
{ {