Skip to content

Commit

Permalink
2.1.0.6
Browse files Browse the repository at this point in the history
* Corrected :
 - Problem on System Media Download
 - Cleaning some
security issue
 - Changing TimeOut handler
* Added :
 - New Handling of
scrape Engine (it will not hammer so much the server)
* Profil
modification :
 - No more Retropie(Video) profil. Now you can choose to
add video and marquee directly in the "Option Configuration Menu"
  • Loading branch information
Universal-Rom-Tools committed Feb 4, 2017
1 parent 358d974 commit 2b4753d
Show file tree
Hide file tree
Showing 14 changed files with 311 additions and 616 deletions.
32 changes: 20 additions & 12 deletions Include/_MyFunction.au3
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Func _LOG($iMessage = "", $iLOGType = 0, $iLOGPath = @ScriptDir & "\Log.txt")
EndIf
ConsoleWrite("!" & $iMessage & @CRLF)
Case 3
;~ FileWrite($iLOGPath, $iTimestamp & $iMessage & @CRLF)
FileWrite($iLOGPath, $iTimestamp & $iMessage & @CRLF)
ConsoleWrite(">----" & $iMessage & @CRLF)
EndSwitch
EndFunc ;==>_LOG
Expand Down Expand Up @@ -189,20 +189,26 @@ EndFunc ;==>_CheckURL
; Related .......:
; Link ..........;
; Example .......; No
Func _Download($iURL, $iPath, $iTimeOut = 20, $iCRC = default)
Local $inetgettime = 0, $aData, $hDownload
Func _Download($iURL, $iPath, $iTimeOut = 10, $iCRC = Default)
Local $inetgettime = 0, $aData, $hDownload, $vDataDL = 0
If $iURL = "" Then
_LOG("Nothing to Downloaded : " & $iPath, 2, $iLOGPath)
Return -1
EndIf
$hDownload = InetGet($iURL, $iPath,$INET_FORCERELOAD , $INET_DOWNLOADBACKGROUND)
$hDownload = InetGet($iURL, $iPath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
Do
Sleep(250)
$inetgettime = $inetgettime + 0.25
$aData = InetGetInfo($hDownload)
If $aData[$INET_DOWNLOADREAD] > $vDataDL Then
$vDataDL = $aData[$INET_DOWNLOADREAD]
Else
$inetgettime = $inetgettime + 0.25
EndIf
If $inetgettime > $iTimeOut Then
InetClose($hDownload)
_LOG("File Downloading URL : " & $iURL, 3, $iLOGPath)
_LOG("Timed out (" & $inetgettime & "s) for downloading file : " & $iPath, 1, $iLOGPath)
FileDelete($iPath)
Return -2
EndIf
Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) ; Check if the download is complete.
Expand All @@ -218,22 +224,23 @@ Func _Download($iURL, $iPath, $iTimeOut = 20, $iCRC = default)

InetClose($hDownload)
If $aData[$INET_DOWNLOADSUCCESS] Then
If ($aData[$INET_DOWNLOADSIZE]<>0 And $aData[$INET_DOWNLOADREAD] <> $aData[$INET_DOWNLOADSIZE]) Or FileGetSize($iPath) < 50 Then
If ($aData[$INET_DOWNLOADSIZE] <> 0 And $aData[$INET_DOWNLOADREAD] <> $aData[$INET_DOWNLOADSIZE]) Or FileGetSize($iPath) < 50 Then
_LOG("Error Downloading URL : " & $iURL, 3, $iLOGPath)
_LOG("Error Downloading File : " & $iPath, 2, $iLOGPath)
_LOG("Error File Line 1 : " & FileReadLine($iPath), 2, $iLOGPath)
_LOG("Bytes read: " & $aData[$INET_DOWNLOADREAD], 2, $iLOGPath)
_LOG("Size: " & $aData[$INET_DOWNLOADSIZE], 2, $iLOGPath)
FileDelete($iPath)
Return -1
EndIf

