From 9ff40f8a23c04e13dd9228916e115a9d85918a75 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 5 Feb 2016 15:21:13 +0000 Subject: [PATCH] refactor --- build-data/build-data-import.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/build-data/build-data-import.sh b/build-data/build-data-import.sh index a7358f14..219549c2 100755 --- a/build-data/build-data-import.sh +++ b/build-data/build-data-import.sh @@ -2,14 +2,20 @@ fetch() { - FILE="$1" - LINK="$2" - TIME="$3" + FILE="$1" + LINK="$2" + TIME="$3" - echo "Fetch $FILE" - if [ ! -f "$FILE" ] || test "`find $FILE -mtime $TIME`"; then - curl -L -o "$FILE" -z "$FILE" "$LINK" - fi + echo "Fetch $FILE" + if [ ! -f "$FILE" ] || test "`find $FILE -mtime $TIME`"; then + curl -L -o "$FILE" -z "$FILE" "$LINK" + if [[ "$FILE" =~ \.gz$ ]]; then + gunzip -k -f "$FILE" + fi + if [[ "$FILE" =~ \.zip$ ]]; then + unzip -o "$FILE" + fi + fi } fetch anidb.txt.gz 'http://anidb.net/api/anime-titles.dat.gz' +5 @@ -17,8 +23,7 @@ fetch tvdb.zip 'http://thetvdb.com/api/58B4AA94C59AD656/updates/updates_all.zip' fetch omdb.zip 'http://beforethecode.com/projects/omdb/download.aspx?e=reinhard.pointner%40gmail.com&tsv=movies' +30 fetch osdb.txt 'http://www.opensubtitles.org/addons/export_movie.php' +30 -gunzip -k -f anidb.txt.gz -unzip -o tvdb.zip -unzip -o omdb.zip +fetch anime-list.xml 'https://raw.githubusercontent.com/ScudLee/anime-lists/master/anime-list.xml' +30 +fetch anime-movieset-list.xml 'https://raw.githubusercontent.com/ScudLee/anime-lists/master/anime-movieset-list.xml' +30 echo 'DONE'