class SvtplayDl < Formula desc "Download videos from http://svtplay.se" homepage "https://svtplay-dl.se" url "https://pypi.python.org/packages/d0/1d/64a5b6dd832e76b3dcb6b55fd389f402b2288dfee821d769b0857d3d0dcf/svtplay-dl-1.1.tar.gz" sha256 "bf2d0ea75a7c381cc28be74e3851efdf4716a5f8bca8791c35d997a0b45d5e0d" bottle do cellar :any sha256 "abd1fbccfb87595e716a55d4bde64ad69a5ebdc21155915448de66ca5270b422" => :el_capitan sha256 "9f671c8bede5528c3c4d8833e1b433d117a728ec92e2f76735bf611ecfe2ac1f" => :yosemite sha256 "55c50a6378d39316264bb6bab982cd418f15d0b5c5d73ea887955433385c4af4" => :mavericks end depends_on "rtmpdump" # for request security resource "cffi" do url "https://pypi.python.org/packages/source/c/cffi/cffi-1.5.2.tar.gz" sha256 "da9bde99872e46f7bb5cff40a9b1cc08406765efafb583c704de108b6cb821dd" end resource "cryptography" do url "https://pypi.python.org/packages/source/c/cryptography/cryptography-1.2.3.tar.gz" sha256 "8eb11c77dd8e73f48df6b2f7a7e16173fe0fe8fdfe266232832e88477e08454e" end resource "enum34" do url "https://pypi.python.org/packages/source/e/enum34/enum34-1.1.2.tar.gz" sha256 "2475d7fcddf5951e92ff546972758802de5260bf409319a9f1934e6bbc8b1dc7" end resource "idna" do url "https://pypi.python.org/packages/source/i/idna/idna-2.0.tar.gz" sha256 "16199aad938b290f5be1057c0e1efc6546229391c23cea61ca940c115f7d3d3b" end resource "ndg-httpsclient" do url "https://pypi.python.org/packages/source/n/ndg-httpsclient/ndg_httpsclient-0.4.0.tar.gz" sha256 "e8c155fdebd9c4bcb0810b4ed01ae1987554b1ee034dd7532d7b8fdae38a6274" end resource "pyasn1" do url "https://pypi.python.org/packages/source/p/pyasn1/pyasn1-0.1.9.tar.gz" sha256 "853cacd96d1f701ddd67aa03ecc05f51890135b7262e922710112f12a2ed2a7f" end resource "pycparser" do url "https://pypi.python.org/packages/source/p/pycparser/pycparser-2.14.tar.gz" sha256 "7959b4a74abdc27b312fed1c21e6caf9309ce0b29ea86b591fd2e99ecdf27f73" end resource "requests" do url "https://pypi.python.org/packages/source/r/requests/requests-2.9.1.tar.gz" sha256 "c577815dd00f1394203fc44eb979724b098f88264a9ef898ee45b8e5e9cf587f" end resource "six" do url "https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz" sha256 "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a" end ######## resource "pycrypto" do url "https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz" sha256 "f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c" end def install ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages" resources.each do |r| r.stage do system "python", *Language::Python.setup_install_args(libexec/"vendor") end end # ndg is a namespace package and .pth files aren't read from our # vendor site-packages touch libexec/"vendor/lib/python2.7/site-packages/ndg/__init__.py" ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python2.7/site-packages" system "python", *Language::Python.setup_install_args(libexec) bin.install Dir[libexec/"bin/*"] bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"]) end def caveats; <<-EOS.undent To use post-processing options: `brew install ffmpeg` or `brew install libav`. EOS end test do system "#{bin}/svtplay-dl", "-g", "http://tv.aftonbladet.se/abtv/articles/121638" end end