-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a88a768
commit 84cd93f
Showing
22 changed files
with
832 additions
and
848 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
<prism:PrismApplication x:Class="STS_Bcut.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:STS_Bcut" | ||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" | ||
xmlns:prism="http://prismlibrary.com/"> | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" | ||
xmlns:prism="http://prismlibrary.com/"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<materialDesign:BundledTheme BaseTheme="Light" PrimaryColor="BlueGrey" SecondaryColor="Lime" /> | ||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" /> | ||
<ResourceDictionary | ||
Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" /> | ||
</ResourceDictionary.MergedDictionaries> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</prism:PrismApplication> | ||
</prism:PrismApplication> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,35 @@ | ||
using Prism.DryIoc; | ||
using System.Windows; | ||
using Prism.DryIoc; | ||
using Prism.Ioc; | ||
using System.Windows; | ||
using Prism.Services.Dialogs; | ||
using STS_Bcut.src; | ||
using STS_Bcut.src.Common; | ||
using STS_Bcut.src.ViewModels; | ||
using STS_Bcut.src.Views; | ||
using STS_Bcut.src.Common; | ||
|
||
namespace STS_Bcut | ||
namespace STS_Bcut; | ||
|
||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : PrismApplication | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : PrismApplication | ||
protected override Window CreateShell() | ||
{ | ||
protected override Window CreateShell() | ||
{ | ||
return Container.Resolve<MainView>(); | ||
} | ||
return Container.Resolve<MainView>(); | ||
} | ||
|
||
protected override void RegisterTypes(IContainerRegistry containerRegistry) | ||
{ | ||
containerRegistry.Register<IDialogHostService, DialogHostService>(); | ||
protected override void RegisterTypes(IContainerRegistry containerRegistry) | ||
{ | ||
containerRegistry.Register<IDialogHostService, DialogHostService>(); | ||
|
||
containerRegistry.RegisterForNavigation<AboutView,AboutViewModel>(); | ||
containerRegistry.RegisterForNavigation<SettingsView,SettingsViewModel>(); | ||
containerRegistry.RegisterForNavigation<MainView, MainViewModel>(); | ||
} | ||
containerRegistry.RegisterForNavigation<AboutView, AboutViewModel>(); | ||
containerRegistry.RegisterForNavigation<SettingsView, SettingsViewModel>(); | ||
containerRegistry.RegisterForNavigation<MainView, MainViewModel>(); | ||
} | ||
|
||
protected override void OnExit(ExitEventArgs e) | ||
{ | ||
base.OnExit(e); | ||
ConfigUtil.WriteConfig(MainViewModel.config); | ||
} | ||
protected override void OnExit(ExitEventArgs e) | ||
{ | ||
base.OnExit(e); | ||
ConfigUtil.WriteConfig(MainViewModel.config); | ||
Check warning on line 33 in App.xaml.cs GitHub Actions / build-win-x64-arm64
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,139 +1,140 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace STS_Bcut.src | ||
namespace STS_Bcut.src; | ||
|
||
public class UploadStruct | ||
{ | ||
public class UploadStruct | ||
public string model_id = "7"; | ||
|
||
public int type = 2; | ||
|
||
public UploadStruct(string name, int size, string res) | ||
{ | ||
public UploadStruct(string name, int size, string res) | ||
{ | ||
this.name = name; | ||
this.size = size; | ||
ResourceFileType = res; | ||
} | ||
|
||
public int type = 2; | ||
public string name { get; set; } | ||
public int size { get; set; } | ||
public string ResourceFileType { get; set; } | ||
public string model_id = "7"; | ||
this.name = name; | ||
this.size = size; | ||
ResourceFileType = res; | ||
} | ||
|
||
public string name { get; set; } | ||
public int size { get; set; } | ||
public string ResourceFileType { get; set; } | ||
} | ||
|
||
public class CommitUploadStruct | ||
{ | ||
public string Etags; | ||
|
||
public string InBossKey; | ||
public string model_id = "7"; | ||
public string ResourceId; | ||
public string UploadId; | ||
|
||
public class CommitUploadStruct | ||
public CommitUploadStruct(string in_boss_key, string resource_id, string etags, string upload_id) | ||
{ | ||
public CommitUploadStruct(string in_boss_key, string resource_id, string etags, string upload_id) | ||
{ | ||
InBossKey = in_boss_key; | ||
ResourceId = resource_id; | ||
Etags = etags; | ||
UploadId = upload_id; | ||
} | ||
|
||
public string InBossKey; | ||
public string ResourceId; | ||
public string Etags; | ||
public string UploadId; | ||
public string model_id = "7"; | ||
InBossKey = in_boss_key; | ||
ResourceId = resource_id; | ||
Etags = etags; | ||
UploadId = upload_id; | ||
} | ||
} | ||
|
||
public class CreateTaskStruct | ||
{ | ||
public string model_id = "7"; | ||
|
||
public string resource; | ||
|
||
public CreateTaskStruct(string resource) | ||
{ | ||
this.resource = resource; | ||
} | ||
} | ||
|
||
public enum ResultStateEnum | ||
{ | ||
WAITING = 0, | ||
RUNNING = 1, | ||
ERROR = 3, | ||
COMLETE = 4 | ||
} | ||
|
||
public class ResultResponse | ||
{ | ||
public string remark; | ||
Check warning on line 64 in src/APIDataStruct.cs GitHub Actions / build-win-x64-arm64
|
||
public string result; | ||
Check warning on line 65 in src/APIDataStruct.cs GitHub Actions / build-win-x64-arm64
|
||
public ResultStateEnum state; | ||
public string task_id; | ||
Check warning on line 67 in src/APIDataStruct.cs GitHub Actions / build-win-x64-arm64
|
||
} | ||
|
||
public class STSDataSeg | ||
{ | ||
public int confidence; | ||
public int end_time; | ||
public int start_time; | ||
public string transcript; | ||
Check warning on line 75 in src/APIDataStruct.cs GitHub Actions / build-win-x64-arm64
|
||
public List<STSDataWords> words; | ||
Check warning on line 76 in src/APIDataStruct.cs GitHub Actions / build-win-x64-arm64
|
||
|
||
public class CreateTaskStruct | ||
private (int, int, int, int) _Srt_Time_Conv_(int time) | ||
{ | ||
public CreateTaskStruct(string resource) | ||
{ | ||
this.resource = resource; | ||
} | ||
return (time / 3600000, time / 60000 % 60, time / 1000 % 60, time % 1000); | ||
} | ||
|
||
public string resource; | ||
public string model_id = "7"; | ||
private (int, int, int) _Lrc_Time_Conv_(int time) | ||
{ | ||
return (time / 60000, time / 1000 % 60, time % 1000 / 10); | ||
} | ||
|
||
public enum ResultStateEnum : int | ||
public string ToSrtTs() | ||
{ | ||
WAITING = 0, | ||
RUNNING = 1, | ||
ERROR = 3, | ||
COMLETE = 4 | ||
var (s_h, s_m, s_s, s_ms) = _Srt_Time_Conv_(start_time); | ||
var (e_h, e_m, e_s, e_ms) = _Srt_Time_Conv_(end_time); | ||
return string.Format("{0:00}:{1:00}:{2:00},{3:000} --> {4:00}:{5:00}:{6:00},{7:000}", s_h, s_m, s_s, s_ms, e_h, | ||
e_m, e_s, e_ms); | ||
} | ||
|
||
public class ResultResponse | ||
public string ToLrcTs() | ||
{ | ||
public string task_id; | ||
public string result; | ||
public string remark; | ||
public ResultStateEnum state; | ||
var (s_m, s_s, s_ms) = _Lrc_Time_Conv_(start_time); | ||
return string.Format("[{0:00}:{1:00}.{2:00}]", s_m, s_s, s_ms); | ||
} | ||
|
||
public class STSDataSeg | ||
public class STSDataWords | ||
{ | ||
public class STSDataWords | ||
{ | ||
public string label; | ||
public int start_time; | ||
public int end_time; | ||
public int confidence; | ||
} | ||
public int start_time; | ||
public int end_time; | ||
public string transcript; | ||
public List<STSDataWords> words; | ||
public int confidence; | ||
|
||
private (int, int, int, int) _Srt_Time_Conv_(int time) => (time / 3600000, time / 60000 % 60, time / 1000 % 60, time % 1000); | ||
private (int, int, int) _Lrc_Time_Conv_(int time) => (time / 60000, time / 1000 % 60, time % 1000 / 10); | ||
|
||
public string ToSrtTs() | ||
{ | ||
var (s_h, s_m, s_s, s_ms) = _Srt_Time_Conv_(start_time); | ||
var (e_h, e_m, e_s, e_ms) = _Srt_Time_Conv_(end_time); | ||
return string.Format("{0:00}:{1:00}:{2:00},{3:000} --> {4:00}:{5:00}:{6:00},{7:000}", s_h, s_m, s_s, s_ms, e_h, e_m, e_s, e_ms); | ||
} | ||
|
||
public string ToLrcTs() | ||
{ | ||
var (s_m, s_s, s_ms) = _Lrc_Time_Conv_(start_time); | ||
return string.Format("[{0:00}:{1:00}.{2:00}]", s_m, s_s, s_ms); | ||
} | ||
public int end_time; | ||
public string label; | ||
public int start_time; | ||
} | ||
} | ||
|
||
public class STSData | ||
{ | ||
public List<STSDataSeg> utterances; | ||
public string version; | ||
|
||
public class STSData | ||
public bool HasData() | ||
{ | ||
public List<STSDataSeg> utterances; | ||
public string version; | ||
|
||
public bool HasData() | ||
{ | ||
return utterances.Count > 0; | ||
} | ||
|
||
public string ToTxt() | ||
{ | ||
return string.Join("\n", utterances.Select(x => x.transcript).ToList()); | ||
} | ||
|
||
public string ToSrt() | ||
{ | ||
List<string> srt = new(); | ||
for (int i = 0; i < utterances.Count; i++) | ||
{ | ||
srt.Add($"{i + 1}\n{utterances[i].ToSrtTs()}\n{utterances[i].transcript}\n"); | ||
} | ||
return string.Join("\n", srt); | ||
} | ||
|
||
public string ToLrc() | ||
{ | ||
List<string> lrc = new(); | ||
foreach (var item in utterances) | ||
{ | ||
lrc.Add($"{item.ToLrcTs()}{item.transcript}"); | ||
} | ||
return string.Join("\n", lrc); | ||
} | ||
return utterances.Count > 0; | ||
} | ||
|
||
public string ToTxt() | ||
{ | ||
return string.Join("\n", utterances.Select(x => x.transcript).ToList()); | ||
} | ||
|
||
public string ToSrt() | ||
{ | ||
List<string> srt = new(); | ||
for (var i = 0; i < utterances.Count; i++) | ||
srt.Add($"{i + 1}\n{utterances[i].ToSrtTs()}\n{utterances[i].transcript}\n"); | ||
return string.Join("\n", srt); | ||
} | ||
|
||
} | ||
public string ToLrc() | ||
{ | ||
List<string> lrc = new(); | ||
foreach (var item in utterances) lrc.Add($"{item.ToLrcTs()}{item.transcript}"); | ||
return string.Join("\n", lrc); | ||
} | ||
} |
Oops, something went wrong.