|
@@ -474,23 +474,11 @@ def get_url_type(url):
|
|
|
contentType = r.getheader('Content-Type')
|
|
|
return contentType
|
|
|
|
|
|
-def notify_line_user(msg, line_token):
|
|
|
- headers = {
|
|
|
- "Authorization": "Bearer " + line_token,
|
|
|
- "Content-Type": "application/x-www-form-urlencoded"
|
|
|
- }
|
|
|
- params = {"message": msg}
|
|
|
- r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params=params)
|
|
|
-
|
|
|
def notify_group(msg):
|
|
|
- glist=['WekCRfnAirSiSxALiD6gcm0B56EejsoK89zFbIaiZQD']
|
|
|
+ glist=['7vilzohcyQMPLfAMRloUawiTV4vtusZhxv8Czo7AJX8','WekCRfnAirSiSxALiD6gcm0B56EejsoK89zFbIaiZQD','1dbtJHbWVbrooXmQqc4r8OyRWDryjD4TMJ6DiDsdgsX','HOB1kVNgIb81tTB4Ort1BfhVp9GFo6NlToMQg88vEhh']
|
|
|
for gid in glist:
|
|
|
- headers = {
|
|
|
- "Authorization": "Bearer " + gid,
|
|
|
- "Content-Type": "application/x-www-form-urlencoded"
|
|
|
- }
|
|
|
- params = {"message": msg}
|
|
|
- r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params=params)
|
|
|
+ headers = {"Authorization": "Bearer " + gid,"Content-Type": "application/x-www-form-urlencoded"}
|
|
|
+ r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params={"message": msg})
|
|
|
|
|
|
|
|
|
def gen_video_long_queue(name_hash,name,text_content, image_urls,avatar,multiLang,video_id,user_id):
|
|
@@ -537,7 +525,7 @@ def gen_video_long_queue(name_hash,name,text_content, image_urls,avatar,multiLan
|
|
|
msg = '您本月額度剩下'+str(left_time)+'秒,此部影片有'+str(vid_duration)+'秒, 若要繼續產生影片請至 192.168.1.106:8887/confirm_add_value?name_hash='+name_hash+' 加值'
|
|
|
print(msg)
|
|
|
msg =msg.encode(encoding='utf-8')
|
|
|
- mailer.send(msg, email)
|
|
|
+ mailer.send_left_not_enough(msg, email)
|
|
|
#notify_line_user(msg, line_token)
|
|
|
notify_group(name+":帳號餘額不足,請至email查看詳細資訊")
|
|
|
else:
|
|
@@ -596,8 +584,9 @@ def gen_video_queue(name_hash,name,text_content, image_urls,avatar,multiLang,vid
|
|
|
msg = '您本月額度剩下'+str(left_time)+'秒,此部影片有'+str(vid_duration)+'秒, 若要繼續產生影片請至 192.168.1.106:8887/confirm_add_value?name_hash='+name_hash+' 加值'
|
|
|
print(msg)
|
|
|
msg =msg.encode(encoding='utf-8')
|
|
|
- mailer.send(msg, email)
|
|
|
- notify_line_user(msg, line_token)
|
|
|
+ mailer.send_left_not_enough(msg, email)
|
|
|
+ notify_group(msg)
|
|
|
+ #notify_line_user(msg, line_token)
|
|
|
else:
|
|
|
left_time = left_time - vid_duration
|
|
|
db.query('UPDATE users SET left_time ='+str(left_time)+' WHERE id='+str(user_id)+';')
|
|
@@ -642,6 +631,7 @@ def gen_video_queue_eng(name_hash,name,text_content, image_urls,sub_titles,avata
|
|
|
my_answer = remote_svc.call_video_eng(top1['name_hash'],top1['name'],top1['text_content'].split(','), top1['image_urls'].split(','),top1['subtitles'].split(','),top1['avatar']) # method call
|
|
|
shutil.copy(tmp_video_dir+top1['name_hash']+'.mp4',video_dest+top1['name_hash']+'.mp4')
|
|
|
os.remove(tmp_video_dir+top1['name_hash']+'.mp4')
|
|
|
+ notify_group(name+"(ENG)的影片已經產生完成囉! www.choozmo.com:8168/"+video_sub_folder+name_hash+".mp4")
|
|
|
except:
|
|
|
print('video generation error')
|
|
|
notify_group('影片錯誤')
|