Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. var http = preload('res://_scene/Http.xml').instance()
  2. var imageFile = File.new()
  3. var imageName = ""
  4.  
  5. func LoadingDownloadKomik(s, l):
  6. var percent = s * 100 / l
  7. get_node("Panel/Label").set_text(str(percent))
  8. pass
  9.  
  10. func LoadedDownloadKomik(result):
  11. var path = "res://_storage/comic page/"
  12. if result != null:
  13. get_node("Panel/Label").set_text("")
  14. var dirImage = Directory.new()
  15. if dirImage.open(path) == OK:
  16. if dirImage.open(path + comicName) == OK:
  17. print("ada")
  18. else:
  19. dirImage.make_dir(comicName)
  20. var imgPath = path + comicName + "/" + str(imageDownloadedCounter) + imageName
  21. if dirImage.file_exists(imgPath):
  22. dirImage.remove(imgPath)
  23. imageFile.open(imgPath, 2)
  24. imageFile.store_buffer(result)
  25. imageFile.close()
  26. isCanSwipe = true
  27. if imageDownloadedCounter == 1:
  28. ShowPage(imgPath, 0)
  29. DownLoadImageManager()
  30. pass
  31.  
  32. func DownloadPageKomik(namaGambar):
  33. var domain = "https://komikng.com"
  34. var port = 80
  35. var ssl = false
  36. var imageAPI = "/storage/" + namaGambar
  37. imageName = namaGambar
  38.  
  39. http.get(domain, imageAPI, port, ssl)
  40. http.connect("loading", self, "LoadingDownloadKomik")
  41. http.connect("loaded", self, "LoadedDownloadKomik")
  42. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement