-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
214 additions
and
61 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.ropeproject | ||
*.pyc | ||
*.orig |
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 @@ | ||
2012-08-29 klen | ||
|
||
* Version 0.3.0 | ||
* Add console interface | ||
* Published on pypi |
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 @@ | ||
Command line internet radio player. |
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,32 @@ | ||
MODULE=pyradio | ||
SPHINXBUILD=sphinx-build | ||
ALLSPHINXOPTS= -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . | ||
BUILDDIR=_build | ||
|
||
|
||
.PHONY: clean | ||
clean: | ||
sudo rm -rf build dist docs/_build | ||
find . -name "*.pyc" -delete | ||
find . -name "*.orig" -delete | ||
|
||
.PHONY: register | ||
register: | ||
python setup.py register | ||
|
||
.PHONY: upload | ||
upload: | ||
python setup.py sdist upload || echo 'Upload already' | ||
|
||
.PHONY: test | ||
test: audit | ||
python setup.py test | ||
|
||
.PHONY: audit | ||
audit: | ||
pylama $(MODULE) -i E501 | ||
|
||
.PHONY: doc | ||
doc: docs | ||
python setup.py build_sphinx --source-dir=docs/ --build-dir=docs/_build --all-files | ||
python setup.py upload_sphinx --upload-dir=docs/_build/html |
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,8 @@ | ||
" pyradio -- Console radio player. " | ||
|
||
version_info = (0, 3, 0) | ||
|
||
__version__ = version = '.'.join(map(str, version_info)) | ||
__project__ = __name__ | ||
__author__ = "Ben Dowling" | ||
__license__ = "MIT" |
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,55 @@ | ||
import csv | ||
import sys | ||
import curses | ||
from argparse import ArgumentParser | ||
from os import path as op | ||
|
||
from .radio import PyRadio | ||
|
||
|
||
DEFAULT_FILE = '' | ||
for path in ['~/.pyradio/stations.csv', '~/.pyradio', op.join(op.dirname(__file__), 'stations.csv')]: | ||
if op.exists(path) and op.isfile(path): | ||
DEFAULT_FILE = path | ||
break | ||
|
||
|
||
def shell(): | ||
parser = ArgumentParser(description="Console radio player") | ||
parser.add_argument("--stations", "-s", default=DEFAULT_FILE, help="Path on stations csv file.") | ||
parser.add_argument("--random", "-r", action='store_true', help="Start and play random station.") | ||
parser.add_argument("--add", "-a", action='store_true', help="Add station to list.") | ||
parser.add_argument("--list", "-l", action='store_true', help="List of added stations.") | ||
args = parser.parse_args() | ||
|
||
try: | ||
cfgfile = open(args.stations, 'rb') | ||
except IOError, e: | ||
print str(e) | ||
sys.exit(1) | ||
|
||
stations = [] | ||
for row in csv.reader(cfgfile, skipinitialspace=True): | ||
if row[0].startswith('#'): | ||
continue | ||
name, url = map(lambda s: s.strip(), row) | ||
stations.append((name, url)) | ||
|
||
if args.list: | ||
for name, url in stations: | ||
print '{0:50s} {1:s}'.format(name, url) | ||
sys.exit() | ||
|
||
if args.add: | ||
params = raw_input("Enter the name:"), raw_input("Enter the url:") | ||
cfgfile = open(args.stations, 'a+b') | ||
writter = csv.writer(cfgfile) | ||
writter.writerow(params) | ||
sys.exit() | ||
|
||
pyradio = PyRadio(stations, play=args.random) | ||
curses.wrapper(pyradio.setup) | ||
|
||
|
||
if __name__ == '__main__': | ||
shell() |
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
File renamed without changes.
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,44 @@ | ||
#!/usr/bin/env python | ||
from os import path as op | ||
from sys import version_info | ||
|
||
from setuptools import setup, find_packages | ||
|
||
from pyradio import version, __project__, __license__ | ||
|
||
|
||
read = lambda f: open(op.join(op.dirname(__file__), f)).read() if op.exists(f) else '' | ||
|
||
|
||
install_requires = [] | ||
if version_info < (2, 7): | ||
install_requires.append('argparse') | ||
|
||
|
||
meta = dict( | ||
name=__project__, | ||
version=version, | ||
license=__license__, | ||
description=read('DESCRIPTION'), | ||
long_description=read('README.md'), | ||
platforms=('Any'), | ||
|
||
author='Kirill Klenov', | ||
author_email='[email protected]', | ||
url=' http://github.com/coderholic/pyradio', | ||
|
||
packages=find_packages(), | ||
|
||
entry_points={ | ||
'console_scripts': [ | ||
'pyradio = pyradio.main:shell', | ||
] | ||
}, | ||
|
||
install_requires=install_requires, | ||
test_suite = 'tests', | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
setup(**meta) |