58 lines
2.0 KiB
Python
Executable File
58 lines
2.0 KiB
Python
Executable File
# from django.core.mail import EmailMultiAlternatives
|
|
from django.utils import timezone
|
|
# from MNF.settings import EMAIL_HOST_USER
|
|
# from conversion.translation.translation_resources import ibm_watson, google, aws, azure, yandex, lingvanex
|
|
from ..mnfapp.models import MNFScriptDatabase
|
|
|
|
# def check_transalation_services():
|
|
# sentence = "This is MyNextFilm Translation Services Check"
|
|
# source_lang = "en"
|
|
# target_lang = "hi"
|
|
# non_working_services = []
|
|
# try:
|
|
# google(sentence, source_lang, target_lang)
|
|
# except:
|
|
# non_working_services.append("Google")
|
|
# try:
|
|
# ibm_watson(sentence, source_lang, target_lang)
|
|
# except:
|
|
# non_working_services.append("IBM WATSON")
|
|
# try:
|
|
# aws(sentence, source_lang, target_lang)
|
|
# except:
|
|
# non_working_services.append("AWS")
|
|
# try:
|
|
# azure(sentence, target_lang)
|
|
# except:
|
|
# non_working_services.append("Azure")
|
|
# # try:
|
|
# # lingvanex(sentence, source_lang, target_lang)
|
|
# # except:
|
|
# # non_working_services.append("Lingvanex")
|
|
# # try:
|
|
# # yandex(sentence, source_lang, target_lang)
|
|
# # except:
|
|
# # non_working_services.append("Yandex")
|
|
#
|
|
# if len(non_working_services) > 0:
|
|
# # -> Sending Email
|
|
# services_down = ", ".join(non_working_services)
|
|
# msgstr = "Following Translation are Down -> " + services_down
|
|
# msg = EmailMultiAlternatives("Translation Services are DOWN!!!!!", msgstr, EMAIL_HOST_USER, ["support@mynextfilm.com"])
|
|
# msg.send()
|
|
|
|
# def delete_empty_files_existing():
|
|
#
|
|
# scripts = MNFScriptDatabase.objects.all()
|
|
# print("Scripts are ->", scripts)
|
|
# for script in scripts:
|
|
#
|
|
# elapsed_time = (script.date_at - timezone.now()).total_seconds()
|
|
#
|
|
# # 15min
|
|
# if elapsed_time > 900 and len(str(script.script.name)) == 0:
|
|
# print("Script Deleted becuase 15 Mins has passed ->", script.script.name)
|
|
# script.delete()
|
|
|
|
|