Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
andreztz committed Jan 1, 2022
0 parents commit a962a0a
Showing 40 changed files with 1,615 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
127 changes: 127 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

.vscode/
.idea/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 André P. Santos

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# xradios

[![Upload Python Package](https://github.com/andreztz/xradios/actions/workflows/python-publish.yml/badge.svg)](https://github.com/andreztz/xradios/actions/workflows/python-publish.yml)

> Search and play your favorite Internet radio station.
<https://user-images.githubusercontent.com/7193527/144721555-fc18e17c-38a6-42f2-ad4e-df40542e24f2.mp4>

## Installation

```bash
$ pip install xradios
```

## Usage example

Open the terminal, and run the following command

```bash

$ xradios

```


## Development setup

```bash
$ git clone git@github.com:andreztz/xradios.git
$ pip install -e .
```

## Release History

- Work in progress

## Meta

André P. Santos – [@ztzandre](https://twitter.com/ztzandre)andreztz@gmail.com

Distributed under the XYZ license. See `LICENSE` for more information.

[https://github.com/andreztz/xradios](https://github.com/andreztz/)

## Contributing

1. Fork it (<https://github.com/andreztz/xradios/fork>)
2. Create your feature branch (`git checkout -b feature/fooBar`)
3. Commit your changes (`git commit -am 'Add some fooBar'`)
4. Push to the branch (`git push origin feature/fooBar`)
5. Create a new Pull Request
50 changes: 50 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
SHELL := /bin/bash
PYTHON = python3
TEST_PATH = ./tests/
FLAKE8_EXCLUDE = .venv,.eggs,,tox,.git,__pycache__,*.pyc


all:
clean install 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

build: clean
@python -m build

deploy: dist
@echo "-------------------- sending to pypi server ------------------------"
@twine upload dist/*

help:
@echo "---------------------------- help --------------------------------------"
@echo " clean"
@echo " Remove python artifacts and build artifacts."
@echo " build"
@echo " Generate the distribution."
@echo " deploy"
@echo " Deploy on pypi.org."
@echo " check"
@echo " Check style with flake8."
@echo " black"
@echo " Run black"

install:
pip install --upgrade pip
pip install -e .

test:
${PYTHON} -m pytest ${TEST_PATH}
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
prompt-toolkit>=3.0.8
notify-send>=0.0.20
Pygments>=2.7.3
streamscrobbler3>=0.0.4
python-mpv>=0.5.2
pyradios>=0.0.22
pluginbase>=1.0.1
python-vlc>=3.0.12118
psutil>=5.8.0
tinydb>=4.5.2
39 changes: 39 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[metadata]
name = xradios
version = attr: xradios.__version__
description = Search and play your favorite Internet radio station.
author = André P. Santos
author_email = andreztz@gmail.com
long_description_content_type = text/markdown
long_description = file: README.md
license = MIT
url = https://github.com/andreztz/xradios
keywords = player, radio, stations, radio-stations, terminal
classifiers =
Development Status :: 1 - Planning
Intended Audience :: End Users/Desktop
Programming Language :: Python :: 3 :: Only
Topic :: Multimedia :: Sound/Audio :: Players
Topic :: Utilities
project_urls =
Source = https://github.com/andreztz/xradios/

[options]
python_requires = >=3.8
include_package_data = true
packages = find:
install_requires =
prompt-toolkit >= 3.0.8
notify-send >= 0.0.20
Pygments >= 2.7.3
streamscrobbler3 >= 0.0.4
python-mpv >= 0.5.2
pyradios >= 0.0.22
python-vlc >= 3.0.12118
pluginbase >= 1.0.1


[options.entry_points]
console_scripts =
xradios = xradios.__main__:main
xradiosd = xradios.core.server:main
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from setuptools import setup


setup()
1 change: 1 addition & 0 deletions xradios/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.0.dev5"
31 changes: 31 additions & 0 deletions xradios/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import time
import logging
import subprocess

from xradios.tui import TUI
from xradios.cli import parser
from xradios.tui.client import proxy


def main():
cli = parser.parse_args()
query = {}
if cli.stations_by_tag:
query['command'] = "bytag"
query["term"] = cli.stations_by_tag
else:
query['command'] = "bytag"
query["term"] = "trance"
proc = subprocess.Popen(
['xradiosd'],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL
)
time.sleep(2)
response = proxy.bookmarks()
# response = proxy.search(**query)
tui = TUI()
tui.initialize(response)
tui.run()
proc.terminate()
proc.wait(timeout=2)
11 changes: 11 additions & 0 deletions xradios/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import argparse


def create_parser():
parser = argparse.ArgumentParser()
parser.add_argument('--stations-by-tag', type=str)
# parser.add_argument('--station-by-tag-list', type=str)
return parser


parser = create_parser()
Empty file added xradios/core/__init__.py
Empty file.
Loading

0 comments on commit a962a0a

Please sign in to comment.