X-Git-Url: https://git.distorted.org.uk/~mdw/epls/blobdiff_plain/c9d5b3696ba41dc113007bcfd9f33eefb75806a6..HEAD:/Makefile diff --git a/Makefile b/Makefile index 9e3117e..8ca1252 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,11 @@ all: clean::; rm -f $(CLEANFILES) +realclean::; rm -f $(REALCLEANFILES) force: -.PHONY: all clean +.PHONY: all clean force +.SECONDEXPANSION: # not sorry +SHELL = bash V ?= 0 V_AT = $(V_AT_$V) @@ -16,126 +19,203 @@ v-tag.0 = @$(call v-print.0,$1,$@); TARGETS = CLEANFILES += $(TARGETS) +REALCLEANFILES += $(CLEANFILES) -TARGETS += $(addsuffix .m3u8,$(PLAYLISTS)) +MKM3UFLAGS = -dmkm3u.cache +REALCLEANFILES += mkm3u.cache define %declare-playlist PLAYLISTS += $1 -$1_INITIAL = $2 -$1_FULLNAME = $3 +$1_FULLNAME = $2 endef -declare-playlist = $(eval $(call %declare-playlist,$1,$2,$3)) + +define %declare-simple-playlist +$1_EPLS = $1.epls +$1_MKM3UFLAGS = +endef + +define %declare-chapter-playlist +$1_EPLS = $2.epls +$1_MKM3UFLAGS = -c +endef + +define %declare-filter-playlist +$1_EPLS = $2.epls +$1_MKM3UFLAGS = -s$3 +endef + +declare-playlist = \ + $(eval $(call %declare-playlist,$1,$2)) \ + $(eval $(call %declare-simple-playlist,$1)) +declare-chapters-only = \ + $(eval $(call %declare-playlist,$1,$2)) \ + $(eval $(call %declare-chapter-playlist,$1,$1)) +declare-chapters = \ + $(eval $(call %declare-playlist,$1,$2)) \ + $(eval $(call %declare-simple-playlist,$1)) \ + $(eval $(call %declare-playlist,$1-chap,$2 (chapters))) \ + $(eval $(call %declare-chapter-playlist,$1-chap,$1)) +declare-filter = \ + $(eval $(call %declare-playlist,$1,$4)) \ + $(eval $(call %declare-filter-playlist,$1,$2,$3)) ARCHIVEROOT = ../archive -$(call declare-playlist, 24, \#,24) -$(call declare-playlist, agent-carter, A,Agent Carter) -#$(call declare-playlist, agents-of-shield, A,Agents of SHIELD) -#$(call declare-playlist, andromeda, A,Andromeda) -#$(call declare-playlist, arrow, A,Arrow) -#$(call declare-playlist, arrowverse, A,Arrowverse) -#$(call declare-playlist, a-team, A,The A-Team) -#$(call declare-playlist, the-americans, A,The Americans) -$(call declare-playlist, allo-allo, A,'Allo 'Allo!) -$(call declare-playlist, angel, A,Angel) -$(call declare-playlist, babylon-5, B,Babylon 5) -#$(call declare-playlist, batman-1966, B,Batman (1966 series)) -$(call declare-playlist, bsg-1978, B,Battlestar Galactica (1978)) -#$(call declare-playlist, bsg-1980, B,Battlestar Galactica 1980) -#$(call declare-playlist, bsg-2003, B,Battlestar Galactica (2003)) -#$(call declare-playlist, batwoman, B,Batwoman) -$(call declare-playlist, between-the-lines, B,Between the Lines) -#$(call declare-playlist, blackadder, B,Blackadder) -$(call declare-playlist, blakes-7, B,Blake's 7) #' -$(call declare-playlist, brass-eye, B,Brass Eye) -$(call declare-playlist, the-bridge, B,The Bridge) -$(call declare-playlist, btvs, B,Buffy the Vampire Slayer) -#$(call declare-playlist, caprica, C,Caprica) -#$(call declare-playlist, constantine, C,Constantine) -#$(call declare-playlist, cracker, C,Cracker) -#$(call declare-playlist, crow-stairway, C,The Crow—Stairway to Heaven) -#$(call declare-playlist, danger-mouse, D,Danger Mouse) -#$(call declare-playlist, dark-angel, D,Dark Angel) -#$(call declare-playlist, the-day-today, D,The Day Today) -#$(call declare-playlist, dexter, D,Dexter) -$(call declare-playlist, dollhouse, D,Dollhouse) -#$(call declare-playlist, engrenages, E,Engrenages) -#$(call declare-playlist, equalizer, E,The Equalizer (1985)) -$(call declare-playlist, fawlty-towers, F,Fawlty Towers) -$(call declare-playlist, firefly, F,Firefly) -#$(call declare-playlist, the-flash, F,The Flash) -$(call declare-playlist, fry-and-laurie, F,A Bit of Fry and Laurie) -$(call declare-playlist, game-of-thrones, G,Game of Thrones) -#$(call declare-playlist, godfather-ii, G/The Godfather Trilogy,02. Part II) -#$(call declare-playlist, gotham, G,Gotham) -#$(call declare-playlist, hannibal, H,Hannibal) -#$(call declare-playlist, hhgttg, H,The Hitchhiker's Guide to the Galaxy) #' -$(call declare-playlist, sherlock-holmes, H,Sherlock Holmes (1984)) -#$(call declare-playlist, house-of-cards, H,House of Cards) -#$(call declare-playlist, into-the-labyrinth, I,Into the Labyrinth) -#$(call declare-playlist, it-2017, I,It (2017)) -#$(call declare-playlist, snyder-justice, J,Justice League (Snyder cut)) -#$(call declare-playlist, kill-bill, K,Kill Bill) -#$(call declare-playlist, the-killing, K,The Killing) -#$(call declare-playlist, kingdom-of-heaven, K,Kingdom of Heaven (Definitive Edition)) -#$(call declare-playlist, knight-rider, K,Knight Rider) -#$(call declare-playlist, legends-of-tomrrow, L,Legends of Tomorrow) -#$(call declare-playlist, lexx, L,Lexx) -#$(call declare-playlist, lois-and-clark, L,Lois and Clark—The New Adventures of Superman) -$(call declare-playlist, morse, M,Inspector Morse) -$(call declare-playlist, macgyver, M,MacGyver) -#$(call declare-playlist, metallica-s-and-m, M,Metallica—S&M) -#$(call declare-playlist, the-night-manager, N,The Night Manager) -#$(call declare-playlist, person-of-interest, P,Person of Interest) -#$(call declare-playlist, harry-potter, P,Harry Potter) -$(call declare-playlist, flying-circus, P,Monty Python's Flying Circus) #' -$(call declare-playlist, robin-of-sherwood, R,Robin of Sherwood) -$(call declare-playlist, rome, R,Rome) -#$(call declare-playlist, sanctuary, S,Sanctuary) -$(call declare-playlist, shark, S,Shark) -#$(call declare-playlist, the-shield, S,The Shield) -#$(call declare-playlist, smallville, S,Smallville) -#$(call declare-playlist, george-smiley, S,George Smiley) -$(call declare-playlist, spartacus, S,Spartacus) -#$(call declare-playlist, spooks, S,Spooks) -#$(call declare-playlist, star-wars, S,Star Wars) -$(call declare-playlist, stargate-sg1, S,Stargate SG-1) -#$(call declare-playlist, stargate-atlantis, S,Stargate Atlantis) -#$(call declare-playlist, stargate-universe, S,Stargate Universe) -#$(call declare-playlist, state-of-play, S,State of Play) -#$(call declare-playlist, supergirl, S,Supergirl) -#$(call declare-playlist, terminator-scc, T,Terminator—The Sarah Connor Chronicles) -#$(call declare-playlist, traffik, T,Traffik) -#$(call declare-playlist, the-tripods, T,The Tripods) -#$(call declare-playlist, tru-calling, T,Tru Calling) -#$(call declare-playlist, ultraviolet, U,Ultraviolet) -#$(call declare-playlist, v-1983, V,V (1983)) -#$(call declare-playlist, v-2009, V,V (2009)) -$(call declare-playlist, the-wire, W,The Wire) -$(call declare-playlist, waking-the-dead, W,Waking the Dead) -#$(call declare-playlist, wonder-woman-1975, W,Wonder Woman (1975)) -#$(call declare-playlist, yes-minister, Y,Yes Minister) -#$(call declare-playlist, the-young-ones, Y,The Young Ones) - -$(call declare-playlist, drwho-marco-polo, D/Doctor Who,S01E04 D. Marco Polo) -$(call declare-playlist, drwho-crusade, D/Doctor Who,S02E06 P. The Crusade) -$(call declare-playlist, drwho-masterplan, D/Doctor Who,S03E04 V. The Daleks' Master Plan) #' -$(call declare-playlist, drwho-massacre, D/Doctor Who,S03E05 W. The Massacre of St Bartholomew's Eve) #' -$(call declare-playlist, drwho-toymaker, D/Doctor Who,S03E07 Y. The Celestial Toymaker) -$(call declare-playlist, drwho-savages, D/Doctor Who,S03E09 AA. The Savages) -$(call declare-playlist, drwho-smugglers, D/Doctor Who,S04E01 CC. The Smugglers) -$(call declare-playlist, drwho-highlanders, D/Doctor Who,S04E04 FF. The Highlanders) -$(call declare-playlist, drwho-snowmen, D/Doctor Who,S05E02 NN. The Abominable Snowmen) -$(call declare-playlist, drwho-wheel, D/Doctor Who,S05E07 SS. The Wheel in Space) -$(call declare-playlist, drwho-invasion, D/Doctor Who,S06E03 VV. The Invasion) -$(call declare-playlist, drwho-pirates, D/Doctor Who,S06E06 YY. The Space Pirates) -$(call declare-playlist, drwho-war-games, D/Doctor Who,S06E07 ZZ. The War Games) -$(call declare-playlist, drwho-silurians, D/Doctor Who,S07E02 BBB. Doctor Who and the Silurians) +$(call declare-playlist, 24, \#/24) +$(call declare-playlist, agent-carter, A/Agent Carter) +$(call declare-playlist, agents-of-shield, A/Agents of SHIELD) +$(call declare-playlist, andromeda, A/Andromeda) +$(call declare-playlist, arrowverse, A/Arrowverse) +$(call declare-filter, arrow, arrowverse,arr, A/Arrow) +$(call declare-filter, the-flash, arrowverse,fls, F/The Flash) +$(call declare-filter, constantine, arrowverse,cns, C/Constantine) +$(call declare-filter, supergirl, arrowverse,spg, S/Supergirl) +$(call declare-filter, legends-of-tomorrow, arrowverse,lot, L/Legends of Tomorrow) +$(call declare-filter, batwoman, arrowverse,bwm, B/Batwoman) +$(call declare-filter, black-lightning, arrowverse,blt, B/Black Lightning) +$(call declare-filter, stargirl, arrowverse,stg, S/Stargirl) +$(call declare-filter, superman-and-lois, arrowverse,sal, S/Superman & Lois) +$(call declare-playlist, a-team, A/The A-Team) +$(call declare-playlist, the-americans, A/The Americans) +$(call declare-playlist, allo-allo, A/'Allo 'Allo!) +$(call declare-playlist, babylon-5, B/Babylon 5) +$(call declare-playlist, batman-1966, B/Batman (1966)) +$(call declare-playlist, bsg-1978, B/Battlestar Galactica (1978)) +$(call declare-playlist, bsg-1980, B/Battlestar Galactica 1980) +$(call declare-playlist, bsg-2003, B/Battlestar Galactica (2003)) +$(call declare-playlist, between-the-lines, B/Between the Lines) +$(call declare-playlist, blackadder, B/Blackadder) +$(call declare-playlist, blakes-7, B/Blake's 7) #' +$(call declare-playlist, brass-eye, B/Brass Eye) +$(call declare-playlist, the-bridge, B/The Bridge) +$(call declare-playlist, buffyverse, B/Buffyverse) +$(call declare-filter, btvs, buffyverse,b, B/Buffy the Vampire Slayer) +$(call declare-filter, angel, buffyverse,a, A/Angel) +$(call declare-playlist, caprica, C/Caprica) +$(call declare-playlist, cracker, C/Cracker) +$(call declare-playlist, crow-stairway, C/The Crow—Stairway to Heaven) +$(call declare-playlist, danger-mouse, D/Danger Mouse) +$(call declare-playlist, dark-angel, D/Dark Angel) +$(call declare-playlist, the-day-today, D/The Day Today) +$(call declare-playlist, dexter, D/Dexter) +$(call declare-playlist, drwho, D/Doctor Who) +$(call declare-filter, drwho-marco-polo, drwho,marco-polo, D/Doctor Who/S01E04 D. Marco Polo) +$(call declare-filter, drwho-crusade, drwho,crusade, D/Doctor Who/S02E06 P. The Crusade) +$(call declare-filter, drwho-myth-makers, drwho,myth-makers, D/Doctor Who/S03E03 U. The Myth Makers) +$(call declare-filter, drwho-masterplan, drwho,daleks-masterplan, D/Doctor Who/S03E04 V. The Daleks' Master Plan) #' +$(call declare-filter, drwho-massacre, drwho,massacre, D/Doctor Who/S03E05 W. The Massacre of St Bartholomew's Eve) #' +$(call declare-filter, drwho-toymaker, drwho,toymaker, D/Doctor Who/S03E07 Y. The Celestial Toymaker) +$(call declare-filter, drwho-savages, drwho,savages, D/Doctor Who/S03E09 AA. The Savages) +$(call declare-filter, drwho-smugglers, drwho,smugglers, D/Doctor Who/S04E01 CC. The Smugglers) +$(call declare-filter, drwho-highlanders, drwho,highlanders, D/Doctor Who/S04E04 FF. The Highlanders) +$(call declare-filter, drwho-snowmen, drwho,snowmen, D/Doctor Who/S05E02 NN. The Abominable Snowmen) +$(call declare-filter, drwho-wheel, drwho,wheel, D/Doctor Who/S05E07 SS. The Wheel in Space) +$(call declare-filter, drwho-invasion, drwho,invasion, D/Doctor Who/S06E03 VV. The Invasion) +$(call declare-filter, drwho-pirates, drwho,pirates, D/Doctor Who/S06E06 YY. The Space Pirates) +$(call declare-filter, drwho-war-games, drwho,war-games, D/Doctor Who/S06E07 ZZ. The War Games) +$(call declare-filter, drwho-silurians, drwho,silurians, D/Doctor Who/S07E02 BBB. Doctor Who and the Silurians) +$(call declare-playlist, dollhouse, D/Dollhouse) +$(call declare-playlist, dune-2000, D/Dune (2000)) +$(call declare-playlist, engrenages, E/Engrenages) +$(call declare-playlist, equalizer, E/The Equalizer (1985)) +$(call declare-playlist, father-ted, F/Father Ted) +$(call declare-playlist, fawlty-towers, F/Fawlty Towers) +$(call declare-playlist, firefly, F/Firefly) +$(call declare-playlist, aeon-flux, F/Æon Flux) +$(call declare-chapters, fry-and-laurie, F/A Bit of Fry & Laurie) +$(call declare-playlist, game-of-thrones, G/Game of Thrones) +$(call declare-playlist, godfather-ii, G/The Godfather Trilogy/02. Part II) +$(call declare-playlist, gotham, G/Gotham) +$(call declare-playlist, hannibal, H/Hannibal) +$(call declare-playlist, hhgttg, H/The Hitchhiker's Guide to the Galaxy) #' +$(call declare-playlist, sherlock-holmes, H/Sherlock Holmes (1984)) +$(call declare-playlist, house-of-cards, H/House of Cards) +$(call declare-playlist, i-claudius, I/I Claudius) +$(call declare-playlist, into-the-labyrinth, I/Into the Labyrinth) +$(call declare-playlist, it-2017, I/It (2017)) +$(call declare-playlist, snyder-justice, J/Justice League (Snyder cut)) +$(call declare-playlist, kill-bill, K/Kill Bill) +$(call declare-playlist, the-killing, K/The Killing) +$(call declare-playlist, kingdom-of-heaven, K/Kingdom of Heaven (Definitive Edition)) +$(call declare-playlist, knight-rider, K/Knight Rider) +$(call declare-playlist, lexx, L/Lexx) +$(call declare-playlist, lois-and-clark, L/Lois and Clark—The New Adventures of Superman) +$(call declare-playlist, morse, M/Inspector Morse) +$(call declare-playlist, macgyver, M/MacGyver) +$(call declare-chapters, metallica-s-and-m, M/Metallica—S&M) +$(call declare-playlist, the-night-manager, N/The Night Manager) +$(call declare-playlist, nymphomaniac, N/Nymphomaniac) +$(call declare-playlist, person-of-interest, P/Person of Interest) +$(call declare-playlist, harry-potter, P/Harry Potter) +$(call declare-playlist, police-squad, P/Police Squad!) +$(call declare-playlist, prime-suspect, P/Prime Suspect) +$(call declare-playlist, the-prisoner, P/The Prisoner) +$(call declare-playlist, flying-circus-restored, P/Monty Python's Flying Circus (restored)) #' +$(call declare-chapters-only, flying-circus-sketches, P/Monty Python's Flying Circus (sketches)) #' +$(call declare-playlist, robin-of-sherwood, R/Robin of Sherwood) +$(call declare-playlist, buck-rogers, R/Buck Rogers in the 25th Century) +$(call declare-playlist, rome, R/Rome) +$(call declare-playlist, sanctuary, S/Sanctuary) +$(call declare-playlist, sapphire-and-steel, S/Sapphire & Steel) +$(call declare-playlist, shark, S/Shark) +$(call declare-playlist, sharpe, S/Sharpe) +$(call declare-playlist, the-shield, S/The Shield) +$(call declare-playlist, smallville, S/Smallville) +$(call declare-playlist, george-smiley, S/George Smiley) +$(call declare-playlist, spartacus, S/Spartacus) +$(call declare-playlist, spooks, S/Spooks) +$(call declare-playlist, star-wars, S/Star Wars) +$(call declare-filter, skywalker-saga, star-wars,sws, S/Star Wars—The Skywalker Saga) +$(call declare-filter, starwars-stories, star-wars,sty, S/Star Wars Stories) +$(call declare-filter, clone-wars, star-wars,tcw, S/Star Wars—The Clone Wars) +$(call declare-filter, rebels, star-wars,rbl, S/Star Wars—Rebels) +$(call declare-playlist, stargate, S/Stargate) +$(call declare-filter, stargate-sg1, stargate,sg1, S/Stargate SG-1) +$(call declare-filter, stargate-atlantis, stargate,sga, S/Stargate Atlantis) +$(call declare-filter, stargate-universe, stargate,sgu, S/Stargate Universe) +$(call declare-playlist, state-of-play, S/State of Play) +$(call declare-playlist, strike, S/Strike) +$(call declare-playlist, terminator-scc, T/Terminator—The Sarah Connor Chronicles) +$(call declare-playlist, traffik, T/Traffik) +$(call declare-playlist, the-tripods, T/The Tripods) +$(call declare-playlist, tru-calling, T/Tru Calling) +$(call declare-playlist, twin-peaks, T/Twin Peaks) +$(call declare-playlist, ultraviolet, U/Ultraviolet) +$(call declare-playlist, v-1983, V/V (1983)) +$(call declare-playlist, v-2009, V/V (2009)) +$(call declare-playlist, the-wire, W/The Wire) +$(call declare-playlist, waking-the-dead, W/Waking the Dead) +$(call declare-playlist, westworld, W/Westworld) +$(call declare-playlist, wonder-woman-1975, W/Wonder Woman (1975)) +$(call declare-playlist, worricker, W/The Worricker trilogy) +$(call declare-playlist, yes-minister, Y/Yes Minister) +$(call declare-playlist, the-young-ones, Y/The Young Ones) -all: $(TARGETS) +M3US = $(addsuffix .m3u8,$(PLAYLISTS)) +DEPFILES += $(addsuffix .m3u-dep,$(PLAYLISTS)) +TARGETS += $(M3US) +CLEANFILES += $(DEPFILES) + +CLEANFILES += mkm3u.cache-stamp +mkm3u.cache-stamp: + if [ ! -f mkm3u.cache ]; then \ + ./mkm3u -i -dmkm3u.cache.new && mv mkm3u.cache.new mkm3u.cache; \ + fi + touch $@ -%.m3u8: %.epls mkm3u - $(call v-tag,MKM3U)./mkm3u "$<" >"$@.new" && mv "$@.new" "$@" +CLEANFILES += *.m3u8.new +$(M3US): %.m3u8: $$($$*_EPLS) mkm3u mkm3u.cache-stamp + $(call v-tag,MKM3U)./mkm3u $(MKM3UFLAGS) $($*_MKM3UFLAGS) \ + -M$*.m3u-dep -O$@ -o"$@.new" "$<" && mv "$@.new" "$@" + +PLS = $(sort $(foreach p,$(PLAYLISTS), \ + $($p_EPLS:.epls=.pl))) +DEPFILES += $(addsuffix -dep,$(PLS)) +TARGETS += $(PLS) +CLEANFILES += *.pl.new +$(PLS): %.pl: %.epls mkm3u mkm3u.cache-stamp + $(call v-tag,MKPL)./mkm3u -D $(MKM3UFLAGS) $($*_MKM3UFLAGS) \ + -M$*.pl-dep -O$@ -o"$@.new" "$<" && mv "$@.new" "$@" CHECKS = $(foreach p,$(PLAYLISTS), check/$p) check: $(CHECKS) @@ -147,7 +227,7 @@ LINKS = $(foreach p,$(PLAYLISTS), link/$p) link: $(LINKS) $(LINKS): link/%: $(V_AT) \ - ok=nil t="$(ARCHIVEROOT)/$($*_INITIAL)/$($*_FULLNAME).m3u8"; \ + ok=nil t="$(ARCHIVEROOT)/$($*_FULLNAME).m3u8"; \ if [ -L "$$t" ]; then \ case $$(realpath "$$t") in \ "$(abspath $*.m3u8)") ok=t ;; \ @@ -180,3 +260,15 @@ $(FORCE_SAVE): force-save/%: %.m3u8 cp $< ref/$*.m3u8.new && mv ref/$*.m3u8.new ref/$*.m3u8; \ fi .PHONY: save $(SAVE) + +comma = , +check-deps = $(shell if [ -f $1 ]; then for i in $2; do \ + if ! [ "$$i" -ot $1 ]; then \ + echo force; break; \ + fi; \ + done; fi) +-include $(DEPFILES) + +all: $(TARGETS) + +p:; : $p