From 0cc7183d4f1d2d271f848bc0274e1a1c9211c273 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Thu, 2 Jan 2020 12:45:23 +0000 Subject: [PATCH] lib/postgres/hostads.sql --- lib/postgres/hostads.sql | 2 +- lib/postgres/lang.sh | 7 +++++++ lib/postgres/lang.sql | 16 ++++++++-------- 3 files changed, 16 insertions(+), 9 deletions(-) create mode 100755 lib/postgres/lang.sh diff --git a/lib/postgres/hostads.sql b/lib/postgres/hostads.sql index d69bb3b3..8ea15da0 100644 --- a/lib/postgres/hostads.sql +++ b/lib/postgres/hostads.sql @@ -4,5 +4,5 @@ CREATE TABLE IF NOT EXISTS hostads ( ); BEGIN TRANSACTION; DELETE FROM hostads; -COPY hostads FROM PROGRAM 'curl -s http://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml' WITH (format 'text', NULL ''); +COPY hostads FROM PROGRAM 'curl -s https://pgl.yoyo.org/adservers/serverlist.php?hostformat=nohtml' WITH (format 'text', NULL ''); COMMIT; diff --git a/lib/postgres/lang.sh b/lib/postgres/lang.sh new file mode 100755 index 00000000..64e624c7 --- /dev/null +++ b/lib/postgres/lang.sh @@ -0,0 +1,7 @@ +#!/bin/sh +curl -s http://download.geonames.org/export/dump/iso-languagecodes.txt \ +| tail -n +2 \ +| cut -f 1,4 \ +| sed -e "s/ *(.*$//" -e "s/\tModern /\t/" \ +| grep -Ev '^\s' \ +; diff --git a/lib/postgres/lang.sql b/lib/postgres/lang.sql index 366cdf6f..410a4719 100644 --- a/lib/postgres/lang.sql +++ b/lib/postgres/lang.sql @@ -3,11 +3,11 @@ CREATE TABLE IF NOT EXISTS lang ( id char(3) PRIMARY KEY, name varchar(60) ); -BEGIN TRANSACTION; -DELETE FROM lang; -COPY lang FROM PROGRAM 'curl -s http://download.geonames.org/export/dump/iso-languagecodes.txt \ -| tail -n +2 \ -| cut -f 1,4 \ -| sed -e "s/ *(.*$//" -e "s/\tModern /\t/" -' WITH (format 'text', NULL ''); -COMMIT; +-- NB 02.12.19 BEGIN TRANSACTION; +-- NB 02.12.19 DELETE FROM lang; +-- NB 02.12.19 COPY lang FROM PROGRAM 'curl -s http://download.geonames.org/export/dump/iso-languagecodes.txt \ +-- NB 02.12.19 | tail -n +2 \ +-- NB 02.12.19 | cut -f 1,4 \ +-- NB 02.12.19 | sed -e "s/ *(.*$//" -e "s/\tModern /\t/" +-- NB 02.12.19 ' WITH (format 'text', NULL ''); +-- NB 02.12.19 COMMIT; -- 2.47.3