Last active
December 9, 2020 23:23
-
-
Save munroebot/8ac2490ec7af2b7abad0732c1adaf2db to your computer and use it in GitHub Desktop.
GoProFileModel class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math, sys | |
import json | |
from goprocam import GoProCamera, constants | |
# files look like: GH010041.mp4, GH020041.mp4 | |
class GoProFileModel: | |
def __init__(self, filename): | |
self.filename = filename | |
self.gp = GoProCamera.GoPro(constants.gpcontrol) | |
@property | |
def prefix(self): | |
return self.filename[0:2] | |
@property | |
def chapter(self): | |
return self.filename[2:4] | |
@property | |
def clip(self): | |
return self.filename[4:8] | |
@property | |
def extension(self): | |
return self.filename[9:] | |
@property | |
def sane_format(self): | |
return self.clip + "-" + self.chapter + "." + self.extension | |
@property | |
def duration(self): | |
return self.gp.getVideoInfo("dur",folder,self.filename) | |
@property | |
def tags(self): | |
return self.gp.getVideoInfo("tags",folder,self.filename) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment