Skip to content

Commit

Permalink
Merge pull request #16 from harlanx:bugfix/-remove-await-on-merging-m…
Browse files Browse the repository at this point in the history
…ethods

fix:  Remove await on muxing methods
  • Loading branch information
harlanx authored Aug 4, 2023
2 parents 4517ab2 + 519c829 commit e3cf043
Show file tree
Hide file tree
Showing 13 changed files with 287 additions and 167 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Automatically manage and mux series or movie files to the common conventions use
1. Run mkv_profile.exe to launch app

- **Installer (MSIX)**
- Note: Requires Certificate Installation
- Note: Requires Certificate Installation (first time only or if previously removed)
1. Head to the downloaded msix file
1. Right click and select properties
1. From the properties dialog, select Digital Signatures tab
Expand All @@ -39,7 +39,7 @@ Automatically manage and mux series or movie files to the common conventions use

## Available Profile Configurations
- Show (Movie / Series) Title Formats
- ***Example:*** %show_title%% (year)%
- ***Example:*** `%show_title%% (year)%`

|Data|Variable|
|:-|:-|
Expand All @@ -52,7 +52,7 @@ Automatically manage and mux series or movie files to the common conventions use
|Width|`%width%`|
|Year|`%year%`|
- Video Title Formats
- ***Example:*** %show_title%% - Sseason_number%%Eepisode_number%% - episode_title%
- ***Example:*** `%show_title%% - Sseason_number%%Eepisode_number%% - episode_title%`

|Data|Variable|
|:-|:-|
Expand Down Expand Up @@ -84,7 +84,7 @@ Automatically manage and mux series or movie files to the common conventions use
|Visual Impaired|`%visual_impaired%`|
|Text Description|`%text_description%`|
- Subtitle Title Formats
- ***Example:*** %language%% (hearing_impaired)%% (forced)%
- ***Example:*** `%language%% (hearing_impaired)%% (forced)%`

