generated from pavel.muhortov/template-bash
Compare commits
4 Commits
540ddbe0a0
...
cd26b947cf
Author | SHA1 | Date | |
---|---|---|---|
cd26b947cf | |||
b06619e6a0 | |||
bc2498addd | |||
090c4f70dc |
|
@ -237,7 +237,8 @@ wp_user_pass = pass
|
||||||
wp_update_page_id = 4848
|
wp_update_page_id = 4848
|
||||||
#
|
#
|
||||||
# Optionality you can enable or disable publishing by Telegram:
|
# Optionality you can enable or disable publishing by Telegram:
|
||||||
# true - Wordpress enabled, false - Telegram disbaled.
|
# true - Telegram enabled, false - Telegram disbaled.
|
||||||
tg_enabled = true
|
tg_enabled = true
|
||||||
tg_api_key = TELEGRAM_API_KEY
|
tg_api_key = TELEGRAM_API_KEY
|
||||||
tg_chat_id = @blackhole
|
tg_chat_id = @blackhole
|
||||||
|
#tg_chat_id = -100123456789_123
|
|
@ -145,7 +145,7 @@ class Parse:
|
||||||
for line in strings.replace('\n', ';').split(';'):
|
for line in strings.replace('\n', ';').split(';'):
|
||||||
if not line.lstrip().startswith('#') and "=" in line:
|
if not line.lstrip().startswith('#') and "=" in line:
|
||||||
dictionary[line.split('=')[0].strip()] = (
|
dictionary[line.split('=')[0].strip()] = (
|
||||||
line.split('=')[1].strip().split(';')[0].strip()
|
line.split('=', maxsplit=1)[1].strip().split(';')[0].strip()
|
||||||
)
|
)
|
||||||
return dictionary
|
return dictionary
|
||||||
|
|
||||||
|
@ -565,11 +565,18 @@ class FFmpeg:
|
||||||
if que:
|
if que:
|
||||||
while True:
|
while True:
|
||||||
while not que.empty():
|
while not que.empty():
|
||||||
local_logger.debug(msg=que.get())
|
que_str = que.get()
|
||||||
|
local_logger.debug(msg=que_str)
|
||||||
|
|
||||||
|
trigger = "Delay between the first packet and last packet in the muxing queue"
|
||||||
|
if re.match(".*" + trigger + ".*", que_str):
|
||||||
|
Proc.kill(pid)
|
||||||
|
local_logger.debug(msg='exit by watchdog, reason: ' + trigger)
|
||||||
sleep(sec)
|
sleep(sec)
|
||||||
if que.empty():
|
if que.empty():
|
||||||
Proc.kill(pid)
|
Proc.kill(pid)
|
||||||
local_logger.debug(msg='exit by watchdog')
|
trigger = "que is empty for " + str(sec) + " seconds"
|
||||||
|
local_logger.debug(msg='exit by watchdog, reason: ' + trigger)
|
||||||
break
|
break
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
@ -2764,6 +2771,9 @@ class Telegram:
|
||||||
"parse_mode": parse_mode,
|
"parse_mode": parse_mode,
|
||||||
"disable_notification": True
|
"disable_notification": True
|
||||||
}
|
}
|
||||||
|
if '_' in chat:
|
||||||
|
data["chat_id"] = chat.split('_')[0]
|
||||||
|
data["message_thread_id"] = chat.split('_')[1]
|
||||||
response = requests.post(url=url, json=data, timeout=15)
|
response = requests.post(url=url, json=data, timeout=15)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
response = response.json()
|
response = response.json()
|
||||||
|
@ -2850,7 +2860,12 @@ class Telegram:
|
||||||
media_type == 'video' or
|
media_type == 'video' or
|
||||||
media_type == 'audio'
|
media_type == 'audio'
|
||||||
):
|
):
|
||||||
|
if '_' in chat:
|
||||||
|
thrd = chat.split('_')[1]
|
||||||
|
chat = chat.split('_')[0]
|
||||||
url = self.api_path + '/send' + media_type + '?chat_id=' + chat
|
url = self.api_path + '/send' + media_type + '?chat_id=' + chat
|
||||||
|
if thrd:
|
||||||
|
url = url + '?message_thread_id=' + thrd
|
||||||
else:
|
else:
|
||||||
raise ValueError("'media_type' value is wrong: " + media_type)
|
raise ValueError("'media_type' value is wrong: " + media_type)
|
||||||
|
|
||||||
|
@ -3067,6 +3082,9 @@ class Telegram:
|
||||||
'media': json.dumps(group),
|
'media': json.dumps(group),
|
||||||
"disable_notification": disable_notification
|
"disable_notification": disable_notification
|
||||||
}
|
}
|
||||||
|
if '_' in chat:
|
||||||
|
data["chat_id"] = chat.split('_')[0]
|
||||||
|
data["message_thread_id"] = chat.split('_')[1]
|
||||||
|
|
||||||
response = requests.post(url=url, data=data, files=files, timeout=300)
|
response = requests.post(url=url, data=data, files=files, timeout=300)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
|
@ -3795,7 +3813,7 @@ class Publish:
|
||||||
if period == 'm' or period == 'month':
|
if period == 'm' or period == 'month':
|
||||||
reg_exp = "_(?:[0-9]{4}|yyyy).(?:[0-9]{2}|mm_)(?:|-[0-9]).mp4"
|
reg_exp = "_(?:[0-9]{4}|yyyy).(?:[0-9]{2}|mm_)(?:|-[0-9]).mp4"
|
||||||
if period == 'y' or period == 'year':
|
if period == 'y' or period == 'year':
|
||||||
reg_exp = "_(?:[0-9]{4}|yyyy)(?:|-[0-9])"
|
reg_exp = "_(?:[0-9]{4}|yyyy)(?:|-[0-9]).mp4"
|
||||||
|
|
||||||
replace = 0
|
replace = 0
|
||||||
new_str = link
|
new_str = link
|
||||||
|
|
Loading…
Reference in New Issue
Block a user