Overview of My Submission
Would you like yo watch Star Wars from MongoDB using nothing but mongo shell ? You are in good hands. The wonderful work done by Simon Jansen in https://asciimation.co.nz/ has been ported to MongoDB in full glory. You need nothing but a MongoDB and mongo shell.
Submission Category:
Choose Your Own Adventure
Link to Code
mongosaw
Star Ascii Wars MongoDB Edition
Additional Resources / Info
Trailer:
I use starasciiwars database but you can select your own.
For trailer you only need the github repo to watch the entire movie. Open https://asciimation.co.nz/ in chrome
Press F12 to open developer console and paste the following code into console to download movie as a txt file.
var temp = document.createElement('a');
temp.href = URL.createObjectURL(new Blob([film.join('\n')], { type: 'text/plain' }));
temp.download = 'starwars.txt';
temp.click();
Use the following command to convert txt to json file.
ascii2jsonmovie.py
Use the following command to import json file to DB
mongoimport --uri <your mongodb uri> --db starasciiwars --collection trailer --drop --jsonArray --type json --maintainInsertionOrder --username=<user name> --file starwars.json
Use the following command for mongoshell to connect to MongoDB.
mongosh <your mongodb uri> --username=<user name>
Select starasciiwars database
use starasciiwars
Run the following command to watch the movie. you can use speedX variable to set the speed.
db.episodeIV.find().sort({_id:1}).forEach(function(frame){
cls();
speedX=1;
print(frame.line1);
print(frame.line2);
print(frame.line3);
print(frame.line4);
print(frame.line5);
print(frame.line6);
print(frame.line7);
print(frame.line8);
print(frame.line9);
print(frame.line10);
print(frame.line11);
print(frame.line12);
print(frame.line13);
sleep(frame.sleeptime*120*speedX);
});
Thanks to https://github.com/JLChnToZ for offline download
Top comments (0)