def nuke_it_from_orbit(): print('Are you sure you want to remove the database and start over?') confirmation = Colors.RED + 'KappaKeepoPogChamp' + Colors.ENDC confirm = input(f'Please type {confirmation} to continue: ') if confirm == 'KappaKeepoPogChamp': twitchy_database.DatabaseInit().remove_database() twitchy_config.ConfigInit().remove_config() print(' Done.')
def main(): parser = argparse.ArgumentParser( description='Watch twitch.tv from your terminal. IT\'S THE FUTURE.', add_help=False) parser.add_argument('searchfor', type=str, nargs='?', help='Search for channel name in database', metavar='*searchstring*') parser.add_argument('-h', '--help', help='This helpful message', action='help') parser.add_argument('-a', type=str, nargs='+', help='Add channel name(s) to database', metavar='') parser.add_argument('-an', type=str, nargs='?', const='Null', help='Set/Unset alternate names', metavar='*searchstring*') parser.add_argument('--configure', action='store_true', help='Configure options') parser.add_argument('-d', type=str, nargs='?', const='Null', help='Delete channel(s) from database', metavar='*searchstring*') parser.add_argument( '--non-interactive', type=str, nargs='?', help='Generate parsable data for integration elsewhere', const='go', metavar='go / kickstart') parser.add_argument('--reset', action='store_true', help='Start over') parser.add_argument( '-s', type=str, help='Sync username\'s followed accounts to local database', metavar='username') parser.add_argument('-v', type=str, nargs='+', help='Watch VODs', metavar='<channel>') parser.add_argument('-w', type=str, nargs='+', help='Watch specified channel(s)', metavar='<channel>') args = parser.parse_args() if (args.s or args.v) and args.searchfor: parser.error('Only one argument allowed with -s') exit(1) if args.a: channel_addition('add', args.a) elif args.an: arg = args.an if args.an == 'Null': arg = None database_modification('alternate_name', arg) elif args.configure: twitchy_config.ConfigInit().configure_options() elif args.d: arg = args.d if args.d == 'Null': arg = None database_modification('delete', arg) elif args.non_interactive: if args.non_interactive == 'go': non_interactive('get_online') elif args.non_interactive == 'kickstart': non_interactive('kickstart', args.searchfor) elif args.reset: nuke_it_from_orbit() elif args.s: channel_addition('sync', args.s) elif args.searchfor: watch_channel(None, args.searchfor) elif args.v: watch_vods(args.v) elif args.w: watch_channel('watch', args.w) else: watch_channel(None)
#!/usr/bin/env python3 # Requirements: streamlink, requests # Standard imports import sys import argparse # Exit if version requirements are not met if sys.version_info < (3, 6): print(' Python 3.6 or greater required.') exit(1) # Custom imports from twitchy import twitchy_config # This import also creates the path from twitchy.twitchy_config import Colors, YouAndTheHorseYouRodeInOn twitchy_config.ConfigInit() # Everything will error out unless # both the config and the database files exist from twitchy import twitchy_database twitchy_database.DatabaseInit() from twitchy import twitchy_api from twitchy import twitchy_display from twitchy import twitchy_play # All database functions are methods in database_instance database_instance = twitchy_database.DatabaseFunctions() Options = twitchy_config.Options() Options.parse_options()
import sys from setuptools import setup MAJOR_VERSION = '3' MINOR_VERSION = '4' MICRO_VERSION = '0' VERSION = "{}.{}.{}".format(MAJOR_VERSION, MINOR_VERSION, MICRO_VERSION) if sys.argv[-1] == 'test': from twitchy import twitchy_config twitchy_config.ConfigInit(True) setup(name='twitchy', version=VERSION, description="Command line streamlink wrapper for twitch.tv", url='https://github.com/BasioMeusPuga/twitchy', author='BasioMeusPuga', author_email='*****@*****.**', license='GPLv3', packages=['twitchy'], classifiers=[ 'Environment :: Console', 'Intended Audience :: End Users/Desktop', 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', 'Operating System :: MacOS :: MacOS X', 'Operating System :: Unix', 'Operating System :: POSIX', 'Programming Language :: Python', 'Programming Language :: Python :: 3.6', 'Development Status :: 5 - Production/Stable', 'Topic :: Multimedia :: Video :: Display' ], zip_safe=False,