-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/python3 | ||
# Program to retrieve the latest CBS radio news as a file. | ||
# The news URL changes hourly, but it is easy to work out: | ||
# 27May2019 - changed timezone to Central. Since May 20th, | ||
# bulletins have stepped back by an hour, and I don't | ||
# know why. | ||
|
||
|
||
import datetime, pytz | ||
#, wget | ||
|
||
PREFIX = "http://audio.cbsradionewsfeed.com/" | ||
#RAW_DL = "CBS_raw.mp3" | ||
#PART1_AUDIO = "CBS_part1.wav" | ||
#PART2_AUDIO = "CBS_part2.wav" | ||
#PART2_AUDIO_CUT = "CBS_part2-cut.wav" | ||
#CBS_EDITED = "CBS_news.mka" | ||
|
||
# Time, in seconds, where we start to look for the silence marking the end of bulletin. | ||
|
||
#SPLIT = 240 | ||
|
||
|
||
est = datetime.datetime.now(pytz.timezone('US/Eastern')) | ||
|
||
year = str(est.year) | ||
month = "{:02}".format(est.month) | ||
date = "{:02}".format(est.day) | ||
hour = "{:02}".format(est.hour) | ||
|
||
URL = year + '/' + month + '/' + date + '/' + hour + '/Hourly-' + hour + '.mp3' | ||
|
||
# We need to get this URL, divide it into two, and search for the first silence in the second part. | ||
|
||
print(PREFIX + URL) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/python3 | ||
|
||
# Takes duplicates CSV file, | ||
# plus original playlist m3u8 file, | ||
# then: | ||
# sorts CSV file by similarity (field 0) | ||
# make a holding directory for audio | ||
# open a new m3u8 file for possible duplicates | ||
# for each line: | ||
# move file in field 1 to holding directory | ||
# move file in field 2 to holding directory | ||
|
||
import csv | ||
import argparse | ||
|
||
parser = argparse.ArgumentParser(description='Separate out possible duplicates for manual checking.') | ||
parser.add_argument('-d', '--duplicates', required=True, type=str, help='Filename of CSV with possible duplicates') | ||
args = parser.parse_args() | ||
|
||
duplicates = args.duplicates | ||
|
||
# listofDupes will contain the duplicates, sorted with the best matches at the top | ||
with open(duplicates, 'r') as csvfile: | ||
reader = csv.reader(csvfile) | ||
listofDupes = list(reader) | ||
|
||
listofDupes.sort(key=lambda value: int(value[0]), reverse=True) | ||
# print(listofDupes) | ||
|
||
# We'd | ||
|
||
|