Added a version argument and slightly updated the README

This commit is contained in:
Kepoor Hampond 2016-12-12 20:46:28 -08:00
parent 70b3c8447b
commit e745f086ce
4 changed files with 53 additions and 14 deletions

View file

@ -20,7 +20,7 @@ optional arguments:
```
[![asciicast](https://asciinema.org/a/bcs7i0sjmka052wsdyxg5xrug.png)](https://asciinema.org/a/bcs7i0sjmka052wsdyxg5xrug?speed=3&autoplay=true)
[![asciicast](https://asciinema.org/a/8kb9882j4cbtd4hwbsbb7h0ia.png)](https://asciinema.org/a/8kb9882j4cbtd4hwbsbb7h0ia?speed=3&autoplay=true)
[![asciicast](https://asciinema.org/a/8kb9882j4cbtd4hwbsbb7h0ia.png)](https://asciinema.org/a/8kb9882j4cbtd4hwbsbb7h0ia?speed=3)
___
### Installation

View file

@ -32,6 +32,7 @@ def console():
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-a', '--artist', dest="artist", help="Specify the artist name")
parser.add_argument('-v', '--version', dest="version", action='store_true', help="Display the version and exit.")
media = parser.add_mutually_exclusive_group()
media.add_argument('-A', '--album', dest="album", help="Specify album name of the artist")
@ -39,6 +40,17 @@ def main():
args = parser.parse_args()
if args.version:
import pkg_resources
print ("\n\n" + color("Ingenious Redistribution System", ["HEADER", "BOLD"]))
print ("Homepage: " + color("https://github.com/kepoorhampond/irs", ["OKGREEN"]))
print ("License: " + color("The GNU", ["YELLOW"]) + " (http://www.gnu.org/licenses/gpl.html)")
print ("Version: " + pkg_resources.get_distribution("irs").version)
print ("\n")
exit(0)
if args.artist and not (args.album or args.song):
print ("usage: __init__.py [-h] [-a ARTIST] [-A ALBUM | -s SONG] \n\
error: must specify -A/--album or -s/--song if specifying -a/--artist")

View file

@ -4,21 +4,48 @@ def strip_special_chars(string):
string.replace(char, "")
return string
class bc:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[32m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
GRAY = '\033[30m'
YELLOW = '\033[33m'
def supports_color():
"""
Returns True if the running system's terminal supports color, and False
otherwise.
"""
plat = sys.platform
supported_platform = plat != 'Pocket PC' and (plat != 'win32' or
'ANSICON' in os.environ)
# isatty is not always implemented, #6223.
is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
if not supported_platform or not is_a_tty:
return False
return True
if supports_color():
class bc:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[32m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
GRAY = '\033[30m'
YELLOW = '\033[33m'
else:
class bc:
HEADER = ''
OKBLUE = ''
OKGREEN = ''
WARNING = ''
FAIL = ''
ENDC = ''
BOLD = ''
UNDERLINE = ''
GRAY = ''
YELLOW = ''
def color(text, colors=[]):
color_string = ""
for color in colors:
color_string += "bc.%s + " % color
color_string = color_string[:-2]
return (eval(color_string) + text + bc.ENDC)
return (bc.ENDC + eval(color_string) + text + bc.ENDC)

View file

@ -2,7 +2,7 @@ from setuptools import setup
setup(
name='irs',
version='1.1.4',
version='1.2.4',
description='A music downloader that just gets metadata.',
url='https://github.com/kepoorhampond/irs',
author='Kepoor Hampond',