youcubeapi

Lua library for accessing YouCub's API

_API_VERSION = "0.0.0-poc.1.0.0""Metadata" - YouCube API Version
_VERSION = "0.0.0-poc.1.4.2""Metadata" - Library Version
_DESCRIPTION"Metadata" - Description
_URL"Metadata" - Homepage / Url
_LICENSE = "GPL-3.0""Metadata" - License
API"wrapper" for accessing YouCub's API
AudioDeviceAbstraction for Audio Devices
SpeakerAudioDevice from a Speaker
TapeAudioDevice from a Computronics tape_drive
Base64Base64 functions
FillerAbstract object for filling a Buffer
AudioFillerFiller for Audio
VideoFillerFiller for Video
BufferBuffers Data
play_vid(buffer)Create's a new Buffer instance.
reset_term()
_API_VERSION = "0.0.0-poc.1.0.0"

"Metadata" - YouCube API Version

_VERSION = "0.0.0-poc.1.4.2"

"Metadata" - Library Version

_DESCRIPTION:string

"Metadata" - Description

_URL:string

"Metadata" - Homepage / Url

_LICENSE = "GPL-3.0"

"Metadata" - License

API

"wrapper" for accessing YouCub's API

Usage

  • Example:

    local youcubeapi  = require("youcubeapi")
    local api         = youcubeapi.API.new()
    api:detect_bestest_server()
    api:request_media(url)
    local data = api.websocket.receive()
AudioDevice

Abstraction for Audio Devices

Speaker

AudioDevice from a Speaker

Usage

Tape

AudioDevice from a Computronics tape_drive

Usage

  • Example:

    local youcubeapi  = require("youcubeapi")
    local tape_drive  = peripheral.find("tape_drive")
    local audiodevice = youcubeapi.Tape.new(tape_drive)
Base64

Base64 functions

Filler

Abstract object for filling a Buffer

AudioFiller

Filler for Audio

VideoFiller

Filler for Video

Buffer

Buffers Data

play_vid(buffer)

Create's a new Buffer instance.

Based on sanjuuni/raw-player.lua and sanjuuni/websocket-player.lua

Parameters

  1. buffer Buffer filled with frames
reset_term()

Types

API

"wrapper" for accessing YouCub's API

Usage

API.new(websocket)

Create's a new API instance.

Parameters

  1. websocket Websocket The websocket.

Returns

  1. API instance
API:detect_bestest_server(_server, _verbose)

Connects to a YouCub Server

Parameters

  1. _server
  2. _verbose
API.receive(filter)

Receive data from The YouCub Server

Parameters

  1. filter string action filter

Returns

  1. table retval data
API.send(data)

Send data to The YouCub Server

Parameters

  1. data table data to send
API.get_chunk(chunkindex, id)

Request a 16 * 1024 bit chunk

Parameters

  1. chunkindex number The chunkindex
  2. id string Media id

Returns

  1. bytes chunk 16 * 1024 bit chunk
API.get_vid(line, id, width, height)

Get 32vid

Parameters

  1. line number The line to return
  2. id string Media id
  3. width number Video width
  4. height number Video height

Returns

  1. string line one line of the given 32vid
API.request_media()

Request media @tparam string url Url or Search Term

Returns

  1. table json response
API.handshake()

Handshake - get Server capabilities and version

Returns

  1. table json response

AudioDevice

Abstraction for Audio Devices

AudioDevice.new(object)

Create's a new AudioDevice instance.

Parameters

  1. object table Base values

Returns

  1. AudioDevice instance

AudioFiller

Filler for Audio

AudioFiller.new(youcubeapi, id)

Create's a new AudioFiller instance.

Parameters

  1. youcubeapi API API object
  2. id string Media id

Returns

  1. AudioFiller | Filler instance

Base64

Base64 functions

Base64.decode(str)

Decode base64 string

Parameters

  1. str string base64 string

Returns

  1. string string decoded string

Buffer

Buffers Data

Buffer.new(filler, size)

Create's a new Buffer instance.

Parameters

  1. filler Filler filler instance
  2. size number buffer limit

Returns

  1. Buffer instance

Filler

Abstract object for filling a Buffer

Filler.new()

Create's a new Filler instance.

Returns

  1. Filler instance

Speaker

AudioDevice from a Speaker

Usage

Speaker.new(speaker)

Create's a new Tape instance.

Parameters

  1. speaker speaker The speaker

Returns

  1. AudioDevice | Speaker instance

Tape

AudioDevice from a Computronics tape_drive

Usage

Tape.new(tape)

Create's a new Tape instance.

Parameters

  1. tape tape The tape_drive

Returns

  1. AudioDevice | Tape instance

VideoFiller

Filler for Video

VideoFiller.new(youcubeapi, id, width, height)

Create's a new VideoFiller instance.

Parameters

  1. youcubeapi API API object
  2. id string Media id
  3. width number Video width
  4. height number Video height

Returns

  1. VideoFiller | Filler instance