The youtube Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The youtube Reference Manual

This is the youtube Reference Manual, version 0.1, generated automatically by Declt version 2.4 patchlevel 1 "Will Decker" on Mon Jul 29 16:59:12 2019 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

youtube

Play songs from youtube given a youtube url or a search string. Uses youtube-dl and the mpv player.

Installation

Make sure you have mpv and youtube-dl installed.

# clone to local-projects for quickload access
git clone https://github.com/mihaiolteanu/youtube ~/quicklisp/local-projects/youtube
; Register the new project
(ql:register-local-projects)

Usage

(ql:quickload :youtube)

Play a known url

(play "https://www.youtube.com/watch?v=skpQ-joyuLw")

Or let youtube-dl search for a youtube url given an artist name and a song name and play that

(play "anathema one last goodbye")

This will start an mpv player instance listening on the /tmp/mpv-cl-socket socket. By default, mpv runs with no video support, in the background.

Following this, you can control the playback by pausing the player, rewinding, opening a youtube page or querying the playback position. See the API for details.

API

play url-or-song &key (video nil) (pos "0")

Play the youtube url through mpv. If `video` is T, open the video with mpv
player, if not, run mpv in the background. If position is specified, in seconds,
start playback from there. If the youtube link is valid but the video is
unavailable for some reason, return nil and don't play anything.

play/pause

Toggle playing status.

replay

Rewind the song at the beginning, effectively replaying it.

seek seconds

Forward or backward play by seconds, if the seconds is negative.

percent-pos

Current playing song position, in percent.

time-pos

Current playing song position, in seconds, as string.

duration

Current playing song duration, in MM:SS format, as string.

switch-to-browser &key (from-beginning nil)

Pause the player and open the youtube page of the current playing song in the
user default browser. If `from-beginning` is T, start playing from the beginning,
otherwise continue from where the player was. 

turn-video-on

Quit mpv and restart it in video mode, locally (i.e. not in the browser)

quit

Stop the playback.

Authors

Copyright (c) 2019 Mihai Olteanu

Licensed under the GPLv3 license.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 youtube

Author

Mihai Olteanu <mihai_olteanu@fastmail.fm>

License

GPLv3

Description

Play youtube urls with or without video using mpv

Version

0.1

Dependencies
Source

youtube.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 youtube.asd

Location

youtube.asd

Systems

