1 ; ///////////////////////////////////////////////////////////////////////////////
2 ; // MPlayer for Windows - Install Script
3 ; // Copyright (C) 2004-2024 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.Popup '!insertmacro _DownloadFile "popup"'
48 !define user_agent "Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20111106 IceCat/7.0.1"
50 !macro _DownloadFile action status_txt dl_url destfile
53 !if "${action}" != "get"
54 !if "${action}" != "popup"
55 !error "Invalid 'action' value has been specified!"
60 ${SetStatus} "${status_txt}"
61 DetailPrint "$(MPLAYER_LANG_DL_PROGRESS)"
62 !if "${action}" == "get"
63 inetc::get /CONNECTTIMEOUT 30 /RECEIVETIMEOUT 30 /CANCELTEXT "$(^CancelBtn)" /USERAGENT "${user_agent}" /SILENT "${dl_url}" "${destfile}" /END
65 !if "${action}" == "popup"
66 inetc::get /CONNECTTIMEOUT 30 /RECEIVETIMEOUT 30 /CANCELTEXT "$(^CancelBtn)" /USERAGENT "${user_agent}" /CAPTION "${status_txt}" /POPUP "" "${dl_url}" "${destfile}" /END
70 ${IfThen} "$dl_tmp" == "OK" ${|} ${Break} ${|}
72 ${If} "$dl_tmp" == "File Open Error"
73 ${SetStatus} "$(MPLAYER_LANG_DL_FAILED)"
74 DetailPrint "Error: $dl_tmp"
75 MessageBox MB_TOPMOST|MB_ICONSTOP "$(MPLAYER_LANG_DL_UPDATE_FAILED)"
76 Abort "$(MPLAYER_LANG_DL_FAILED)"
79 ${If} "$dl_tmp" == "Cancelled"
80 ${SetStatus} "$(MPLAYER_LANG_DL_ABORTED)"
81 DetailPrint "$(MPLAYER_LANG_DL_ERROR): $dl_tmp"
82 ${IfCmd} MessageBox MB_TOPMOST|MB_RETRYCANCEL|MB_ICONSTOP "$(MPLAYER_LANG_DL_USER_ABORTED)" IDRETRY ${||} ${Continue} ${|}
83 Abort "$(MPLAYER_LANG_DL_FAILED)"
86 IntOp $errors $errors + 3
87 DetailPrint "$(MPLAYER_LANG_DL_ERROR): $dl_tmp"
90 ${SetStatus} "$(MPLAYER_LANG_DL_FAILED)"
92 MessageBox MB_TOPMOST|MB_ICONSTOP "$(MPLAYER_LANG_DL_FAILED_MSG) $dl_tmp$\n$\n$(MPLAYER_LANG_DL_RETRY)"
93 Abort "$(MPLAYER_LANG_DL_FAILED)"
95 ${SetStatus} "$(MPLAYER_LANG_DL_RESTARTING)"
100 DetailPrint "$(MPLAYER_LANG_DL_SUCCESSFULL)"
101 ${SetStatus} "$(MPLAYER_LANG_DL_COMPELETED)"