#!/bin/bash
#######################################################
#                                                     #
#  Update checker    (DO NOT EDIT !!!)                #
#                                        version 2.6  #
#######################################################

if [ "$1" != "goupdater" ]; then
   echo -e "\n\e[31mERROR:\e[m Updater can not start outside of conky!\n"
   exit 1
fi

source "./player.ini"
source "./themes/$theme.ini"

if ! [ -f ./tempfiles/update_checked ]; then

   version=$(cat "./player.conky" | grep 'version=' | awk -F'=' '{print $2}')
   if [ "$showupdates" = "yes" ]; then
      curl -s "www.cobrasoft.nl/download/conky/musicplayer/updates" -o ./tempfiles/updates.tmp
      newversion=$(cat ./tempfiles/updates.tmp)
      if [ $newversion \> $version ]; then
        touch ./tempfiles/new_update
      else
        rm -f ./tempfiles/new_update
      fi
   fi
   rm -f ./tempfiles/updates.tmp

fi