forked from 0x2620/pandora
py3 fixes
This commit is contained in:
parent
9b3547f9bc
commit
6aabe8d9df
4 changed files with 8 additions and 8 deletions
|
@ -17,7 +17,7 @@ def save_chunk(obj, file, chunk, offset, name, done_cb=None):
|
|||
if not file:
|
||||
file.name = name
|
||||
ox.makedirs(os.path.dirname(file.path))
|
||||
with open(file.path, 'w') as f:
|
||||
with open(file.path, 'wb') as f:
|
||||
f.write(chunk.read())
|
||||
obj.save()
|
||||
else:
|
||||
|
@ -27,7 +27,7 @@ def save_chunk(obj, file, chunk, offset, name, done_cb=None):
|
|||
offset = size
|
||||
elif offset > size:
|
||||
return False, size
|
||||
with open(path, 'r+') as f:
|
||||
with open(path, 'rb+') as f:
|
||||
f.seek(offset)
|
||||
f.write(chunk.read())
|
||||
return done_cb() if done_cb else True, file.size
|
||||
|
|
|
@ -31,7 +31,7 @@ class AspectRatio(fractions.Fraction):
|
|||
|
||||
def __new__(cls, numerator, denominator=None):
|
||||
if not denominator:
|
||||
ratio = map(int, numerator.split(':'))
|
||||
ratio = list(map(int, numerator.split(':')))
|
||||
if len(ratio) == 1:
|
||||
ratio.append(1)
|
||||
numerator = ratio[0]
|
||||
|
@ -560,7 +560,7 @@ def timeline_strip(item, cuts, info, prefix):
|
|||
if cuts[0] != 0:
|
||||
cuts.insert(0, 0)
|
||||
|
||||
cuts = map(lambda x: int(round(x * fps)), cuts)
|
||||
cuts = list(map(lambda x: int(round(x * fps)), cuts))
|
||||
|
||||
for frame in range(frames):
|
||||
i = int(frame / timeline_width)
|
||||
|
|
|
@ -215,7 +215,7 @@ class File(models.Model):
|
|||
add_file(f)
|
||||
versions = ox.movie.parse_item_files(files)
|
||||
for version in versions:
|
||||
p = filter(lambda f: f['oshash'] == self.oshash, version['files'])
|
||||
p = list(filter(lambda f: f['oshash'] == self.oshash, version['files']))
|
||||
if p:
|
||||
return p[0]['normalizedPath']
|
||||
|
||||
|
@ -774,7 +774,7 @@ class Stream(models.Model):
|
|||
self.duration = self.info.get('duration', 0)
|
||||
if 'video' in self.info and self.info['video']:
|
||||
if 'display_aspect_ratio' in self.info['video'][0]:
|
||||
dar = map(int, self.info['video'][0]['display_aspect_ratio'].split(':'))
|
||||
dar = list(map(int, self.info['video'][0]['display_aspect_ratio'].split(':')))
|
||||
self.aspect_ratio = dar[0] / dar[1]
|
||||
else:
|
||||
self.aspect_ratio = self.info['video'][0]['width'] / self.info['video'][0]['height']
|
||||
|
|
|
@ -29,14 +29,14 @@ def trim(docstring):
|
|||
# and split into a list of lines:
|
||||
lines = docstring.expandtabs().splitlines()
|
||||
# Determine minimum indentation (first line doesn't count):
|
||||
indent = sys.maxint
|
||||
indent = sys.maxsize
|
||||
for line in lines[1:]:
|
||||
stripped = line.lstrip()
|
||||
if stripped:
|
||||
indent = min(indent, len(line) - len(stripped))
|
||||
# Remove indentation (first line is special):
|
||||
trimmed = [lines[0].strip()]
|
||||
if indent < sys.maxint:
|
||||
if indent < sys.maxsize:
|
||||
for line in lines[1:]:
|
||||
trimmed.append(line[indent:].rstrip())
|
||||
# Strip off trailing and leading blank lines:
|
||||
|
|
Loading…
Reference in a new issue