Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mihaiolteanu/youtube
Play songs from youtube given a youtube url or a search string.
https://github.com/mihaiolteanu/youtube
common-lisp mpv music youtube-dl
Last synced: about 1 month ago
JSON representation
Play songs from youtube given a youtube url or a search string.
- Host: GitHub
- URL: https://github.com/mihaiolteanu/youtube
- Owner: mihaiolteanu
- Created: 2019-06-10T17:37:05.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-13T12:57:58.000Z (about 5 years ago)
- Last Synced: 2024-12-20T15:00:14.411Z (about 2 months ago)
- Topics: common-lisp, mpv, music, youtube-dl
- Language: Common Lisp
- Homepage:
- Size: 10.7 KB
- Stars: 8
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# youtube
Play songs from youtube given a youtube url or a search string. Uses youtube-dl and the mpv player.# Install
```common-lisp
(ql:quickload :youtube)
```Install the [mpv](https://mpv.io/) player,
[socat](https://linux.die.net/man/1/socat) and
[youtube-dl](https://github.com/ytdl-org/youtube-dl).# Usage
Play a known url
```common-lisp
(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
```common-lisp
(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](www.mihaiolteanu.me)Licensed under the [GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html) license.