Skip to content

Commit

Permalink
improved error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
stax76 committed Aug 1, 2019
1 parent d90025e commit 8626b82
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 29 deletions.
15 changes: 5 additions & 10 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
###
### 5.1

- 'Tools > Execute mpv command' was removed,
[mpv-repl](https://github.com/rossy/mpv-repl) is currently the best choice
- 'Tools > Execute mpv command' was replaced with [mpv-repl](https://github.com/rossy/mpv-repl)
- many [wiki pages](https://github.com/stax76/mpv.net/wiki) were improved
- the logo/icon had a very small cosmetic change
- the help in the context menu was improved,
for quick access consider the command palette (F1 key)
- config options specific to mpv.net are now available from the command line
- the input editor no longer as known limitations, 'alt gr' and ctrl+alt are working now
- the input editor no longer has known limitations, 'alt gr' and ctrl+alt are working now
- the help in the input editor was simplified and the filter logic was improved
- fixed issue in file associations causing mpv.net not to appear in OS default apps
- 'Tools > Manage File Associations' was replaced by 'Tools > OS Setup',
Expand All @@ -25,18 +24,14 @@
- it's now enforced that mpv properties on the command line and in
the mpv.conf config file are lowercase, if not a error is shown
- gpu-api vulkan was not working if media files were opened via
command line (that included Explorer), Vulkan unlike d3d11 and opengl
requires a window being visible, this is now satisfied with a
workaround, it's only possible showing a window with default size
first as defines by autofit. Vulkan has few issues, usually the auto option
which uses d3d11 is better! Using Vulkan the mpv.net setting
command line (that included Explorer)
- new setting minimum-aspect-ratio added, minimum aspect ratio for the window,
this was previously hard coded to 1.3
- new setting auto-load-folder added, for single files automatically load
the entire directory into the playlist, previously this was forced,
now it can be disabled
- new setting themed-menu added, follow theme color in context menu,
default: no, UI related settings have now a separate UI tab in the config editor
default: no. UI related settings have now a separate UI tab in the config editor

### 5.0

Expand Down
4 changes: 2 additions & 2 deletions extensions/ScriptingExtension/ScriptingExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public ScriptingExtension()
scriptFiles.AddRange(Directory.GetFiles(mp.ConfigFolder + "scripts", "*.cs"));

if (Directory.Exists(PathHelp.StartupPath + "scripts"))
foreach (string file in Directory.GetFiles(PathHelp.StartupPath + "scripts", "*.cs"))
App.UnknownModule(file);
foreach (string path in Directory.GetFiles(PathHelp.StartupPath + "scripts", "*.cs"))
scriptFiles.AddRange(Directory.GetFiles(PathHelp.StartupPath + "scripts", "*.cs"));

if (scriptFiles.Count == 0) return;
CSScriptLibrary.CSScript.EvaluatorConfig.Engine = EvaluatorEngine.CodeDom;
Expand Down
Binary file added img/Avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions mpv.net/Misc/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ public static Dictionary<string, string> Conf {
}
}

public static void UnknownModule(string path)
{
Msg.ShowError("Failed to load script or extension", "Only scripts and extensions that ship with mpv.net are allowed in <startup>\\scripts or <startup>\\extensions.\n\nUser scripts or extensions have to use <config folder>\\scripts or <config folder>\\extensions.\n\nNever copy a new mpv.net version over a old mpv.net version.\n\nNever install a new mpv.net version on top of a old mpv.net version.\n\n" + path);
}

public static bool ProcessProperty(string name, string value)
{
switch (name)
Expand Down
2 changes: 1 addition & 1 deletion mpv.net/Misc/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static void Execute(string id, string[] args)
{
switch (id)
{
case "manage-file-associations": ManageFileAssociations(); break;
case "manage-file-associations": ManageFileAssociations(); break; // deprecated 2019
case "cycle-audio": CycleAudio(); break;
case "load-audio": LoadAudio(); break;
case "load-sub": LoadSubtitle(); break;
Expand Down
2 changes: 1 addition & 1 deletion mpv.net/Misc/Extension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Extension()
if (knownExtensions.Contains(Path.GetFileName(path)))
catalog.Catalogs.Add(new DirectoryCatalog(path, "*Extension.dll"));
else
App.UnknownModule(path);
Msg.ShowError("Failed to load extension", path + "\n\nOnly extensions that ship with mpv.net are allowed in <startup>\\extensions\n\nUser extensions have to use <config folder>\\extensions\n\nNever copy or install a new mpv.net version over a old mpv.net version.");
}
}

Expand Down
4 changes: 2 additions & 2 deletions mpv.net/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.0.0.0")]
[assembly: AssemblyFileVersion("5.0.0.0")]
[assembly: AssemblyVersion("5.1.0.0")]
[assembly: AssemblyFileVersion("5.1.0.0")]
1 change: 1 addition & 0 deletions mpv.net/Resources/inputConf.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@

F1 script-message mpv.net show-command-palette #menu: Tools > Show All Commands
h script-message mpv.net show-history #menu: Tools > Show History
Ctrl+r script-message-to repl type "" #menu: Tools > Show REPL
l ab-loop #menu: Tools > Set/clear A-B loop points
L cycle-values loop-file "inf" "no" #menu: Tools > Toggle infinite file looping
Ctrl+h cycle-values hwdec "auto" "no" #menu: Tools > Toggle Hardware Decoding
Expand Down
5 changes: 4 additions & 1 deletion mpv.net/WinForms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ public void CycleFullscreen(bool enabled)
{
if (WindowState != FormWindowState.Maximized || FormBorderStyle != FormBorderStyle.None)
{
if (WindowState == FormWindowState.Maximized)
WindowState = FormWindowState.Minimized;

FormBorderStyle = FormBorderStyle.None;
WindowState = FormWindowState.Maximized;
}
Expand All @@ -324,7 +327,7 @@ public void CycleFullscreen(bool enabled)
if (mp.Border)
FormBorderStyle = FormBorderStyle.Sizable;
else
FormBorderStyle = FormBorderStyle.None;
FormBorderStyle = FormBorderStyle.None;

SetFormPosAndSize();
}
Expand Down
11 changes: 4 additions & 7 deletions mpv.net/mpv/mp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,12 @@ public static void LoadMpvScripts()
string[] startupScripts = Directory.GetFiles(PathHelp.StartupPath + "Scripts");

foreach (string path in startupScripts)
if (path.EndsWith(".lua") || path.EndsWith(".js"))
if (KnownScripts.Contains(Path.GetFileName(path)))
commandv("load-script", $"{path}");
else
App.UnknownModule(path);
if ((path.EndsWith(".lua") || path.EndsWith(".js")) && KnownScripts.Contains(Path.GetFileName(path)))
commandv("load-script", $"{path}");
}
}

public static string[] KnownScripts { get; } = { "osc-visibility.js", "show-playlist.js", "seek-show-position.py" };
public static string[] KnownScripts { get; } = { "osc-visibility.js", "show-playlist.js", "seek-show-position.py", "repl.lua" };

public static void LoadScripts()
{
Expand All @@ -259,7 +256,7 @@ public static void LoadScripts()
PowerShellScript.Init(path);
}
else
App.UnknownModule(path);
Msg.ShowError("Failed to load script", path + "\n\nOnly scripts that ship with mpv.net are allowed in <startup>\\scripts\n\nUser scripts have to use <config folder>\\scripts\n\nNever copy or install a new mpv.net version over a old mpv.net version.");
}
}

Expand Down

0 comments on commit 8626b82

Please sign in to comment.