2022-01-13 15:56:54 -08:00
|
|
|
import os
|
2023-08-20 20:49:55 -07:00
|
|
|
from openpilot.tools.lib.url_file import URLFile
|
2020-07-20 17:10:08 +02:00
|
|
|
|
2022-08-29 13:31:43 -07:00
|
|
|
DATA_ENDPOINT = os.getenv("DATA_ENDPOINT", "http://data-raw.comma.internal/")
|
2022-01-13 15:56:54 -08:00
|
|
|
|
2020-02-24 21:24:54 -05:00
|
|
|
def FileReader(fn, debug=False):
|
2022-01-13 15:56:54 -08:00
|
|
|
if fn.startswith("cd:/"):
|
2022-01-13 18:21:19 -08:00
|
|
|
fn = fn.replace("cd:/", DATA_ENDPOINT)
|
2023-08-10 15:28:51 -07:00
|
|
|
if fn.startswith(("http://", "https://")):
|
2020-02-24 21:24:54 -05:00
|
|
|
return URLFile(fn, debug=debug)
|
2021-07-22 12:08:56 -07:00
|
|
|
return open(fn, "rb")
|