Exemple #1
0
def pillow_info():
    if request.method == "POST":
        path = request.form["path"]
        return render_template("get_image_info.html",
                               result=pillow_module.get_image_info(path),
                               path=path)
    else:
        defaulticon = fs.getCurrentDirectory() + PYTHONICON
        return render_template("get_image_info.html",
                               result="",
                               path=defaulticon)
Exemple #2
0
def pillow_mirror():
    if request.method == "POST":
        path = request.form["path"]
        mode = request.form["mode"]
        return render_template("pillow_mirror.html",
                               result=pillow_module.mirror_image(path, mode),
                               path=path,
                               mode=mode)
    else:
        defaulticon = fs.getCurrentDirectory() + PYTHONICON
        return render_template("pillow_mirror.html",
                               result=defaulticon,
                               path=defaulticon,
                               mode="")
Exemple #3
0
def pillow_rotate():
    if request.method == "POST":
        path = request.form["path"]
        angle = int(request.form["angle"])
        return render_template("pillow_rotate.html",
                               result=pillow_module.rotate_image(path, angle),
                               path=path,
                               angle=angle)
    else:
        defaulticon = fs.getCurrentDirectory() + PYTHONICON
        return render_template("pillow_rotate.html",
                               result=defaulticon,
                               path=defaulticon,
                               angle="")
Exemple #4
0
def pillow_resize():
    if request.method == "POST":
        path = request.form["path"]
        percent = int(request.form["percent"])
        return render_template("pillow_resize.html",
                               result=pillow_module.resize_image(
                                   path, percent),
                               path=path,
                               percent=percent)
    else:
        defaulticon = fs.getCurrentDirectory() + PYTHONICON
        return render_template("pillow_resize.html",
                               result=defaulticon,
                               path=defaulticon,
                               percent="")
Exemple #5
0
def pillow_convert():
    if request.method == "POST":
        path = request.form["path"]
        mode = request.form["mode"]
        if mode == "LA" and fs.getExtension(path) == ".jpg":
            return "Error: JPEG は LA を使用できません。"
        return render_template("pillow_convert.html",
                               result=pillow_module.convert_image(path, mode),
                               path=path,
                               mode=mode)
    else:
        defaulticon = fs.getCurrentDirectory() + PYTHONICON
        return render_template("pillow_convert.html",
                               result=defaulticon,
                               path=defaulticon,
                               mode="")
Exemple #6
0
def pillow_crop():
    if request.method == "POST":
        left_top = request.form["left_top"]
        right_bottom = request.form["right_bottom"]
        path = request.form["path"]
        return render_template("pillow_crop.html",
                               result=pillow_module.crop_image(
                                   path, left_top, right_bottom),
                               path=path,
                               left_top=left_top,
                               right_bottom=right_bottom)
    else:
        defaulticon = fs.getCurrentDirectory() + PYTHONICON
        return render_template("pillow_crop.html",
                               result=defaulticon,
                               path=defaulticon,
                               left_top="",
                               right_bottom="")
Exemple #7
0
  ret = False
  if Common.is_windows() :
    ret = path.endswith(".exe") or path.endswith(".bat") or or path.endswith(".ps1") or or path.endswith(".vbs")
  else :
    stinfo = os.stat(path)
    ret = stinfo.st_mode & S_IXUSR
  return ret

# path を テーブル Apps に挿入する。
def insertToApps(path) :
  title = fs.getFileName(path)
  platform = "linux"
  if Common.is_windows() :
    platform = "windows"
  sql = f"INSERT INTO Apps VALUES(NULL, '{title}', '{path}', '', '{platform}', '', '', CURRENT_DATE())"
  mysql.execute(sql)
  return

# START Program
settings = fs.readJson(fs.getCurrentDirectory() + '/InsApps.json')
binfolder = settings["binfolder"]

mysql = my.MySQL()

files = fs.listFiles2(binfolder)
for f in files :
  if isExecutable(f) :
    print(f)
    insertToApps(f)

print("終わり。")