From: Nicolas Boisselier Date: Tue, 9 Jan 2018 03:19:03 +0000 (+0000) Subject: lib/postgres/mime.sql X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=8c760c4034cc922acd6a94bfe4817dae31470bb7;p=nb.git lib/postgres/mime.sql --- diff --git a/lib/postgres/mime.sql b/lib/postgres/mime.sql index d4bdd32e..e5d11309 100644 --- a/lib/postgres/mime.sql +++ b/lib/postgres/mime.sql @@ -9,27 +9,6 @@ CREATE INDEX IF NOT EXISTS mime_ext_idx ON mime (ext); BEGIN TRANSACTION; CREATE TEMPORARY TABLE tmp_mime ON COMMIT DROP AS SELECT * FROM mime LIMIT 0; -COPY mime FROM PROGRAM 'true || curl -s \ -https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types \ -| tr -d "\n" \ -| sed -E "s,^(.*?)]+>(.*?)(.*?)$,\2," \ -| sed "s/<.tr>/\n/g" \ -| grep ",\t,g" \ -| sed -E -e "s/ *]*> */,/g" -e "s/,[^\t]+//" -e "s, *<[^>]+> *,,g" -e "s/^[\t ]*//" -e "s/([^\t]+)\t([^\t]+)$/\2\t\1/" \ -| perl -pe "0 and /^([^\t]+,[^\t]+)/ and @_=split(qq|,|,\$_) and s/^[^\t]+/join(qq|,|,sort {length(\$b)<=>length(\$a)} @_)/e" \ - -' WITH (format 'text', NULL ''); - -DELETE FROM tmp_mime; -COPY tmp_mime FROM PROGRAM 'true || curl -s \ -https://gist.githubusercontent.com/electerious/3d5a31a73cfd6423f835c074ab25fc06/raw/d48b8410e9aa6746cfd946bca21a1bb54c351c4e/Caddyfile \ -| sed -e "s/^ *//" -e "/^[^\.]/d" -e "s/ /\t/" -e "s/$/\t/" \ -' WITH (format 'text', NULL ''); -INSERT INTO mime SELECT * FROM tmp_mime ON CONFLICT DO NOTHING; - -UPDATE mime SET ext = REPLACE(ext,'.','') WHERE ext LIKE '.%'; - COPY mime FROM STDIN WITH (format 'text', NULL ''); x3d application/vnd.hzn-3d-crossword 3D Crossword Plugin 3g2 video/3gpp2 3GP2 @@ -718,4 +697,24 @@ zir application/vnd.zul Z.U.L. Geometry zmm application/vnd.handheld-entertainment+xml ZVUE Media Manager zaz application/vnd.zzazz.deck+xml Zzazz Deck \. + +DELETE FROM tmp_mime; +COPY tmp_mime FROM PROGRAM 'true && curl -s \ +https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types \ +| tr -d "\n" \ +| sed -E "s,^(.*?)]+>(.*?)(.*?)$,\2," \ +| sed "s/<.tr>/\n/g" \ +| grep ",\t,g" \ +| sed -E -e "s/ *]*> */,/g" -e "s/,[^\t]+//" -e "s, *<[^>]+> *,,g" -e "s/^[\t ]*//" -e "s/([^\t]+)\t([^\t]+)$/\2\t\1/" \ +| perl -pe "0 and /^([^\t]+,[^\t]+)/ and @_=split(qq|,|,\$_) and s/^[^\t]+/join(qq|,|,sort {length(\$b)<=>length(\$a)} @_)/e" \ +' WITH (format 'text', NULL ''); +INSERT INTO mime SELECT * FROM tmp_mime ON CONFLICT DO NOTHING; + +DELETE FROM tmp_mime; +COPY tmp_mime FROM PROGRAM 'true && curl -s \ +https://gist.githubusercontent.com/electerious/3d5a31a73cfd6423f835c074ab25fc06/raw/d48b8410e9aa6746cfd946bca21a1bb54c351c4e/Caddyfile \ +| sed -e "s/^ *//" -e "/^[^\.]/d" -e "s/ /\t/" -e "s/$/\t/" -e "s/^\.//" \ +' WITH (format 'text', NULL ''); +INSERT INTO mime SELECT * FROM tmp_mime ON CONFLICT DO NOTHING; COMMIT;