} ''' from Py365Lib import Common, FileSystem as fs, MySQL # START # パラメータ確認 if Common.count_args() < 1 : Common.stop("Usage : Ins_VideosSQL.py filelist [json]") filelist = Common.args(0) album = 0 media = "media" series = "series" mark = "mark" info = "info" if Common.count_args() >= 2 : json = fs.readJson(Common.args(1)) album = json["album"] media = json["media"] series = json["series"] mark = json["mark"] info = json["info"] else : pass # ファイルリストを読む。 filename = "insert.sql" lines = fs.readLines(filelist) firstdata = True sql = "" #with open(filename, mode="w", encoding='utf_8_sig') as f : with open(filename, mode="w", encoding='shift_jis') as f :
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("終わり。")