Patreon CSV parser, better py err handling, WIP: Deprecation of Pkg Mgr

This commit is contained in:
N00MKRAD 2020-12-07 22:10:58 +01:00
parent 320b21f29e
commit e807f174c0
6 changed files with 71 additions and 9 deletions

View File

@ -58,9 +58,17 @@ namespace Flowframes
void Checks()
{
GetWebInfo.LoadNews(newsLabel);
GetWebInfo.LoadPatronList(patronsLabel);
Updater.AsyncUpdateCheck();
try
{
GetWebInfo.LoadNews(newsLabel);
GetWebInfo.LoadPatronListCsv(patronsLabel);
Updater.AsyncUpdateCheck();
}
catch (Exception e)
{
Logger.Log("Non-critical error while performing online checks. See logs for details.");
Logger.Log(e.Message + "\n" + e.StackTrace, true);
}
}
public HTTabControl GetMainTabControl() { return mainTabControl; }

View File

@ -20,7 +20,6 @@ namespace Flowframes.Main
{
public static async Task Export(string path, string outPath, i.OutMode mode)
{
Logger.Log("Auto-Encode is off, exporting video...");
if (!mode.ToString().ToLower().Contains("vid")) // Copy interp frames out of temp folder and skip video export for image seq export
{
try

View File

@ -271,7 +271,7 @@ namespace Flowframes
if (!hasShownError && line.ToLower().Contains("modulenotfounderror"))
{
hasShownError = true;
InterpolateUtils.ShowMessage($"A python module is missing. Check {logFilename} for details.\n\n{line}\n\nIf you don't want to install it yourself, use the Python package from the Package Installer.", "Error");
InterpolateUtils.ShowMessage($"A python module is missing.\nCheck {logFilename} for details.\n\n{line}\n\nIf you don't want to install it yourself, use the Python package from the Package Installer.", "Error");
}
if (!hasShownError && line.ToLower().Contains("no longer supports this gpu"))
@ -280,10 +280,10 @@ namespace Flowframes
InterpolateUtils.ShowMessage($"Your GPU seems to be outdated and is not supported!\n\n{line}", "Error");
}
if (!hasShownError && line.Contains("RuntimeError"))
if (!hasShownError && (line.Contains("RuntimeError") || line.Contains("ImportError") || line.Contains("OSError")))
{
hasShownError = true;
InterpolateUtils.ShowMessage($"An error occured during interpolation!\n\n{line}", "Error");
InterpolateUtils.ShowMessage($"A python error occured during interpolation!\nCheck {logFilename} for details.\n\n{line}", "Error");
}
if (!hasShownError && line.Contains("vkQueueSubmit failed"))

View File

@ -14,10 +14,14 @@ namespace Flowframes.OS
public static string GetPyCmd ()
{
if (PkgUtils.IsInstalled(Packages.python))
if (Directory.Exists(Path.Combine(Paths.GetPkgPath(), "py-tu")) || Directory.Exists(Path.Combine(Paths.GetPkgPath(), "py-ampt")))
{
Logger.Log("Using embedded Python runtime.");
string pyPkgDir = Path.Combine(Paths.GetPkgPath(), Path.GetFileNameWithoutExtension(Packages.python.fileName));
string pyPkgDir = Path.Combine(Paths.GetPkgPath(), "py-amp");
if (!Directory.Exists(pyPkgDir))
pyPkgDir = Path.Combine(Paths.GetPkgPath(), "py-tu");
if (!Directory.Exists(pyPkgDir))
return "";
return Path.Combine(pyPkgDir, "python.exe").Wrap();
}
else

View File

@ -25,5 +25,46 @@ namespace Flowframes.UI
var str = await client.DownloadStringTaskAsync(new Uri(url));
patronsLabel.Text = str;
}
public static async Task LoadPatronListCsv(Label patronsLabel)
{
string url = $"http://dl.nmkd.de/flowframes/patrons.csv";
var client = new WebClient();
var csvData = await client.DownloadStringTaskAsync(new Uri(url));
patronsLabel.Text = ParsePatreonCsv(csvData);
}
public static string ParsePatreonCsv(string csvData)
{
List<string> goldPatrons = new List<string>();
List<string> silverPatrons = new List<string>();
string str = "Gold:\n";
string[] lines = csvData.SplitIntoLines();
for (int i = 0; i < lines.Length; i++)
{
string line = lines[i];
string[] values = line.Split(',');
if (i == 0 || line.Length < 10 || values.Length < 5) continue;
string name = values[0];
float amount = float.Parse(values[7], System.Globalization.CultureInfo.InvariantCulture);
if(amount >= 4.5f)
{
if (amount >= 11f)
goldPatrons.Add(name);
else
silverPatrons.Add(name);
}
}
foreach (string pat in goldPatrons)
str += pat + "\n";
str += "\nSilver:\n";
foreach (string pat in silverPatrons)
str += pat + "\n";
return str;
}
}
}

10
PythonDependencies.md Normal file
View File

@ -0,0 +1,10 @@
# Installation Of Python And Dependencies
- Make sure your GPU drivers are up to date
- Install Python 3.8.6 from the [official website](https://www.python.org/downloads/release/python-386/)
- In CMD, run `pip install torch===1.7.0+cu110 torchvision===0.8.1+cu110 -f https://download.pytorch.org/whl/torch_stable.html`
- Run `pip install opencv-python sk-video imageio`
This should be sufficient to run RIFE and other Pytorch-based networks on any modern GPU, including the RTX 3000 (Ampere) series.