Moe.bot Database

Goals for today

  • Make each click of the next show button start playing another show
  • Show the show date and song name if possible
  • Make each click of the next song button play the next song from the same show (until all of them are played)

Right now the list of songs is saved in a static list that got created at server setup. There are only 50 songs and then the list of songs runs out. What I want it to do is have every song for three shows saved in three ArrayLists. When a show is skipped a random song in the next show is played. Then while the next song is playing another show takes the place.

Next song sticks to the same show and plays them in order until all of them are played. Then it grabs the next show.

Reach Goals

  • List out all of the songs that are in the show
  • Stop playing the song when another one is loaded. ONLY ONE AT A TIME!
  • Add ALL of the moe. shows to the database

Implementation

 

The easiest implementation I can think of is to just have the user access the database each time a new show is needed. The next song should just play the next song in the list until it runs through them all. So I need a count of the songs in the show and the song_url’s.

I want to access my mysql database to remind myself what I’m working with. Do NOT include the port number. Password is your old school one 6.

mysql -h rds-mysql-10mintutorial.cr8bdnqgcx5a.us-east-1.rds.amazonaws.com:3306 -u milesgwood -p

mysql -h rds-mysql-10mintutorial.cr8bdnqgcx5a.us-east-1.rds.amazonaws.com -u milesgwood -p

use moe_db

The iframe I am using takes two extra pieces of information from the database. Archive example

<iframe src=”https://archive.org/embed/jj2008-06-14.mk4/jj2008-06-14d2t04.flac” width=”500″ height=”30″ frameborder=”0″ webkitallowfullscreen=”true” mozallowfullscreen=”true” allowfullscreen></iframe>

It’s the show url and the song name : show_url + / + name

I want to get a random show from the database. There are currently 859 shows with songs in the database. I want one.

SELECT column FROM table
ORDER BY RAND()
LIMIT 1
SELECT show_id FROM songs  ORDER BY RAND()  LIMIT 1;

Get a random show ID. Then I use that ID to get the info about the show and the songs.

I will definitely need to keep track of the last played song in session.

Session object handling

Making Ajax action HTTP Session aware

Getting the show info.

SELECT * FROM shows WHERE id = 748;

SELECT * FROM shows WHERE id = ?;

Getting the songs for the show

SELECT * FROM songs WHERE show_id = 748;

Time for a redeploy

Here is the old URL – http://sample-env.jcupmg7i2k.us-east-1.elasticbeanstalk.com/

I want to see if the new URL from elastic beanstalk is the same. I’m hoping it will be. I will setup a redirect on my WordPress if it isn’t the same URL. They are the same URL so I am safe to use it as is.