eliminate xx filereader (#23514)

* eliminate xx filereader

* framereader cleanup
pull/23517/head
Greg Hogan 2022-01-13 15:56:54 -08:00 committed by GitHub
parent 2c94f15584
commit d5f4fdb1db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 8 deletions

View File

@ -1,6 +1,11 @@
import os
from tools.lib.url_file import URLFile
DATA_PREFIX = os.getenv("DATA_PREFIX", "http://data-raw.internal/")
def FileReader(fn, debug=False):
if fn.startswith("cd:/"):
fn.replace("cd:/", DATA_PREFIX)
if fn.startswith("http://") or fn.startswith("https://"):
return URLFile(fn, debug=debug)
return open(fn, "rb")

View File

@ -17,10 +17,7 @@ from tools.lib.cache import cache_path_for_file_path
from tools.lib.exceptions import DataUnreadableError
from common.file_helpers import atomic_write_in_dir
try:
from xx.chffr.lib.filereader import FileReader
except ImportError:
from tools.lib.filereader import FileReader
from tools.lib.filereader import FileReader
HEVC_SLICE_B = 0
HEVC_SLICE_P = 1

View File

@ -5,10 +5,7 @@ import bz2
import urllib.parse
import capnp
try:
from xx.chffr.lib.filereader import FileReader
except ImportError:
from tools.lib.filereader import FileReader
from tools.lib.filereader import FileReader
from cereal import log as capnp_log
# this is an iterator itself, and uses private variables from LogReader