Skip to content

Commit

Permalink
support all rife 4.x models, reinstall backend button
Browse files Browse the repository at this point in the history
  • Loading branch information
the-database committed Jul 29, 2024
1 parent 8b416c3 commit 383ebe9
Show file tree
Hide file tree
Showing 8 changed files with 406 additions and 49 deletions.
4 changes: 4 additions & 0 deletions VideoJaNai/Services/IPythonService.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using Avalonia.Collections;
using System;

namespace AnimeJaNaiConverterGui.Services
{
public interface IPythonService
{
bool IsPythonInstalled();
bool AreModelsInstalled();
bool IsFfmpegInstalled();
string PythonDirectory { get; }
string ModelsDirectory { get; }
string BackendDirectory { get; }
Expand All @@ -14,6 +16,8 @@ public interface IPythonService
string PythonPath { get; }
string VspipePath { get; }
string VapourSynthPluginsPath { get; }
string VsmlrtModelsPath { get; }
Version VsmlrtMinVersion { get; }
string AnimeJaNaiDirectory { get; }
string InstallUpdatePythonDependenciesCommand { get; }
string InstallVapourSynthPluginsCommand { get; }
Expand Down
5 changes: 4 additions & 1 deletion VideoJaNai/Services/PythonService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,22 @@ public PythonService(IUpdateManagerService? updateManagerService = null)
_updateManagerService = updateManagerService ?? Locator.Current.GetService<IUpdateManagerService>()!;
}

public string ModelsDirectory => Path.Join(AnimeJaNaiDirectory, "onnx");
public string BackendDirectory => (_updateManagerService?.IsInstalled ?? false) ? Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"VideoJaNai") : Path.GetFullPath(@".\backend");
public string ModelsDirectory => Path.Join(BackendDirectory, "onnx");
public string PythonDirectory => Path.Join(BackendDirectory, "python");
public string FfmpegDirectory => Path.Join(BackendDirectory, "ffmpeg");
public string AnimeJaNaiDirectory => Path.GetFullPath("./backend/animejanai");
public string PythonPath => Path.GetFullPath(Path.Join(PythonDirectory, PYTHON_DOWNLOADS["win32"].Path));
public string VapourSynthPluginsPath => Path.Combine(PythonDirectory, "vs-plugins");
public string VsmlrtModelsPath => Path.Combine(VapourSynthPluginsPath, "models");
public string FfmpegPath => Path.GetFullPath(Path.Join(FfmpegDirectory, "ffmpeg.exe"));
public string VspipePath => Path.GetFullPath(Path.Join(PythonDirectory, "VSPipe.exe"));
public string VsrepoPath => Path.GetFullPath(Path.Join(PythonDirectory, "vsrepo.py"));
public Version VsmlrtMinVersion => new("3.20.4"); // vsmlrt v14.test3

public bool IsPythonInstalled() => File.Exists(PythonPath);
public bool AreModelsInstalled() => Directory.Exists(ModelsDirectory) && Directory.GetFiles(ModelsDirectory).Length > 0;
public bool IsFfmpegInstalled() => File.Exists(FfmpegPath);

public class PythonDownload
{
Expand Down
Loading

0 comments on commit 383ebe9

Please sign in to comment.