remove debug prints and unused code

This commit is contained in:
mst 2024-11-26 15:14:57 +03:00
parent b98cf142d7
commit 74fd0ba646

26
app.py
View file

@ -256,9 +256,7 @@ def emojis():
packs = func.listEmojiPacks() packs = func.listEmojiPacks()
if packs: if packs:
for pack in packs: for pack in packs:
# print(pack,'\n')
json_pack = bool(pack.get('website') and pack.get('exportedAt')) json_pack = bool(pack.get('website') and pack.get('exportedAt'))
print(json_pack)
if json_pack: if json_pack:
break break
else: else:
@ -540,28 +538,7 @@ def uploadEmojiPack():
meta_json_path = extract_path / 'meta.json' meta_json_path = extract_path / 'meta.json'
if meta_json_path.exists(): if meta_json_path.exists():
processed_emojis = func.processEmojis(meta_json_path) processed_emojis = func.processEmojis(meta_json_path)
# emoji_metadata = func.loadJSON(meta_json_path)
# emojis = emoji_metadata.get('emojis', [])
# processed_emojis = []
# for emoji in emojis:
# emoji_info = {
# 'name': emoji['emoji']['name'],
# 'file_name': emoji['fileName']
# }
# processed_emojis.append(emoji_info)
# app.logger.debug(f"[CatAsk/API/upload_emoji_pack] Processed emoji: {emoji_info['name']} (File: {emoji_info['file_name']})")
# pack_json = {
# 'name': emoji_metadata['emojis'][0]['emoji']['category'].capitalize(),
# 'exportedAt': emoji_metadata["exportedAt"],
# 'emojis': processed_emojis
# }
# pack_json_name = const.emojiPath / (emoji_metadata['emojis'][0]['emoji']['category'] + '.json')
# func.saveJSON(pack_json, pack_json_name)
return jsonify({'message': f'Successfully uploaded and processed {len(processed_emojis)} emojis from archive "{filename}".'}), 201 return jsonify({'message': f'Successfully uploaded and processed {len(processed_emojis)} emojis from archive "{filename}".'}), 201
else: else:
return jsonify({'message': f'Archive {filename} successfully uploaded and extracted.'}), 201 return jsonify({'message': f'Archive {filename} successfully uploaded and extracted.'}), 201
@ -605,9 +582,7 @@ def deleteEmoji():
emoji_name = request.args.get('emoji_name') emoji_name = request.args.get('emoji_name')
emoji_base_path = const.emojiPath emoji_base_path = const.emojiPath
emoji_file_path = emoji_base_path / emoji_name emoji_file_path = emoji_base_path / emoji_name
print(emoji_file_path)
emoji_ext = os.path.splitext(f"{emoji_base_path}/{emoji_file_path}") emoji_ext = os.path.splitext(f"{emoji_base_path}/{emoji_file_path}")
print("emoji ext:", emoji_ext)
if not emoji_file_path.exists() or not emoji_file_path.is_file(): if not emoji_file_path.exists() or not emoji_file_path.is_file():
return jsonify({'error': 'Emoji not found'}), 404 return jsonify({'error': 'Emoji not found'}), 404
@ -729,7 +704,6 @@ def viewAnswer():
cursor.close() cursor.close()
conn.close() conn.close()
return jsonify(answer) return jsonify(answer)
"""
@api_bp.route('/update_config/', methods=['POST']) @api_bp.route('/update_config/', methods=['POST'])
@loginRequired @loginRequired