youtube (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 youtube/package.lisp

Parent

youtube (system)

Location

package.lisp

Packages

youtube


Previous: , Up: Lisp files   [Contents][Index]

3.1.3 youtube/youtube.lisp

Dependency

package.lisp (file)

Parent

youtube (system)

Location

youtube.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 youtube

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Functions

Function: duration ()

Current playing song duration, in MM:SS format, as string.

Package

youtube

Source

youtube.lisp (file)

Function: percent-pos ()

Current playing song position, in percent.

Package

youtube

Source

youtube.lisp (file)

Function: play URL-OR-SONG &key VIDEO POS

Play the youtube url through mpv. If video is T, open the video with mpv player, if not, run mpv in the background. If position is specified, in seconds, start playback from there.

Package

youtube

Source

youtube.lisp (file)

Function: play/pause ()

Toggle playing status

Package

youtube

Source

youtube.lisp (file)

Function: quit ()

Stop the playback.

Package

youtube

Source

youtube.lisp (file)

Function: replay ()

Rewind the song at the beginning, effectively replaying it.

Package

youtube

Source

youtube.lisp (file)

Function: seek SECONDS

Forward or backward play by seconds, if the seconds is negative.

Package

youtube

Source

youtube.lisp (file)

Function: switch-to-browser &key FROM-BEGINNING

Pause the player and open the youtube page of the current playing song in the user default browser. If from-beginning is T, start playing from the beginning, otherwise continue from where the player was.

Package

youtube

Source

youtube.lisp (file)

Function: time-pos ()

Current playing song position, in seconds, as string.

Package

youtube

Source

youtube.lisp (file)

Function: turn-video-on ()

Quit mpv and restart it in video mode, locally (i.e. not in the browser)

Package

youtube

Source

youtube.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: *playing-url*
Package

youtube

Source

youtube.lisp (file)

Special Variable: *socket*
Package

youtube

Source

youtube.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: clear-playing-url ()
Package

youtube

Source

youtube.lisp (file)

Function: get-property PROPERTY
Package

youtube

Source

youtube.lisp (file)

Function: pause ()

Pause the player

Package

youtube

Source

youtube.lisp (file)

Function: paused-p ()

Check if mpv is paused.

Package

youtube

Source

youtube.lisp (file)

Function: playing-url ()
Package

youtube

Source

youtube.lisp (file)

Function: running-p ()

Check if mpv player has been started, regardles if it’s paused or actually playing.

Package

youtube

Source

youtube.lisp (file)

Function: send-command &rest ARGS
Package

youtube

Source

youtube.lisp (file)

Function: set-playing-url URL
Package

youtube

Source

youtube.lisp (file)

Function: set-property PROPERTY VALUE
Package

youtube

Source

youtube.lisp (file)

Function: url-from-string STR

Use youtube-dl to search for a youtube url based on the input string. The –get-url option returns a nasty url. –get-thumbnail returns a url that contains the url id we’re interested it.

Package

youtube

Source

youtube.lisp (file)

Function: youtube-url-p URL-OR-SONG

Decide if the string is a youtube url and return it back if it is.

Package

youtube

Source

youtube.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   Y  
Index Entry  Section

F
File, Lisp, youtube.asd: The youtube<dot>asd file
File, Lisp, youtube/package.lisp: The youtube/package<dot>lisp file
File, Lisp, youtube/youtube.lisp: The youtube/youtube<dot>lisp file

L
Lisp File, youtube.asd: The youtube<dot>asd file
Lisp File, youtube/package.lisp: The youtube/package<dot>lisp file
Lisp File, youtube/youtube.lisp: The youtube/youtube<dot>lisp file

Y
youtube.asd: The youtube<dot>asd file
youtube/package.lisp: The youtube/package<dot>lisp file
youtube/youtube.lisp: The youtube/youtube<dot>lisp file

Jump to:   F   L   Y  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   C   D   F   G   P   Q   R   S   T   U   Y  
Index Entry  Section

C
clear-playing-url: Internal functions

D
duration: Exported functions

F
Function, clear-playing-url: Internal functions
Function, duration: Exported functions
Function, get-property: Internal functions
Function, pause: Internal functions
Function, paused-p: Internal functions
Function, percent-pos: Exported functions
Function, play: Exported functions
Function, play/pause: Exported functions
Function, playing-url: Internal functions
Function, quit: Exported functions
Function, replay: Exported functions
Function, running-p: Internal functions
Function, seek: Exported functions
Function, send-command: Internal functions
Function, set-playing-url: Internal functions
Function, set-property: Internal functions
Function, switch-to-browser: Exported functions
Function, time-pos: Exported functions
Function, turn-video-on: Exported functions
Function, url-from-string: Internal functions
Function, youtube-url-p: Internal functions

G
get-property: Internal functions

P
pause: Internal functions
paused-p: Internal functions
percent-pos: Exported functions
play: Exported functions
play/pause: Exported functions
playing-url: Internal functions

Q
quit: Exported functions

R
replay: Exported functions
running-p: Internal functions

S
seek: Exported functions
send-command: Internal functions
set-playing-url: Internal functions
set-property: Internal functions
switch-to-browser: Exported functions

T
time-pos: Exported functions
turn-video-on: Exported functions

U
url-from-string: Internal functions

Y
youtube-url-p: Internal functions

Jump to:   C   D   F   G   P   Q   R   S   T   U   Y  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*playing-url*: Internal special variables
*socket*: Internal special variables

S
Special Variable, *playing-url*: Internal special variables
Special Variable, *socket*: Internal special variables

Jump to:   *  
S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   P   S   Y  
Index Entry  Section

P
Package, youtube: The youtube package

S
System, youtube: The youtube system

Y
youtube: The youtube system
youtube: The youtube package

Jump to:   P   S   Y