Skip to content

Commit 627f211

Browse files
committed
- veriosn 0.9.2.10
- all PyRadio threads will terminate when Alt-F4 or the close button is used to close the program - adding a message about dateutil module missing - fixing a Windows error that has made PyRadio unusable on Windows
1 parent 63dcfb1 commit 627f211

8 files changed

+88
-8
lines changed

Changelog

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2023-06-14 s-n-g
2+
* version 0.9.2.10
3+
* all PyRadio threads will terminate when Alt-F4 or the
4+
close button is used to close the program
5+
* adding a message about dateutil module missing
6+
* fixing a Windows error that has made PyRadio unusable
7+
on Windows
8+
19
2023-06-13 s-n-g
210
* version 0.9.2.9
311
* fixing: Remote Control Server does not terminate when

README.html

+8
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,14 @@ <h2 id="requirements">Requirements <span style="padding-left: 10px;"><sup style=
207207
<h2 id="changelog">Changelog <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
208208
<pre style="height: 200px;">
209209

210+
2023-06-14 s-n-g
211+
* version 0.9.2.10
212+
* all PyRadio threads will terminate when Alt-F4 or the
213+
close button is used to close the program
214+
* adding a message about dateutil module missing
215+
* fixing a Windows error that has made PyRadio unusable
216+
on Windows
217+
210218
2023-06-13 s-n-g
211219
* version 0.9.2.9
212220
* fixing: Remote Control Server does not terminate when

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "pyradio"
3-
version = "0.9.2.9"
3+
version = "0.9.2.10"
44
authors = [
55
{ name="Ben Dowling", email="[email protected]" },
66
{ name="Spiros Georgaras", email="[email protected]" },

pyradio/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" pyradio -- Console radio player. "
22

3-
version_info = (0, 9, 2, 9)
3+
version_info = (0, 9, 2, 10)
44

55
# Set it to True if new stations have been
66
# added to the package's stations.csv

pyradio/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from subprocess import Popen
1717
from platform import system
1818
if system().lower() == 'windows':
19-
from os import stastfile
19+
from os import startfile
2020
from pyradio import version, stations_updated
2121

2222
from .browser import PyRadioStationsBrowser, probeBrowsers

pyradio/install.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
''' This is PyRadio version this
1616
install.py was released for
1717
'''
18-
PyRadioInstallPyReleaseVersion = '0.9.2.9'
18+
PyRadioInstallPyReleaseVersion = '0.9.2.10'
1919

2020
import locale
2121
locale.setlocale(locale.LC_ALL, "")

pyradio/radio.py

+39-3
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,17 @@ def _give_me_a_search_class(self, operation_mode):
18221822

18231823
def ctrl_c_handler(self, signum, frame, save_playlist=True):
18241824
# ok
1825+
logger.error('signum = {}'.format(signum))
1826+
logger.error('frame = {}'.format(frame))
1827+
self.player.stop_update_notification_thread = True
1828+
self.player.stop_win_vlc_status_update_thread = True
1829+
if self.player:
1830+
# ok
1831+
self.detect_if_player_exited = False
1832+
self.stopPlayer(
1833+
show_message=False,
1834+
reset_playing=False
1835+
)
18251836
self._cls_update_stations = None
18261837
self.detect_if_player_exited = False
18271838
if self._cnf.dirty_playlist and save_playlist:
@@ -1872,6 +1883,11 @@ def _wait_for_threads(self):
18721883
except AttributeError:
18731884
pass
18741885
self.stop_update_notification_thread = True
1886+
try:
1887+
while self.log._desktop_notification_thread.is_alive():
1888+
self.log._stop_desktop_notification_thread = True
1889+
except:
1890+
self.log._stop_desktop_notification_thread = True
18751891

18761892
def _goto_playing_station(self, changing_playlist=False):
18771893
''' make sure playing station is visible '''
@@ -10047,12 +10063,32 @@ def _register_signals_handlers(self):
1004710063

1004810064
def _linux_signal_handler(self, a_signal, a_frame):
1004910065
logger.error('DE ----==== _linux_signal_handler ====----')
10066+
10067+
# self.ctrl_c_handler(0,0, True)
10068+
# for a_sig in self.handled_signals.keys():
10069+
# try:
10070+
# signal.signal(
10071+
# self.handled_signals[a_sig],
10072+
# self.def_signal_handlers[a_sig]
10073+
# )
10074+
# except:
10075+
# pass
10076+
# return
10077+
self._cls_update_stations = None
10078+
self.detect_if_player_exited = False
1005010079
self.log._stop_desktop_notification_thread = True
10080+
self.player.stop_update_notification_thread = True
10081+
self.player.stop_win_vlc_status_update_thread = True
10082+
if self.player:
10083+
# ok
10084+
self.detect_if_player_exited = False
10085+
self.stopPlayer(
10086+
show_message=False,
10087+
reset_playing=False
10088+
)
1005110089
if self._system_asked_to_terminate:
1005210090
return
1005310091
self._system_asked_to_terminate = True
10054-
self.player.stop_update_notification_thread = True
10055-
self.player.stop_win_vlc_status_update_thread = True
1005610092
if logger.isEnabledFor(logging.INFO):
1005710093
# logger.info('System asked me to terminate (signal: {})!!!'.format(list(self.handled_signals.keys())[list(self.handled_signals.values()).index(a_signal)]))
1005810094
logger.info('My terminal got closed... Terminating...')
@@ -10069,7 +10105,6 @@ def _linux_signal_handler(self, a_signal, a_frame):
1006910105
sel._cnf.online_browser = None
1007010106
self.player.close()
1007110107
self._cnf.save_config()
10072-
#self._wait_for_threads()
1007310108
self._cnf.remove_session_lock_file()
1007410109
for a_sig in self.handled_signals.keys():
1007510110
try:
@@ -10083,6 +10118,7 @@ def _linux_signal_handler(self, a_signal, a_frame):
1008310118
ret, _ = self._remote_control_server.close_server()
1008410119
if ret:
1008510120
self._remote_control_server = None
10121+
self._wait_for_threads()
1008610122

1008710123
def _windows_signal_handler(self, event):
1008810124
''' windows signal handler

pyradio/simple_curses_widgets.py

+29-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,36 @@
11
# -*- coding: utf-8 -*-
22
import curses
33
import curses.ascii
4+
from sys import exit
45
from datetime import date, time, datetime, timedelta
5-
from dateutil.relativedelta import relativedelta
6+
try:
7+
from dateutil.relativedelta import relativedelta
8+
except:
9+
print('''Error: Module "dateutil" not found!
10+
11+
Please install the above module and try again.
12+
13+
Debian based distros:
14+
sudo apt install python3-dateutil
15+
16+
Arch based distros:
17+
sudo pacman install python-dateutil
18+
19+
Fedora based distros:
20+
sudo dnf install python-dateutil
21+
22+
openSUSE based distros:
23+
sudo zypper install python3-dateutil
24+
25+
If everything else fails, try:
26+
python -m pip install dateutil
27+
or
28+
python3 -m pip install dateutil
29+
or even
30+
python -m pip install --user dateutil
31+
32+
''')
33+
exit(1)
634
import logging
735
from sys import version_info, platform, version
836
# try:

0 commit comments

Comments
 (0)