We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1034ca5 commit abbcd67Copy full SHA for abbcd67
1 file changed
pythonbits/bb.py
@@ -61,8 +61,20 @@ def confirm_finalization(self, fields):
61
fields or self.default_fields)
62
63
def subcategory(self):
64
- # only video for now
65
- return VideoSubmission
+ files = []
+ for root, _, fs in os.walk(self['path']):
66
+ for f in fs:
67
+ fpath = os.path.join(root, f)
68
+ files.append((os.path.getsize(fpath), fpath))
69
+
70
+ for size, path in sorted(files, reverse=True):
71
+ mime_guess, _ = guess_type(path)
72
+ if mime_guess:
73
+ mime_guess = mime_guess.split('/')
74
+ if mime_guess[0] == 'video':
75
+ return VideoSubmission
76
+ elif mime_guess[0] == 'audio':
77
+ return AudioSubmission
78
79
def subcategorise(self):
80
log.debug('Attempting to narrow category')
0 commit comments