code: def _build_tasks_list(
      urls,
      download_dir,
      video_paths,
      clip_segments,
      tmp_dir,
      ext,
      only_progressive,
      resolution,
  ):
      if video_paths is None and download_dir is None:
          raise ValueError(
              "Either `download_dir` or `video_paths` are required"
          )
  
      if video_paths is not None and download_dir is not None:
          raise ValueError(
              "Only one of `download_dir` or `video_paths` can be provided"
          )
  
      if download_dir is None:
          ext = None
  
      if not etau.is_str(resolution) or (
          resolution not in ("highest", "lowest")
          and not resolution.endswith("p")
      ):
          raise ValueError(
              "Invalid resolution=%s. The supported values are 'highest', "
              "'lowest', and strings like '1080p', '720p', ..."
              % resolution
          )
  
      if resolution.endswith("p"):
          resolution = int(resolution[:-1])
  
      if video_paths is None:
          video_paths = itertools.repeat(None)
  
      if clip_segments is None:
          clip_segments = itertools.repeat(clip_segments)
      else:
          clip_segments = list(clip_segments)
  
          # Replace all variations of full video downloads with `None` so that
          # the most optimized download logic is used
          for idx, clip_segment in enumerate(clip_segments):
              if (
                  clip_segment is not None
                  and (clip_segment[0] is None or clip_segment[0] <= 0)
                  and clip_segment[1] is None
              ):
                  clip_segments[idx] = None
  
      return list(
          zip(
              range(len(urls)),
              urls,
              itertools.repeat(download_dir),
              video_paths,
              clip_segments,
              itertools.repeat(tmp_dir),
              itertools.repeat(ext),
              itertools.repeat(only_progressive),
              itertools.repeat(resolution),
          )
      )
  
imports: import importlib
  import itertools
  import logging
  import multiprocessing.dummy
  import os
  import numpy
  import eta.core.utils
  import eta.core.video
  import fiftyone.core.utils
label_desc: Use image node_id 4 for calling a global function with example usage: _build_tasks_list(urls, download_dir, video_paths, clip_segments, tmp_dir, ext, only_progressive, resolution) and returns: list