BluRay folder path auto detection

This commit is contained in:
Frank Skare
2020-07-26 03:19:35 +02:00
parent b4632a0b6e
commit 5f4eca21e5
3 changed files with 22 additions and 9 deletions

View File

@@ -3,7 +3,9 @@
============
- BluRays with dozens of titles showed all titles in the menu
which was difficult to choose and also extremely slow.
which was difficult to choose and extremely slow.
- BluRay folder paths are auto detected when received
from drag & drop and command line.
5.4.8.3 Beta

View File

@@ -11,6 +11,7 @@ using VB = Microsoft.VisualBasic;
using static NewLine;
using static mpvnet.Core;
using System.Threading;
namespace mpvnet
{
@@ -82,21 +83,24 @@ namespace mpvnet
public static void Open_DVD_Or_BD_Folder()
{
InvokeOnMainThread(new Action(() => {
using (var d = new FolderBrowserDialog())
using (var dialog = new FolderBrowserDialog())
{
d.Description = "Select a DVD or Blu-ray folder.";
d.ShowNewFolderButton = false;
dialog.Description = "Select a DVD or Blu-ray folder.";
dialog.ShowNewFolderButton = false;
if (d.ShowDialog() == DialogResult.OK)
if (dialog.ShowDialog() == DialogResult.OK)
{
if (Directory.Exists(d.SelectedPath + "\\BDMV"))
core.command("stop");
Thread.Sleep(500);
if (Directory.Exists(dialog.SelectedPath + "\\BDMV"))
{
core.set_property_string("bluray-device", d.SelectedPath);
core.set_property_string("bluray-device", dialog.SelectedPath);
core.LoadFiles(new[] { @"bd://" }, false, false);
}
else
{
core.set_property_string("dvd-device", d.SelectedPath);
core.set_property_string("dvd-device", dialog.SelectedPath);
core.LoadFiles(new[] { @"dvd://" }, false, false);
}
}

View File

@@ -1020,6 +1020,13 @@ namespace mpvnet
LoadISO(file);
else if(App.SubtitleTypes.Contains(file.Ext()))
commandv("sub-add", file);
else if (file.Ext().Length != 3 && File.Exists(Path.Combine(file, "BDMV\\index.bdmv")))
{
core.command("stop");
Thread.Sleep(500);
set_property_string("bluray-device", file);
commandv("loadfile", @"bd://");
}
else
if (i == 0 && !append)
commandv("loadfile", file);
@@ -1141,7 +1148,7 @@ namespace mpvnet
string GetLanguage(string id)
{
foreach (var ci in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
if (ci.ThreeLetterISOLanguageName == id)
return ci.EnglishName;