Skip to content

Commit

Permalink
- veriosn 0.9.2.10
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
s-n-g committed Jun 14, 2023
1 parent 63dcfb1 commit 627f211
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 8 deletions.
8 changes: 8 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2023-06-14 s-n-g
* version 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

2023-06-13 s-n-g
* version 0.9.2.9
* fixing: Remote Control Server does not terminate when
Expand Down
8 changes: 8 additions & 0 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@ <h2 id="requirements">Requirements <span style="padding-left: 10px;"><sup style=
<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>
<pre style="height: 200px;">

2023-06-14 s-n-g
* version 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

2023-06-13 s-n-g
* version 0.9.2.9
* fixing: Remote Control Server does not terminate when
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pyradio"
version = "0.9.2.9"
version = "0.9.2.10"
authors = [
{ name="Ben Dowling", email="[email protected]" },
{ name="Spiros Georgaras", email="[email protected]" },
Expand Down
2 changes: 1 addition & 1 deletion pyradio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
" pyradio -- Console radio player. "

version_info = (0, 9, 2, 9)
version_info = (0, 9, 2, 10)

# Set it to True if new stations have been
# added to the package's stations.csv
Expand Down
2 changes: 1 addition & 1 deletion pyradio/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from subprocess import Popen
from platform import system
if system().lower() == 'windows':
from os import stastfile
from os import startfile
from pyradio import version, stations_updated

from .browser import PyRadioStationsBrowser, probeBrowsers
Expand Down
2 changes: 1 addition & 1 deletion pyradio/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
''' This is PyRadio version this
install.py was released for
'''
PyRadioInstallPyReleaseVersion = '0.9.2.9'
PyRadioInstallPyReleaseVersion = '0.9.2.10'

import locale
locale.setlocale(locale.LC_ALL, "")
Expand Down
42 changes: 39 additions & 3 deletions pyradio/radio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1822,6 +1822,17 @@ def _give_me_a_search_class(self, operation_mode):

def ctrl_c_handler(self, signum, frame, save_playlist=True):
# ok
logger.error('signum = {}'.format(signum))
logger.error('frame = {}'.format(frame))
self.player.stop_update_notification_thread = True
self.player.stop_win_vlc_status_update_thread = True
if self.player:
# ok
self.detect_if_player_exited = False
self.stopPlayer(
show_message=False,
reset_playing=False
)
self._cls_update_stations = None
self.detect_if_player_exited = False
if self._cnf.dirty_playlist and save_playlist:
Expand Down Expand Up @@ -1872,6 +1883,11 @@ def _wait_for_threads(self):
except AttributeError:
pass
self.stop_update_notification_thread = True
try:
while self.log._desktop_notification_thread.is_alive():
self.log._stop_desktop_notification_thread = True
except:
self.log._stop_desktop_notification_thread = True

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

def _linux_signal_handler(self, a_signal, a_frame):
logger.error('DE ----==== _linux_signal_handler ====----')

# self.ctrl_c_handler(0,0, True)
# for a_sig in self.handled_signals.keys():
# try:
# signal.signal(
# self.handled_signals[a_sig],
# self.def_signal_handlers[a_sig]
# )
# except:
# pass
# return
self._cls_update_stations = None
self.detect_if_player_exited = False
self.log._stop_desktop_notification_thread = True
self.player.stop_update_notification_thread = True
self.player.stop_win_vlc_status_update_thread = True
if self.player:
# ok
self.detect_if_player_exited = False
self.stopPlayer(
show_message=False,
reset_playing=False
)
if self._system_asked_to_terminate:
return
self._system_asked_to_terminate = True
self.player.stop_update_notification_thread = True
self.player.stop_win_vlc_status_update_thread = True
if logger.isEnabledFor(logging.INFO):
# logger.info('System asked me to terminate (signal: {})!!!'.format(list(self.handled_signals.keys())[list(self.handled_signals.values()).index(a_signal)]))
logger.info('My terminal got closed... Terminating...')
Expand All @@ -10069,7 +10105,6 @@ def _linux_signal_handler(self, a_signal, a_frame):
sel._cnf.online_browser = None
self.player.close()
self._cnf.save_config()
#self._wait_for_threads()
self._cnf.remove_session_lock_file()
for a_sig in self.handled_signals.keys():
try:
Expand All @@ -10083,6 +10118,7 @@ def _linux_signal_handler(self, a_signal, a_frame):
ret, _ = self._remote_control_server.close_server()
if ret:
self._remote_control_server = None
self._wait_for_threads()

def _windows_signal_handler(self, event):
''' windows signal handler
Expand Down
30 changes: 29 additions & 1 deletion pyradio/simple_curses_widgets.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
# -*- coding: utf-8 -*-
import curses
import curses.ascii
from sys import exit
from datetime import date, time, datetime, timedelta
from dateutil.relativedelta import relativedelta
try:
from dateutil.relativedelta import relativedelta
except:
print('''Error: Module "dateutil" not found!
Please install the above module and try again.
Debian based distros:
sudo apt install python3-dateutil
Arch based distros:
sudo pacman install python-dateutil
Fedora based distros:
sudo dnf install python-dateutil
openSUSE based distros:
sudo zypper install python3-dateutil
If everything else fails, try:
python -m pip install dateutil
or
python3 -m pip install dateutil
or even
python -m pip install --user dateutil
''')
exit(1)
import logging
from sys import version_info, platform, version
# try:
Expand Down

0 comments on commit 627f211

Please sign in to comment.