Skip to content

Commit

Permalink
feat(initial): initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
m4c1elz committed Aug 29, 2024
0 parents commit 30208a1
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
music.mp3
venv
**__pycache__**
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# last_words.py

Mitski's Last Words of a Shooting Star, entirely remade in a command-line interface.
![program demo](demo.gif)

# Setup

First, you'll need the song.
For copyright reasons, it wasn't included in this repo. However you can download it, put on the project root folder and rename it to "music.mp3."

Next, clone the repo, create a virtual environment and install the dependencies.

**if you're lazy:**

```
git clone https://github.com/m4c1elz/last-words-py
cd last-words-py
py -m venv venv
.\venv\Scripts\activate
pip install -r .\requirements.txt
```

Now you can run it!
`py .\main.py`

Hope you enjoy!
This is one of my first small python projects, so maybe the code might not be the best written one.
Binary file added demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added last_words/__init__.py
Empty file.
120 changes: 120 additions & 0 deletions last_words/lyrics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
from .write_with_delay import write_with_delay
from time import sleep
import os

def clear_terminal():
os.system('cls' if os.name == "nt" else "clear")

def lyrics():
clear_terminal()
sleep(12.2)
write_with_delay("All of this turbulence", 0.15)
write_with_delay(" wasn't forecasted", 0.1)
sleep(0.5)
write_with_delay("\nApologies from the intercom", 0.15)
sleep(0.8)
write_with_delay("\nAnd I am relieved ", 0.13)
write_with_delay("that I'd left my room tidy", 0.1)
sleep(0.3)
write_with_delay("\nThey'll think of me ", 0.07)
write_with_delay("kindly", 0.1)
sleep(0.3)
write_with_delay("\nWhen they come ", 0.07)
write_with_delay("for my things", 0.1)
sleep(0.6)
clear_terminal()

write_with_delay("They'll never ", 0.07)
write_with_delay("know ", 0.2)
write_with_delay("how I'd stared at the ", 0.09)
write_with_delay("dark ", 0.19)
write_with_delay("in that room", 0.08)
write_with_delay("\nWith no ", 0.07)
write_with_delay("thoughts", 0.1)
write_with_delay("\nLike a ", 0.09)
write_with_delay("blood-sniffing ", 0.11)
write_with_delay("shark", 0.09)
sleep(0.7)
write_with_delay("\nAnd ", 0.12)
write_with_delay("while my dreams made music ", 0.09)
write_with_delay("in the night", 0.12)
sleep(0.6)
write_with_delay("\nCarefully", 0.15)
write_with_delay("\nI was going to live", 0.15)
sleep(4)
clear_terminal()
sleep(4)

write_with_delay("You wouldn't leave ", 0.1)
write_with_delay("till we loved in the morning", 0.09)
write_with_delay("\nYou'd learned from movies ", 0.09)
write_with_delay("how love ", 0.12)
write_with_delay("ought to be", 0.08)
sleep(1)
write_with_delay("\nAnd you'd say you love me and look in my eyes", 0.09)
sleep(0.2)
write_with_delay("\nBut ", 0.09)
write_with_delay("I know ", 0.13)
sleep(0.4)
write_with_delay("through mine you were", 0.09)
write_with_delay("\nLooking in yours", 0.1)
sleep(0.8)
clear_terminal()

write_with_delay("And did you know the ", 0.09)
write_with_delay("liberty bell ", 0.1)
sleep(1)
write_with_delay("is a replica", 0.1)
sleep(0.2)
write_with_delay("\nSilently housed in it's ", 0.09)
write_with_delay("original walls", 0.15)
sleep(0.7)
write_with_delay("\nAnd ", 0.12)
write_with_delay("while it's dreams played music ", 0.09)
write_with_delay("in the night", 0.15)
sleep(0.6)
write_with_delay("\nQuietly", 0.15)
write_with_delay("\nIt was told to believe", 0.17)
sleep(4)
clear_terminal()
sleep(5.7)

write_with_delay("I always wanted to die ", 0.13)
sleep(0.2)
write_with_delay("clean and pretty", 0.11)
sleep(0.2)
write_with_delay("\nBut I'd ", 0.1)
sleep(0.2)
write_with_delay("be too busy ", 0.1)
sleep(0.4)
write_with_delay("on working days", 0.12)
sleep(1)
write_with_delay("\nSo I am relieved ", 0.1)
write_with_delay("that the turbulence wasn't forecasted", 0.12)
sleep(1)
write_with_delay("\nI couldn't have ", 0.1)
write_with_delay("changed anyways", 0.1)
sleep(1.5)
clear_terminal()

write_with_delay("I am relieved that I'd left my room tidy", 0.1)
sleep(1)
write_with_delay("\nGoodbye", 0.1)
sleep(2)
clear_terminal()

sleep(2)
write_with_delay("thank you for watching. :)\n", 0.05)
sleep(2)
write_with_delay("music from mitski\n", 0.05)
sleep(2)
write_with_delay("song: Last Words of a Shooting Star\n", 0.05)
sleep(2)
write_with_delay("made with love my maciel", 0.05)
sleep(7)

def _test():
lyrics()

if __name__ == "__main__":
_test()
14 changes: 14 additions & 0 deletions last_words/write_with_delay.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import sys
from time import sleep

def write_with_delay(string: str, delay: float):
for letter in string:
sys.stdout.write(letter)
sys.stdout.flush()
sleep(delay)

def _test():
write_with_delay('test', 1)

if __name__ == '__main__':
_test()
17 changes: 17 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from playsound import playsound
from last_words.lyrics import lyrics

def main():
try:
with open('music.mp3'):
print('Song found. Starting...')
except FileNotFoundError:
print("\nSong not found. Please download the song and rename it to 'music.mp3'.\n")
exit()

playsound('music.mp3', block=False)
lyrics()


if __name__ == "__main__":
main()
Binary file added requirements.txt
Binary file not shown.

0 comments on commit 30208a1

Please sign in to comment.