dfsg-main: More mpv plugins.

This commit is contained in:
Efraim Flashner 2021-09-29 17:53:49 +03:00
parent 04c660de62
commit 0916a0f848
Signed by: efraim
GPG key ID: 41AAE7DCCA3D8351

View file

@ -20,12 +20,14 @@
#:use-module (guix git-download)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
#:use-module (gnu packages curl))
#:use-module (gnu packages curl)
#:use-module (gnu packages lua))
(define-public mpv-sponsorblock-minimal
(let ((commit "b1ed75df1af73c0d9abe1e26017d45c637089a34") ; Aug 7, 2021
(revision "3"))
(let ((commit "9ae5f21658fbc0050e2acad179296da904dde0f3") ; Sept 28, 2021
(revision "4"))
(package
(name "mpv-sponsorblock-minimal")
(version (git-version "0" revision commit))
@ -37,7 +39,7 @@
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32 "1a5m09kpc73m24yfz6rm5d3yiw3xvfv46sq4yxzrkhcn2kpr79sp"))))
(base32 "0srxfldx9cra2n7rp01ji70z4rv8i7j3161gp8b3yx7ccp8w5qr1"))))
(build-system trivial-build-system)
(arguments
`(#:modules ((guix build utils))
@ -61,3 +63,99 @@
(description "This package provides a plugin to @code{mpv} to skip
sponsored segments of YouTube videos.")
(license license:gpl3))))
(define-public mpv-twitch-chat
(let ((commit "71dfa17b4fbbba88a81e13f8954353cdd5b7eddf") ; Sept 4, 2021
(revision "1"))
(package
(name "mpv-twitch-chat")
(version (git-version "0" revision commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/CrendKing/mpv-twitch-chat")
(commit commit)
))
(file-name (git-file-name name version))
(sha256
(base32 "0qajfvykc9jbbgf9v2684gihywfnnvpvzrdrhaabpcvnk27byb52"))))
(build-system trivial-build-system)
(arguments
`(#:modules ((guix build utils))
#:builder
(begin
(use-modules (guix build utils))
(let* ((out (assoc-ref %outputs "out"))
(lib (string-append out "/lib"))
(curl (assoc-ref %build-inputs "curl"))
(lua-json (assoc-ref %build-inputs "lua-json"))
(source (assoc-ref %build-inputs "source")))
(install-file (string-append source "/main.lua") lib)
(install-file (string-append source "/LICENSE")
(string-append out "/share/doc/" ,name "-" ,version))
(substitute* (string-append lib "/main.lua")
(("\"curl\"") (string-append "\"" curl "/bin/curl\""))
(("^package\\.path.*") "")
(("local json .*")
(string-append "local json = loadfile(\"" lua-json "/share/lua/5.2/json.lua\")()")))))))
(inputs
`(("curl" ,curl-minimal)
("lua-json" ,lua5.2-json)))
(home-page "https://github.com/CrendKing/mpv-twitch-chat/")
(synopsis "Twitch chat messages as subtitles")
(description "Show Twitch chat messages as subtitles when watching Twitch
VOD with @code{mpv}. @code{mpv} internally uses @code{youtube-dl} to handle
Twitch VOD URL. In addition to the regular video track, it also adds a
\"rechat\" subtitle track. This track points to the Twitch API
@code{videos/<video_id>/comments}, which contains the full transcript of a VOD's
chat messages in JSON. Unfortunately, @code{mpv} can't directly consume the
JSON as subtitle. This script converts it into a SubRip subtitle track so that
@code{mpv} can directly display the chat messages.")
(license license:expat))))
(define (make-lua-json name lua)
(package
(name name)
(version "0.1.2")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/rxi/json.lua")
(commit (string-append "v" version))))
(file-name (git-file-name "lua-json" version))
(sha256
(base32 "0sgcf7x8nds3abn46p4fg687pk6nlvsi82x186vpaj2dbv28q8i5"))))
(build-system gnu-build-system)
(arguments
`(#:phases
(modify-phases %standard-phases
(delete 'configure)
(delete 'build)
(replace 'check
(lambda _
(with-directory-excursion "test"
(invoke "lua" "test.lua"))))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out"))
(lua-version ,(version-major+minor (package-version lua))))
(install-file "json.lua"
(string-append out "/share/lua/" lua-version))
#t))))))
(inputs
`(("lua" ,lua)))
(home-page "https://github.com/rxi/json.lua")
(synopsis "JSON library for Lua")
(description "This package provides a lightweight JSON library for Lua.")
(license license:expat)))
(define-public lua-json
(make-lua-json "lua-json" lua))
(define-public lua5.1-json
(make-lua-json "lua5.1-json" lua-5.1))
(define-public lua5.2-json
(make-lua-json "lua5.2-json" lua-5.2))