Add support for s3 uploads.
This commit is contained in:
parent
e78453d6bd
commit
a7e2f04bde
3 changed files with 23 additions and 1 deletions
|
@ -52,7 +52,10 @@ def DemoInPath(wad, mapstr):
|
|||
return sorted(filter(lambda s : re.search("-", str(s)), candidates))[-1]
|
||||
|
||||
def DemoOutPath(wad, mapstr):
|
||||
return DEMOS.joinpath(wad).joinpath("{}_map{}.lmp".format(wad, mapstr))
|
||||
return DEMOS.joinpath(wad).joinpath(DemoName(wad, mapstr))
|
||||
|
||||
def VideoPath(wad, mapstr):
|
||||
return OUTPUT.joinpath(wad).joinpath("{}_map{}.mp4".format(wad, mapstr))
|
||||
|
||||
def DemoName(wad, mapstr):
|
||||
return "{}_map{}.lmp".format(wad, mapstr)
|
||||
|
|
18
dcc/put.py
Normal file
18
dcc/put.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
from cliff.command import Command
|
||||
import dcc.config
|
||||
import boto3
|
||||
|
||||
class Put(Command):
|
||||
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
|
||||
def take_action(self, parsed_args):
|
||||
s3_client = boto3.client('s3')
|
||||
demo = dcc.config.DemoInPath(parsed_args.wad, parsed_args.map)
|
||||
s3_client.upload_file(
|
||||
demo, 'yrriban', 'doom/' + dcc.config.DemoName(parsed_args.wad, parsed_args.map),
|
||||
ExtraArgs={'ContentType': 'binary/octet-stream'})
|
1
setup.py
1
setup.py
|
@ -24,6 +24,7 @@ setup(
|
|||
'play = dcc.play:Play',
|
||||
'record = dcc.record:Record',
|
||||
'fabricate = dcc.fabricate:Fabricate',
|
||||
'put = dcc.put:Put',
|
||||
],
|
||||
},
|
||||
zip_safe=False,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue