-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.py
More file actions
executable file
·77 lines (69 loc) · 2.7 KB
/
client.py
File metadata and controls
executable file
·77 lines (69 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!bin/python3.10
import re
import time
import os
from syndication.hackday import HackDay
from syndication.itsfoss import Itsfoss
from syndication.jeffgeerling import JG
from syndication.lwn import Lwn
from syndication.phoronix import Phoronix
from syndication.linux_magazine import LinuxMagazine
debug: bool = True
skip_send: bool = False
tts_server = "http://localhost:3636/tts/"
if debug:
rss = HackDay()
rss.consume_feed()
rss.parse_feed()
# news = []
# news.append(Itsfoss())
# news.append(JG())
# news.append(Lwn())
# news.append(Phoronix())
# news.append(LinuxMagazine())
# for feeds in news:
# feeds.consume_feed()
if len(rss.articles) > 0:
print("Found ", len(rss.articles), "articles: \n")
for index, article in enumerate(rss.articles):
print(f"{index})", article["title"])
print('\n')
print("Did you like to see the description?\n[Y/n] ")
user_choice = input()
if user_choice == "Y" or user_choice == "y":
print("Which: \n")
user_choice = input()
elif user_choice != "Y" or user_choice != "y":
exit(1)
if int(user_choice) <= len(rss.articles):
print('\n')
print("Title:", rss.articles[int(user_choice)]["title"])
print("Date:", rss.articles[int(user_choice)]["pub_date"])
print("Creator:", rss.articles[int(user_choice)]["creator"])
print("Description:", rss.articles[int(user_choice)]["description"], '...')
print('\n')
print("Continue: ")
hit = input()
if not hit:
if not skip_send:
res = rss.send_feed(tts_server, rss.articles[int(user_choice)])
if res["status"] == "process":
print("Audio processed:", res["name"])
print("Downloading file:", res["link"])
if rss.get_wave(res):
print('Download file with success!')
print('Save in ./sounds folder.')
if res["status"] == "unprocessed":
print("TTS server did not process the task.")
if skip_send:
for stanzas in rss.articles[int(user_choice)]["content"]:
print(stanzas, '\n')
time.sleep(8.5)
print('Creator:', rss.articles[int(user_choice)]["creator"])
print("Published:", rss.articles[int(user_choice)]["pub_date"])
print("Categories:\n")
for categories in rss.articles[int(user_choice)]["category"]:
print(str(categories).capitalize())
print('\n')
else:
print('Bye!')