Commit | Line | Data |
---|---|---|
04a05f7f MW |
1 | ### -*-makefile-*- |
2 | ||
3 | all: | |
4 | clean::; rm -f $(CLEANFILES) | |
0becf74e | 5 | realclean::; rm -f $(REALCLEANFILES) |
04a05f7f | 6 | force: |
2f4f35b0 | 7 | .PHONY: all clean force |
151b3c4f | 8 | .SECONDEXPANSION: # not sorry |
2f4f35b0 | 9 | SHELL = bash |
04a05f7f MW |
10 | |
11 | V ?= 0 | |
12 | V_AT = $(V_AT_$V) | |
13 | V_AT_0 = @ | |
fd176c0c MW |
14 | v-print = $(call v-print.$V,$1,$2) |
15 | v-print.1 = : | |
16 | v-print.0 = printf " %-8s %s\n" "$1" "$2" | |
04a05f7f | 17 | v-tag = $(call v-tag.$V,$1) |
fd176c0c | 18 | v-tag.0 = @$(call v-print.0,$1,$@); |
04a05f7f MW |
19 | |
20 | TARGETS = | |
21 | CLEANFILES += $(TARGETS) | |
0becf74e MW |
22 | REALCLEANFILES += $(CLEANFILES) |
23 | ||
24 | MKM3UFLAGS = -dmkm3u.cache | |
25 | REALCLEANFILES += mkm3u.cache | |
04a05f7f | 26 | |
04a05f7f MW |
27 | define %declare-playlist |
28 | PLAYLISTS += $1 | |
151b3c4f MW |
29 | $1_FULLNAME = $2 |
30 | endef | |
31 | ||
32 | define %declare-simple-playlist | |
33 | $1_EPLS = $1.epls | |
34 | $1_MKM3UFLAGS = | |
35 | endef | |
36 | ||
37 | define %declare-chapter-playlist | |
6c3e910f MW |
38 | $1_EPLS = $2.epls |
39 | $1_MKM3UFLAGS = -c | |
151b3c4f MW |
40 | endef |
41 | ||
42 | define %declare-filter-playlist | |
43 | $1_EPLS = $2.epls | |
44 | $1_MKM3UFLAGS = -s$3 | |
04a05f7f | 45 | endef |
151b3c4f MW |
46 | |
47 | declare-playlist = \ | |
48 | $(eval $(call %declare-playlist,$1,$2)) \ | |
49 | $(eval $(call %declare-simple-playlist,$1)) | |
6c3e910f MW |
50 | declare-chapters-only = \ |
51 | $(eval $(call %declare-playlist,$1,$2)) \ | |
52 | $(eval $(call %declare-chapter-playlist,$1,$1)) | |
151b3c4f MW |
53 | declare-chapters = \ |
54 | $(eval $(call %declare-playlist,$1,$2)) \ | |
55 | $(eval $(call %declare-simple-playlist,$1)) \ | |
56 | $(eval $(call %declare-playlist,$1-chap,$2 (chapters))) \ | |
6c3e910f | 57 | $(eval $(call %declare-chapter-playlist,$1-chap,$1)) |
151b3c4f MW |
58 | declare-filter = \ |
59 | $(eval $(call %declare-playlist,$1,$4)) \ | |
60 | $(eval $(call %declare-filter-playlist,$1,$2,$3)) | |
04a05f7f MW |
61 | |
62 | ARCHIVEROOT = ../archive | |
63 | ||
151b3c4f MW |
64 | $(call declare-playlist, 24, \#/24) |
65 | $(call declare-playlist, agent-carter, A/Agent Carter) | |
879c3754 | 66 | $(call declare-playlist, agents-of-shield, A/Agents of SHIELD) |
a7af5935 | 67 | $(call declare-playlist, andromeda, A/Andromeda) |
863cc6f0 MW |
68 | $(call declare-playlist, arrowverse, A/Arrowverse) |
69 | $(call declare-filter, arrow, arrowverse,arr, A/Arrow) | |
70 | $(call declare-filter, the-flash, arrowverse,fls, F/The Flash) | |
71 | $(call declare-filter, constantine, arrowverse,cns, C/Constantine) | |
72 | $(call declare-filter, supergirl, arrowverse,spg, S/Supergirl) | |
73 | $(call declare-filter, legends-of-tomorrow, arrowverse,lot, L/Legends of Tomorrow) | |
74 | $(call declare-filter, batwoman, arrowverse,bwm, B/Batwoman) | |
a68367a1 MW |
75 | $(call declare-filter, black-lightning, arrowverse,blt, B/Black Lightning) |
76 | $(call declare-filter, stargirl, arrowverse,stg, S/Stargirl) | |
197d1151 | 77 | $(call declare-filter, superman-and-lois, arrowverse,sal, S/Superman & Lois) |
6a388c2d MW |
78 | $(call declare-playlist, a-team, A/The A-Team) |
79 | $(call declare-playlist, the-americans, A/The Americans) | |
151b3c4f | 80 | $(call declare-playlist, allo-allo, A/'Allo 'Allo!) |
151b3c4f | 81 | $(call declare-playlist, babylon-5, B/Babylon 5) |
5cd491f9 | 82 | $(call declare-playlist, batman-1966, B/Batman (1966)) |
151b3c4f | 83 | $(call declare-playlist, bsg-1978, B/Battlestar Galactica (1978)) |
dd453b10 MW |
84 | $(call declare-playlist, bsg-1980, B/Battlestar Galactica 1980) |
85 | $(call declare-playlist, bsg-2003, B/Battlestar Galactica (2003)) | |
151b3c4f MW |
86 | $(call declare-playlist, between-the-lines, B/Between the Lines) |
87 | $(call declare-playlist, blackadder, B/Blackadder) | |
88 | $(call declare-playlist, blakes-7, B/Blake's 7) #' | |
89 | $(call declare-playlist, brass-eye, B/Brass Eye) | |
90 | $(call declare-playlist, the-bridge, B/The Bridge) | |
acc98df2 MW |
91 | $(call declare-playlist, buffyverse, B/Buffyverse) |
92 | $(call declare-filter, btvs, buffyverse,b, B/Buffy the Vampire Slayer) | |
93 | $(call declare-filter, angel, buffyverse,a, A/Angel) | |
00a8e35b MW |
94 | $(call declare-playlist, caprica, C/Caprica) |
95 | $(call declare-playlist, cracker, C/Cracker) | |
96 | $(call declare-playlist, crow-stairway, C/The Crow—Stairway to Heaven) | |
eb6d05d3 MW |
97 | $(call declare-playlist, danger-mouse, D/Danger Mouse) |
98 | $(call declare-playlist, dark-angel, D/Dark Angel) | |
99 | $(call declare-playlist, the-day-today, D/The Day Today) | |
100 | $(call declare-playlist, dexter, D/Dexter) | |
50a7c91c MW |
101 | $(call declare-playlist, drwho, D/Doctor Who) |
102 | $(call declare-filter, drwho-marco-polo, drwho,marco-polo, D/Doctor Who/S01E04 D. Marco Polo) | |
103 | $(call declare-filter, drwho-crusade, drwho,crusade, D/Doctor Who/S02E06 P. The Crusade) | |
104 | $(call declare-filter, drwho-myth-makers, drwho,myth-makers, D/Doctor Who/S03E03 U. The Myth Makers) | |
a4da849c | 105 | $(call declare-filter, drwho-masterplan, drwho,daleks-masterplan, D/Doctor Who/S03E04 V. The Daleks' Master Plan) #' |
50a7c91c MW |
106 | $(call declare-filter, drwho-massacre, drwho,massacre, D/Doctor Who/S03E05 W. The Massacre of St Bartholomew's Eve) #' |
107 | $(call declare-filter, drwho-toymaker, drwho,toymaker, D/Doctor Who/S03E07 Y. The Celestial Toymaker) | |
108 | $(call declare-filter, drwho-savages, drwho,savages, D/Doctor Who/S03E09 AA. The Savages) | |
109 | $(call declare-filter, drwho-smugglers, drwho,smugglers, D/Doctor Who/S04E01 CC. The Smugglers) | |
110 | $(call declare-filter, drwho-highlanders, drwho,highlanders, D/Doctor Who/S04E04 FF. The Highlanders) | |
111 | $(call declare-filter, drwho-snowmen, drwho,snowmen, D/Doctor Who/S05E02 NN. The Abominable Snowmen) | |
112 | $(call declare-filter, drwho-wheel, drwho,wheel, D/Doctor Who/S05E07 SS. The Wheel in Space) | |
113 | $(call declare-filter, drwho-invasion, drwho,invasion, D/Doctor Who/S06E03 VV. The Invasion) | |
114 | $(call declare-filter, drwho-pirates, drwho,pirates, D/Doctor Who/S06E06 YY. The Space Pirates) | |
115 | $(call declare-filter, drwho-war-games, drwho,war-games, D/Doctor Who/S06E07 ZZ. The War Games) | |
116 | $(call declare-filter, drwho-silurians, drwho,silurians, D/Doctor Who/S07E02 BBB. Doctor Who and the Silurians) | |
151b3c4f | 117 | $(call declare-playlist, dollhouse, D/Dollhouse) |
3a53da4f | 118 | $(call declare-playlist, dune-2000, D/Dune (2000)) |
9cb8c89b | 119 | $(call declare-playlist, engrenages, E/Engrenages) |
151b3c4f | 120 | $(call declare-playlist, equalizer, E/The Equalizer (1985)) |
80c267e5 | 121 | $(call declare-playlist, father-ted, F/Father Ted) |
151b3c4f MW |
122 | $(call declare-playlist, fawlty-towers, F/Fawlty Towers) |
123 | $(call declare-playlist, firefly, F/Firefly) | |
cdccb079 | 124 | $(call declare-playlist, aeon-flux, F/Æon Flux) |
d6c10a57 | 125 | $(call declare-chapters, fry-and-laurie, F/A Bit of Fry & Laurie) |
151b3c4f | 126 | $(call declare-playlist, game-of-thrones, G/Game of Thrones) |
be078cf8 | 127 | $(call declare-playlist, godfather-ii, G/The Godfather Trilogy/02. Part II) |
c1304cf0 MW |
128 | $(call declare-playlist, gotham, G/Gotham) |
129 | $(call declare-playlist, hannibal, H/Hannibal) | |
130 | $(call declare-playlist, hhgttg, H/The Hitchhiker's Guide to the Galaxy) #' | |
151b3c4f | 131 | $(call declare-playlist, sherlock-holmes, H/Sherlock Holmes (1984)) |
c1304cf0 | 132 | $(call declare-playlist, house-of-cards, H/House of Cards) |
cb8d18f5 MW |
133 | $(call declare-playlist, i-claudius, I/I Claudius) |
134 | $(call declare-playlist, into-the-labyrinth, I/Into the Labyrinth) | |
be078cf8 MW |
135 | $(call declare-playlist, it-2017, I/It (2017)) |
136 | $(call declare-playlist, snyder-justice, J/Justice League (Snyder cut)) | |
137 | $(call declare-playlist, kill-bill, K/Kill Bill) | |
cb8d18f5 | 138 | $(call declare-playlist, the-killing, K/The Killing) |
be078cf8 | 139 | $(call declare-playlist, kingdom-of-heaven, K/Kingdom of Heaven (Definitive Edition)) |
a4301b54 | 140 | $(call declare-playlist, knight-rider, K/Knight Rider) |
cb8d18f5 MW |
141 | $(call declare-playlist, lexx, L/Lexx) |
142 | $(call declare-playlist, lois-and-clark, L/Lois and Clark—The New Adventures of Superman) | |
151b3c4f MW |
143 | $(call declare-playlist, morse, M/Inspector Morse) |
144 | $(call declare-playlist, macgyver, M/MacGyver) | |
be078cf8 | 145 | $(call declare-chapters, metallica-s-and-m, M/Metallica—S&M) |
cb8d18f5 | 146 | $(call declare-playlist, the-night-manager, N/The Night Manager) |
30354d1d | 147 | $(call declare-playlist, nymphomaniac, N/Nymphomaniac) |
cb8d18f5 | 148 | $(call declare-playlist, person-of-interest, P/Person of Interest) |
be078cf8 | 149 | $(call declare-playlist, harry-potter, P/Harry Potter) |
f7954042 | 150 | $(call declare-playlist, police-squad, P/Police Squad!) |
5ea3eefa MW |
151 | $(call declare-playlist, prime-suspect, P/Prime Suspect) |
152 | $(call declare-playlist, the-prisoner, P/The Prisoner) | |
76387030 | 153 | $(call declare-playlist, flying-circus-restored, P/Monty Python's Flying Circus (restored)) #' |
de8d1aed | 154 | $(call declare-chapters-only, flying-circus-sketches, P/Monty Python's Flying Circus (sketches)) #' |
151b3c4f | 155 | $(call declare-playlist, robin-of-sherwood, R/Robin of Sherwood) |
3a53da4f | 156 | $(call declare-playlist, buck-rogers, R/Buck Rogers in the 25th Century) |
151b3c4f | 157 | $(call declare-playlist, rome, R/Rome) |
d7cfe50f | 158 | $(call declare-playlist, sanctuary, S/Sanctuary) |
87a098c4 | 159 | $(call declare-playlist, sapphire-and-steel, S/Sapphire & Steel) |
151b3c4f | 160 | $(call declare-playlist, shark, S/Shark) |
be99dae5 | 161 | $(call declare-playlist, sharpe, S/Sharpe) |
eec435be MW |
162 | $(call declare-playlist, the-shield, S/The Shield) |
163 | $(call declare-playlist, smallville, S/Smallville) | |
164 | $(call declare-playlist, george-smiley, S/George Smiley) | |
151b3c4f | 165 | $(call declare-playlist, spartacus, S/Spartacus) |
eec435be | 166 | $(call declare-playlist, spooks, S/Spooks) |
788a54a1 MW |
167 | $(call declare-playlist, star-wars, S/Star Wars) |
168 | $(call declare-filter, skywalker-saga, star-wars,sws, S/Star Wars—The Skywalker Saga) | |
169 | $(call declare-filter, starwars-stories, star-wars,sty, S/Star Wars Stories) | |
170 | $(call declare-filter, clone-wars, star-wars,tcw, S/Star Wars—The Clone Wars) | |
171 | $(call declare-filter, rebels, star-wars,rbl, S/Star Wars—Rebels) | |
151b3c4f MW |
172 | $(call declare-playlist, stargate, S/Stargate) |
173 | $(call declare-filter, stargate-sg1, stargate,sg1, S/Stargate SG-1) | |
174 | $(call declare-filter, stargate-atlantis, stargate,sga, S/Stargate Atlantis) | |
175 | $(call declare-filter, stargate-universe, stargate,sgu, S/Stargate Universe) | |
c855b981 | 176 | $(call declare-playlist, state-of-play, S/State of Play) |
a78ddb93 | 177 | $(call declare-playlist, strike, S/Strike) |
151b3c4f | 178 | $(call declare-playlist, terminator-scc, T/Terminator—The Sarah Connor Chronicles) |
ac7739eb MW |
179 | $(call declare-playlist, traffik, T/Traffik) |
180 | $(call declare-playlist, the-tripods, T/The Tripods) | |
181 | $(call declare-playlist, tru-calling, T/Tru Calling) | |
a68367a1 | 182 | $(call declare-playlist, twin-peaks, T/Twin Peaks) |
ac7739eb MW |
183 | $(call declare-playlist, ultraviolet, U/Ultraviolet) |
184 | $(call declare-playlist, v-1983, V/V (1983)) | |
151b3c4f MW |
185 | $(call declare-playlist, v-2009, V/V (2009)) |
186 | $(call declare-playlist, the-wire, W/The Wire) | |
187 | $(call declare-playlist, waking-the-dead, W/Waking the Dead) | |
f1ea5d9e | 188 | $(call declare-playlist, westworld, W/Westworld) |
ac7739eb | 189 | $(call declare-playlist, wonder-woman-1975, W/Wonder Woman (1975)) |
3a53da4f | 190 | $(call declare-playlist, worricker, W/The Worricker trilogy) |
ac7739eb MW |
191 | $(call declare-playlist, yes-minister, Y/Yes Minister) |
192 | $(call declare-playlist, the-young-ones, Y/The Young Ones) | |
04a05f7f | 193 | |
151b3c4f | 194 | M3US = $(addsuffix .m3u8,$(PLAYLISTS)) |
12ded3ea | 195 | DEPFILES += $(addsuffix .m3u-dep,$(PLAYLISTS)) |
151b3c4f | 196 | TARGETS += $(M3US) |
2f4f35b0 | 197 | CLEANFILES += $(DEPFILES) |
04a05f7f | 198 | |
0becf74e MW |
199 | CLEANFILES += mkm3u.cache-stamp |
200 | mkm3u.cache-stamp: | |
201 | if [ ! -f mkm3u.cache ]; then \ | |
202 | ./mkm3u -i -dmkm3u.cache.new && mv mkm3u.cache.new mkm3u.cache; \ | |
203 | fi | |
204 | touch $@ | |
205 | ||
206 | CLEANFILES += *.m3u8.new | |
207 | $(M3US): %.m3u8: $$($$*_EPLS) mkm3u mkm3u.cache-stamp | |
208 | $(call v-tag,MKM3U)./mkm3u $(MKM3UFLAGS) $($*_MKM3UFLAGS) \ | |
12ded3ea | 209 | -M$*.m3u-dep -O$@ -o"$@.new" "$<" && mv "$@.new" "$@" |
04a05f7f | 210 | |
1766dcfb MW |
211 | PLS = $(sort $(foreach p,$(PLAYLISTS), \ |
212 | $($p_EPLS:.epls=.pl))) | |
213 | DEPFILES += $(addsuffix -dep,$(PLS)) | |
214 | TARGETS += $(PLS) | |
215 | CLEANFILES += *.pl.new | |
216 | $(PLS): %.pl: %.epls mkm3u mkm3u.cache-stamp | |
217 | $(call v-tag,MKPL)./mkm3u -D $(MKM3UFLAGS) $($*_MKM3UFLAGS) \ | |
218 | -M$*.pl-dep -O$@ -o"$@.new" "$<" && mv "$@.new" "$@" | |
219 | ||
04a05f7f MW |
220 | CHECKS = $(foreach p,$(PLAYLISTS), check/$p) |
221 | check: $(CHECKS) | |
222 | $(CHECKS): check/%: %.m3u8 | |
fd176c0c | 223 | $(V_AT)diff -u $< ref/$*.m3u8 |
04a05f7f MW |
224 | .PHONY: check $(CHECKS) |
225 | ||
226 | LINKS = $(foreach p,$(PLAYLISTS), link/$p) | |
227 | link: $(LINKS) | |
228 | $(LINKS): link/%: | |
fd176c0c | 229 | $(V_AT) \ |
151b3c4f | 230 | ok=nil t="$(ARCHIVEROOT)/$($*_FULLNAME).m3u8"; \ |
fd176c0c MW |
231 | if [ -L "$$t" ]; then \ |
232 | case $$(realpath "$$t") in \ | |
233 | "$(abspath $*.m3u8)") ok=t ;; \ | |
234 | esac; \ | |
235 | fi; \ | |
236 | case $$ok in \ | |
237 | t) ;; \ | |
238 | *) $(call v-print,LINK,$*); \ | |
239 | ln -frs $*.m3u8 "$$t.new" && mv "$$t.new" "$$t" ;; \ | |
240 | esac | |
04a05f7f | 241 | .PHONY: link $(LINKS) |
c8746a36 MW |
242 | |
243 | SAVE = $(foreach p,$(PLAYLISTS), save/$p) | |
244 | FORCE_SAVE = $(foreach p,$(PLAYLISTS), force-save/$p) | |
245 | save: $(SAVE) | |
246 | force-save: $(FORCE_SAVE) | |
247 | $(SAVE): save/%: %.m3u8 | |
248 | $(V_AT) \ | |
249 | ok=nil; \ | |
250 | if ! [ -f "ref/$*.m3u8" ]; then \ | |
251 | $(call v-print,SAVE,$*); \ | |
252 | cp $< ref/$*.m3u8.new && mv ref/$*.m3u8.new ref/$*.m3u8; \ | |
253 | fi | |
254 | .PHONY: save $(SAVE) | |
255 | $(FORCE_SAVE): force-save/%: %.m3u8 | |
256 | $(V_AT) \ | |
257 | ok=nil; \ | |
258 | if ! [ -f "ref/$*.m3u8" ] || ! cmp -s $< ref/$*.m3u8; then \ | |
259 | $(call v-print,SAVE,$*); \ | |
260 | cp $< ref/$*.m3u8.new && mv ref/$*.m3u8.new ref/$*.m3u8; \ | |
261 | fi | |
262 | .PHONY: save $(SAVE) | |
151b3c4f | 263 | |
2f4f35b0 MW |
264 | comma = , |
265 | check-deps = $(shell if [ -f $1 ]; then for i in $2; do \ | |
266 | if ! [ "$$i" -ot $1 ]; then \ | |
267 | echo force; break; \ | |
268 | fi; \ | |
269 | done; fi) | |
270 | -include $(DEPFILES) | |
271 | ||
151b3c4f MW |
272 | all: $(TARGETS) |
273 | ||
274 | p:; : $p |