If $iCRC <> Default Then
$vDlCRC = StringRight(_CRC32ForFile($iPath), 8)
If $vDlCRC <> $iCRC Then
_LOG("Error CRC File ("& $vDlCRC & " <> " & $iCRC &") : " & $iPath, 2, $iLOGPath)
_LOG("Error CRC File (" & $vDlCRC & " <> " & $iCRC & ") : " & $iPath, 2, $iLOGPath)
;~ Return -1
Else
_LOG(">>> CRC OK ("& $vDlCRC & " = " & $iCRC &") : " & $iPath, 1, $iLOGPath)
_LOG(">>> CRC OK (" & $vDlCRC & " = " & $iCRC & ") : " & $iPath, 1, $iLOGPath)
EndIf
EndIf
_LOG("File Downloading URL : " & $iURL, 3, $iLOGPath)
Expand All @@ -248,6 +255,7 @@ Func _Download($iURL, $iPath, $iTimeOut = 20, $iCRC = default)
_LOG("successful: " & $aData[$INET_DOWNLOADSUCCESS], 2, $iLOGPath)
_LOG("@error: " & $aData[$INET_DOWNLOADERROR], 2, $iLOGPath)
_LOG("@extended: " & $aData[$INET_DOWNLOADEXTENDED], 2, $iLOGPath)
FileDelete($iPath)
Return -1
EndIf
EndFunc ;==>_Download
Expand All @@ -268,7 +276,7 @@ EndFunc ;==>_Download
; Related .......:
; Link ..........;
; Example .......; No
Func _DownloadWRetry($iURL, $iPath, $iRetry = 3, $iTimeOut = 20, $iCRC = default)
Func _DownloadWRetry($iURL, $iPath, $iRetry = 3, $iTimeOut = 10, $iCRC = Default)
Local $iCount = 0, $iResult = -1, $vTimer = TimerInit()
While $iResult < 0 And $iCount < $iRetry
$iCount = $iCount + 1
Expand Down Expand Up @@ -582,7 +590,7 @@ Func _MakeTEMPFile($iPath, $iPath_Temp)
If Not FileCopy($iPath, $iPath_Temp, $FC_OVERWRITE + $FC_CREATEPATH) Then
Sleep(250)
If Not FileCopy($iPath, $iPath_Temp, $FC_OVERWRITE + $FC_CREATEPATH) Then
_LOG("Error copying " & $iPath & " to " & $iPath_Temp &" ("&FileGetSize($iPath)&")", 2, $iLOGPath)
_LOG("Error copying " & $iPath & " to " & $iPath_Temp & " (" & FileGetSize($iPath) & ")", 2, $iLOGPath)
Return -1
EndIf
EndIf
Expand Down Expand Up @@ -690,7 +698,7 @@ Func _GDIPlus_ResizeMax($iPath, $iMAX_Width, $iMAX_Height)
$iWidth = _GDIPlus_ImageGetWidth($hImage)
If $iWidth = 4294967295 Then $iWidth = 0 ;4294967295 en cas d'erreur.
$iHeight = _GDIPlus_ImageGetHeight($hImage)
If $iWidth = -1 Or $iHeight = -1 Then MsgBox(0,"error",$iPath & " or " & $iPath_Temp & " Fucked")
If $iWidth = -1 Or $iHeight = -1 Then MsgBox(0, "error", $iPath & " or " & $iPath_Temp & " Fucked")
$iRatio = $iHeight / $iWidth
If $iMAX_Width <= 0 And $iMAX_Height > 0 Then $iMAX_Width = $iMAX_Height / $iRatio
If $iMAX_Height <= 0 And $iMAX_Width > 0 Then $iMAX_Height = $iMAX_Width * $iRatio
Expand Down Expand Up @@ -1733,7 +1741,7 @@ EndFunc ;==>_XML_Read
; Related .......:
; Link ..........;
; Example .......; No
Func _XML_Replace($iXpath, $iValue, $iXMLType = 0, $iXMLPath = "", $oXMLDoc = "")
Func _XML_Replace($iXpath, $iValue =" ", $iXMLType = 0, $iXMLPath = "", $oXMLDoc = "")
Local $iXMLValue = -1, $oNode, $iXpathSplit, $iXMLAttributeName
If $iXMLPath = "" And $oXMLDoc = "" Then
_LOG('_XML_Replace Error : Need an Handle or Path', 2, $iLOGPath)
Expand Down
189 changes: 0 additions & 189 deletions ProfilsFiles/Retropie (MIX)(Video).xml

This file was deleted.

