Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/h313/spet
an interpreter for a turing-complete programming language based on Spotify playlists
https://github.com/h313/spet
esoteric-language spotify-api
Last synced: 6 days ago
JSON representation
an interpreter for a turing-complete programming language based on Spotify playlists
- Host: GitHub
- URL: https://github.com/h313/spet
- Owner: h313
- License: gpl-2.0
- Created: 2018-10-13T01:41:50.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-08-24T00:11:53.000Z (about 1 year ago)
- Last Synced: 2024-08-01T19:57:38.214Z (3 months ago)
- Topics: esoteric-language, spotify-api
- Language: Python
- Homepage: http://h313.info/spet/
- Size: 26.4 KB
- Stars: 94
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# About
`spet` is an interpreter for a turing-complete programming language loosely based off of brainfuck based on Spotify playlists. It is
licensed under the GPLv3.## Language Definition
The interpreter reads the playlist from the top down. Various attributes of the song, sorted in terms of importance, defines the behaviours of the songs. The data land is a list of 40000 bytes, which can be navigated through with a pointer. From most important to least important, the songs evaluate to:
### Print Character
Any song from RADWIMPS' album `Your Name.` prints the character at the pointer location.### Input Character
Any song by Coldplay grabs input from `stdin` depending on the number of letters in the first word of the song. For example, A Sky Full of Stars will take only the first letter of whatever input is in `stdin` and write it to the location of the pointer. However, Yellow will take the first six letters of `stdin` and write it, starting at the pointer location. The pointer stays at its position befure the input is called.### Moving the pointer
Any song by Radiohead moves a pointer forward by `1` byte, while any song by Green Day moves a pointer back `1` byte.### Incrementing and Decrementing a value
Any song from the Muse album `Drones` will decrement the value at the pointer by `1`, while any song from the Muse album `Origin of Symmetry` increments the value at the pointer by `1`. Decrementing causes the value to wrap around, so decrementing a `0` results in a `255`, while incrementing a `255` results in a `0`.### Loops
If a song contains the word `Run` in its name, and if the data at the pointer is `0`, the program jumps forward to the song directly following the next song containing the word `Talk` in its name. If a song contains the word `Talk` in its name, and if the data at the pointer is nonzero, the program jumps back to the corresponding song containing the word `Run`.### Setting values
If a song's album's first word has length less than `7`, and does not satisfy any of the above definitions, the data at the pointer is set to the first character of the next song.## Setup
`spet` requires a Spotify premium account to connect with the API. To set up `spet`'s interpreter, clone the repo and do a `pip install -r requirements.txt`. Then, [create a Spotify API key](https://developer.spotify.com/dashboard/applications) and set the redirect URL to something like `http://localhost:8888/callback`.To run `spet`, `cd` into the `spet` directory and run `python3 spet.py `. Follow the instructions to set up the correct environment variables for the API keys. The playlist URI can be found on the Spotify app's Share button, and looks something like `7hShQSKY5AU0YQaN833iEx`.