1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
#!/bin/bash
# Copyright (C) 2007-2010 PlayOnLinux Team
# Copyright (C) 2009 Pâris Quentin
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# This script calls maj_check to update POL
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"
config_maj() # Celle ci est exécuté à chaque ligne (wget | config_maj), elle traite tout
{
read line
if [ ! "$line" = "" ]
then
file=$(echo "$line" | cut -d "/" -f 1)
content=$(echo "$line" | cut -d "/" -f 2)
download_icon=$(echo "$line" | cut -d "/" -f 3)
download_min=$(echo "$line" | cut -d "/" -f 4)
#download_des=$(echo "$line" | cut -d "/" -f 5)
echo "$content" >> "$file"
if [ ! "$file" = "10" ] # If not in beta file
then
echo "$content" >> "search"
fi
if [ "$download_icon" = 1 ]
then
if [ ! -e "../icones/$content" ]
then
$POL_WGET "$SITE/V2_data/icones/$content" -O "../icones/$content"
fi
taille=$(du "../icones/$content")
taille=${taille:0:1}
if [ "$taille" = "0" ]
then
rm "../icones/$content"
fi
fi
config_maj
fi
}
maj_check ()
{
#clean_tmp
WEB_TIMESTAMP="$($POL_WGET "$SITE/update_mark.txt" -O- 2> /dev/null)"
LAST_TIMESTAMP="$(POL_Config_Read LAST_TIMESTAMP)"
$POL_WGET "$SITE/V4_data/repository/getf.php" -O- > "$REPERTOIRE/configurations/POL_Functions" && mv "$REPERTOIRE/configurations/POL_Functions" "$REPERTOIRE/configurations/listes/POL_Functions"
# Gecko
$POL_WGET "$GECKO_SITE/gecko.lst" -O- > "$REPERTOIRE/tmp/gecko.lst" && mv "$REPERTOIRE/tmp/gecko.lst" "$REPERTOIRE/configurations/listes/gecko.lst"
if [ ! "$WEB_TIMESTAMP" = "" ] && [ ! "$WEB_TIMESTAMP" = "$LAST_TIMESTAMP" ] # On évite les mises à jours inutiles
then
POL_Debug_Message "Web version : $WEB_TIMESTAMP"
POL_Debug_Message "Current local version : $LAST_TIMESTAMP"
POL_Debug_Message "Updating list"
mkdir -p "$REPERTOIRE/configurations/listes/"
cd "$REPERTOIRE/configurations/listes"
rm 0 1 2 3 4 5 6 7 8 9 10 rate download search 2> /dev/null
touch 0 1 2 3 4 5 6 7 8 9 10 rate download search
if [ "$POL_OS" = "Linux" ]
then
$POL_WGET "$SITE/V4_data/repository/get_list.php" -O- | config_maj
$POL_WGET "$SITE/V4_data/repository/get_top?by=download" -O- > download
$POL_WGET "$SITE/V4_data/repository/get_top" -O- > rate
$POL_WGET "$SITE/V4_data/repository/get_md5_list.php?playonlinux=1" -O- > md5sums
else
$POL_WGET "$SITE/V4_data/repository/get_list.php?playonmac=1" -O- | config_maj
$POL_WGET "$SITE/V4_data/repository/get_top?by=download&playonmac=1" -O- > download
$POL_WGET "$SITE/V4_data/repository/get_top?playonmac=1" -O- > rate
$POL_WGET "$SITE/V4_data/repository/get_md5_list.php?playonmac=1" -O- > md5sums
fi
POL_Config_Write LAST_TIMESTAMP "$WEB_TIMESTAMP"
else
POL_Debug_Message "List is up to date"
fi
}
maj_check
|