提醒:本文最后更新于 2608 天前,文中所描述的信息可能已发生改变,请仔细核实。
11月最后一天,经过疯狂的加班,总算可以过过周末了,不过事情还是不少。
一直想写文章的,连文章都准备好了。但是内心突然没准备好发布。待以后再说吧。
明年1月15号,Google Code不再可上传文件到下载区了,原有下载文件仍然可以连接。新的文件,我也不想丢Google Drive里,所以势必转移所有文件。好在Google Code提供了Atom feeds,可以通过此来download所有在Google Code Download的文件,下面丢个autoit3脚本,可以下载所有文件(注意atom的显示数量)。不过我没加入容错,一般反正是没错的。请自行fix bug。
转移目标还没定。。不知道要放去哪里,要能外链还能不限流量,标准链接语法,稳定快速,全球可用,真难找。不知大家有什么推荐没有?
如果实在没有的话,考虑放本地。其他的没什么讲,看明天有时间就再扯扯。
话说,再送首歌吧!
; Name...........: Get Google Code Project’s Downloads
; Description ...: Download or list the project downloads flies.
; |The files from your google code project's downloads will be copied to the local folder from where the script is run.
; Author ........: kn007 <kn007 at 126 dot com>
; Parameters ....: $iFlag - Optional: specifies whether to list files to log or download files
; |$iFlag=0(Default) List files to LOG only
; |$iFlag=1 List and download these files
;==========================================================================Global Const $FO_OVERWRITE = 2 ; Write mode (erase previous contents)
Global $Atom = 'https://code.google.com/feeds/p/kn007/downloads/basic'
Global $Parameter = '?max-results='
Global $MaxNum = '300'
Main(1)
Func Main($iFlag=0)
Local $aSRE = List()
ArrayWriteLOG('atom_list', $aSRE)
If $iFlag = 0 Then Exit
Local $i, $sName, $iSize = UBound($aSRE)
For $i=0 To $iSize - 1
$sName=StringRegExp($aSRE[$i], '/files/(.*)', 3)
Local $hDownload = InetGet($aSRE[$i], @ScriptDir&'\'&$sName[0],1, 1)
Do
Sleep(1)
TraySetToolTip('Downloading: '&$aSRE[$i])
Until InetGetInfo($hDownload, 2)
InetClose($hDownload)
Next
Exit
EndFunc
Func ArrayWriteLOG($sFilename, $aArray)
Local $hFile = FileOpen(@ScriptDir & '\' &$sFilename & '.log', 1)
_FileWriteFromArray($hFile, $aArray)
FileClose($hFile)
EndFunc
Func List()
Local $sPreGet = $Atom&$Parameter&$MaxNum
Local $sResGet = Get($sPreGet)
Local $sPTN = '<link rel="direct" href="(.*)" />'
Return StringRegExp($sResGet, $sPTN, 3)
EndFunc
Func Get($oURL)
Local $oHTTP = ObjCreate('winhttp.winhttprequest.5.1')
$oHTTP.Open('get', $oURL, False)
$oHTTP.Send()
$sReturn = BinaryToString($oHTTP.responseBody)
$oHTTP.Nothing
Return $sReturn
EndFunc
;#FUNCTION#=================================================================
; Name...........: _FileWriteFromArray
; Description ...: Writes an array to a specified file.
; Author ........: Jos van der Zande <jdeb at autoitscript dot com>
; Modified.......: Updated for file handles by PsaltyDS, @error = 4 msg and 2-dimension capability added by Spiff59 and fixed by guinness.
;===========================================================================
Func _FileWriteFromArray($sFilePath, $aArray, $iBase = 0, $iUBound = 0, $sDelimeter = "|")
; Check if we have a valid array as input
If Not IsArray($aArray) Then Return SetError(2, 0, 0)
; Check the number of dimensions
Local $iDims = UBound($aArray, 0)
If $iDims > 2 Then Return SetError(4, 0, 0)
; Determine last entry of the array
Local $iLast = UBound($aArray) - 1
If $iUBound < 1 Or $iUBound > $iLast Then $iUBound = $iLast
If $iBase < 0 Or $iBase > $iLast Then $iBase = 0
; Open output file for overwrite by default, or use input file handle if passed
Local $hFileOpen
If IsString($sFilePath) Then
$hFileOpen = FileOpen($sFilePath, $FO_OVERWRITE)
Else
$hFileOpen = $sFilePath
EndIf
If $hFileOpen = -1 Then Return SetError(1, 0, 0)
; Write array data to file
Local $iError = 0
Switch $iDims
Case 1
For $i = $iBase To $iUBound
If FileWrite($hFileOpen, $aArray[$i] & @CRLF) = 0 Then
$iError = 3
ExitLoop
EndIf
Next
Case 2
Local $sTemp
Local $iCols = UBound($aArray, 2)
For $i = $iBase To $iUBound
$sTemp = $aArray[$i][0]
For $j = 1 To $iCols - 1
$sTemp &= $sDelimeter & $aArray[$i][$j]
Next
If FileWrite($hFileOpen, $sTemp & @CRLF) = 0 Then
$iError = 3
ExitLoop
EndIf
Next
EndSwitch
; Close file only if specified by a string path
If IsString($sFilePath) Then FileClose($hFileOpen)
; Return results
If $iError Then Return SetError($iError, 0, 0)
Return 1
EndFunc ;==>_FileWriteFromArray
转载请注明转自:kn007的个人博客的《十一月末,冒泡》