msekoyan commited on
Commit
75e5132
·
verified ·
1 Parent(s): 18e428a

Update yt_utils.py

Browse files
Files changed (1) hide show
  1. yt_utils.py +21 -3
yt_utils.py CHANGED
@@ -14,11 +14,11 @@ class Logger:
14
  def __init__(self, filename):
15
  self.filename = filename
16
  self.logs = open(filename, "w+")
17
- self.logs.write("The download has not started yet!\n")
18
  self.code_pattern = r"(?<=enter code )[\w-]+"
19
  self.access_got = False
20
 
21
- self.logs_list = ["The download has not started yet!"]
22
 
23
  def info(self, message):
24
  DEV_LOGGER.info(f'YT INFO MESSAGE: {message}')
@@ -33,7 +33,7 @@ class Logger:
33
 
34
  DEV_LOGGER.info(f'YT MESSAGE: {message}')
35
 
36
- if "The download has not started yet!" in self.logs_list:
37
  self.logs_list = []
38
  self.logs.seek(0)
39
  self.logs.truncate(0)
@@ -82,6 +82,24 @@ class Logger:
82
 
83
  self.logs_list = ["The download has not started yet!"]
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  def complete_logs(self):
86
  message = '✅ Download Completed!\n'
87
  if message not in self.logs_list:
 
14
  def __init__(self, filename):
15
  self.filename = filename
16
  self.logs = open(filename, "w+")
17
+ self.logs.write("See the demo video transcription below!\n")
18
  self.code_pattern = r"(?<=enter code )[\w-]+"
19
  self.access_got = False
20
 
21
+ self.logs_list = ["See the demo video transcription below!"]
22
 
23
  def info(self, message):
24
  DEV_LOGGER.info(f'YT INFO MESSAGE: {message}')
 
33
 
34
  DEV_LOGGER.info(f'YT MESSAGE: {message}')
35
 
36
+ if "The download has not started yet!" in self.logs_list or "See demo video transcription below!" in self.logs_list:
37
  self.logs_list = []
38
  self.logs.seek(0)
39
  self.logs.truncate(0)
 
82
 
83
  self.logs_list = ["The download has not started yet!"]
84
 
85
+ def reset_logs_for_demo(self):
86
+ self.access_got = False
87
+ self.logs.seek(0)
88
+ self.logs.truncate(0)
89
+ self.logs.write('See the demo video transcription below!\n')
90
+ self.logs.flush()
91
+
92
+ self.logs_list = ["See the demo video transcription below!"]
93
+
94
+ def remind_about_demo(self):
95
+ self.access_got = False
96
+ self.logs.seek(0)
97
+ self.logs.truncate(0)
98
+ self.logs.write('Click on the button to get transcription for the demo video!\n')
99
+ self.logs.flush()
100
+
101
+ self.logs_list = ["Click on the button to get transcription for the demo video!"]
102
+
103
  def complete_logs(self):
104
  message = '✅ Download Completed!\n'
105
  if message not in self.logs_list: