py3: Use explicit float or integer division
This commit is contained in:
parent
7124226fc7
commit
e35a066d5e
@ -1,4 +1,4 @@
|
|||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, division, unicode_literals
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
@ -81,7 +81,7 @@ class Scanner(object):
|
|||||||
def _collect(self):
|
def _collect(self):
|
||||||
"""Polls for messages to collect data."""
|
"""Polls for messages to collect data."""
|
||||||
start = time.time()
|
start = time.time()
|
||||||
timeout_s = self._timeout_ms / float(1000)
|
timeout_s = self._timeout_ms / 1000.
|
||||||
tags = {}
|
tags = {}
|
||||||
|
|
||||||
while time.time() - start < timeout_s:
|
while time.time() - start < timeout_s:
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
from __future__ import absolute_import, print_function, unicode_literals
|
from __future__ import (
|
||||||
|
absolute_import, division, print_function, unicode_literals)
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@ -163,6 +164,6 @@ class _Progress(object):
|
|||||||
logger.info('Scanned %d of %d files in %ds.',
|
logger.info('Scanned %d of %d files in %ds.',
|
||||||
self.count, self.total, duration)
|
self.count, self.total, duration)
|
||||||
else:
|
else:
|
||||||
remainder = duration / self.count * (self.total - self.count)
|
remainder = duration // self.count * (self.total - self.count)
|
||||||
logger.info('Scanned %d of %d files in %ds, ~%ds left.',
|
logger.info('Scanned %d of %d files in %ds, ~%ds left.',
|
||||||
self.count, self.total, duration, remainder)
|
self.count, self.total, duration, remainder)
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, division, unicode_literals
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import logging
|
import logging
|
||||||
@ -92,7 +92,7 @@ class LocalPlaylistsProvider(backend.PlaylistsProvider):
|
|||||||
|
|
||||||
def _write_m3u_extinf(self, file_handle, track):
|
def _write_m3u_extinf(self, file_handle, track):
|
||||||
title = track.name.encode('latin-1', 'replace')
|
title = track.name.encode('latin-1', 'replace')
|
||||||
runtime = track.length / 1000 if track.length else -1
|
runtime = track.length // 1000 if track.length else -1
|
||||||
file_handle.write('#EXTINF:' + str(runtime) + ',' + title + '\n')
|
file_handle.write('#EXTINF:' + str(runtime) + ',' + title + '\n')
|
||||||
|
|
||||||
def _save_m3u(self, playlist):
|
def _save_m3u(self, playlist):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user