talklib 2.1.6__tar.gz → 2.2.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: talklib
3
- Version: 2.1.6
3
+ Version: 2.2.1
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>
@@ -106,6 +106,8 @@ Requires-Dist: zipp==3.17.0
106
106
 
107
107
  ## A package to automate processing TL shows/segments and podcasts
108
108
 
109
+ [talklib on PyPI](https://pypi.org/project/talklib/)
110
+
109
111
  [Skip to Examples](#examples)
110
112
 
111
113
  *THIS README IS INTENDED TO ASSIST TL STAFF IN INSTALLING AND USING THIS PACKAGE*
@@ -130,7 +132,7 @@ Use Python 3.10 or higher.
130
132
  Make sure to select "add to PATH" during installation.
131
133
 
132
134
  ### -[FFmpeg](https://www.ffmpeg.org/download.html#build-windows)
133
- You need Windows binaries for both FFmpeg & FFprobe installed on the PC and added to the PATH:
135
+ You need both FFmpeg & FFprobe installed on the PC and added to the PATH:
134
136
 
135
137
  To repeat, **this package will not work without FFmpeg and FFprobe**.
136
138
 
@@ -139,6 +141,8 @@ FFmpeg and FFprobe should be two separate binaries.
139
141
  ### -[Twilio](https://www.twilio.com/)
140
142
  Twilio is used for SMS and phone call notifications.
141
143
 
144
+ THIS IS NOT SOMETHING YOU NEED TO DOWNLOAD/INSTALL.
145
+
142
146
  Access our TL Twilio info (token, etc.) by [logging in](https://www.twilio.com/login) to Twilio.
143
147
 
144
148
  See [below](#disable-twilio) for how to disable Twilio.
@@ -171,7 +175,7 @@ Before we begin, a general note:
171
175
  - The "Run" command in WR defaults to running from a different directory AND a different drive letter. This causes confusion.
172
176
  - WR also does not run `.py` files by default.
173
177
  - These are some of the reasons why we do not run `.py` files directly from WR.
174
- - Instead, we tell WR to run a Batch script (`.bat` file) which in turn will run the Python script (`.py` file).
178
+ - Instead, we tell WR to run a Batch script (`.bat` file) which in turn will automatically run the Python script (`.py` file).
175
179
  - Ensure the Batch & Python scripts are in the same directory.
176
180
  - A sample `.bat` file (`Example.bat`) is included in the [misc](https://github.com/Nashville-Public-Library/misc/tree/main/talklib_examples) repo.
177
181
  - Download this file and place it in the same folder as your Python file.
@@ -186,7 +190,7 @@ D:\wireready
186
190
  -WP.bat
187
191
  -WP.py
188
192
  ````
189
- You would schedule WR to run the `WP.bat` file, which would run the `WP.py` file.
193
+ You would schedule WR to run the `WP.bat` file, which would automatically run the `WP.py` file.
190
194
 
191
195
  ----
192
196
 
@@ -527,7 +531,6 @@ from talklib import TLPod
527
531
  nyt = TLPod(
528
532
  display_name = "New York Times",
529
533
  filename_to_match = "nyt",
530
- categories = ["News and Politics"],
531
534
  )
532
535
  nyt.notifications.notify.enable_all = False
533
536
  nyt.run()
@@ -6,6 +6,8 @@
6
6
 
7
7
  ## A package to automate processing TL shows/segments and podcasts
8
8
 
9
+ [talklib on PyPI](https://pypi.org/project/talklib/)
10
+
9
11
  [Skip to Examples](#examples)
10
12
 
11
13
  *THIS README IS INTENDED TO ASSIST TL STAFF IN INSTALLING AND USING THIS PACKAGE*
@@ -30,7 +32,7 @@ Use Python 3.10 or higher.
30
32
  Make sure to select "add to PATH" during installation.
31
33
 
32
34
  ### -[FFmpeg](https://www.ffmpeg.org/download.html#build-windows)
33
- You need Windows binaries for both FFmpeg & FFprobe installed on the PC and added to the PATH:
35
+ You need both FFmpeg & FFprobe installed on the PC and added to the PATH:
34
36
 
35
37
  To repeat, **this package will not work without FFmpeg and FFprobe**.
36
38
 
@@ -39,6 +41,8 @@ FFmpeg and FFprobe should be two separate binaries.
39
41
  ### -[Twilio](https://www.twilio.com/)
40
42
  Twilio is used for SMS and phone call notifications.
41
43
 
44
+ THIS IS NOT SOMETHING YOU NEED TO DOWNLOAD/INSTALL.
45
+
42
46
  Access our TL Twilio info (token, etc.) by [logging in](https://www.twilio.com/login) to Twilio.
43
47
 
44
48
  See [below](#disable-twilio) for how to disable Twilio.
@@ -71,7 +75,7 @@ Before we begin, a general note:
71
75
  - The "Run" command in WR defaults to running from a different directory AND a different drive letter. This causes confusion.
72
76
  - WR also does not run `.py` files by default.
73
77
  - These are some of the reasons why we do not run `.py` files directly from WR.
74
- - Instead, we tell WR to run a Batch script (`.bat` file) which in turn will run the Python script (`.py` file).
78
+ - Instead, we tell WR to run a Batch script (`.bat` file) which in turn will automatically run the Python script (`.py` file).
75
79
  - Ensure the Batch & Python scripts are in the same directory.
76
80
  - A sample `.bat` file (`Example.bat`) is included in the [misc](https://github.com/Nashville-Public-Library/misc/tree/main/talklib_examples) repo.
77
81
  - Download this file and place it in the same folder as your Python file.
@@ -86,7 +90,7 @@ D:\wireready
86
90
  -WP.bat
87
91
  -WP.py
88
92
  ````
89
- You would schedule WR to run the `WP.bat` file, which would run the `WP.py` file.
93
+ You would schedule WR to run the `WP.bat` file, which would automatically run the `WP.py` file.
90
94
 
91
95
  ----
92
96
 
@@ -427,7 +431,6 @@ from talklib import TLPod
427
431
  nyt = TLPod(
428
432
  display_name = "New York Times",
429
433
  filename_to_match = "nyt",
430
- categories = ["News and Politics"],
431
434
  )
432
435
  nyt.notifications.notify.enable_all = False
433
436
  nyt.run()
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "talklib"
3
- version = "2.1.6"
3
+ version = "2.2.1"
4
4
  description = "A package to automate processing of shows/segments airing on the TL"
5
5
  readme = "README.md"
6
6
  license = {file = "LICENSE.txt"}
@@ -161,7 +161,7 @@ class Episode(BaseModel):
161
161
  return size_in_bytes
162
162
 
163
163
  def enclosure(self) -> str:
164
- enclosure = f"https://dts.podtrac.com/redirect.mp3/assets.library.nashville.org/talkinglibrary/shows/{self.bucket_folder}/{self.audio_filename}"
164
+ enclosure = f"https://assets.library.nashville.org/talkinglibrary/shows/{self.bucket_folder}/{self.audio_filename}"
165
165
  self.notifications.prep_syslog(message=f"enclosure will be {enclosure}")
166
166
  return enclosure
167
167
 
@@ -347,15 +347,35 @@ class TLPod(BaseModel):
347
347
  prefix = f"{self.display_name} (podcast)"
348
348
  Notifications.prefix = prefix
349
349
 
350
+ self.display_name = f"{self.display_name} ({datetime.now().strftime('%a, %d %b')})"
351
+
350
352
  return self
351
353
 
352
354
  def get_filename_to_match(self) -> str:
353
355
  if self.override_filename:
354
356
  self.notifications.prep_syslog(message="filename override is turned ON")
355
- file = (self.filename_to_match + ".wav").lower()
357
+ file = (self.filename_to_match).lower()
356
358
  return file
357
359
  today_date: str = datetime.now().strftime("%m%d%y") # this is how we date our programs: MMDDYY
358
- return (self.filename_to_match + today_date + ".wav").lower()
360
+ return (self.filename_to_match + today_date).lower()
361
+
362
+ def check_alt_endings(self,file: str):
363
+ file_lower_case: str = file.lower()
364
+
365
+ if file_lower_case.endswith("-sub.wav"):
366
+ self.notifications.prep_syslog(message=f"'-sub' found in filename: {file}. Amending 'display_name' for episode...")
367
+ self.display_name = f"{self.display_name} (Substitute)"
368
+ self.notifications.prep_syslog(message=f"New display_name: {self.display_name}")
369
+
370
+ if file_lower_case.endswith("-rep.wav"):
371
+ self.notifications.prep_syslog(message=f"'-rep' found in filename: {file}. Amending 'display_name' for episode...")
372
+ self.display_name = f"{self.display_name} (Encore)"
373
+ self.notifications.prep_syslog(message=f"New display_name: {self.display_name}")
374
+
375
+ if file_lower_case.endswith("-dnp.wav"):
376
+ to_send = f"'-dnp' found in filename ({file}), will NOT podcast this episode. Exiting automation!"
377
+ self.notifications.send_notifications(message=to_send, subject="Info", syslog_level="info")
378
+ raise Exception (to_send)
359
379
 
360
380
  def match_file(self):
361
381
  '''match the name of the program that has today's date in the filename'''
@@ -365,10 +385,17 @@ class TLPod(BaseModel):
365
385
  self.notifications.prep_syslog(message=f"searching for {to_match} in {dest}...")
366
386
  files = glob.glob(f"{dest}/*.wav")
367
387
  for file in files:
368
- basename = os.path.basename(file)
369
- if to_match == basename.lower():
388
+ if to_match in file.lower():
370
389
  self.notifications.prep_syslog(message=f"found matching file: {file}")
390
+
391
+ if "Copy (" in file:
392
+ self.notifications.prep_syslog(message=f"skipping file with 'copy' in filename: {file}")
393
+ continue
394
+
395
+ self.check_alt_endings(file=file)
396
+
371
397
  return file
398
+
372
399
  to_send = f"There was a problem podcasting {self.display_name}. Cannot find matched file {to_match} in {self.audio_folders}"
373
400
  self.notifications.send_notifications(message=to_send, subject='Error')
374
401
  raise FileNotFoundError
@@ -423,7 +450,7 @@ class TLPod(BaseModel):
423
450
  self.episode.feed_file = feed_file
424
451
  self.episode.audio_filename = converted_file
425
452
  self.episode.bucket_folder = self.bucket_folder
426
- self.episode.episode_title = f"{self.display_name} ({datetime.now().strftime('%a, %d %B')})"
453
+ self.episode.episode_title = self.display_name
427
454
  self.episode.max_episodes = self.max_episodes_in_feed
428
455
 
429
456
  self.episode.add_new_episode()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: talklib
3
- Version: 2.1.6
3
+ Version: 2.2.1
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>
@@ -106,6 +106,8 @@ Requires-Dist: zipp==3.17.0
106
106
 
107
107
  ## A package to automate processing TL shows/segments and podcasts
108
108
 
109
+ [talklib on PyPI](https://pypi.org/project/talklib/)
110
+
109
111
  [Skip to Examples](#examples)
110
112
 
111
113
  *THIS README IS INTENDED TO ASSIST TL STAFF IN INSTALLING AND USING THIS PACKAGE*
@@ -130,7 +132,7 @@ Use Python 3.10 or higher.
130
132
  Make sure to select "add to PATH" during installation.
131
133
 
132
134
  ### -[FFmpeg](https://www.ffmpeg.org/download.html#build-windows)
133
- You need Windows binaries for both FFmpeg & FFprobe installed on the PC and added to the PATH:
135
+ You need both FFmpeg & FFprobe installed on the PC and added to the PATH:
134
136
 
135
137
  To repeat, **this package will not work without FFmpeg and FFprobe**.
136
138
 
@@ -139,6 +141,8 @@ FFmpeg and FFprobe should be two separate binaries.
139
141
  ### -[Twilio](https://www.twilio.com/)
140
142
  Twilio is used for SMS and phone call notifications.
141
143
 
144
+ THIS IS NOT SOMETHING YOU NEED TO DOWNLOAD/INSTALL.
145
+
142
146
  Access our TL Twilio info (token, etc.) by [logging in](https://www.twilio.com/login) to Twilio.
143
147
 
144
148
  See [below](#disable-twilio) for how to disable Twilio.
@@ -171,7 +175,7 @@ Before we begin, a general note:
171
175
  - The "Run" command in WR defaults to running from a different directory AND a different drive letter. This causes confusion.
172
176
  - WR also does not run `.py` files by default.
173
177
  - These are some of the reasons why we do not run `.py` files directly from WR.
174
- - Instead, we tell WR to run a Batch script (`.bat` file) which in turn will run the Python script (`.py` file).
178
+ - Instead, we tell WR to run a Batch script (`.bat` file) which in turn will automatically run the Python script (`.py` file).
175
179
  - Ensure the Batch & Python scripts are in the same directory.
176
180
  - A sample `.bat` file (`Example.bat`) is included in the [misc](https://github.com/Nashville-Public-Library/misc/tree/main/talklib_examples) repo.
177
181
  - Download this file and place it in the same folder as your Python file.
@@ -186,7 +190,7 @@ D:\wireready
186
190
  -WP.bat
187
191
  -WP.py
188
192
  ````
189
- You would schedule WR to run the `WP.bat` file, which would run the `WP.py` file.
193
+ You would schedule WR to run the `WP.bat` file, which would automatically run the `WP.py` file.
190
194
 
191
195
  ----
192
196
 
@@ -527,7 +531,6 @@ from talklib import TLPod
527
531
  nyt = TLPod(
528
532
  display_name = "New York Times",
529
533
  filename_to_match = "nyt",
530
- categories = ["News and Politics"],
531
534
  )
532
535
  nyt.notifications.notify.enable_all = False
533
536
  nyt.run()
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