def setup_parser_upload_youtube(subparsers): """Setup youtube upload command parser""" defaults = YoutubeFrontend.get_defaults() parser = subparsers.add_parser("youtube", help="Youtube upload command line tool") parser.add_argument("files", help="Path to videos or video directories to upload", nargs="*", default=[defaults["video_directory"]]) parser.add_argument("-t", "--token", help="Path to OAuth2 token", default=defaults["oauth2_token"]) parser.add_argument("-y", "--yes", help="Automatic yes to prompts", action="store_true")
def setup_parser_config_youtube(subparsers): """Setup Youtube config parser""" from oauth2client import tools # Inherent Google API argparser parser = subparsers.add_parser("youtube", help="Obtain OAuth2 token for Youtube access", parents=[tools.argparser]) defaults = YoutubeFrontend.get_defaults() parser.add_argument("-c", "--client-secrets", help="Path to client secrets file", default=defaults["client_secrets"]) parser.add_argument("-t", "--token", help="Location to save token file", default=defaults["oauth2_token"])
def setup_parser_config_youtube(subparsers): """Setup Youtube config parser""" from oauth2client import tools # Inherent Google API argparser parser = subparsers.add_parser( "youtube", help="Obtain OAuth2 token for Youtube access", parents=[tools.argparser]) defaults = YoutubeFrontend.get_defaults() parser.add_argument("-c", "--client-secrets", help="Path to client secrets file", default=defaults["client_secrets"]) parser.add_argument("-t", "--token", help="Location to save token file", default=defaults["oauth2_token"])
def parse_args(parser, parse_args=None): if len(sys.argv) == 1: # No arguments passed launch_recordapp() args = parser.parse_args(parse_args) if args.app == 'record': if len(sys.argv) == 2: # No 'record' arguments passed launch_recordapp() import gobject # Must declare after argparse otherwise GStreamer will take over the cli help from freeseer.frontend.record.RecordingController import RecordingController # TODO: Abstract the database stuff away from here as it's only # used in conjunction with talks. if args.profile is None: # Profile is an optional parameter args.profile = 'default' profile = settings.profile_manager.get(args.profile) config = profile.get_config('freeseer.conf', settings.FreeseerConfig, storage_args=['Global'], read_only=False) # XXX: There should only be 1 database per user. Workaround for this # is to put it in the 'default' profile. db = settings.profile_manager.get().get_database() app = RecordingController(profile, db, config, cli=True) if args.talk: if app.record_talk_id(args.talk): sys.exit(gobject.MainLoop().run()) elif args.filename: if app.record_filename(args.filename): sys.exit(gobject.MainLoop().run()) elif args.show_talks: app.print_talks() elif args.app == 'config': if len(sys.argv) == 2: # No 'config' arguments passed launch_configtool() from freeseer.settings import configdir from freeseer.framework.util import reset from freeseer.framework.util import reset_configuration from freeseer.framework.util import reset_database from freeseer.framework.youtube import YoutubeService if args.reset: reset(configdir) elif args.reset_configuration: reset_configuration(configdir) elif args.reset_database: reset_database(configdir) elif args.config_service == "youtube": YoutubeService.acquire_token(args.client_secrets, args.token, args) elif args.app == 'talk': if len(sys.argv) == 2: # No 'talk' arguments passed launch_talkeditor() from freeseer.framework.presentation import Presentation profile = settings.profile_manager.get() db = profile.get_database() if args.action == "add": presentation = Presentation(args.title, speaker=args.speaker, room=args.room, event=args.event) db.insert_presentation(presentation) elif args.action == "remove": db.delete_presentation(args.talk_id) elif args.action == "clear": db.clear_database() else: print("Invalid option.") elif args.app == 'report': if len(sys.argv) == 2: # No 'report' arguments passed launch_reporteditor() elif args.app == 'upload': if args.upload_service == 'youtube': youtube = YoutubeFrontend() youtube.upload(args.files, args.token, args.yes)
def parse_args(parser, parse_args=None): if len(sys.argv) == 1: # No arguments passed launch_recordapp() args = parser.parse_args(parse_args) if args.app == 'record': if len(sys.argv) == 2: # No 'record' arguments passed launch_recordapp() import gobject # Must declare after argparse otherwise GStreamer will take over the cli help from freeseer.frontend.record.RecordingController import RecordingController # TODO: Abstract the database stuff away from here as it's only # used in conjunction with talks. if args.profile is None: # Profile is an optional parameter args.profile = 'default' profile = settings.profile_manager.get(args.profile) config = profile.get_config('freeseer.conf', settings.FreeseerConfig, storage_args=['Global'], read_only=False) # XXX: There should only be 1 database per user. Workaround for this # is to put it in the 'default' profile. db = settings.profile_manager.get().get_database() app = RecordingController(profile, db, config, cli=True) if args.talk: if app.record_talk_id(args.talk): sys.exit(gobject.MainLoop().run()) elif args.filename: if app.record_filename(args.filename): sys.exit(gobject.MainLoop().run()) elif args.show_talks: app.print_talks() elif args.app == 'config': if len(sys.argv) == 2: # No 'config' arguments passed launch_configtool() from freeseer.settings import configdir from freeseer.framework.util import reset from freeseer.framework.util import reset_configuration from freeseer.framework.util import reset_database from freeseer.framework.youtube import YoutubeService if args.config_service == "reset": if args.reset == "all": reset(configdir) elif args.reset == "configuration": reset_configuration(configdir, args.profile) elif args.reset == "database": reset_database(configdir, args.profile) else: print("Invalid reset option.") elif args.config_service == "youtube": YoutubeService.acquire_token(args.client_secrets, args.token, args) elif args.app == 'talk': if len(sys.argv) == 2: # No 'talk' arguments passed launch_talkeditor() from freeseer.framework.presentation import Presentation profile = settings.profile_manager.get() db = profile.get_database() if args.action == "add": presentation = Presentation(args.title, speaker=args.speaker, room=args.room, event=args.event) db.insert_presentation(presentation) elif args.action == "remove": db.delete_presentation(args.talk_id) elif args.action == "clear": db.clear_database() else: print("Invalid option.") elif args.app == 'report': if len(sys.argv) == 2: # No 'report' arguments passed launch_reporteditor() elif args.app == 'upload': if args.upload_service == 'youtube': youtube = YoutubeFrontend() youtube.upload(args.files, args.token, args.yes)