talklib 3.1.0__tar.gz → 3.2.0__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-3.1.0/src/talklib.egg-info → talklib-3.2.0}/PKG-INFO +2 -2
- {talklib-3.1.0 → talklib-3.2.0}/README.md +1 -1
- {talklib-3.1.0 → talklib-3.2.0}/pyproject.toml +1 -1
- {talklib-3.1.0 → talklib-3.2.0}/src/talklib/cli.py +30 -4
- {talklib-3.1.0 → talklib-3.2.0}/src/talklib/pod.py +17 -3
- {talklib-3.1.0 → talklib-3.2.0/src/talklib.egg-info}/PKG-INFO +2 -2
- {talklib-3.1.0 → talklib-3.2.0}/LICENSE.txt +0 -0
- {talklib-3.1.0 → talklib-3.2.0}/requirements.txt +0 -0
- {talklib-3.1.0 → talklib-3.2.0}/setup.cfg +0 -0
- {talklib-3.1.0 → talklib-3.2.0}/src/talklib/__init__.py +0 -0
- {talklib-3.1.0 → talklib-3.2.0}/src/talklib/ev.py +0 -0
- {talklib-3.1.0 → talklib-3.2.0}/src/talklib/ffmpeg.py +0 -0
- {talklib-3.1.0 → talklib-3.2.0}/src/talklib/notify.py +0 -0
- {talklib-3.1.0 → talklib-3.2.0}/src/talklib/show.py +0 -0
- {talklib-3.1.0 → talklib-3.2.0}/src/talklib/utils.py +0 -0
- {talklib-3.1.0 → talklib-3.2.0}/src/talklib.egg-info/SOURCES.txt +0 -0
- {talklib-3.1.0 → talklib-3.2.0}/src/talklib.egg-info/dependency_links.txt +0 -0
- {talklib-3.1.0 → talklib-3.2.0}/src/talklib.egg-info/entry_points.txt +0 -0
- {talklib-3.1.0 → talklib-3.2.0}/src/talklib.egg-info/requires.txt +0 -0
- {talklib-3.1.0 → talklib-3.2.0}/src/talklib.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: talklib
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.2.0
|
|
4
4
|
Summary: A package to automate processing of shows/segments airing on the TL
|
|
5
5
|
Author-email: Ben Weddle <ben.weddle@gmail.com>
|
|
6
6
|
Maintainer-email: Ben Weddle <ben.weddle@gmail.com>
|
|
@@ -523,7 +523,7 @@ nyt.run()
|
|
|
523
523
|
|
|
524
524
|
To disable ALL notifications, add a line like this:
|
|
525
525
|
|
|
526
|
-
> This will disable all notifications **including** syslog messages
|
|
526
|
+
> This will disable all notifications **including** syslog messages (shell print statements will not be disabled)
|
|
527
527
|
|
|
528
528
|
````python
|
|
529
529
|
from talklib import TLPod
|
|
@@ -423,7 +423,7 @@ nyt.run()
|
|
|
423
423
|
|
|
424
424
|
To disable ALL notifications, add a line like this:
|
|
425
425
|
|
|
426
|
-
> This will disable all notifications **including** syslog messages
|
|
426
|
+
> This will disable all notifications **including** syslog messages (shell print statements will not be disabled)
|
|
427
427
|
|
|
428
428
|
````python
|
|
429
429
|
from talklib import TLPod
|
|
@@ -3,7 +3,7 @@ import os
|
|
|
3
3
|
import sys
|
|
4
4
|
import xml.etree.ElementTree as ET
|
|
5
5
|
|
|
6
|
-
from talklib.pod import SSH
|
|
6
|
+
from talklib.pod import SSH, Notifications
|
|
7
7
|
|
|
8
8
|
def parse_args():
|
|
9
9
|
parser = argparse.ArgumentParser(description="use talklib in the terminal")
|
|
@@ -15,10 +15,32 @@ def parse_args():
|
|
|
15
15
|
You MUST have an RSS feed (feed.xml) and logo (image.jpg) in the current directory."
|
|
16
16
|
parser.add_argument('--new-pod-dir', type=str, help=new_podcast_directory_help, required=False)
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
download_feed_help:str = "Download the RSS feed from the folder on the server you specify."
|
|
19
|
+
parser.add_argument('--download-feed', type=str, help=download_feed_help, required=False)
|
|
20
|
+
|
|
21
|
+
upload_feed_help:str = "Upload the RSS feed to the folder on the server you specify."
|
|
22
|
+
parser.add_argument('--upload-feed', type=str, help=upload_feed_help, required=False)
|
|
19
23
|
|
|
24
|
+
args = parser.parse_args()
|
|
20
25
|
return args
|
|
21
26
|
|
|
27
|
+
def get_SSH():
|
|
28
|
+
Notifications.prefix = "talklib CLI"
|
|
29
|
+
notifications = Notifications()
|
|
30
|
+
notifications.notify.email_enable = False
|
|
31
|
+
ssh = SSH(notifications=notifications)
|
|
32
|
+
return ssh
|
|
33
|
+
|
|
34
|
+
def download_feed(name: str):
|
|
35
|
+
ssh = get_SSH()
|
|
36
|
+
ssh.get_feed_from_folder(folder=name)
|
|
37
|
+
|
|
38
|
+
def upload_feed(name:str):
|
|
39
|
+
if not os.path.isfile("feed.xml"):
|
|
40
|
+
return print(f"cannot find 'feed.xml' in {os.getcwd()}. You must have this file in the current directory.")
|
|
41
|
+
ssh = get_SSH()
|
|
42
|
+
ssh.upload_feed_to_folder(folder=name)
|
|
43
|
+
|
|
22
44
|
def generate_feed_template():
|
|
23
45
|
ET.register_namespace(prefix="atom", uri="http://www.w3.org/2005/Atom")
|
|
24
46
|
ET.register_namespace(prefix="itunes", uri="http://www.itunes.com/dtds/podcast-1.0.dtd")
|
|
@@ -52,9 +74,13 @@ def main():
|
|
|
52
74
|
args = parse_args()
|
|
53
75
|
|
|
54
76
|
if args.feed_template:
|
|
55
|
-
generate_feed_template()
|
|
77
|
+
return generate_feed_template()
|
|
56
78
|
if args.new_pod_dir:
|
|
57
|
-
new_podcast_dir(name=args.new_pod_dir)
|
|
79
|
+
return new_podcast_dir(name=args.new_pod_dir)
|
|
80
|
+
if args.download_feed:
|
|
81
|
+
return download_feed(name=args.download_feed)
|
|
82
|
+
if args.upload_feed:
|
|
83
|
+
return upload_feed(name=args.upload_feed)
|
|
58
84
|
|
|
59
85
|
feed_template: str = """
|
|
60
86
|
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
|
|
@@ -20,7 +20,7 @@ from talklib.utils import today_is_weekday
|
|
|
20
20
|
|
|
21
21
|
class Notifications(BaseModel):
|
|
22
22
|
prefix: ClassVar[str] = None # prefix all messages with identifier for the show/podcast
|
|
23
|
-
notify: Type[Notify] = Notify()
|
|
23
|
+
notify: ClassVar[Type[Notify]] = Notify()
|
|
24
24
|
|
|
25
25
|
def prep_syslog(self, message: str, level: str = 'info'):
|
|
26
26
|
'''send message to syslog server'''
|
|
@@ -67,6 +67,7 @@ class SSH(BaseModel):
|
|
|
67
67
|
raise e
|
|
68
68
|
|
|
69
69
|
def download_file(self, file: str, folder: str) -> None:
|
|
70
|
+
folder = folder.lower()
|
|
70
71
|
try:
|
|
71
72
|
self.notifications.prep_syslog(message=f"Attempting to download '{file}' from {folder}/ on server")
|
|
72
73
|
self.connection.get(remote=f"shows/{folder}/{file}")
|
|
@@ -94,6 +95,7 @@ The error from the SSH library is: {e}"
|
|
|
94
95
|
subject="Error")
|
|
95
96
|
|
|
96
97
|
def make_new_folder(self, folder: str) -> None:
|
|
98
|
+
folder = folder.lower()
|
|
97
99
|
if self.check_folder_exists_no_exception(folder=folder):
|
|
98
100
|
raise Exception (f"{folder}/ already exists on server! Exiting...")
|
|
99
101
|
self.connection.run(f"cd shows && mkdir {folder}", hide=True)
|
|
@@ -130,8 +132,12 @@ The error from the SSH library is: {e}"
|
|
|
130
132
|
return ret_val
|
|
131
133
|
|
|
132
134
|
def get_feed_from_folder(self, folder: str):
|
|
135
|
+
self.check_folder_exists(folder=folder)
|
|
133
136
|
self.download_file(file="feed.xml", folder=folder)
|
|
134
137
|
|
|
138
|
+
def upload_feed_to_folder(self, folder:str):
|
|
139
|
+
self.upload_file(file="feed.xml", folder=folder)
|
|
140
|
+
|
|
135
141
|
def check_folder_exists(self, folder: str) -> bool:
|
|
136
142
|
self.notifications.prep_syslog(message=f"checking if {folder}/ exists on server...")
|
|
137
143
|
folders = self.get_folders()
|
|
@@ -343,9 +349,9 @@ class TLPod(BaseModel):
|
|
|
343
349
|
override_filename: bool = False
|
|
344
350
|
audio_folders:list = EV().destinations
|
|
345
351
|
notifications: Type[Notifications] = Notifications()
|
|
346
|
-
episode: Type[Episode] = Episode(
|
|
352
|
+
episode: Type[Episode] = Episode()
|
|
347
353
|
ffmpeg: Type[FFMPEG] = FFMPEG()
|
|
348
|
-
ssh: Type[SSH] = SSH(
|
|
354
|
+
ssh: Type[SSH] = SSH()
|
|
349
355
|
|
|
350
356
|
@model_validator(mode='after')
|
|
351
357
|
def post_update(self):
|
|
@@ -364,6 +370,14 @@ class TLPod(BaseModel):
|
|
|
364
370
|
|
|
365
371
|
self.display_name = f"{self.display_name} ({datetime.now().strftime('%a, %d %b')})"
|
|
366
372
|
|
|
373
|
+
# before we carry on, make sure we can successfully connect to the server
|
|
374
|
+
# try:
|
|
375
|
+
# self.ssh.connection.run("ls")
|
|
376
|
+
# except Exception as e:
|
|
377
|
+
# to_send:str = f"Cannot connect to server. Are you sure the SSH keys are set up correctly? Here is the error: {e}"
|
|
378
|
+
# self.notifications.send_notifications(message=to_send, subject="Error")
|
|
379
|
+
# raise e
|
|
380
|
+
|
|
367
381
|
return self
|
|
368
382
|
|
|
369
383
|
def get_filename_to_match(self) -> str:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: talklib
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.2.0
|
|
4
4
|
Summary: A package to automate processing of shows/segments airing on the TL
|
|
5
5
|
Author-email: Ben Weddle <ben.weddle@gmail.com>
|
|
6
6
|
Maintainer-email: Ben Weddle <ben.weddle@gmail.com>
|
|
@@ -523,7 +523,7 @@ nyt.run()
|
|
|
523
523
|
|
|
524
524
|
To disable ALL notifications, add a line like this:
|
|
525
525
|
|
|
526
|
-
> This will disable all notifications **including** syslog messages
|
|
526
|
+
> This will disable all notifications **including** syslog messages (shell print statements will not be disabled)
|
|
527
527
|
|
|
528
528
|
````python
|
|
529
529
|
from talklib import TLPod
|
|
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
|
|
File without changes
|
|
File without changes
|