diff --git a/Web/Models/Entities/Video.php b/Web/Models/Entities/Video.php index 17500e8d..f57159b7 100644 --- a/Web/Models/Entities/Video.php +++ b/Web/Models/Entities/Video.php @@ -41,7 +41,9 @@ class Video extends Media mkdir($dirId); $dir = $this->getBaseDir(); - Shell::bash(__DIR__ . "/../shell/processVideo.sh", OPENVK_ROOT, $filename, $dir, $hash)->start(); #async :DDD + $ext = Shell::isPowershell() ? "ps1" : "sh"; + $cmd = Shell::isPowershell() ? "powershell" : "bash"; + Shell::$cmd(__DIR__ . "/../shell/processVideo.$ext", OPENVK_ROOT, $filename, $dir, $hash)->start(); #async :DDD } catch(ShellUnavailableException $suex) { exit(OPENVK_ROOT_CONF["openvk"]["debug"] ? "Shell is unavailable" : VIDEOS_FRIENDLY_ERROR); } catch(UnknownCommandException $ucex) { diff --git a/Web/Models/Repositories/Notes.php b/Web/Models/Repositories/Notes.php index f1b19eaf..a41c6914 100644 --- a/Web/Models/Repositories/Notes.php +++ b/Web/Models/Repositories/Notes.php @@ -29,7 +29,7 @@ class Notes function getUserNotes(User $user, int $page = 1, ?int $perPage = NULL): \Traversable { $perPage = $perPage ?? OPENVK_DEFAULT_PER_PAGE; - foreach($this->notes->where("owner", $user->getId())->where("deleted", 0)->page($page, $perPage) as $album) + foreach($this->notes->where("owner", $user->getId())->where("deleted", 0)->order("created DESC")->page($page, $perPage) as $album) yield new Note($album); } diff --git a/Web/Models/shell/processVideo.ps1 b/Web/Models/shell/processVideo.ps1 new file mode 100644 index 00000000..8e87442e --- /dev/null +++ b/Web/Models/shell/processVideo.ps1 @@ -0,0 +1,17 @@ +$ovkRoot = $args[0] +$file = $args[1] +$dir = $args[2] +$hash = $args[3] +$hashT = $hash.substring(0, 2) +$temp = [System.IO.Path]::GetTempFileName() +$temp2 = [System.IO.Path]::GetTempFileName() + +Move-Item $file $temp + +# video stub logic was implicitly deprecated, so we start processing at once +ffmpeg -i $temp -ss 00:00:01.000 -vframes 1 "$dir$hashT/$hash.gif" +start /B /Low /Wait /Shared ffmpeg -i $temp -c:v libtheora -q:v 7 -c:a libvorbis -q:a 4 -vf scale=640x360,setsar=1:1 -y $temp2 + +Move-Item $temp2 "$dir$hashT/$hash.ogv" +Remove-Item $temp +Remove-Item $temp2 \ No newline at end of file diff --git a/Web/Presenters/templates/@layout.xml b/Web/Presenters/templates/@layout.xml index ef2ccfdb..84fade03 100644 --- a/Web/Presenters/templates/@layout.xml +++ b/Web/Presenters/templates/@layout.xml @@ -98,8 +98,8 @@
-