Skip to content

Video URL Parser Component

Peter Gusev edited this page May 2, 2015 · 1 revision

Description

This component is used to perform service URL => video URL transformation.

video URL parser

Requirements

  • Youtube-dl script

    Youtube-dl should be installed as a module in the system's Python environment.

Interface

Inputs:

  • serviceUrlIn (DAT) - DAT Text or DAT Table in, containing service URL

Outputs:

  • videoUrlOut (DAT) - DAT Text out, containing video URL
  • statusOut (DAT) - DAT Table out, containing current URL fetching status, might have several values:
    • "URL fetched" - indicates that video URL has been successfully fetched and it has been written to videoUrlOut.
    • "opening service URL" - indicates that component is running a process of retrieval of video URL; videoUrlOut is unreliable in this state.
    • "Error" - indicates that an error has been occurred during retrieval process.

Implementation

Video URL retrieval process is triggered whenever serviceUrlIn input has been changed and is not an empty string.

There are two implementations of this component:

  • Synchronous (video_url_parser.tox)

    Performs retrieval of a video URL in synchronous manner. For the end user, using synchronous implementation means that every time when new service URL is fed to the component, TouchDesigner "freezes" for ~100-500ms (depending on the internet connection and how long it took to fetch a Youtube page) and writes retrieved video URL to videoUrlOut immediately after that. For the use cases, when TouchDesigner's hiccups are critical, one may consider using asynchronous implementation.

  • Asynchronous (video_url_parser_async.tox)

    Performs retrieval of a video URL in asynchronous manner. Whenever new service URL is fed to the component's serviceUrlIn input, the statusOut output is updated with "opening service URL" status and stays unchanged unless video URL has been successfully retrieved. During this period, videoUrlOut is unreliable - usually it contains values from a previous run. When video URL is retrieved, statusOut is updated to "URL fetched". Asynchronous approach requires using background threads and this results in slower overall processing times (1.5-2.5 seconds).