Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var http = preload('res://_scene/Http.xml').instance()
- var imageFile = File.new()
- var imageName = ""
- func LoadingDownloadKomik(s, l):
- var percent = s * 100 / l
- get_node("Panel/Label").set_text(str(percent))
- pass
- func LoadedDownloadKomik(result):
- var path = "res://_storage/comic page/"
- if result != null:
- get_node("Panel/Label").set_text("")
- var dirImage = Directory.new()
- if dirImage.open(path) == OK:
- if dirImage.open(path + comicName) == OK:
- print("ada")
- else:
- dirImage.make_dir(comicName)
- var imgPath = path + comicName + "/" + str(imageDownloadedCounter) + imageName
- if dirImage.file_exists(imgPath):
- dirImage.remove(imgPath)
- imageFile.open(imgPath, 2)
- imageFile.store_buffer(result)
- imageFile.close()
- isCanSwipe = true
- if imageDownloadedCounter == 1:
- ShowPage(imgPath, 0)
- DownLoadImageManager()
- pass
- func DownloadPageKomik(namaGambar):
- var domain = "https://komikng.com"
- var port = 80
- var ssl = false
- var imageAPI = "/storage/" + namaGambar
- imageName = namaGambar
- http.get(domain, imageAPI, port, ssl)
- http.connect("loading", self, "LoadingDownloadKomik")
- http.connect("loaded", self, "LoadedDownloadKomik")
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement