New options autofit-image and autofit-audio
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
|
||||
- New options `autofit-image` and `autofit-audio`, like
|
||||
autofit but used for image and audio files. Default 80.
|
||||
- Fix long commands causing key bindings not visible in the
|
||||
command palette.
|
||||
|
||||
# 6.0.0.0 Beta (2022-06-05)
|
||||
|
||||
- The options `cache` and `demuxer-max-bytes`have been added
|
||||
|
||||
@@ -282,6 +282,9 @@ Registers the file associations.
|
||||
### scale-window \<factor\>
|
||||
Decreases or increases the Window size.
|
||||
|
||||
### select-profile
|
||||
Shows the command palette to select a profile.
|
||||
|
||||
### shell-execute \<file|URL\>
|
||||
Shell executes a single file or URL.
|
||||
|
||||
@@ -381,6 +384,12 @@ mpv.net specific options can be found in the conf editor searching for 'mpv.net'
|
||||
|
||||
The options are saved in the mpvnet.conf file.
|
||||
|
||||
#### --autofit-audio \<integer\>
|
||||
Initial window height in percent for audio files. Default: 80
|
||||
|
||||
#### --autofit-image \<integer\>
|
||||
Initial window height in percent for image files. Default: 80
|
||||
|
||||
#### --queue \<files\>
|
||||
|
||||
Adds files to the playlist, requires [--process-instance=single](#--process-instancevalue).
|
||||
|
||||
@@ -36,6 +36,8 @@ namespace mpvnet
|
||||
public static int StartThreshold { get; set; } = 1500;
|
||||
public static int RecentCount { get; set; } = 15;
|
||||
|
||||
public static float AutofitAudio { get; set; } = 0.8f;
|
||||
public static float AutofitImage { get; set; } = 0.8f;
|
||||
public static float MinimumAspectRatio { get; set; }
|
||||
public static float QuickBookmark { get; set; }
|
||||
|
||||
@@ -241,6 +243,8 @@ namespace mpvnet
|
||||
case "audio-file-extensions": CorePlayer.AudioTypes = value.Split(" ,;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); return true;
|
||||
case "auto-load-folder": AutoLoadFolder = value == "yes"; return true;
|
||||
case "auto-play": AutoPlay = value == "yes"; return true;
|
||||
case "autofit-image": AutofitImage = value.Trim('%').ToInt() / 100f; return true;
|
||||
case "autofit-audio": AutofitAudio = value.Trim('%').ToInt() / 100f; return true;
|
||||
case "dark-mode": DarkMode = value; return true;
|
||||
case "dark-theme": DarkTheme = value.Trim('\'', '"'); return true;
|
||||
case "debug-mode": DebugMode = value == "yes"; return true;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
@@ -433,6 +434,12 @@ namespace mpvnet
|
||||
Screen screen = Screen.FromControl(this);
|
||||
int autoFitHeight = Convert.ToInt32(screen.WorkingArea.Height * Core.Autofit);
|
||||
|
||||
if (App.AutofitAudio > 1) App.AutofitAudio = 1;
|
||||
if (App.AutofitImage > 1) App.AutofitImage = 1;
|
||||
|
||||
if (Core.IsAudio) autoFitHeight = Convert.ToInt32(screen.WorkingArea.Height * App.AutofitAudio);
|
||||
if (Core.IsImage) autoFitHeight = Convert.ToInt32(screen.WorkingArea.Height * App.AutofitImage);
|
||||
|
||||
if (Core.VideoSize.Height == 0 || Core.VideoSize.Width == 0 ||
|
||||
Core.VideoSize.Width / (float)Core.VideoSize.Height < App.MinimumAspectRatio)
|
||||
|
||||
|
||||
@@ -146,7 +146,19 @@ namespace mpvnet
|
||||
|
||||
public string Path { get; set; } = "";
|
||||
public string Command { get; set; } = "";
|
||||
public string Display { get { return string.IsNullOrEmpty(Path) ? Command : Path; } }
|
||||
|
||||
public string Display {
|
||||
get {
|
||||
if (string.IsNullOrEmpty(Path))
|
||||
{
|
||||
if (Command.Length > 50)
|
||||
return Command.Substring(0, 50) + "...";
|
||||
return Command;
|
||||
}
|
||||
else
|
||||
return Path;
|
||||
}
|
||||
}
|
||||
|
||||
public CommandItem() { }
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace mpvnet
|
||||
public class CorePlayer
|
||||
{
|
||||
public static string[] VideoTypes { get; set; } = "264 265 asf avc avi avs dav flv h264 h265 hevc m2t m2ts m2v m4v mkv mov mp4 mpeg mpg mpv mts ts vob vpy webm wmv y4m".Split(' ');
|
||||
public static string[] AudioTypes { get; set; } = "aac ac3 dts dtshd dtshr dtsma eac3 flac m4a mka mp2 mp3 mpa mpc ogg opus thd thd+ac3 w64 wav".Split(' ');
|
||||
public static string[] ImageTypes { get; set; } = { "jpg", "bmp", "png", "gif" };
|
||||
public static string[] AudioTypes { get; set; } = "aac ac3 dts dtshd dtshr dtsma eac3 flac m4a mka mp2 mp3 mpa mpc ogg opus thd w64 wav".Split(' ');
|
||||
public static string[] ImageTypes { get; set; } = { "jpg", "bmp", "png", "gif", "webp" };
|
||||
public static string[] SubtitleTypes { get; } = { "srt", "ass", "idx", "sub", "sup", "ttxt", "txt", "ssa", "smi", "mks" };
|
||||
|
||||
public event Action<mpv_log_level, string> LogMessageAsync; // log-message MPV_EVENT_LOG_MESSAGE
|
||||
@@ -56,9 +56,9 @@ namespace mpvnet
|
||||
public event Action InitializedAsync;
|
||||
public event Action Pause;
|
||||
public event Action ShowMenu;
|
||||
public event Action<double> WindowScaleMpv;
|
||||
public event Action<float> ScaleWindow;
|
||||
public event Action<float> WindowScaleNET;
|
||||
public event Action<double> WindowScaleMpv;
|
||||
public event Action<int> PlaylistPosChanged;
|
||||
public event Action<int> PlaylistPosChangedAsync;
|
||||
public event Action<Size> VideoSizeChanged;
|
||||
@@ -85,8 +85,9 @@ namespace mpvnet
|
||||
|
||||
public string ConfPath { get => ConfigFolder + "mpv.conf"; }
|
||||
public string GPUAPI { get; set; } = "auto";
|
||||
public string VO { get; set; } = "gpu";
|
||||
public string InputConfPath => ConfigFolder + "input.conf";
|
||||
public string Path { get; set; } = "";
|
||||
public string VO { get; set; } = "gpu";
|
||||
|
||||
public string VID { get; set; } = "";
|
||||
public string AID { get; set; } = "";
|
||||
@@ -173,6 +174,7 @@ namespace mpvnet
|
||||
SetPropertyString("idle", "yes");
|
||||
|
||||
ObservePropertyDouble("window-scale", value => WindowScaleMpv(value));
|
||||
ObservePropertyString("path", value => Path = value);
|
||||
|
||||
ObservePropertyBool("pause", value => {
|
||||
Paused = value;
|
||||
@@ -251,16 +253,22 @@ namespace mpvnet
|
||||
switch (name)
|
||||
{
|
||||
case "autofit":
|
||||
if (int.TryParse(value.Trim('%'), out int result))
|
||||
Autofit = result / 100f;
|
||||
{
|
||||
if (int.TryParse(value.Trim('%'), out int result))
|
||||
Autofit = result / 100f;
|
||||
}
|
||||
break;
|
||||
case "autofit-smaller":
|
||||
if (int.TryParse(value.Trim('%'), out int result2))
|
||||
AutofitSmaller = result2 / 100f;
|
||||
{
|
||||
if (int.TryParse(value.Trim('%'), out int result))
|
||||
AutofitSmaller = result / 100f;
|
||||
}
|
||||
break;
|
||||
case "autofit-larger":
|
||||
if (int.TryParse(value.Trim('%'), out int result3))
|
||||
AutofitLarger = result3 / 100f;
|
||||
{
|
||||
if (int.TryParse(value.Trim('%'), out int result))
|
||||
AutofitLarger = result / 100f;
|
||||
}
|
||||
break;
|
||||
case "fs":
|
||||
case "fullscreen": Fullscreen = value == "yes"; break;
|
||||
@@ -333,7 +341,7 @@ namespace mpvnet
|
||||
{
|
||||
File.WriteAllText(_ConfigFolder + "input.conf", Properties.Resources.input_conf);
|
||||
|
||||
string scriptOptsPath = _ConfigFolder + "script-opts" + Path.DirectorySeparatorChar;
|
||||
string scriptOptsPath = _ConfigFolder + "script-opts" + System.IO.Path.DirectorySeparatorChar;
|
||||
|
||||
if (!Directory.Exists(scriptOptsPath))
|
||||
{
|
||||
@@ -438,7 +446,7 @@ namespace mpvnet
|
||||
ps.Scripts.Add(eventCode);
|
||||
ps.Scripts.Add(propertyChangedCode);
|
||||
ps.Scripts.Add(File.ReadAllText(file));
|
||||
ps.Module = Path.GetFileName(file);
|
||||
ps.Module = System.IO.Path.GetFileName(file);
|
||||
ps.Print = true;
|
||||
|
||||
lock (PowerShell.References)
|
||||
@@ -1195,7 +1203,7 @@ namespace mpvnet
|
||||
LoadISO(file);
|
||||
else if(SubtitleTypes.Contains(file.Ext()))
|
||||
CommandV("sub-add", file);
|
||||
else if (file.Ext().Length != 3 && File.Exists(Path.Combine(file, "BDMV\\index.bdmv")))
|
||||
else if (file.Ext().Length != 3 && File.Exists(System.IO.Path.Combine(file, "BDMV\\index.bdmv")))
|
||||
{
|
||||
Command("stop");
|
||||
Thread.Sleep(500);
|
||||
@@ -1284,7 +1292,7 @@ namespace mpvnet
|
||||
path = path.Replace("/", "\\");
|
||||
|
||||
if (path.Contains("\\"))
|
||||
dir = Path.GetDirectoryName(path);
|
||||
dir = System.IO.Path.GetDirectoryName(path);
|
||||
|
||||
List<string> files = Directory.GetFiles(dir).ToList();
|
||||
|
||||
@@ -1388,6 +1396,10 @@ namespace mpvnet
|
||||
|
||||
void HideLogo() => Command("overlay-remove 0");
|
||||
|
||||
public bool IsImage => ImageTypes.Contains(Path.Ext());
|
||||
|
||||
public bool IsAudio => AudioTypes.Contains(Path.Ext());
|
||||
|
||||
string GetLanguage(string id)
|
||||
{
|
||||
foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.NeutralCultures))
|
||||
@@ -1419,7 +1431,7 @@ namespace mpvnet
|
||||
}
|
||||
|
||||
public void RaiseScaleWindow(float value) => ScaleWindow(value);
|
||||
|
||||
|
||||
public void RaiseWindowScaleNET(float value) => WindowScaleNET(value);
|
||||
|
||||
public void RaiseShowMenu() => ShowMenu();
|
||||
|
||||
@@ -410,6 +410,18 @@ file = mpv
|
||||
filter = Screen
|
||||
help = <int> Initial window height in percent. Default: 60
|
||||
|
||||
[setting]
|
||||
name = autofit-image
|
||||
file = mpvnet
|
||||
filter = Screen
|
||||
help = <int> Initial window height in percent for image files. Default: 80
|
||||
|
||||
[setting]
|
||||
name = autofit-audio
|
||||
file = mpvnet
|
||||
filter = Screen
|
||||
help = <int> Initial window height in percent for audio files. Default: 80
|
||||
|
||||
[setting]
|
||||
name = autofit-smaller
|
||||
file = mpv
|
||||
|
||||
Reference in New Issue
Block a user