Use Python chained comparison

https://docs.python.org/3.6/reference/expressions.html#comparisons
This commit is contained in:
Laurent Monin
2018-12-16 17:26:31 +01:00
parent b19d1039ad
commit ea5dca607e

View File

@@ -309,7 +309,7 @@ def tracknum_from_filename(base_filename):
# 4-digit or more numbers are very unlikely to be a track number
# smaller number is preferred in any case
numbers = sorted([int(n) for n in re.findall(r'\d+', filename) if
int(n) <= 99 and int(n) > 0])
0 < int(n) <= 99])
if numbers:
return numbers[0]
return -1