excalidrawz 1.2.5
[Homebrew/homebrew-cask.git] / Casks / v / vlc@nightly.rb
blobeda05894e249d0959bd38bd85333b8e765dd183f
1 cask "vlc@nightly" do
2   arch arm: "arm64", intel: "x86_64"
3   livecheck_arch = on_arch_conditional arm: "-arm64", intel: "-intel64"
5   on_arm do
6     version "4.0.0,20241203-0413,e65b2754"
7     sha256 "3168b23969ce752000277da3c42889b8e138eb8d5b69f8fb41dae758d63ad806"
9     url "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/#{version.csv.second}/vlc-#{version.csv.first}-dev-arm64-#{version.csv.third}.dmg"
10   end
11   on_intel do
12     version "4.0.0,20241203-0415,e65b2754"
13     sha256 "72b52116bd7677490a2ca863d27fc6c232ff4cac1187922d3f8401a5baf66b12"
15     url "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/#{version.csv.second}/vlc-#{version.csv.first}-dev-intel64-#{version.csv.third}.dmg"
16   end
18   name "VLC media player"
19   desc "Open-source cross-platform multimedia player"
20   homepage "https://www.videolan.org/vlc/"
22   livecheck do
23     url "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/"
24     regex(/href=.*?vlc[._-]v?(\d+(?:\.\d+)+)-dev#{livecheck_arch}-(\h+)\.dmg/i)
25     strategy :page_match do |page, regex|
26       directory = page.scan(%r{href=["']?v?(\d+(?:[.-]\d+)+)/?["' >]}i)
27                       .flatten
28                       .uniq
29                       .max
30       next if directory.blank?
32       # Fetch the directory listing page for newest build
33       build_response = Homebrew::Livecheck::Strategy.page_content(
34         "https://artifacts.videolan.org/vlc/nightly-macos-#{arch}/#{directory}/",
35       )
36       next if (build_page = build_response[:content]).blank?
38       match = build_page.match(regex)
39       next if match.blank?
41       "#{match[1]},#{directory},#{match[2]}"
42     end
43   end
45   deprecate! date: "2025-05-01", because: :unsigned
47   conflicts_with cask: "vlc"
49   app "VLC.app"
50   # shim script (https://github.com/Homebrew/homebrew-cask/issues/18809)
51   shimscript = "#{staged_path}/vlc.wrapper.sh"
52   binary shimscript, target: "vlc"
54   preflight do
55     File.write shimscript, <<~EOS
56       #!/bin/sh
57       exec '#{appdir}/VLC.app/Contents/MacOS/VLC' "$@"
58     EOS
59   end
61   zap trash: [
62     "~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/org.videolan.vlc.sfl*",
63     "~/Library/Application Support/org.videolan.vlc",
64     "~/Library/Application Support/VLC",
65     "~/Library/Caches/org.videolan.vlc",
66     "~/Library/Preferences/org.videolan.vlc",
67     "~/Library/Preferences/org.videolan.vlc.plist",
68     "~/Library/Saved Application State/org.videolan.vlc.savedState",
69   ]
70 end