杉宫竹苑工作室

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2643|回复: 0

在线下载软件

[复制链接]
发表于 2017-3-4 16:05:17 | 显示全部楼层 |阅读模式

正式会员享受无限制浏览网站功能和高速网盘下载,赶快加入本站吧!

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. Name "Test Download And Convert Video"
  2. Caption "Test Download And Convert Video"
  3. OutFile "Test Download And Convert Video.exe"
  4. InstallDir "$TEMP\Test Download And Convert Video"

  5. # Compress

  6. SetCompressor /SOLID /FINAL lzma

  7. # Include

  8. !include "MUI2.nsh"
  9. !include "WinCore.nsh"
  10. !include "LogicLib.nsh"
  11. !include "WinMessages.nsh"
  12. !include "FileFunc.nsh"
  13. !insertmacro GetFileName
  14. !insertmacro GetParameters
  15. !insertmacro DriveSpace
  16. !insertmacro GetParent
  17. !insertmacro GetOptions
  18. !insertmacro GetDrives
  19. !insertmacro GetRoot
  20. !insertmacro GetSize

  21. # Runtime

  22. RequestExecutionLevel Admin

  23. ShowInstDetails hide
  24. ShowInstDetails nevershow
  25. XPStyle off

  26. BrandingText /TRIMRIGHT " "

  27. # Page

  28. Page instfiles "" ""

  29. !insertmacro MUI_LANGUAGE "English"

  30. Function .onInit
  31. FunctionEnd

  32. var /GLOBAL LINK
  33. var /GLOBAL YOUVIDEO
  34. var /GLOBAL BASEFILENAME

  35. Section "Main" SEC001

  36. DetailPrint `Check FFMPeg if exist ...`

  37. IfFileExists "$EXEDIR\FFMpeg\FFMpeg.exe" "NSIS.Detect.FFMPeg.App" "NSIS.Download.FFMPeg.App"
  38. NSIS.Download.FFMPeg.App:

  39. DetailPrint `Downloading FFMpeg ...`

  40. System::Call 'kernel32::CreateDirectoryW(w "$TEMP\FFMpeg", i0)i.r0?e'

  41. inetc::get "https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20170221-a5c1c7a-win32-static.zip" "$TEMP\FFMpeg\ffmpeg-20170221-a5c1c7a-win32-static.zip" /END
  42. Pop $0
  43. StrCmp $0 "OK" +3
  44.   MessageBox MB_OK|MB_ICONEXCLAMATION "$0.Error Downloading!"
  45. Goto Cancelled

  46. System::Call 'kernel32::CreateDirectoryW(w "$EXEDIR\FFMpeg", i0)i.r0?e'

  47. nsisunz::UnzipToLog "$TEMP\FFMpeg\ffmpeg-20170221-a5c1c7a-win32-static.zip" "$TEMP\FFMpeg"
  48. Pop $0
  49. StrCmp $0 "success" ok
  50.   DetailPrint "$0" ;print error message to log
  51. ok:

  52. ClearErrors

  53. SetShellVarContext "all"

  54. nsExec::ExecToStack '"$SYSDIR\xcopy.exe" /y /r "$TEMP\FFMpeg\ffmpeg-20170221-a5c1c7a-win32-static\bin\*.*" /d "$EXEDIR\FFMpeg"' $0
  55. Pop $0
  56. Pop $1

  57. IfFileExists "$EXEDIR\FFMpeg\FFMpeg.exe" "NSIS.Detect.FFMPeg.App" "Next.Step"

  58. GoTo Next.Step

  59. NSIS.Detect.FFMPeg.App:

  60. GoTo Next.Step

  61. Next.Step:

  62. DetailPrint `Check Youtube-dl if exist ...`

  63. IfFileExists "$EXEDIR\Youtube-dl\youtube-dl.exe" "NSIS.Detect.Youtube-dl.App" "NSIS.Download.Youtube-dl.App"

  64. NSIS.Download.Youtube-dl.App:

  65. DetailPrint `Downloading Youtube-dl ...`

  66. System::Call 'kernel32::CreateDirectoryW(w "$EXEDIR\Youtube-dl", i0)i.r0?e'

  67. inetc::get "https://yt-dl.org/downloads/2017.02.17/youtube-dl.exe" "$EXEDIR\Youtube-dl\youtube-dl.exe" /END
  68. Pop $0
  69. StrCmp $0 "OK" +3
  70.   MessageBox MB_OK|MB_ICONEXCLAMATION "$0.Error Downloading!"
  71. Goto Cancelled

  72. IfFileExists "$EXEDIR\Youtube-dl\youtube-dl.exe" "NSIS.Detect.Youtube-dl.App" "Next.Step1"

  73. GoTo Next.Step1

  74. NSIS.Detect.Youtube-dl.App:

  75. GoTo Next.Step1

  76. Next.Step1:

  77. DetailPrint `Downloading your video ...Please wait for a moments ...`

  78. # Download

  79. System::Call 'kernel32::CreateDirectoryW(w "C:\Downloads", i0)i.r0?e'

  80. # YOUTUBE-DL CONFIG

  81. Strcpy $LINK "https://www.youtube.com/watch?v=k85mRPqvMbE"

  82. nsExec::ExecToStack '"$EXEDIR\Youtube-dl\youtube-dl.exe" --skip-download --get-filename "$LINK"' $0
  83. pop $0
  84. pop $1
  85. Strcpy $YOUVIDEO "$1"

  86. DetailPrint `Downloading ...$1`

  87. nsExec::ExecToStack '"$EXEDIR\Youtube-dl\youtube-dl.exe" -q --continue -f mp4 --no-part "$LINK" -o "C:\Downloads\%(title)s-%(id)s.%(ext)s"' $0
  88. pop $0
  89. pop $1
  90. ${GetBaseName} "C:\Downloads\$YOUVIDEO" $BASEFILENAME
  91. IfFileExists "C:\Downloads\$BASEFILENAME.mp4" "NSIS.Done.Download.Video" "NSIS.Failed.Download.Video"

  92. NSIS.Done.Download.Video:
  93. DetailPrint `NSIS was sucessfully download your video!`
  94. MessageBox MB_YESNO|MB_USERICON "NSIS was sucessfully download your video!$\n$\nDo you want convert this download video?" IDYES "NSIS.Yes.Convert.Video" IDNO "NSIS.Skyp.And.Continue"
  95. Abort

  96. NSIS.Yes.Convert.Video:

  97. # FFMPeg CONFIG

  98. System::Call 'kernel32::CreateDirectoryW(w "C:\Converts", i0)i.r0?e'

  99. ${GetBaseName} "C:\Downloads\$YOUVIDEO" $BASEFILENAME

  100. nsExec::ExecToStack '"$EXEDIR\FFMpeg\FFMpeg.exe" -i "C:\Downloads\$BASEFILENAME.mp4" -s hd1080 -c:v libx264 -crf 23 -c:a aac -strict -2 -pix_fmt yuv420p "C:\Converts\$BASEFILENAME.mp4"' $0
  101. Pop $0
  102. Pop $1
  103. DetailPrint `Converting ... $1`
  104. IfFileExists "C:\Converts\$BASEFILENAME.mp4" "NSIS.Done.Convert.Video" "NSIS.Failed.Convert.Video"

  105. NSIS.Done.Convert.Video:

  106. ${GetSize} "C:\Converts" "/M=$BASEFILENAME.mp4 /S=0K" $0 $1 $2
  107. IfErrors 0 +2
  108. StrCpy $0 $0 * 1024
  109. IntCmp $0 100 +3 0 +3
  110. IntCmp $0 0 +2 +2 0
  111. IntOp $0 103 + 0
  112. IntOp $0 $0 * 10
  113. IntOp $0 $0 / 1024
  114. StrCpy $1 "$0" "" -1
  115. IntCmp $0 9 +3 +3 0
  116. StrCpy $0 "$0" -1 ""
  117. Goto +2
  118. StrCpy $0 "0"

  119. DetailPrint `NSIS was succesfully convert your video! ($0.$1 MiB)`
  120. Abort

  121. NSIS.Failed.Convert.Video:
  122. DetailPrint `NSIS was failed convert your video!`
  123. Abort

  124. NSIS.Failed.Download.Video:
  125. DetailPrint `NSIS was failed download your video!`
  126. Abort

  127. NSIS.Skyp.And.Continue:
  128. DetailPrint `NSIS continue installing files ...`
  129. Abort

  130. Cancelled:
  131. DetailPrint `NSIS was failed download files ...`
  132. SetAutoClose true
  133. SectionEnd

  134. Function .onGUIEND
  135. FunctionEnd  
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|SgzyStudio

GMT+8, 2024-4-29 10:44 , Processed in 0.115108 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表