talklib 2.1.2__tar.gz → 2.1.3__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-2.1.2/src/talklib.egg-info → talklib-2.1.3}/PKG-INFO +1 -1
- {talklib-2.1.2 → talklib-2.1.3}/pyproject.toml +1 -1
- {talklib-2.1.2 → talklib-2.1.3}/src/talklib/pod.py +41 -19
- {talklib-2.1.2 → talklib-2.1.3/src/talklib.egg-info}/PKG-INFO +1 -1
- {talklib-2.1.2 → talklib-2.1.3}/LICENSE.txt +0 -0
- {talklib-2.1.2 → talklib-2.1.3}/README.md +0 -0
- {talklib-2.1.2 → talklib-2.1.3}/requirements.txt +0 -0
- {talklib-2.1.2 → talklib-2.1.3}/setup.cfg +0 -0
- {talklib-2.1.2 → talklib-2.1.3}/src/talklib/__init__.py +0 -0
- {talklib-2.1.2 → talklib-2.1.3}/src/talklib/ev.py +0 -0
- {talklib-2.1.2 → talklib-2.1.3}/src/talklib/ffmpeg.py +0 -0
- {talklib-2.1.2 → talklib-2.1.3}/src/talklib/notify.py +0 -0
- {talklib-2.1.2 → talklib-2.1.3}/src/talklib/show.py +0 -0
- {talklib-2.1.2 → talklib-2.1.3}/src/talklib/utils.py +0 -0
- {talklib-2.1.2 → talklib-2.1.3}/src/talklib.egg-info/SOURCES.txt +0 -0
- {talklib-2.1.2 → talklib-2.1.3}/src/talklib.egg-info/dependency_links.txt +0 -0
- {talklib-2.1.2 → talklib-2.1.3}/src/talklib.egg-info/requires.txt +0 -0
- {talklib-2.1.2 → talklib-2.1.3}/src/talklib.egg-info/top_level.txt +0 -0
|
@@ -170,24 +170,47 @@ class Episode(BaseModel):
|
|
|
170
170
|
self.notifications.prep_syslog(message=f"itunes:duration will be {result}")
|
|
171
171
|
return result
|
|
172
172
|
|
|
173
|
-
def
|
|
173
|
+
def get_root_feed_file(self):
|
|
174
|
+
ET.register_namespace(prefix="atom", uri="http://www.w3.org/2005/Atom")
|
|
175
|
+
ET.register_namespace(prefix="itunes", uri="http://www.itunes.com/dtds/podcast-1.0.dtd")
|
|
176
|
+
feed = ET.parse(self.feed_file)
|
|
177
|
+
root = feed.getroot()
|
|
178
|
+
return root
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def check_for_duplicate_episode(self):
|
|
174
182
|
self.notifications.prep_syslog(message="checking for duplicate episode...")
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
183
|
+
root = self.get_root_feed_file()
|
|
184
|
+
channel = root.find("channel")
|
|
185
|
+
items = channel.findall("item")
|
|
186
|
+
for item in items:
|
|
187
|
+
item = item.find("title").text
|
|
188
|
+
if item == self.episode_title:
|
|
189
|
+
to_send = "Found episode with identical title already in feed. Aborting..."
|
|
190
|
+
self.notifications.send_notifications(message=to_send, subject="Error")
|
|
191
|
+
self.cleanup_files_on_abort()
|
|
192
|
+
raise Exception (to_send)
|
|
180
193
|
self.notifications.prep_syslog(message="no duplicate episode found")
|
|
181
194
|
return
|
|
182
195
|
|
|
183
196
|
def cleanup_files_on_abort(self):
|
|
197
|
+
self.notifications.prep_syslog(message=f"Aborting automation, deleting local temp files...")
|
|
184
198
|
files = glob.glob("*.mp3")
|
|
185
199
|
for file in files:
|
|
186
|
-
self.notifications.prep_syslog(message=f"
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
200
|
+
self.notifications.prep_syslog(message=f"Attempting to delete: {file}")
|
|
201
|
+
try:
|
|
202
|
+
os.remove(file)
|
|
203
|
+
self.notifications.prep_syslog(message=f"Successfully deleted: {file}")
|
|
204
|
+
except:
|
|
205
|
+
self.notifications.prep_syslog(message=f"Unable to delete {file}")
|
|
206
|
+
|
|
207
|
+
self.notifications.prep_syslog(message=f"Attempting to delete: feed.xml")
|
|
208
|
+
try:
|
|
209
|
+
os.remove("feed.xml")
|
|
210
|
+
self.notifications.prep_syslog(message=f"Successfully deleted: feed.xml")
|
|
211
|
+
except:
|
|
212
|
+
self.notifications.prep_syslog(message=f"Unable to delete:: feed.xml")
|
|
213
|
+
|
|
191
214
|
def add_new_episode(self):
|
|
192
215
|
'''Create an 'item' element. Then create all of the necessary sub elements and append them to the item element'''
|
|
193
216
|
ET.register_namespace(prefix="atom", uri="http://www.w3.org/2005/Atom")
|
|
@@ -197,10 +220,7 @@ class Episode(BaseModel):
|
|
|
197
220
|
root = root.find('channel')
|
|
198
221
|
|
|
199
222
|
# if we have a new feed, or a feed with no episodes
|
|
200
|
-
|
|
201
|
-
self.check_for_duplicate_episode(title=root.find("item").find("title").text)
|
|
202
|
-
except:
|
|
203
|
-
pass
|
|
223
|
+
self.check_for_duplicate_episode()
|
|
204
224
|
|
|
205
225
|
self.notifications.prep_syslog(message="Building the new <item> element")
|
|
206
226
|
item = ET.Element('item')
|
|
@@ -323,9 +343,10 @@ class TLPod(BaseModel):
|
|
|
323
343
|
def get_filename_to_match(self) -> str:
|
|
324
344
|
if self.override_filename:
|
|
325
345
|
self.notifications.prep_syslog(message="filename override is turned ON")
|
|
326
|
-
|
|
346
|
+
file = (self.filename_to_match + ".wav").lower()
|
|
347
|
+
return file
|
|
327
348
|
today_date: str = datetime.now().strftime("%m%d%y") # this is how we date our programs: MMDDYY
|
|
328
|
-
return (self.filename_to_match + today_date).lower()
|
|
349
|
+
return (self.filename_to_match + today_date + ".wav").lower()
|
|
329
350
|
|
|
330
351
|
def match_file(self):
|
|
331
352
|
'''match the name of the program that has today's date in the filename'''
|
|
@@ -335,8 +356,9 @@ class TLPod(BaseModel):
|
|
|
335
356
|
self.notifications.prep_syslog(message=f"searching for {to_match} in {dest}...")
|
|
336
357
|
files = glob.glob(f"{dest}/*.wav")
|
|
337
358
|
for file in files:
|
|
338
|
-
|
|
339
|
-
|
|
359
|
+
basename = os.path.basename(file)
|
|
360
|
+
if to_match == basename.lower():
|
|
361
|
+
self.notifications.prep_syslog(message=f"found matching file: {file}")
|
|
340
362
|
return file
|
|
341
363
|
to_send = f"There was a problem podcasting {self.display_name}. Cannot find matched file {to_match} in {self.audio_folders}"
|
|
342
364
|
self.notifications.send_notifications(message=to_send, subject='Error')
|
|
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
|