talklib 1.2.0__tar.gz → 1.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {talklib-1.2.0/src/talklib.egg-info → talklib-1.2.2}/PKG-INFO +1 -1
- {talklib-1.2.0 → talklib-1.2.2}/pyproject.toml +1 -1
- {talklib-1.2.0 → talklib-1.2.2}/src/talklib/show.py +28 -14
- {talklib-1.2.0 → talklib-1.2.2}/src/talklib/utils.py +2 -1
- {talklib-1.2.0 → talklib-1.2.2/src/talklib.egg-info}/PKG-INFO +1 -1
- {talklib-1.2.0 → talklib-1.2.2}/LICENSE.txt +0 -0
- {talklib-1.2.0 → talklib-1.2.2}/README.md +0 -0
- {talklib-1.2.0 → talklib-1.2.2}/requirements.txt +0 -0
- {talklib-1.2.0 → talklib-1.2.2}/setup.cfg +0 -0
- {talklib-1.2.0 → talklib-1.2.2}/src/talklib/__init__.py +0 -0
- {talklib-1.2.0 → talklib-1.2.2}/src/talklib/ev.py +0 -0
- {talklib-1.2.0 → talklib-1.2.2}/src/talklib/ffmpeg.py +0 -0
- {talklib-1.2.0 → talklib-1.2.2}/src/talklib/notify.py +0 -0
- {talklib-1.2.0 → talklib-1.2.2}/src/talklib.egg-info/SOURCES.txt +0 -0
- {talklib-1.2.0 → talklib-1.2.2}/src/talklib.egg-info/dependency_links.txt +0 -0
- {talklib-1.2.0 → talklib-1.2.2}/src/talklib.egg-info/requires.txt +0 -0
- {talklib-1.2.0 → talklib-1.2.2}/src/talklib.egg-info/top_level.txt +0 -0
|
@@ -9,7 +9,7 @@ import requests
|
|
|
9
9
|
|
|
10
10
|
from talklib.ev import EV
|
|
11
11
|
from talklib.notify import Notify
|
|
12
|
-
from talklib.utils import get_timestamp, clear_screen,
|
|
12
|
+
from talklib.utils import get_timestamp, clear_screen, raise_exception_and_wait, today_is_weekday
|
|
13
13
|
from talklib.ffmpeg import FFMPEG
|
|
14
14
|
|
|
15
15
|
|
|
@@ -211,7 +211,7 @@ It looks like the file either wasn't converted or didn't transfer correctly. \
|
|
|
211
211
|
Please check manually!\n\n\
|
|
212
212
|
{get_timestamp()}")
|
|
213
213
|
self.__send_notifications(message=toSend, subject='Error')
|
|
214
|
-
|
|
214
|
+
raise_exception_and_wait(message=toSend)
|
|
215
215
|
break
|
|
216
216
|
if success:
|
|
217
217
|
self.__countdown()
|
|
@@ -339,14 +339,18 @@ Is this a permalink show? Did you forget to set the is_permalink attribute?\n\n\
|
|
|
339
339
|
(I can't figure out how else to get the name of the attribute)
|
|
340
340
|
'''
|
|
341
341
|
if type(attrib_to_check) != type_to_check:
|
|
342
|
-
|
|
342
|
+
message = f"Sorry, '{attrib_return}' attribute must be type: {type_to_check}, but you used {type(attrib_to_check)}."
|
|
343
|
+
self.__send_notifications(message=message, subject="Error")
|
|
344
|
+
raise_exception_and_wait(message=message)
|
|
343
345
|
|
|
344
346
|
def __check_int_and_float_type(self, attrib_to_check, attrib_return: str):
|
|
345
347
|
'''
|
|
346
348
|
Attributes passed here can be either int or float.
|
|
347
349
|
'''
|
|
348
350
|
if not (type(attrib_to_check) == int or type(attrib_to_check) == float):
|
|
349
|
-
|
|
351
|
+
message = f'Sorry, the {attrib_return} attribute must be a valid number (without quotes).'
|
|
352
|
+
self.__send_notifications(message=message, subject="Error")
|
|
353
|
+
raise_exception_and_wait(message=message)
|
|
350
354
|
|
|
351
355
|
def __check_attributes_are_valid(self):
|
|
352
356
|
'''
|
|
@@ -356,24 +360,34 @@ Is this a permalink show? Did you forget to set the is_permalink attribute?\n\n\
|
|
|
356
360
|
self.__prep_syslog(message='checking user defined attributes')
|
|
357
361
|
|
|
358
362
|
if not self.show:
|
|
359
|
-
|
|
363
|
+
message = 'Sorry, you need to specify a name for the show.'
|
|
364
|
+
self.__send_notifications(message=message, subject="Error")
|
|
365
|
+
raise_exception_and_wait(message=message)
|
|
360
366
|
else:
|
|
361
367
|
self.__check_str_and_bool_type(attrib_to_check=self.show, type_to_check=str, attrib_return='show')
|
|
362
368
|
|
|
363
369
|
if not self.show_filename:
|
|
364
|
-
|
|
370
|
+
message = 'Sorry, you need to specify a filename for the show.'
|
|
371
|
+
self.__send_notifications(message=message, subject="Error")
|
|
372
|
+
raise_exception_and_wait(message=message)
|
|
365
373
|
else:
|
|
366
374
|
self.__check_str_and_bool_type(attrib_to_check=self.show_filename, type_to_check=str, attrib_return='show_filename')
|
|
367
375
|
|
|
368
376
|
if not self.url:
|
|
369
377
|
if not self.is_local:
|
|
370
|
-
|
|
378
|
+
message = 'Sorry, you need to specify either a URL or a local file'
|
|
379
|
+
self.__send_notifications(message=message, subject="Error")
|
|
380
|
+
raise_exception_and_wait('Sorry, you need to specify either a URL or a local file')
|
|
371
381
|
|
|
372
382
|
if self.url and self.is_local:
|
|
373
|
-
|
|
383
|
+
message = 'Sorry, you cannot specify both a URL and a local audio file. You must choose only one.'
|
|
384
|
+
self.__send_notifications(message=message, subject="Error")
|
|
385
|
+
raise_exception_and_wait(message=message)
|
|
374
386
|
|
|
375
387
|
if self.url and self.local_file:
|
|
376
|
-
|
|
388
|
+
message = 'Sorry, you cannot specify both a URL and a local audio file. You must choose only one.'
|
|
389
|
+
self.__send_notifications(message=message, subject="Error")
|
|
390
|
+
raise_exception_and_wait(message=message)
|
|
377
391
|
|
|
378
392
|
if self.url:
|
|
379
393
|
self.__check_str_and_bool_type(attrib_to_check=self.url, type_to_check=str, attrib_return='url')
|
|
@@ -433,7 +447,9 @@ Is this a permalink show? Did you forget to set the is_permalink attribute?\n\n\
|
|
|
433
447
|
self.__run_local()
|
|
434
448
|
|
|
435
449
|
else:
|
|
436
|
-
|
|
450
|
+
message = "Sorry, something bad happened..."
|
|
451
|
+
self.__send_notifications(message=message, subject="Error")
|
|
452
|
+
raise_exception_and_wait(message=message)
|
|
437
453
|
|
|
438
454
|
def __run_URL_permalink(self):
|
|
439
455
|
# if url is declared, it's either an RSS or permalink show
|
|
@@ -464,8 +480,7 @@ It looks like today's file hasn't yet been posted. Please check and download man
|
|
|
464
480
|
{get_timestamp()}"
|
|
465
481
|
)
|
|
466
482
|
self.__send_notifications(message=toSend, subject='Error')
|
|
467
|
-
|
|
468
|
-
raise Exception
|
|
483
|
+
raise_exception_and_wait(message=toSend)
|
|
469
484
|
|
|
470
485
|
def __run_local(self):
|
|
471
486
|
if self.local_file:
|
|
@@ -482,5 +497,4 @@ It looks like the source file doesn't exist. Please check manually! Yesterday's
|
|
|
482
497
|
{get_timestamp()}"
|
|
483
498
|
)
|
|
484
499
|
self.__send_notifications(message=to_send, subject='Error')
|
|
485
|
-
|
|
486
|
-
raise FileNotFoundError
|
|
500
|
+
raise_exception_and_wait(message=to_send, error=FileNotFoundError)
|
|
@@ -16,11 +16,12 @@ def clear_screen() -> None:
|
|
|
16
16
|
else:
|
|
17
17
|
os.system('clear')
|
|
18
18
|
|
|
19
|
-
def
|
|
19
|
+
def raise_exception_and_wait(message: str, error = Exception) -> None:
|
|
20
20
|
'''clear terminal and print message to screen.'''
|
|
21
21
|
clear_screen()
|
|
22
22
|
print(f'{message}\n') # get user's attention!
|
|
23
23
|
input('(press enter to close this window)') # force user to acknowledge by closing window
|
|
24
|
+
raise error (message)
|
|
24
25
|
|
|
25
26
|
def today_is_weekday() -> bool:
|
|
26
27
|
'''crude mechanism for determining if today is a weekday.'''
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|