add gdown.pl / update WinterMoon link to v1.2.3

This commit is contained in:
Christopher Roy Bratusek 2014-05-16 21:38:20 +02:00
parent 90fd3cd103
commit 60c9925806
4 changed files with 77 additions and 3 deletions

View File

@ -2,6 +2,8 @@ v4.96:
- wiimmfi/mkwiimm/kirbywii: minor improvements and fixups
- support RVLution Wii (a NewSMB Mod)
- update README.GAMEIDS
- update WinterMoon link to v1.2.3
- added gdown.pl (google-drive downloader) by circulosmeos
v4.95:
- fixed storing NewSMB mods into ${PATCHIMAGE_GAME_DIR}

View File

@ -40,6 +40,8 @@ setup_tools () {
SZS=${PATCHIMAGE_TOOLS_DIR}/../override/linux${SUFFIX}/wszst
fi
GDOWN=${PATCHIMAGE_TOOLS_DIR}/gdown.pl
}
ask_game () {
@ -333,7 +335,16 @@ check_riivolution_patch () {
${UNP} "${PATCHIMAGE_RIIVOLUTION_DIR}/${RIIVOLUTION_ZIP}" >/dev/null || exit 63
elif [[ ${PATCHIMAGE_RIIVOLUTION_DOWNLOAD} == "TRUE" ]]; then
x=4
if [[ ${DOWNLOAD_LINK} ]]; then
if [[ ${DOWNLOAD_LINK} == *docs.google* ]]; then
if [[ ! -f "${PATCHIMAGE_RIIVOLUTION_DIR}/${RIIVOLUTION_ZIP}" ]]; then
x=5
echo "*** >> downloading"
${GDOWN} "${DOWNLOAD_LINK}" "${PATCHIMAGE_RIIVOLUTION_DIR}/${RIIVOLUTION_ZIP}"__tmp >/dev/null || exit 57
mv "${PATCHIMAGE_RIIVOLUTION_DIR}/${RIIVOLUTION_ZIP}"__tmp "${PATCHIMAGE_RIIVOLUTION_DIR}/${RIIVOLUTION_ZIP}"
echo "*** >> unpacking"
${UNP} "${PATCHIMAGE_RIIVOLUTION_DIR}/${RIIVOLUTION_ZIP}" >/dev/null || exit 63
fi
elif [[ ${DOWNLOAD_LINK} ]]; then
if [[ ! -f "${PATCHIMAGE_RIIVOLUTION_DIR}/${RIIVOLUTION_ZIP}" ]]; then
x=5
echo "*** >> downloading"
@ -360,7 +371,7 @@ download_covers () {
for path in cover cover3D coverfull disc disccustom; do
wget -O ${PATCHIMAGE_COVER_DIR}/${1}_${path}.png \
http://art.gametdb.com/wii/${path}/EN/${1}.png &>/dev/null \
|| ( echo "Cover (${path}) does not exists for gameid ${1}." && \
|| ( echo "Cover (${path}) does not exist for gameid ${1}." && \
rm ${PATCHIMAGE_COVER_DIR}/${1}_${path}.png )
done

View File

@ -2,7 +2,7 @@
WORKDIR=nsmb.d
DOL=${WORKDIR}/sys/main.dol
DOWNLOAD_LINK="https://www.dropbox.com/s/3wyc49450iiz2ok/WinterMoon.rar"
DOWNLOAD_LINK="https://docs.google.com/uc?id=0B0P-eSDZCIexTXdHZm5Xbk9HbEU&export=download"
RIIVOLUTION_ZIP="WinterMoon.rar"
RIIVOLUTION_DIR="WinterMoon"
GAMENAME="SMMA+: Winter Moon"

61
tools/gdown.pl Executable file
View File

@ -0,0 +1,61 @@
#!/usr/bin/perl
#
# Google Drive direct download of big files
# ./gdown.pl 'gdrive file url' ['desired file name']
#
# v1.0 by circulosmeos 04-2014.
# http://circulosmeos.wordpress.com/2014/04/12/google-drive-direct-download-of-big-files
#
use strict;
my $TEMP='/tmp';
my $COMMAND;
my $confirm;
my $check;
sub execute_command();
my $URL=shift;
die "\n./gdown.pl 'gdrive file url' [desired file name]\n\n" if $URL eq '';
my $FILENAME=shift;
$FILENAME='gdown' if $FILENAME eq '';
execute_command();
while (-s $FILENAME < 100000) { # only if the file isn't the download yet
open fFILENAME, '<', $FILENAME;
$check=0;
foreach (<fFILENAME>) {
if (/href="(\/uc\?export=download[^"]+)/) {
$URL='https://docs.google.com'.$1;
$URL=~s/&amp;/&/g;
$confirm='';
$check=1;
last;
}
if (/confirm=([^;&]+)/) {
$confirm=$1;
$check=1;
last;
}
if (/"downloadUrl":"([^"]+)/) {
$URL=$1;
$URL=~s/\\u003d/=/g;
$URL=~s/\\u0026/&/g;
$confirm='';
$check=1;
last;
}
}
close fFILENAME;
die "Couldn't download the file :-(\n" if ($check==0);
$URL=~s/confirm=([^;&]+)/confirm=$confirm/ if $confirm ne '';
execute_command();
}
sub execute_command() {
$COMMAND="wget --load-cookie $TEMP/cookie.txt --save-cookie $TEMP/cookie.txt \"$URL\"";
$COMMAND.=" -O \"$FILENAME\"" if $FILENAME ne '';
`$COMMAND`;
return 1;
}