102 lines
4.7 KiB
Ruby
102 lines
4.7 KiB
Ruby
class YleDl < Formula
|
|
desc "Download Yle videos from the command-line"
|
|
homepage "https://aajanki.github.io/yle-dl/index-en.html"
|
|
url "https://github.com/aajanki/yle-dl/archive/20210502.tar.gz"
|
|
sha256 "172c6b3f819dc9d6df340f9bf55ffbeee8763f49d5a275f38835582be0b8299a"
|
|
license "GPL-3.0-or-later"
|
|
head "https://github.com/aajanki/yle-dl.git"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "fb9308ba39404b4e2e48b2118eab73a6001088957baac9f359e08bab7e2d3d18"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "21c8e4e7aad27b2f8c88ee3c75ed4a67da4a80a1c02c086964c663b2e534de30"
|
|
sha256 cellar: :any_skip_relocation, catalina: "51b872d7498eff38d926bc67886a53348e6fd5236354f4b6acb757d250ea7c0a"
|
|
sha256 cellar: :any_skip_relocation, mojave: "2dce4ec8b32677abf57e72ece6ebb411ce645331d40a6e93ac2cc38810ba01de"
|
|
end
|
|
|
|
depends_on "ffmpeg"
|
|
depends_on "python@3.9"
|
|
depends_on "rtmpdump"
|
|
|
|
uses_from_macos "libxslt"
|
|
|
|
# `Cannot import name "Feature" from "setuptools" in version 46.0.0`, and lock setuptools to v45.0.0
|
|
# https://github.com/pypa/setuptools/issues/2017#issuecomment-605354361
|
|
resource "setuptools" do
|
|
url "https://files.pythonhosted.org/packages/fd/76/3c7f726ed5c582019937f178d7478ce62716b7e8263344f1684cbe11ab3e/setuptools-45.0.0.zip"
|
|
sha256 "c46d9c8f2289535457d36c676b541ca78f7dcb736b97d02f50d17f7f15b583cc"
|
|
end
|
|
|
|
resource "AdobeHDS.php" do
|
|
# NOTE: yle-dl always installs the HEAD version of AdobeHDS.php. We use a specific commit.
|
|
# Check if there are bugfixes at https://github.com/K-S-V/Scripts/commits/master/AdobeHDS.php
|
|
url "https://raw.githubusercontent.com/K-S-V/Scripts/7fea932cb012cba8c203d5b46b891167b0f609a6/AdobeHDS.php"
|
|
sha256 "b79e8a4c8544953c39b79a622049c4deced57354adb9697e8c73420c12547229"
|
|
end
|
|
|
|
resource "attrs" do
|
|
url "https://files.pythonhosted.org/packages/ed/d6/3ebca4ca65157c12bd08a63e20ac0bdc21ac7f3694040711f9fd073c0ffb/attrs-21.2.0.tar.gz"
|
|
sha256 "ef6aaac3ca6cd92904cdd0d83f629a15f18053ec84e6432106f7a4d04ae4f5fb"
|
|
end
|
|
|
|
resource "certifi" do
|
|
url "https://files.pythonhosted.org/packages/06/a9/cd1fd8ee13f73a4d4f491ee219deeeae20afefa914dfb4c130cfc9dc397a/certifi-2020.12.5.tar.gz"
|
|
sha256 "1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c"
|
|
end
|
|
|
|
resource "chardet" do
|
|
url "https://files.pythonhosted.org/packages/ee/2d/9cdc2b527e127b4c9db64b86647d567985940ac3698eeabc7ffaccb4ea61/chardet-4.0.0.tar.gz"
|
|
sha256 "0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa"
|
|
end
|
|
|
|
resource "ConfigArgParse" do
|
|
url "https://files.pythonhosted.org/packages/fa/c2/986a0692857b25d6c7998060b21d40068bfb08a510dcf1bf4b0d161745b6/ConfigArgParse-1.4.1.tar.gz"
|
|
sha256 "6df537158f28c5ef2e8a8146781833abbc6cb7fca81b1b55d18808ce3439235e"
|
|
end
|
|
|
|
resource "idna" do
|
|
url "https://files.pythonhosted.org/packages/ea/b7/e0e3c1c467636186c39925827be42f16fee389dc404ac29e930e9136be70/idna-2.10.tar.gz"
|
|
sha256 "b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"
|
|
end
|
|
|
|
resource "lxml" do
|
|
url "https://files.pythonhosted.org/packages/e5/21/a2e4517e3d216f0051687eea3d3317557bde68736f038a3b105ac3809247/lxml-4.6.3.tar.gz"
|
|
sha256 "39b78571b3b30645ac77b95f7c69d1bffc4cf8c3b157c435a34da72e78c82468"
|
|
end
|
|
|
|
resource "requests" do
|
|
url "https://files.pythonhosted.org/packages/6b/47/c14abc08432ab22dc18b9892252efaf005ab44066de871e72a38d6af464b/requests-2.25.1.tar.gz"
|
|
sha256 "27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804"
|
|
end
|
|
|
|
resource "urllib3" do
|
|
url "https://files.pythonhosted.org/packages/cb/cf/871177f1fc795c6c10787bc0e1f27bb6cf7b81dbde399fd35860472cecbc/urllib3-1.26.4.tar.gz"
|
|
sha256 "e7b021f7241115872f92f43c6508082facffbd1c048e3c6e2bb9c2a157e28937"
|
|
end
|
|
|
|
def install
|
|
# Fix "ld: file not found: /usr/lib/system/libsystem_darwin.dylib" for lxml
|
|
ENV["SDKROOT"] = MacOS.sdk_path if MacOS.version == :sierra
|
|
|
|
xy = Language::Python.major_minor_version "python3"
|
|
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python#{xy}/site-packages"
|
|
(resources - [resource("AdobeHDS.php")]).each do |r|
|
|
r.stage do
|
|
system "python3", *Language::Python.setup_install_args(libexec/"vendor")
|
|
end
|
|
end
|
|
|
|
resource("AdobeHDS.php").stage(pkgshare)
|
|
|
|
ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python#{xy}/site-packages"
|
|
system "python3", *Language::Python.setup_install_args(libexec)
|
|
|
|
bin.install Dir["#{libexec}/bin/*"]
|
|
bin.env_script_all_files(libexec/"bin", PYTHONPATH: ENV["PYTHONPATH"])
|
|
end
|
|
|
|
test do
|
|
output = shell_output("#{bin}/yle-dl --showtitle https://areena.yle.fi/1-1570236")
|
|
assert_equal "Traileri: 1 minuutti-2012-05-30T10:51\n", output
|
|
end
|
|
end
|