1 ; ///////////////////////////////////////////////////////////////////////////////
2 ; // MPlayer for Windows - Install Script
3 ; // Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
5 ; // This program is free software; you can redistribute it and/or modify
6 ; // it under the terms of the GNU General Public License as published by
7 ; // the Free Software Foundation; either version 2 of the License, or
8 ; // (at your option) any later version.
10 ; // This program is distributed in the hope that it will be useful,
11 ; // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ; // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ; // GNU General Public License for more details.
15 ; // You should have received a copy of the GNU General Public License along
16 ; // with this program; if not, write to the Free Software Foundation, Inc.,
17 ; // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ; // http://www.gnu.org/licenses/gpl-2.0.txt
20 ; ///////////////////////////////////////////////////////////////////////////////
23 !include "LogicLib.nsh"
24 !include "WinMessages.nsh"
25 !include "StdUtils.nsh"
27 !define HWND_TOPMOST -1
32 ; ----------------------------------------------------------------------------
34 !define SetStatus "!insertmacro _SetStatus"
36 !macro _SetStatus text
37 SetDetailsPrint textonly
39 SetDetailsPrint listonly
43 ; ----------------------------------------------------------------------------
45 !define DownloadFile.Get '!insertmacro _DownloadFile "get" ""'
46 !define DownloadFile.Post '!insertmacro _DownloadFile "post"'
48 !define user_agent "Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20111106 IceCat/7.0.1"
50 !macro _DownloadFile action dl_post status_txt dl_url destfile
54 ${SetStatus} "${status_txt}"
55 DetailPrint "$(MPLAYER_LANG_DL_PROGRESS)"
56 !if "${action}" == "get"
57 inetc::get /CONNECTTIMEOUT 30 /RECEIVETIMEOUT 30 /CANCELTEXT "$(^CancelBtn)" /USERAGENT "${user_agent}" /SILENT "${dl_url}" "${destfile}" /END
59 !if "${action}" == "post"
60 inetc::post "${dl_post}" /CONNECTTIMEOUT 30 /RECEIVETIMEOUT 30 /CANCELTEXT "$(^CancelBtn)" /USERAGENT "${user_agent}" /CAPTION "${status_txt}" /POPUP "" "${dl_url}" "${destfile}" /END
64 ${IfThen} "$dl_tmp" == "OK" ${|} ${Break} ${|}
66 ${If} "$dl_tmp" == "File Open Error"
67 ${SetStatus} "$(MPLAYER_LANG_DL_FAILED)"
68 DetailPrint "Error: $dl_tmp"
69 MessageBox MB_TOPMOST|MB_ICONSTOP "$(MPLAYER_LANG_DL_UPDATE_FAILED)"
70 Abort "$(MPLAYER_LANG_DL_FAILED)"
73 ${If} "$dl_tmp" == "Cancelled"
74 ${SetStatus} "$(MPLAYER_LANG_DL_ABORTED)"
75 DetailPrint "$(MPLAYER_LANG_DL_ERROR): $dl_tmp"
76 ${IfCmd} MessageBox MB_TOPMOST|MB_RETRYCANCEL|MB_ICONEXCLAMATION "$(MPLAYER_LANG_DL_USER_ABORTED)" IDRETRY ${||} ${Continue} ${|}
77 MessageBox MB_TOPMOST|MB_ICONSTOP "$(MPLAYER_LANG_DL_UPDATE_FAILED)"
78 Abort "$(MPLAYER_LANG_DL_FAILED)"
81 IntOp $errors $errors + 3
82 DetailPrint "$(MPLAYER_LANG_DL_ERROR): $dl_tmp"
85 ${SetStatus} "$(MPLAYER_LANG_DL_FAILED)"
87 ${IfCmd} MessageBox MB_TOPMOST|MB_RETRYCANCEL|MB_ICONEXCLAMATION "$(MPLAYER_LANG_DL_FAILED_MSG) $dl_tmp$\n$(MPLAYER_LANG_DL_RETRY)" IDRETRY ${||} ${Continue} ${|}
88 MessageBox MB_TOPMOST|MB_ICONSTOP "$(MPLAYER_LANG_DL_UPDATE_FAILED)"
89 Abort "$(MPLAYER_LANG_DL_FAILED)"
91 ${SetStatus} "$(MPLAYER_LANG_DL_RESTARTING)"
96 DetailPrint "$(MPLAYER_LANG_DL_SUCCESSFULL)"
97 ${SetStatus} "$(MPLAYER_LANG_DL_COMPELETED)"