Add a base class for commands that provides wad and map arguments.
This commit is contained in:
parent
f8873e1947
commit
aff20e9557
6 changed files with 18 additions and 40 deletions
8
dcc/doom_base.py
Normal file
8
dcc/doom_base.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
from cliff.command import Command
|
||||||
|
|
||||||
|
class WadMap(Command):
|
||||||
|
def get_parser(self, prog_name):
|
||||||
|
parser = super().get_parser(prog_name)
|
||||||
|
parser.add_argument('wad')
|
||||||
|
parser.add_argument('map')
|
||||||
|
return parser
|
|
@ -1,14 +1,8 @@
|
||||||
from cliff.command import Command
|
|
||||||
import dcc.config
|
import dcc.config
|
||||||
|
import dcc.doom_base
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
class Fabricate(Command):
|
class Fabricate(dcc.doom_base.WadMap):
|
||||||
def get_parser(self, prog_name):
|
|
||||||
parser = super().get_parser(prog_name)
|
|
||||||
parser.add_argument('wad')
|
|
||||||
parser.add_argument('map')
|
|
||||||
return parser
|
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
subprocess.run([dcc.config.DSDA] +
|
subprocess.run([dcc.config.DSDA] +
|
||||||
dcc.config.DsdaPreamble(parsed_args.wad, parsed_args.map) +
|
dcc.config.DsdaPreamble(parsed_args.wad, parsed_args.map) +
|
||||||
|
|
10
dcc/pb.py
10
dcc/pb.py
|
@ -1,14 +1,8 @@
|
||||||
from cliff.command import Command
|
|
||||||
import dcc.config
|
import dcc.config
|
||||||
|
import dcc.doom_base
|
||||||
import vlc
|
import vlc
|
||||||
|
|
||||||
class PB(Command):
|
class PB(dcc.doom_base.WadMap):
|
||||||
def get_parser(self, prog_name):
|
|
||||||
parser = super().get_parser(prog_name)
|
|
||||||
parser.add_argument('wad')
|
|
||||||
parser.add_argument('map')
|
|
||||||
return parser
|
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
v = dcc.config.VideoPath(parsed_args.wad, parsed_args.map)
|
v = dcc.config.VideoPath(parsed_args.wad, parsed_args.map)
|
||||||
mp = vlc.MediaPlayer(v)
|
mp = vlc.MediaPlayer(v)
|
||||||
|
|
10
dcc/play.py
10
dcc/play.py
|
@ -1,13 +1,7 @@
|
||||||
from cliff.command import Command
|
|
||||||
import dcc.config
|
import dcc.config
|
||||||
|
import dcc.doom_base
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
class Play(Command):
|
class Play(dcc.doom_base.WadMap):
|
||||||
def get_parser(self, prog_name):
|
|
||||||
parser = super().get_parser(prog_name)
|
|
||||||
parser.add_argument('wad')
|
|
||||||
parser.add_argument('map')
|
|
||||||
return parser
|
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
subprocess.run([dcc.config.DSDA] + dcc.config.DsdaPreamble(parsed_args.wad, parsed_args.map))
|
subprocess.run([dcc.config.DSDA] + dcc.config.DsdaPreamble(parsed_args.wad, parsed_args.map))
|
||||||
|
|
10
dcc/put.py
10
dcc/put.py
|
@ -1,14 +1,8 @@
|
||||||
from cliff.command import Command
|
|
||||||
import boto3
|
import boto3
|
||||||
import dcc.config
|
import dcc.config
|
||||||
|
import dcc.doom_base
|
||||||
|
|
||||||
class Put(Command):
|
class Put(dcc.doom_base.WadMap):
|
||||||
def get_parser(self, prog_name):
|
|
||||||
parser = super().get_parser(prog_name)
|
|
||||||
parser.add_argument('wad')
|
|
||||||
parser.add_argument('map')
|
|
||||||
return parser
|
|
||||||
|
|
||||||
# TODO: accept configuration for bucket name
|
# TODO: accept configuration for bucket name
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
s3_client = boto3.client('s3')
|
s3_client = boto3.client('s3')
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
from cliff.command import Command
|
|
||||||
import dcc.config
|
import dcc.config
|
||||||
|
import dcc.doom_base.WadMap
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
class Record(Command):
|
class Record(dcc.doom_base.WadMap):
|
||||||
def get_parser(self, prog_name):
|
|
||||||
parser = super().get_parser(prog_name)
|
|
||||||
parser.add_argument('wad')
|
|
||||||
parser.add_argument('map')
|
|
||||||
return parser
|
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
subprocess.run([dcc.config.DSDA] +
|
subprocess.run([dcc.config.DSDA] +
|
||||||
dcc.config.DsdaPreamble(parsed_args.wad, parsed_args.map) +
|
dcc.config.DsdaPreamble(parsed_args.wad, parsed_args.map) +
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue