mirror of
https://github.com/cooperhammond/irs.git
synced 2025-03-23 16:25:06 +00:00
Added a version argument and slightly updated the README
This commit is contained in:
parent
70b3c8447b
commit
e745f086ce
|
@ -20,7 +20,7 @@ optional arguments:
|
||||||
```
|
```
|
||||||
[](https://asciinema.org/a/bcs7i0sjmka052wsdyxg5xrug?speed=3&autoplay=true)
|
[](https://asciinema.org/a/bcs7i0sjmka052wsdyxg5xrug?speed=3&autoplay=true)
|
||||||
|
|
||||||
[](https://asciinema.org/a/8kb9882j4cbtd4hwbsbb7h0ia?speed=3&autoplay=true)
|
[](https://asciinema.org/a/8kb9882j4cbtd4hwbsbb7h0ia?speed=3)
|
||||||
|
|
||||||
___
|
___
|
||||||
### Installation
|
### Installation
|
||||||
|
|
|
@ -32,6 +32,7 @@ def console():
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-a', '--artist', dest="artist", help="Specify the artist name")
|
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 = parser.add_mutually_exclusive_group()
|
||||||
media.add_argument('-A', '--album', dest="album", help="Specify album name of the artist")
|
media.add_argument('-A', '--album', dest="album", help="Specify album name of the artist")
|
||||||
|
@ -39,6 +40,17 @@ def main():
|
||||||
|
|
||||||
args = parser.parse_args()
|
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):
|
if args.artist and not (args.album or args.song):
|
||||||
print ("usage: __init__.py [-h] [-a ARTIST] [-A ALBUM | -s SONG] \n\
|
print ("usage: __init__.py [-h] [-a ARTIST] [-A ALBUM | -s SONG] \n\
|
||||||
error: must specify -A/--album or -s/--song if specifying -a/--artist")
|
error: must specify -A/--album or -s/--song if specifying -a/--artist")
|
||||||
|
|
51
irs/utils.py
51
irs/utils.py
|
@ -4,21 +4,48 @@ def strip_special_chars(string):
|
||||||
string.replace(char, "")
|
string.replace(char, "")
|
||||||
return string
|
return string
|
||||||
|
|
||||||
class bc:
|
def supports_color():
|
||||||
HEADER = '\033[95m'
|
"""
|
||||||
OKBLUE = '\033[94m'
|
Returns True if the running system's terminal supports color, and False
|
||||||
OKGREEN = '\033[32m'
|
otherwise.
|
||||||
WARNING = '\033[93m'
|
"""
|
||||||
FAIL = '\033[91m'
|
plat = sys.platform
|
||||||
ENDC = '\033[0m'
|
supported_platform = plat != 'Pocket PC' and (plat != 'win32' or
|
||||||
BOLD = '\033[1m'
|
'ANSICON' in os.environ)
|
||||||
UNDERLINE = '\033[4m'
|
# isatty is not always implemented, #6223.
|
||||||
GRAY = '\033[30m'
|
is_a_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
|
||||||
YELLOW = '\033[33m'
|
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=[]):
|
def color(text, colors=[]):
|
||||||
color_string = ""
|
color_string = ""
|
||||||
for color in colors:
|
for color in colors:
|
||||||
color_string += "bc.%s + " % color
|
color_string += "bc.%s + " % color
|
||||||
color_string = color_string[:-2]
|
color_string = color_string[:-2]
|
||||||
return (eval(color_string) + text + bc.ENDC)
|
return (bc.ENDC + eval(color_string) + text + bc.ENDC)
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -2,7 +2,7 @@ from setuptools import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='irs',
|
name='irs',
|
||||||
version='1.1.4',
|
version='1.2.4',
|
||||||
description='A music downloader that just gets metadata.',
|
description='A music downloader that just gets metadata.',
|
||||||
url='https://github.com/kepoorhampond/irs',
|
url='https://github.com/kepoorhampond/irs',
|
||||||
author='Kepoor Hampond',
|
author='Kepoor Hampond',
|
||||||
|
|
Loading…
Reference in a new issue