Jonniy Posted August 29, 2013 Share Posted August 29, 2013 (edited) So, today I have a script that doesn't work as it should. It should select a path based on parameters, and then download the given file. Code: expandcollapse popupGlobal $sSite = 'yggdrasilradio.net' Global $sHTTP = 'http://' Global $sCurrentSongOldTitle = "2" Global $sDataFile = @TempDir & "\YWWData.html" Global $sDataSite = 'yggdrasilradio.net/data.php' Global $sArtSite1 = 'yggdrasilradio.net/images/albumart/largethumbs/' Global $sArtSite2 = 'yggdrasilradio.net/images/albumart/thumbs/' Global $sArtSite3 = 'yggdrasilradio.net/images/albumart/' Global $sArtPath = @TempDir & '\YWWArt.jpg' Local $aSongProps = GetSongInfo() GetSongImage($aSongProps[1], $aSongProps[12]) Func GetSongInfo() InetGet($sHTTP & $sDataSite, $sDataFile) If IsArray($aDataSplit1) == 1 Then For $i = 246 To 0 Step -1 _ArrayDelete($aDataSplit1, $i) Next EndIf Local $hDataFile = FileOpen($sDataFile) FileSetPos($hDataFile, 0, $FILE_BEGIN) Local $sDataFileRaw = FileRead($hDataFile) Local $aDataSplit1 = StringSplit($sDataFileRaw, "|") FileClose($hDataFile) FileDelete($sDataFile) Return $aDataSplit1 EndFunc ;==>GetSongInfo Func GetSongImage($iSongId, $sSongImagePath) InetGet($sHTTP & $sArtSite1 & $iSongId & ".jpg", $sArtPath) If StringInStr(FileRead(FileOpen($sArtPath)), "ErrorDocument") <> 0 Then FileClose(-1) FileDelete(-1) InetGet($sHTTP & $sArtSite2 & $iSongId & ".jpg", $sArtPath) If StringInStr(FileRead(FileOpen($sArtPath)), "ErrorDocument") <> 0 Then FileClose(-1) FileDelete(-1) If StringInStr($sSongImagePath, "*./", 1) <> 0 Then InetGet($sHTTP & $sArtSite3 & StringTrimLeft($sSongImagePath, "3"), $sArtPath) ElseIf StringInStr($sSongImagePath, "*", 1) <> 0 Then InetGet($sHTTP & $sArtSite3 & StringTrimLeft($sSongImagePath, "1"), $sArtPath) Else InetGet($sHTTP & $sArtSite3 & $sSongImagePath, $sArtPath) EndIf If StringInStr(FileRead(FileOpen($sArtPath)), "ErrorDocument") <> 0 Then GUICtrlSetImage($hImageSongImageT1, $sImageDummy) FileClose(-1) FileDelete(-1) EndIf Else GUICtrlSetImage($hImageSongImageT1, $sArtPath) EndIf Else GUICtrlSetImage($hImageSongImageT1, $sArtPath) EndIf EndFunc ;==>GetSongImage The complete code is here (fixed): https://mega.co.nz/#!sodATRaL!UU19gSK1sML0zvVmm8lloxvMDl9rCWfM2x-hrNgHRAc (ISN AutoIt Studio Format). I appreciate any help. Greets, Jonniy Edited August 29, 2013 by Jonniy Links and attachment removed at OP's request Thanks for your help & have a good day. Yours sincerely, -Jonniy- Link to comment Share on other sites More sharing options...
JohnOne Posted August 29, 2013 Share Posted August 29, 2013 Do we have to guess what goes wrong? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Solution Jonniy Posted August 29, 2013 Author Solution Share Posted August 29, 2013 (edited) I don't reaaly know what goes wrong, but one can enter debug lines. I'll do so tomorrow, because I've to go now. EDIT: Ok, I figured it out. I thought that if the image woudn't exist, it would download the error page. But that isn't the case. Now I use FileExists instead. Edited August 30, 2013 by Jonniy Thanks for your help & have a good day. Yours sincerely, -Jonniy- Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now