some more changes ...
This commit is contained in:
parent
6369ef3f52
commit
84a7065cbd
1 changed files with 798 additions and 796 deletions
|
@ -1,5 +1,6 @@
|
|||
#!/usr/local/bin/python3
|
||||
#!/usr/bin/python3
|
||||
|
||||
# this script is added to auto start of the pi zero in /etc/profiles ...
|
||||
|
||||
# this is the telegram version ... created with the @botFather of telegram
|
||||
# bot name: bully3
|
||||
|
@ -28,7 +29,7 @@ my_interpret1 = "unknownart1"
|
|||
my_song2 = "unknownsong2"
|
||||
my_interpret2 = "unknownart2"
|
||||
|
||||
test = True
|
||||
test = False
|
||||
|
||||
if test:
|
||||
# bully4
|
||||
|
@ -97,6 +98,7 @@ def telegram_ahoy_reply(body):
|
|||
global nextchecktime
|
||||
global starttime
|
||||
global auto_check_for_is1_is2
|
||||
global send_false_alarms
|
||||
|
||||
if (re.search("^list$", body, re.IGNORECASE) is not None) | (re.search("^l$", body, re.IGNORECASE) is not None):
|
||||
soup_page(15)
|
||||
|
@ -156,7 +158,7 @@ def telegram_ahoy_reply(body):
|
|||
if send_false_alarms:
|
||||
message = message + "Sending false alarms: ON\n"
|
||||
else:
|
||||
message = message + "Sending false alarms: ON\n"
|
||||
message = message + "Sending false alarms: OFF\n"
|
||||
message = message + "Last overall checktime: " + fullcurrenttime + "\n"
|
||||
message = message + "Last automatic checktime: " + lastwwwparsetime + "\n"
|
||||
message = message + "Next checktime: " + nextchecktime + "\n"
|
||||
|
@ -199,7 +201,6 @@ def telegram_ahoy_reply(body):
|
|||
|
||||
return message
|
||||
|
||||
|
||||
def write_to_file():
|
||||
global file_name
|
||||
global song1, interpret1, song2, interpret2
|
||||
|
@ -487,7 +488,7 @@ def remove_signs_from_string(string):
|
|||
string = string.replace("´", "")
|
||||
string = string.replace("’", "")
|
||||
string = re.sub(' +', ' ', string)
|
||||
string = string.strip()
|
||||
string = string.strip(" ")
|
||||
return string
|
||||
|
||||
def soup_2songs_page():
|
||||
|
@ -542,13 +543,13 @@ def soup_2songs_page():
|
|||
isstr = re.search(" *(.+?) *: *(.+?)$", item_text)
|
||||
if isstr:
|
||||
if is_nr == 1:
|
||||
iinterpret1 = isstr.group(1)
|
||||
isong1 = isstr.group(2)
|
||||
iinterpret1 = remove_signs_from_string(isstr.group(1))
|
||||
isong1 = remove_signs_from_string(isstr.group(2))
|
||||
#print("Interpret1 '" + iinterpret1 + "' - Song1 '" + isong1 + "'")
|
||||
is_nr = is_nr + 1
|
||||
elif is_nr == 2 :
|
||||
iinterpret2 = isstr.group(1)
|
||||
isong2 = isstr.group(2)
|
||||
iinterpret2 = remove_signs_from_string(isstr.group(1))
|
||||
isong2 = remove_signs_from_string(isstr.group(2))
|
||||
#print("Interpret2 '" + iinterpret2 + "' - Song2 '" + isong2 + "'")
|
||||
is_nr = is_nr + 1
|
||||
if parse_error == True:
|
||||
|
@ -780,14 +781,15 @@ bully3_bot = telegram.Bot(telegram_token)
|
|||
if __name__ == "__main__":
|
||||
|
||||
try:
|
||||
scanwwthread = scanThread(1,"parse_www")
|
||||
scanwwthread.start()
|
||||
telegramthread = telegramThread(1,"telegram_bot")
|
||||
telegramthread.start()
|
||||
scanwwthread = scanThread(1,"parse_www")
|
||||
scanwwthread.start()
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("Detected CTRL-C ... stopping the process. Please wait ...\n")
|
||||
run_thread = 0
|
||||
wait(10)
|
||||
scanwwthread.join()
|
||||
telegramthread.join()
|
||||
sys.exit()
|
||||
|
|
Loading…
Reference in a new issue