46 changes: 45 additions & 1 deletion ProfilsFiles/Retropie (MIX).xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,32 @@
<Target_Path_Type>%XML_Path_File%</Target_Path_Type>
<Target_Value>game/image</Target_Value>
</Element>
<Element Type="Picture">
<Element Type="Thumbnail">
<Source_Type>Fixe_Value</Source_Type>
<Source_Value></Source_Value>
<Target_Type>XML_Value</Target_Type>
<Target_Value>game/thumbnail</Target_Value>
</Element>
<Element Type="Marquee">
<Source_Type>XML_Download</Source_Type>
<Source_Download_Path>%Local_Path_File%</Source_Download_Path>
<Source_Download_Tag>-marquee</Source_Download_Tag>
<Source_Download_Ext>jpg</Source_Download_Ext>
<Source_Value>None</Source_Value>
<Target_Type>XML_Path</Target_Type>
<Target_Path_Type>%XML_Path_File%</Target_Path_Type>
<Target_Value>game/marquee</Target_Value>
</Element>
<Element Type="Video">
<Source_Type>XML_Download</Source_Type>
<Source_Download_Path>%Local_Path_File%</Source_Download_Path>
<Source_Download_Tag>-video</Source_Download_Tag>
<Source_Download_Ext>mp4</Source_Download_Ext>
<Source_Value>None</Source_Value>
<Target_Type>XML_Path</Target_Type>
<Target_Path_Type>%XML_Path_File%</Target_Path_Type>
<Target_Value>game/video</Target_Value>
</Element>
<Element Type="Rating">
<Source_Type>XML_Value</Source_Type>
<Source_Value>Data/jeu/note</Source_Value>
Expand Down Expand Up @@ -175,5 +195,29 @@
<Source_Value_Option Name="UpperCase" Desc="Genre in UPPER CASE">True</Source_Value_Option>
<Source_Value_Option Name="LowerCase" Desc="Genre in LOWER CASE">False</Source_Value_Option>
</Option>
<Option>
<Option_Name>Marquee</Option_Name>
<Type>Marquee</Type>
<NodeName>Source_Value</NodeName>
<Source_Value_Option Name="Nothing" Desc="Don't download the Marquee">None</Source_Value_Option>
<Source_Value_Option Name="Marquee" Desc="Download the Marquee">Data/jeu/medias/media_marquee</Source_Value_Option>
<Source_Value_Option Name="Screenshot" Desc="The Game Screenshot">Data/jeu/medias/media_screenshot</Source_Value_Option>
<Source_Value_Option Name="Box 2D" Desc="The Box Front in 2D">Data/jeu/medias/media_boxs/media_boxs2d/media_box2d_%COUNTRY%</Source_Value_Option>
<Source_Value_Option Name="Box 3D" Desc="The Box Front and Side in 3D">Data/jeu/medias/media_boxs/media_boxs3d/media_box3d_%COUNTRY%</Source_Value_Option>
<Source_Value_Option Name="Box Texture" Desc="The Box Back, Side and Front">Data/jeu/medias/media_boxs/media_boxstexture/media_boxtexture_%COUNTRY%</Source_Value_Option>
<Source_Value_Option Name="Support 2D" Desc="The Media in 2D">Data/jeu/medias/media_supports/media_supports2d/media_support2d_%COUNTRY%</Source_Value_Option>
<Source_Value_Option Name="Support Texture" Desc="The Media Label">Data/jeu/medias/media_supports/media_supportstexture/media_supporttexture_%COUNTRY%</Source_Value_Option>
<Source_Value_Option Name="Fanart" Desc="Big Fanart representing the game">Data/jeu/medias/media_fanart</Source_Value_Option>
<Source_Value_Option Name="Wheels" Desc="The game Logo">Data/jeu/medias/media_wheels/media_wheel_%COUNTRY%</Source_Value_Option>
<Source_Value_Option Name="Wheels Carbon" Desc="The game Logo in a Carbon Wheel">Data/jeu/medias/media_wheelscarbon/media_wheelcarbon_%COUNTRY%</Source_Value_Option>
<Source_Value_Option Name="Wheels Steel" Desc="The game Logo in a Steel Wheel">Data/jeu/medias/media_wheelssteel/media_wheelsteel_%COUNTRY%</Source_Value_Option>
</Option>
<Option>
<Option_Name>Video</Option_Name>
<Type>Video</Type>
<NodeName>Source_Value</NodeName>
<Source_Value_Option Name="Yes" Desc="Download the Video">Data/jeu/medias/media_video</Source_Value_Option>
<Source_Value_Option Name="No" Desc="Don't download the Video">None</Source_Value_Option>
</Option>
</Options>
</Profil>
Loading

0 comments on commit 2b4753d

Please sign in to comment.