mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-28 19:06:19 -05:00
Calculating time-to-import for map pbf files in the backend. These times were created using a test RPi4. Encoding URL of archive files to prevent error which blocked displaying of archives.
This commit is contained in:
parent
6a22090e54
commit
c815aa68c6
10 changed files with 46 additions and 59 deletions
|
|
@ -1,8 +1,16 @@
|
|||
from sqlalchemy import Column, Integer, Boolean, BigInteger
|
||||
|
||||
from wrolpi import dates
|
||||
from wrolpi.common import Base, ModelHelper
|
||||
from wrolpi.media_path import MediaPathType
|
||||
|
||||
RPI4_BYTES_PER_SECOND = 3963
|
||||
|
||||
|
||||
def seconds_to_import(size: int) -> int:
|
||||
"""Attempt to predict how long it will take an RPi4 to import a given PBF file."""
|
||||
return max(int(size // RPI4_BYTES_PER_SECOND), 0)
|
||||
|
||||
|
||||
class MapFile(Base, ModelHelper):
|
||||
__tablename__ = 'map_file'
|
||||
|
|
@ -18,4 +26,5 @@ class MapFile(Base, ModelHelper):
|
|||
'path': self.path,
|
||||
'imported': self.imported,
|
||||
'size': self.size,
|
||||
'time_to_import': dates.seconds_to_timestamp(seconds_to_import(self.size)),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue