minor: english variable names

This commit is contained in:
boyska 2018-02-13 20:28:01 +01:00
parent aeb59a8dc0
commit 1633ce703d

30
feed
View file

@ -42,17 +42,17 @@ def weighted_choice(values, weights):
class Audio(object):
def __init__(self, url, durata=None):
def __init__(self, url, duration=None):
self.url = url
if durata is None:
durata = get_duration(url.encode('utf-8'))
self.durata = durata
if duration is None:
duration = get_duration(url.encode('utf-8'))
self.duration = duration
def __str__(self):
return self.url
def __repr__(self):
return '<Audio {} ({})>'.format(self.url, self.durata)
return '<Audio {} ({})>'.format(self.url, self.duration)
@property
def urls(self):
@ -75,12 +75,12 @@ class AudioGroup(list):
def __repr__(self):
return '<AudioGroup "{}" ({})\n{} >'.\
format(self.description, self.durata,
format(self.description, self.duration,
'\n'.join(' ' + repr(a) for a in self.audios))
@property
def durata(self):
return sum(a.durata for a in self.audios if a.durata is not None)
def duration(self):
return sum(a.duration for a in self.audios if a.duration is not None)
@property
def urls(self):
@ -103,10 +103,10 @@ def get_audio_from_description(text):
for line in text.split('\n')
if line.strip()]
url = lines[0]
durata = None
duration = None
if len(lines) > 1:
durata = int(re.findall(r'\d+', lines[1].split('=')[1].strip())[0])
return Audio(unquote(url), durata)
duration = int(re.findall(r'\d+', lines[1].split('=')[1].strip())[0])
return Audio(unquote(url), duration)
# copied from larigira.fsutils
@ -224,12 +224,12 @@ def main():
# get audio urls, removing those that are too long
audios += [audio for audio in get_urls(tree)
if args.max_len == 0 or
audio.durata <= args.max_len]
audio.duration <= args.max_len]
else:
groups = get_grouped_urls(tree)
audios += [groups[g] for g in groups.keys()
if args.max_len == 0 or
groups[g].durata <= args.max_len
groups[g].duration <= args.max_len
]
elif os.path.isdir(url):
audiodir = get_audio_from_dir(url)
@ -258,7 +258,7 @@ def main():
else:
put(audio, args.copy)
if args.slotsize is not None:
duration = audio.durata
duration = audio.duration
if duration < args.slotsize:
print('## musica per {} secondi'
.format(args.slotsize - duration))
@ -270,7 +270,7 @@ def main():
# else: # grouping; TODO: support slotsize
# for item in groups:
# if args.debug:
# print('#', item, groups[item].durata)
# print('#', item, groups[item].duration)
# print(groups[item])