def path_transmit(path, fileData): if not session.get("user_id") and \ ((fileData.DownloadLimit is not None and fileData.Downloaded >= fileData.DownloadLimit) or \ (fileData.ExpiresIn is not None and time.time() > fileData.Uploaded + fileData.ExpiresIn)): if fileData.HideAfterLimitExceeded: return render_template("no_such_file.html") return render_template("limit_exceeded.html") fileData.Downloaded = model.Path.Downloaded + 1 geoipISOCode = "-" if app.config.get("ENABLE_GEOIP", False): try: geoipISOCode = addon.geoipGetCountry(request.remote_addr) except: import traceback print traceback.format_exc() db.session.add(model.History(path, request.remote_addr, int(time.time()), request.user_agent.string, request.referrer, geoipISOCode)) db.session.commit() return file.transmit(fileData.ActualName, fileData.File.StoredPath)
def file_transmit(no, fileData): return file.transmit("File_%s"%(no), fileData.StoredPath)