├── res
├── BCutIcon.ico
└── BCutIcon.png
├── src
├── Common
│ ├── Config.cs
│ ├── IDialogHostService.cs
│ ├── IDialogHostAware.cs
│ ├── BindingProxy.cs
│ ├── AudioFile.cs
│ ├── DialogHostService.cs
│ └── STSTask.cs
├── Views
│ ├── SettingsView.xaml.cs
│ ├── AboutView.xaml.cs
│ ├── MainView.xaml.cs
│ ├── SettingsView.xaml
│ ├── AboutView.xaml
│ └── MainView.xaml
├── ViewModels
│ ├── AboutViewModel.cs
│ ├── SettingsViewModel.cs
│ └── MainViewModel.cs
├── ConfigUtil.cs
├── APIDataStruct.cs
└── BcutAPI.cs
├── AssemblyInfo.cs
├── README.md
├── App.xaml
├── App.xaml.cs
├── STS-Bcut.sln
├── .github
└── workflows
│ └── build_latest.yml
├── STS-Bcut.csproj
├── .gitattributes
├── .gitignore
└── LICENSE.txt
/res/BCutIcon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Forgot-Dream/STS-Bcut/HEAD/res/BCutIcon.ico
--------------------------------------------------------------------------------
/res/BCutIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Forgot-Dream/STS-Bcut/HEAD/res/BCutIcon.png
--------------------------------------------------------------------------------
/src/Common/Config.cs:
--------------------------------------------------------------------------------
1 | namespace STS_Bcut.src.Common;
2 |
3 | public class Config
4 | {
5 | public bool SaveConvertedAudio { get; set; }
6 | }
--------------------------------------------------------------------------------
/src/Views/SettingsView.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows.Controls;
2 |
3 | namespace STS_Bcut.src.Views;
4 |
5 | ///
6 | /// SettingsView.xaml 的交互逻辑
7 | ///
8 | public partial class SettingsView : UserControl
9 | {
10 | public SettingsView()
11 | {
12 | InitializeComponent();
13 | }
14 | }
--------------------------------------------------------------------------------
/src/Common/IDialogHostService.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using Prism.Services.Dialogs;
3 |
4 | namespace STS_Bcut.src.Common;
5 |
6 | public interface IDialogHostService : IDialogService
7 | {
8 | string DialogHostName { get; set; }
9 |
10 | Task ShowDialog(string name, IDialogParameters? parameters, string dialogHostName = "Root");
11 | }
--------------------------------------------------------------------------------
/src/Common/IDialogHostAware.cs:
--------------------------------------------------------------------------------
1 | using Prism.Commands;
2 | using Prism.Services.Dialogs;
3 |
4 | namespace STS_Bcut.src.Common;
5 |
6 | public interface IDialogHostAware
7 | {
8 | string DialogHostName { get; set; }
9 | DelegateCommand SaveCommand { get; set; }
10 | DelegateCommand CancelCommand { get; set; }
11 | void OnDialogOpened(IDialogParameters parameters);
12 | }
--------------------------------------------------------------------------------
/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | [assembly: ThemeInfo(
4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5 | //(used if a resource is not found in the page,
6 | // or application resource dictionaries)
7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8 | //(used if a resource is not found in the page,
9 | // app, or any theme specific resource dictionaries)
10 | )]
--------------------------------------------------------------------------------
/src/ViewModels/AboutViewModel.cs:
--------------------------------------------------------------------------------
1 | using Prism.Commands;
2 | using Prism.Mvvm;
3 | using Prism.Services.Dialogs;
4 | using STS_Bcut.src.Common;
5 |
6 | namespace STS_Bcut.src.ViewModels;
7 |
8 | public class AboutViewModel : BindableBase, IDialogHostAware
9 | {
10 | public string DialogHostName { get; set; }
11 | public DelegateCommand SaveCommand { get; set; }
12 | public DelegateCommand CancelCommand { get; set; }
13 |
14 | public void OnDialogOpened(IDialogParameters parameters)
15 | {
16 | }
17 | }
--------------------------------------------------------------------------------
/src/Common/BindingProxy.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace STS_Bcut.src.Common;
4 |
5 | public class BindingProxy : Freezable
6 | {
7 | public static readonly DependencyProperty DataProperty =
8 | DependencyProperty.Register("Data", typeof(object), typeof(BindingProxy), new UIPropertyMetadata(null));
9 |
10 | public object? Data
11 | {
12 | get => GetValue(DataProperty);
13 | set => SetValue(DataProperty, value);
14 | }
15 |
16 | protected override Freezable CreateInstanceCore()
17 | {
18 | return new BindingProxy();
19 | }
20 | }
--------------------------------------------------------------------------------
/src/ViewModels/SettingsViewModel.cs:
--------------------------------------------------------------------------------
1 | using Prism.Commands;
2 | using Prism.Mvvm;
3 | using Prism.Services.Dialogs;
4 | using STS_Bcut.src.Common;
5 |
6 | namespace STS_Bcut.src.ViewModels;
7 |
8 | public class SettingsViewModel : BindableBase, IDialogHostAware
9 | {
10 | public Config config
11 | {
12 | get => MainViewModel.config;
13 | set => MainViewModel.config = value;
14 | }
15 |
16 | public string DialogHostName { get; set; }
17 | public DelegateCommand SaveCommand { get; set; }
18 | public DelegateCommand CancelCommand { get; set; }
19 |
20 | public void OnDialogOpened(IDialogParameters parameters)
21 | {
22 | }
23 | }
--------------------------------------------------------------------------------
/src/Common/AudioFile.cs:
--------------------------------------------------------------------------------
1 | using Prism.Mvvm;
2 |
3 | namespace STS_Bcut.src.Common;
4 |
5 | public class AudioFile : BindableBase
6 | {
7 | private bool isselected;
8 |
9 | ///
10 | /// 是否被选中
11 | ///
12 | public bool IsSelected
13 | {
14 | get => isselected;
15 | set
16 | {
17 | isselected = value;
18 | RaisePropertyChanged();
19 | }
20 | }
21 |
22 | ///
23 | /// 音频文件全称
24 | ///
25 | public string FullName { get; set; }
26 |
27 | ///
28 | /// 绝对路径
29 | ///
30 | public string FullPath { get; set; }
31 | }
--------------------------------------------------------------------------------
/src/Views/AboutView.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Windows;
3 | using System.Windows.Controls;
4 | using System.Windows.Documents;
5 |
6 | namespace STS_Bcut.src.Views;
7 |
8 | ///
9 | /// AboutView.xaml 的交互逻辑
10 | ///
11 | public partial class AboutView : UserControl
12 | {
13 | public AboutView()
14 | {
15 | InitializeComponent();
16 | }
17 |
18 | private void Hyperlink_OnClick(object sender, RoutedEventArgs e)
19 | {
20 | Process.Start(new ProcessStartInfo
21 | {
22 | UseShellExecute = true,
23 | FileName = ((Hyperlink)sender).NavigateUri.ToString()
24 | });
25 | }
26 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # STS-Bcut
2 |
3 | 使用必剪API,语音转字幕。
4 |
5 | - 支持输入视频文件自动提取音频(ffmpeg)
6 | - 支持拖动添加文件
7 | - 支持多视频/语音文件的一次性转录
8 |
9 | 运行需要安装.NET 8 Runtime和ffmpeg
10 |
11 | ---
12 |
13 | |引用的库|协议|
14 | |---|---|
15 | |FFMpegCore|MIT|
16 | |MaterialDesignThemes|MIT|
17 | |Microsoft-WindowsAPICodePack-Shell|[Custom](https://github.com/contre/Windows-API-Code-Pack-1.1/LICENSE)|
18 | |Newtonsoft.Json|MIT|
19 | |Prism|MIT|
20 |
21 | ---
22 |
23 | |参考的库|链接|
24 | |---|---|
25 | |Bcut-ASR|[https://github.com/SocialSisterYi/bcut-asr](https://github.com/SocialSisterYi/bcut-asr)|
26 |
27 | ---
28 |
29 | ## 开源协议
30 |
31 | GNU GENERAL PUBLIC LICENSE Version 3
32 |
33 | ---
34 |
35 | 项目中的**必剪图标版权**皆为[BiliBili](https://www.bilibili.com)所有
36 |
37 | ---
38 |
39 | Copyright © 2023-2024 Forgot-Dream
--------------------------------------------------------------------------------
/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/ConfigUtil.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using System.Text;
5 | using Newtonsoft.Json;
6 | using STS_Bcut.src.Common;
7 |
8 | namespace STS_Bcut.src;
9 |
10 | public class ConfigUtil
11 | {
12 | public static string ConfigPath = Directory.GetCurrentDirectory() + "/sts-bcut-config.json";
13 |
14 |
15 | public static Config ReadConfig()
16 | {
17 | Config? config = null;
18 | try
19 | {
20 | config = JsonConvert.DeserializeObject(File.ReadAllText(ConfigPath));
21 | }
22 | catch (Exception exception)
23 | {
24 | Debug.WriteLine(exception.Message);
25 | }
26 |
27 | config ??= new Config { SaveConvertedAudio = false };
28 | return config;
29 | }
30 |
31 | public static void WriteConfig(Config config)
32 | {
33 | File.WriteAllText(ConfigPath, JsonConvert.SerializeObject(config, Formatting.Indented), Encoding.UTF8);
34 | }
35 | }
--------------------------------------------------------------------------------
/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using Prism.DryIoc;
3 | using Prism.Ioc;
4 | using STS_Bcut.src;
5 | using STS_Bcut.src.Common;
6 | using STS_Bcut.src.ViewModels;
7 | using STS_Bcut.src.Views;
8 |
9 | namespace STS_Bcut;
10 |
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : PrismApplication
15 | {
16 | protected override Window CreateShell()
17 | {
18 | return Container.Resolve();
19 | }
20 |
21 | protected override void RegisterTypes(IContainerRegistry containerRegistry)
22 | {
23 | containerRegistry.Register();
24 |
25 | containerRegistry.RegisterForNavigation();
26 | containerRegistry.RegisterForNavigation();
27 | containerRegistry.RegisterForNavigation();
28 | }
29 |
30 | protected override void OnExit(ExitEventArgs e)
31 | {
32 | base.OnExit(e);
33 | ConfigUtil.WriteConfig(MainViewModel.config);
34 | }
35 | }
--------------------------------------------------------------------------------
/STS-Bcut.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.4.33205.214
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "STS-Bcut", "STS-Bcut.csproj", "{63E9E96B-7746-4E2D-AE06-D4EB6CF3D0AA}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {63E9E96B-7746-4E2D-AE06-D4EB6CF3D0AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {63E9E96B-7746-4E2D-AE06-D4EB6CF3D0AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {63E9E96B-7746-4E2D-AE06-D4EB6CF3D0AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {63E9E96B-7746-4E2D-AE06-D4EB6CF3D0AA}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {E5FEB980-2E97-4117-BB01-0AD0F0190830}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/.github/workflows/build_latest.yml:
--------------------------------------------------------------------------------
1 | name: Build Latest
2 |
3 | on: [push,workflow_dispatch]
4 |
5 | env:
6 | DOTNET_SDK_VERSION: '8.0.*'
7 | PROJECT_NAME: 'STS-Bcut'
8 |
9 | jobs:
10 |
11 | build-win-x64-arm64:
12 |
13 | runs-on: windows-latest
14 |
15 | steps:
16 |
17 | - uses: actions/checkout@v1
18 |
19 | - name: Set up dotnet
20 | uses: actions/setup-dotnet@v3
21 | with:
22 | dotnet-version: ${{ env.DOTNET_SDK_VERSION }}
23 |
24 | - run: dotnet publish ${{ env.PROJECT_NAME }}.sln -r win-x64 -c Release -o artifact-x64 -p:PublishSingleFile=true -p:PublishReadyToRun=true --self-contained true
25 | - run: dotnet publish ${{ env.PROJECT_NAME }}.sln -r win-arm64 -c Release -o artifact-arm64 -p:PublishSingleFile=true -p:PublishReadyToRun=true --self-contained true
26 |
27 | - name: Upload Artifact[win-x64]
28 | uses: actions/upload-artifact@v3.1.3
29 | with:
30 | name: ${{ env.PROJECT_NAME }}_win-x64
31 | path: artifact-x64\${{ env.PROJECT_NAME }}.exe
32 |
33 | - name: Upload Artifact[win-arm64]
34 | uses: actions/upload-artifact@v3.1.3
35 | with:
36 | name: ${{ env.PROJECT_NAME }}_win-arm64
37 | path: artifact-arm64\${{ env.PROJECT_NAME }}.exe
38 |
--------------------------------------------------------------------------------
/src/Views/MainView.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Windows;
6 | using STS_Bcut.src.Common;
7 | using STS_Bcut.src.ViewModels;
8 |
9 | namespace STS_Bcut;
10 |
11 | ///
12 | /// Interaction logic for MainWindow.xaml
13 | ///
14 | public partial class MainView : Window
15 | {
16 | private readonly MainViewModel viewModel;
17 |
18 | public MainView()
19 | {
20 | InitializeComponent();
21 | viewModel = (MainViewModel?)DataContext;
22 | }
23 |
24 | private void File_Drop(object sender, DragEventArgs e)
25 | {
26 | try
27 | {
28 | var files = new List((IEnumerable)e.Data.GetData(DataFormats.FileDrop));
29 | foreach (var file in files)
30 | viewModel.Files.Add(new AudioFile
31 | {
32 | FullName = Path.GetFileName(file),
33 | FullPath = file,
34 | IsSelected = false
35 | });
36 | }
37 | catch (Exception exception)
38 | {
39 | Debug.WriteLine(exception);
40 | }
41 | }
42 |
43 | private void OnDragEnter(object sender, DragEventArgs e)
44 | {
45 | e.Effects = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Link : DragDropEffects.None;
46 | }
47 | }
--------------------------------------------------------------------------------
/STS-Bcut.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net8.0-windows10.0.17763.0
6 | STS_Bcut
7 | enable
8 | true
9 | 1.0.5.0
10 | res\BCutIcon.ico
11 | BCutIcon.png
12 | https://github.com/Forgot-Dream/STS-Bcut
13 | 1.0.5.0
14 | 10.0.17763.0
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | True
38 | \
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/Views/SettingsView.xaml:
--------------------------------------------------------------------------------
1 |
13 |
14 |
15 |
16 |
21 |
27 |
28 |
29 |
30 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/Common/DialogHostService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using System.Windows;
4 | using MaterialDesignThemes.Wpf;
5 | using Prism.Ioc;
6 | using Prism.Mvvm;
7 | using Prism.Services.Dialogs;
8 |
9 | namespace STS_Bcut.src.Common;
10 |
11 | public class DialogHostService : DialogService, IDialogHostService
12 | {
13 | private readonly IContainerExtension containerExtension;
14 |
15 | public DialogHostService(IContainerExtension containerExtension) : base(containerExtension)
16 | {
17 | this.containerExtension = containerExtension;
18 | }
19 |
20 | public string DialogHostName { get; set; }
21 |
22 | public async Task ShowDialog(string viewName, IDialogParameters parameters,
23 | string dialogHostName = "root")
24 | {
25 | parameters ??= new DialogParameters();
26 |
27 | var content = containerExtension.Resolve