def handle(self, args, opts):
        """
        This method handles command line arguments for the frame set
        collection.

        :param list(str) args: The list of command line arguments.
        :param dict opts: The dict of options.
        :rtype: None
        """

        if args[1] == 'list':
            self.list()
        elif args[1] == 'select' and args[4] == 'curate' \
                and args[5] == 'manual':
            self.select_curate_manual(int(args[3]), opts)
        elif args[1] == 'select' and args[4] == 'extract':
            self.select_extract(parse_range(args[3]), args[5], opts)
        elif args[1] == 'delete':
            self.delete(parse_range(args[3]))
        elif args[1] == 'select' and args[4] == 'clone':
            self.select_clone(parse_range(args[3]))
        elif args[1] == 'select' and args[4] == 'merge':
            self.select_merge(parse_range(args[3]))
        elif args[1] == 'select' and args[4] == 'export' \
                and args[5] == 'dir':
            self.select_export_dir(parse_range(args[3]), args[6], opts)
        elif args[1] == 'insert' and args[3] == 'images':
            self.insert_images(args[4], opts)
        elif args[1] == 'usage':
            self.usage()
Ejemplo n.º 2
0
    def handle(self, args, opts):
        """
        This method handles command line arguments for the video collection.

        :param list(str) args: The list of command line arguments.
        :param dict opts: The dict of options.
        :rtype: None
        """

        if args[1] == 'insert' and args[3] == 'file':
            self.insert_file(args[4], opts)
        elif args[1] == 'insert' and args[3] == 'youtube':
            self.insert_youtube(args[4], opts)
        elif args[1] == 'insert' and args[3] == 'vimeo':
            self.insert_vimeo(args[4], opts)
        elif args[1] == 'insert' and args[3] == 'image':
            self.insert_image(args[4], opts)
        elif args[1] == 'list':
            self.list()
        elif args[1] == 'select' and args[4] == 'extract':
            self.select_extract(parse_range(args[3]), opts)
        elif args[1] == 'delete':
            self.delete(parse_range(args[3]))
        elif args[1] == 'select' and args[4] == 'deploy':
            self.select_deploy(int(args[3]), args[5], opts)
        elif args[1] == 'select' and args[4] == 'detect':
            self.select_detect(int(args[3]), args[5], opts)
        elif args[1] == 'usage':
            self.usage()
Ejemplo n.º 3
0
 def test_parse_range(self):
     self.assertEqual(parse_range('1'), [1])
     self.assertEqual(parse_range('1-3'), [1, 2, 3])
     self.assertEqual(parse_range('1,3'), [1, 3])
     self.assertEqual(parse_range('1-3,5-7'), [1, 2, 3, 5, 6, 7])
     self.assertEqual(parse_range('1-3,5,7-9'), [1, 2, 3, 5, 7, 8, 9])
     self.assertEqual(parse_range('1 - 3'), [1, 2, 3])
     self.assertEqual(parse_range('1 , 3'), [1, 3])
     self.assertEqual(parse_range('1 - 3 , 5 - 7'), [1, 2, 3, 5, 6, 7])
     self.assertEqual(parse_range('1 - 3, 5 , 7 - 9'),
                      [1, 2, 3, 5, 7, 8, 9])  # noqa
Ejemplo n.º 4
0
    def handle(self, args, opts):
        """
        This method handles command line arguments for the transform set
        collection.

        :param list(str) args: The list of command line arguments.
        :param dict opts: The dict of options.
        :rtype: None
        """

        if args[1] == 'list':
            self.list()
        elif args[1] == 'select' and args[4] == 'extract':
            self.select_extract(parse_range(args[3]), args[5], opts)
        elif args[1] == 'select' and args[4] == 'curate':
            if args[5] == 'manual':
                self.select_curate_manual(int(args[3]), opts)
            else:
                self.select_curate_auto(parse_range(args[3]), args[5], opts)
        elif args[1] == 'select' and args[4] == 'export' \
                and args[5] == 'dir':
            self.select_export_dir(parse_range(args[3]), args[6], opts)
        elif args[1] == 'select' and args[4] == 'export' \
                and args[5] == 'video':
            self.select_export_video(parse_range(args[3]), args[6])
        elif args[1] == 'select' and args[4] == 'clone':
            self.select_clone(parse_range(args[3]))
        elif args[1] == 'select' and args[4] == 'merge':
            if len(args) == 6:
                self.select_merge_non_default(parse_range(args[3]), args[5],
                                              opts)
            else:
                self.select_merge(parse_range(args[3]))
        elif args[1] == 'delete':
            self.delete(parse_range(args[3]))
        elif args[1] == 'usage':
            self.usage()
Ejemplo n.º 5
0
 def test_parse_range_fails_to_parse_non_digit(self):
     with self.assertRaises(ValueError):
         parse_range('a')