-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added: --kill to stop background radios sometimes radioactive exists without terminating the ffplay process. find and kill those unwanted processes. * Feat: new pypi project structure * license year updated * README using remote images instead of local * fix: project restructured * minor fix * fix: saving empty last station * fix: build warning * Added: project Makefile * twine added
- Loading branch information
Showing
15 changed files
with
178 additions
and
49 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,7 +130,6 @@ dmypy.json | |
last_station.json | ||
build.sh | ||
deploy.sh | ||
Makefile | ||
|
||
pylint.txt | ||
.gitpod.yml |
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
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,5 @@ | ||
include *.py | ||
include README.md | ||
include LICENSE | ||
include requirements.txt | ||
include requirements-dev.txt |
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,60 @@ | ||
SHELL := /bin/bash | ||
PYTHON = python3 | ||
TEST_PATH = ./tests/ | ||
FLAKE8_EXCLUDE = venv,.venv,.eggs,.tox,.git,__pycache__,*.pyc | ||
SRC_DIR = "radioactive" | ||
TEST_DIR = "test" | ||
|
||
all: clean install-dev test | ||
|
||
check: | ||
${PYTHON} -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude ${FLAKE8_EXCLUDE} | ||
${PYTHON} -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=79 --statistics --exclude ${FLAKE8_EXCLUDE} | ||
|
||
clean: | ||
@find . -name '*.pyc' -exec rm --force {} + | ||
@find . -name '*.pyo' -exec rm --force {} + | ||
@find . -name '*~' -exec rm --force {} + | ||
rm -rf build | ||
rm -rf dist | ||
rm -rf *.egg-info | ||
rm -f *.sqlite | ||
rm -rf .cache | ||
|
||
dist: clean | ||
${PYTHON} setup.py sdist bdist_wheel | ||
|
||
deploy: | ||
twine upload --repository-url https://upload.pypi.org/legacy/ dist/* | ||
|
||
test-deploy: dist | ||
@echo "-------------------- sending to testpypi server ------------------------" | ||
@twine upload -r testpypi dist/* | ||
|
||
help: | ||
@echo "---------------------------- help --------------------------------------" | ||
@echo " clean" | ||
@echo " Remove python artifacts and build artifacts." | ||
@echo " isort" | ||
@echo " Sort import statements." | ||
@echo " check" | ||
@echo " Check style with flake8." | ||
@echo " test" | ||
@echo " Run pytest" | ||
|
||
isort: | ||
@echo "Sorting imports..." | ||
isort $(SRC_DIR) $(TEST_DIR) | ||
|
||
build: | ||
python3 setup.py build | ||
|
||
install: | ||
pip install -e . | ||
|
||
install-dev: install | ||
pip install --upgrade pip | ||
pip install -e .[dev] | ||
|
||
test: | ||
${PYTHON} -m pytest ${TEST_PATH} |
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
from radioactive.handler import Handler | ||
from radioactive.help import show_help | ||
from radioactive.last_station import Last_station | ||
from radioactive.player import Player | ||
from radioactive.player import Player, kill_background_ffplays | ||
|
||
|
||
# using sentry to gather unhandled errors at production and will be removed on next major update. | ||
|
@@ -27,9 +27,6 @@ | |
|
||
sentry_sdk.init( | ||
dsn="https://[email protected]/5749950", | ||
# Set traces_sample_rate to 1.0 to capture 100% | ||
# of transactions for performance monitoring. | ||
# We recommend adjusting this value in production. | ||
traces_sample_rate=1.0, | ||
) | ||
|
||
|
@@ -63,6 +60,7 @@ def main(): | |
add_to_favorite = args.add_to_favorite | ||
show_favorite_list = args.show_favorite_list | ||
flush_fav_list = args.flush | ||
kill_ffplays = args.kill_ffplays | ||
######################################## | ||
|
||
VERSION = app.get_version() | ||
|
@@ -123,10 +121,20 @@ def main(): | |
else: | ||
log.debug("Update not available") | ||
|
||
# flush ? | ||
if flush_fav_list: | ||
# exit radio after deleting fav stations | ||
sys.exit(alias.flush()) | ||
|
||
# -------------- kill background ffplay PIDs --------------------# | ||
# sometimes radio exits while ffplay is still running. | ||
# actively trying to prevent these scenarios. until then use this | ||
|
||
if kill_ffplays: | ||
kill_background_ffplays() | ||
sys.exit(0) | ||
|
||
# ----------------- favorite list ---------------- # | ||
if show_favorite_list: | ||
log.info("Your favorite station list is below") | ||
table = Table(show_header=True, header_style="bold magenta") | ||
|
@@ -140,6 +148,7 @@ def main(): | |
log.info("You have no favorite station list") | ||
sys.exit(0) | ||
|
||
# --------------------------- add a station --------------------------# | ||
if add_station: | ||
left = input("Enter station name:") | ||
right = input("Enter station stream-url or radio-browser uuid:") | ||
|
@@ -172,8 +181,7 @@ def main(): | |
if station_name is None and station_uuid is None: | ||
# Add a selection list here. first entry must be the last played station | ||
# try to fetch the last played station's information | ||
# log.warn( | ||
# "No station information provided, trying to play the last station") | ||
|
||
try: | ||
last_station_info = last_station.get_info() | ||
except: | ||
|
@@ -209,7 +217,7 @@ def main(): | |
) | ||
sys.exit(0) | ||
|
||
_ , index = pick(options, title, indicator="-->") | ||
_, index = pick(options, title, indicator="-->") | ||
|
||
# check if there is direct URL or just UUID | ||
station_option_url = station_selection_urls[index] | ||
|
@@ -326,7 +334,9 @@ def main(): | |
last_played_station["alias"] = True | ||
|
||
if not skip_saving_current_station: | ||
last_station.save_info(last_played_station) | ||
log.debug(f"Saving the current station: {last_played_station}") | ||
if last_played_station: | ||
last_station.save_info(last_played_station) | ||
|
||
# TODO: handle error when favouring last played (aliased) station (BUG) (LOW PRIORITY) | ||
if add_to_favorite: | ||
|
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
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
Oops, something went wrong.