|Data|Variable|
|:-|:-|
Expand Down Expand Up @@ -120,10 +120,10 @@ otherwise if empty, will return `Tom Clancy's Jack Ryan - S01E01`
## Available Track Options (Video/Audio/Subtitle)
- Title
- Language
- **Flags** [Default, Original Language, Forced, Commentary, Hearing Impaired, Visual Impaired, Text Description]
- **Flags** [Enabled, Default, Original Language, Forced, Commentary, Hearing Impaired, Visual Impaired, Text Description]
- Extra Options field for [mkvmerge commands](https://mkvtoolnix.download/doc/mkvmerge.html) (Separated by space)
- You can use the variable %id% to access the track id in the user specified extra options
- e.g. --track-enabled-flag %id%:true --no-track-tags --no-global-tags
- e.g. `--default-duration %id%:23.976fps --no-track-tags --no-global-tags`
## Available Video Options
- No Chapters
- No Attachments
Expand Down Expand Up @@ -158,7 +158,7 @@ This app rely on the third party tools [MediaInfo](https://mediaarea.net/en/Medi
This project uses self signed certificate because trusted signed certificates from services comes with a cost which isn't reasonable for a FOSS project.
If you have doubts about the certificate, [Read more here](https://github.com/harlanx/mkv_profile/blob/93f22cf071d54826499b63e9d6869b6ac00384a4/pubspec.yaml#L76C1-L76C108)

## Third party tools path is default but it's not working?
## Third party tools path is default but its not working?
The saved path was probably from an old installation, to reset it or entirely clear old app data:
- **Reset Tool Path**
- Head to Settings
Expand All @@ -171,7 +171,7 @@ The saved path was probably from an old installation, to reset it or entirely cl
- Find the folder that contains the word `harlanx` or the folder inside it named `MKV Profile` then delete it
- Reopen the app
- The path will be set to the default path of the third party binaries that comes with the app
## Updated the app, now it's showing white screen?
## Updated the app, now its showing white screen?
- **Manually Migrate Old App Settings to New**
- Head to C:\Users\\`<Username>`\AppData\Roaming **or** C:\Users\\`<Username>`\AppData\Local\Packages
- Find the folder that contains the word `harlanx`
Expand Down
4 changes: 2 additions & 2 deletions lib/data/app_settings_notifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ class AppSettingsNotifier extends ChangeNotifier {
tooltipTheme: const TooltipThemeData(
padding: EdgeInsets.all(8),
showDuration: Duration.zero,
waitDuration: Duration.zero,
waitDuration: Duration(milliseconds: 300),
),
infoBarTheme: InfoBarThemeData(
decoration: (severity) {
Expand Down Expand Up @@ -319,7 +319,7 @@ class AppSettingsNotifier extends ChangeNotifier {
tooltipTheme: const TooltipThemeData(
padding: EdgeInsets.all(8),
showDuration: Duration.zero,
waitDuration: Duration.zero,
waitDuration: Duration(milliseconds: 300),
),
infoBarTheme: InfoBarThemeData(
decoration: (severity) {
Expand Down
26 changes: 14 additions & 12 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:fluent_ui/fluent_ui.dart';

Expand Down Expand Up @@ -34,18 +35,19 @@ void main() async {
);

// Causes app frame freeze on hot reload or hot restart so don't await this one.
// ignore: unawaited_futures
windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.setPreventClose(true);
if (AppData.appSettings.isMaximized) {
await windowManager.maximize();
}

// Handles default title bar theme changes at startup
// await windowManager.setBrightness(
// SystemTheme.isDarkMode ? Brightness.dark : Brightness.light,
// );
});
unawaited(
windowManager.waitUntilReadyToShow(windowOptions, () async {
await windowManager.setPreventClose(true);
if (AppData.appSettings.isMaximized) {
await windowManager.maximize();
}

// Handles default title bar theme changes at startup
// await windowManager.setBrightness(
// SystemTheme.isDarkMode ? Brightness.dark : Brightness.light,
// );
}),
);
// Disables any printing in production.
if (kReleaseMode) {
debugPrint = (String? message, {int? wrapWidth}) {};
Expand Down
2 changes: 2 additions & 0 deletions lib/models/user_profile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class UserProfile extends ChangeNotifier with EquatableMixin {
id: 0,
replaceables: [
'GalaxyRG',
'GalaxyTV',
'Infinity',
'Complete',
'Subbed',
Expand All @@ -92,6 +93,7 @@ class UserProfile extends ChangeNotifier with EquatableMixin {
'ION265',
'ION10',
'XEBEC',
'PCOK',
'BDRip',
'Dolby',
'Atmos',
Expand Down
96 changes: 71 additions & 25 deletions lib/screens/home/home_screen.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/material.dart' as mt;
import 'package:fluent_ui/fluent_ui.dart';

import 'package:desktop_drop/desktop_drop.dart';
Expand Down Expand Up @@ -506,8 +507,7 @@ class _SeasonNodeState extends State<SeasonNode> {
child: CustomExpander(
initiallyExpanded: expand,
animationDuration: Duration.zero,
headerHeight: 30,
levelPadding: 0.0,
headerPadding: EdgeInsetsDirectional.zero,
onStateChanged: (value) {
if (value) {
notifier.expandedNodes.add(expandKey);
Expand Down Expand Up @@ -790,6 +790,55 @@ class _VideoNodeState extends State<VideoNode> {
];
},
),
if (widget.video.embeddedChapters.isNotEmpty ||
widget.video.embeddedAttachments.isNotEmpty) ...[
const MenuFlyoutSeparator(),
if (widget.video.embeddedChapters.isNotEmpty)
MenuFlyoutItem(
leading: Icon(
mt.Icons.label_off_rounded,
color: widget.video.removeChapters
? theme.accentColor
.defaultBrushFor(theme.brightness)
: theme.inactiveColor,
),
text: Text(l10n.removeChapters),
onPressed: () {
Flyout.maybeOf(
Flyout.of(context).rootFlyout.currentContext!)
?.close();
widget.video.removeChapters =
!widget.video.removeChapters;
for (final chapter in widget.video.embeddedChapters) {
chapter.include = !widget.video.removeChapters;
}
notifier.refresh();
},
),
if (widget.video.embeddedAttachments.isNotEmpty)
MenuFlyoutItem(
leading: Icon(
mt.Icons.link_off_rounded,
color: widget.video.removeAttachments
? theme.accentColor
.defaultBrushFor(theme.brightness)
: theme.inactiveColor,
),
text: Text(l10n.removeAttachments),
onPressed: () {
Flyout.maybeOf(
Flyout.of(context).rootFlyout.currentContext!)
?.close();
widget.video.removeAttachments =
!widget.video.removeAttachments;
for (final attachment
in widget.video.embeddedAttachments) {
attachment.include = !widget.video.removeAttachments;
}
notifier.refresh();
},
),
],
],
);
},
Expand All @@ -816,8 +865,7 @@ class _VideoNodeState extends State<VideoNode> {
child: CustomExpander(
initiallyExpanded: expand,
animationDuration: Duration.zero,
headerHeight: 30,
levelPadding: videoPadding,
headerPadding: EdgeInsetsDirectional.only(start: videoPadding),
onStateChanged: (value) {
if (value) {
notifier.expandedNodes.add(widget.video.mainFile.path);
Expand Down Expand Up @@ -988,8 +1036,7 @@ class _AudioNodesState extends State<AudioNodes> {
child: CustomExpander(
initiallyExpanded: expand,
animationDuration: Duration.zero,
headerHeight: 30,
levelPadding: widget.trackPadding,
headerPadding: EdgeInsetsDirectional.only(start: widget.trackPadding),
onStateChanged: (value) {
if (value) {
notifier.expandedNodes.add(expandKey);
Expand Down Expand Up @@ -1133,8 +1180,7 @@ class _SubtitleNodesState extends State<SubtitleNodes> {
child: CustomExpander(
initiallyExpanded: expand,
animationDuration: Duration.zero,
headerHeight: 30,
levelPadding: widget.trackPadding,
headerPadding: EdgeInsetsDirectional.only(start: widget.trackPadding),
onStateChanged: (value) {
if (value) {
notifier.expandedNodes.add(expandKey);
Expand Down Expand Up @@ -1275,8 +1321,7 @@ class _ChapterNodesState extends State<ChapterNodes> {
child: CustomExpander(
initiallyExpanded: expand,
animationDuration: Duration.zero,
headerHeight: 30,
levelPadding: widget.trackPadding,
headerPadding: EdgeInsetsDirectional.only(start: widget.trackPadding),
onStateChanged: (value) {
if (value) {
notifier.expandedNodes.add(expandKey);
Expand Down Expand Up @@ -1418,8 +1463,7 @@ class _AttachmentNodesState extends State<AttachmentNodes> {
child: CustomExpander(
initiallyExpanded: expand,
animationDuration: Duration.zero,
headerHeight: 30,
levelPadding: widget.trackPadding,
headerPadding: EdgeInsetsDirectional.only(start: widget.trackPadding),
onStateChanged: (value) {
if (value) {
notifier.expandedNodes.add(expandKey);
Expand Down Expand Up @@ -1794,20 +1838,22 @@ class _ExtraNodeState extends State<ExtraNode> {
builder: (context) {
return MenuFlyout(
items: [
MenuFlyoutItem(
leading: Icon(
embedded ? FluentIcons.link : FluentIcons.add_link,
color: widget.extra.include
? theme.accentColor.defaultBrushFor(theme.brightness)
: theme.inactiveColor,
if (!embedded) ...[
MenuFlyoutItem(
leading: Icon(
FluentIcons.add_link,
color: widget.extra.include
? theme.accentColor.defaultBrushFor(theme.brightness)
: theme.inactiveColor,
),
text: Text(l10n.include),
onPressed: () {
Flyout.of(context).close();
widget.extra.update(include: !widget.extra.include);
notifier.refresh();
},
),
text: Text(l10n.include),
onPressed: () {
Flyout.of(context).close();
widget.extra.update(include: !widget.extra.include);
notifier.refresh();
},
),
],
MenuFlyoutItem(
leading: const Icon(FluentIcons.edit),
text: Text(l10n.edit),
Expand Down
82 changes: 48 additions & 34 deletions lib/screens/home/home_screen_dialogs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ class _VideoTitleDialogState extends State<VideoTitleDialog> {
color: Colors.transparent,
child: Wrap(
direction: Axis.horizontal,
crossAxisAlignment: WrapCrossAlignment.center,
runSpacing: 6,
spacing: 6,
children: [
Expand Down Expand Up @@ -347,40 +348,54 @@ class _VideoTitleDialogState extends State<VideoTitleDialog> {
},
),
],
ValueListenableBuilder<bool>(
valueListenable: removeChapters,
builder: (context, value, child) {
return Tooltip(
message: l10n.remove_chapters_description,
child: mt.ChoiceChip(
avatar: const Icon(mt.Icons.label_off_rounded),
label: Text(l10n.removeChapters),
selected: value,
selectedColor: theme.accentColor,
onSelected: (val) {
removeChapters.value = val;
},
if (widget.v.embeddedChapters.isNotEmpty ||
widget.v.embeddedAttachments.isNotEmpty) ...[
Divider(
direction: Axis.vertical,
size: 15,
style: theme.dividerTheme.merge(
const DividerThemeData(
verticalMargin: EdgeInsets.symmetric(vertical: 3),
),
);
},
),
ValueListenableBuilder<bool>(
valueListenable: removeAttachments,
builder: (context, value, child) {
return Tooltip(
message: l10n.remove_attachments_description,
child: mt.ChoiceChip(
avatar: const Icon(mt.Icons.link_off_rounded),
label: Text(l10n.removeAttachments),
selected: value,
selectedColor: theme.accentColor,
onSelected: (val) {
removeAttachments.value = val;
},
),
);
},
),
),
),
if (widget.v.embeddedChapters.isNotEmpty)
ValueListenableBuilder<bool>(
valueListenable: removeChapters,
builder: (context, value, child) {
return Tooltip(
message: l10n.remove_chapters_description,
child: mt.ChoiceChip(
avatar: const Icon(mt.Icons.label_off_rounded),
label: Text(l10n.removeChapters),
selected: value,
selectedColor: theme.accentColor,
onSelected: (val) {
removeChapters.value = val;
},
),
);
},
),
if (widget.v.embeddedAttachments.isNotEmpty)
ValueListenableBuilder<bool>(
valueListenable: removeAttachments,
builder: (context, value, child) {
return Tooltip(
message: l10n.remove_attachments_description,
child: mt.ChoiceChip(
avatar: const Icon(mt.Icons.link_off_rounded),
label: Text(l10n.removeAttachments),
selected: value,
selectedColor: theme.accentColor,
onSelected: (val) {
removeAttachments.value = val;
},
),
);
},
),
],
],
),
),
Expand Down Expand Up @@ -777,7 +792,6 @@ class ExtraDialog extends StatelessWidget {
),
Expander(
header: Text(l10n.contentPreview),
headerHeight: 32,
content: Container(
decoration: isChapter && !embedded
? BoxDecoration(
Expand Down
Loading

0 comments on commit e3cf043

Please sign in to comment.