My favorites | Sign in
Project Logo
                
Search
for
Updated Nov 06, 2008 by pauldebruin
GrabberUpdateScript  
Script to automagically retrieve the latest release of tv_grab_nl_py

Introduction

Michel Janse heeft een script gemaakt om automagisch de laatste release van tv_grab_nl_py binnen te halen.

Script

Save as "grab-tv_grab_nl_py.sh"

<knip>

#!/bin/sh

# Get the page from Google Code telling us which is the current version
wget --quiet http://code.google.com/p/tvgrabnlpy/downloads/list

# Parse dynamically the filename we need to get (Quick and Dirty hack!)
export TV_GRAB_NL_PY_file=`grep tv_grab_nl_py-r list | grep "a onclick" | grep \=\"\> | awk -F = '{ print $5 }' | awk -F \& '{ print $1 }' | head -1`

# Remove the list downloaded from Google Code
rm list

# Get the new version from Google Code:
wget --quiet http://tvgrabnlpy.googlecode.com/files/$TV_GRAB_NL_PY_file

# Rename the damn thing to the normal filename, and make it executable :-)
mv $TV_GRAB_NL_PY_file tv_grab_nl_py
chmod 777 tv_grab_nl_py

# Print something fancy...
echo "Retrieved $TV_GRAB_NL_PY_file from Google Code and saved it as \"tv_grab_nl_py\"!"

# We're done...
exit 0

<knap>


Comment by mencobolt, Dec 06, 2008

Hmmm, ik heb hem iets aangepast. Dit is mijn versie die in cron.daily staat :

#!/bin/sh

F_OUT_LIST=/tmp/tv_grab_list 
F_OUT_TV=/tmp/tv_grab
TVGRAB=/usr/bin/tv_grab_nl_py

# Get the page from Google Code telling us which is the current version
wget --quiet http://code.google.com/p/tvgrabnlpy/downloads/list -O $F_OUT_LIST

# Parse dynamically the filename we need to get (Quick and Dirty hack!)
export TV_GRAB_NL_PY_file=`grep tv_grab_nl_py-r $F_OUT_LIST | grep "a onclick" | grep \=\"\> | awk -F = '{ print $5 }' | awk -F \& '{ print $1 }' | head -1`

# Remove the list downloaded from Google Code
rm $F_OUT_LIST

# Get the new version from Google Code:
wget --quiet http://tvgrabnlpy.googlecode.com/files/$TV_GRAB_NL_PY_file -O $F_OUT_TV

# Rename the damn thing to the normal filename, and make it executable :-)
chmod 777 $F_OUT_TV
mv $F_OUT_TV $TVGRAB

# Print something fancy...
echo "Retrieved $TV_GRAB_NL_PY_file from Google Code and saved it as \"$TVGRAB\"!"

# We're done...
exit 0
Comment by dajomas, Apr 24, 2009

Ik heb even de 3 greps, de 2 awks en de head aangepast naar de volgende regel:

export TV_GRAB_NL_PY_file=`awk -F= '/a onclick.*name=tv_grab_nl_py-r.*q=\">/ {split($5,x,"&");print x[1];exit}' $F_OUT_LIST`

Het complete script ziet er dan als volgt uit:

#!/bin/sh

F_OUT_LIST=/tmp/tv_grab_list 
F_OUT_TV=/tmp/tv_grab
TVGRAB=/usr/bin/tv_grab_nl_py

# Get the page from Google Code telling us which is the current version
wget --quiet http://code.google.com/p/tvgrabnlpy/downloads/list -O $F_OUT_LIST

# Parse dynamically the filename we need to get (Quick and a little bit less dirty hack! ;-) )
export TV_GRAB_NL_PY_file=`awk -F= '/a onclick.*name=tv_grab_nl_py-r.*q=\">/ {split($5,x,"&");print x[1];exit}' $F_OUT_LIST`

# Remove the list downloaded from Google Code
rm $F_OUT_LIST

# Get the new version from Google Code:
wget --quiet http://tvgrabnlpy.googlecode.com/files/$TV_GRAB_NL_PY_file -O $F_OUT_TV

# Rename the damn thing to the normal filename, and make it executable :-)
chmod 777 $F_OUT_TV
mv $F_OUT_TV $TVGRAB

# Print something fancy...
echo "Retrieved $TV_GRAB_NL_PY_file from Google Code and saved it as \"$TVGRAB\"!"

# We're done...
exit 0

Sign in to add a comment
Hosted by Google Code