Skip to content
Cody Stewart edited this page Aug 19, 2013 · 1 revision

Note: Below I mention tests I run against videos depending on what search method the users chooses. Those methods can be found here: https://github.com/cjstewart88/Tubalr/blob/master/app/assets/javascripts/video.js

General Usage

This is the basic user flow as of now for the web version.

  • A user explores one of the searching methods.
  • Playlist is built
  • First video automatically starts playing
  • When the first video ends, the next starts. This continues throughout the playlist. At the end of the playlist it loops back to the front.
  • At any point a user can switch songs
  • At any point a registered user can add the current song to one of their playlists
  • At any point a user can share the current playlist on facebook or twitter.
  • At any point a user can remove the current video thats playing.

User Accounts

Users can register accounts. Required fields to register are username, email, and password. I use a gem called Devise(https://github.com/plataformatec/devise) to manage user accounts.

User Playlists

Registered users can create playlists and add videos to them. A user can have as many playlists as they want or none at all. A playlist has the following fields playlist_name and user_id(FK to a user's ID in the user table).

Playlist videos are retrieved using the following open json request(http://www.tubalr.com/cody/playlist/Tool.json).

A registered user when on one of their own playlists can remove videos by clicking the "Remove" button.

User Banned Videos

If a user is logged into their account they can click the "Remove" button and it will add the video to the banned_videos table. The fields inserted are user_id(FK to a user's ID in the user table) and video_id.

If a user is not logged in and clicked the "Remove" button, the video is simply removed from the list

"Just" Search

How to use: Type in an artist/band and press enter or click the "just" button.

What is does: Actual Method: https://github.com/cjstewart88/Tubalr/blob/master/app/assets/javascripts/playlist.js#L93

  1. Checks to see if what was entered is considered a genre. If it is then it heads straight to the genres search method. Check to see if what was entered is a subreddit /r/indie_rock. If it is then it heads straight to the reddit search method. Otherwise, keep going. This check can be found here: https://github.com/cjstewart88/Tubalr/blob/master/app/assets/javascripts/playlist.js#L81

  2. Hits EchoNest for the artist's top 40 songs.

  3. If EchoNest returns 10 or less songs head straight to the YouTube search method. Otherwise, keep going.

  4. For each song, hit YouTube's public api, searching for artist name - song title, returning the top 10 results.

  5. Run each result through several tests, selecting the first one that passes all tests. This could be the first result or the last... or none. The tests are: isNotBlocked, isMusic, isUnique, isNotCoverOrRemix, isNotUserBanned, isNotLive. When we find the video, throw it into the videos array for playing.

How to share: www.tubalr.com/just/Red+Hot+Chili+Peppers www.tubalr.com/just/Foo+Fighters www.tubalr.com/just/Nirvana

"Similar" Search

How to use: Type in an artist/band and press enter or click the "similar" button.

What is does: Actual Method: https://github.com/cjstewart88/Tubalr/blob/master/app/assets/javascripts/playlist.js#L131

  1. Checks to see if what was entered is considered a genre. If it is then it heads straight to the genres search method. Check to see if what was entered is a subreddit /r/indie_rock. If it is then it heads straight to the reddit search method. Otherwise, keep going. This check can be found here: https://github.com/cjstewart88/Tubalr/blob/master/app/assets/javascripts/playlist.js#L81

  2. Hits EchoNest for the artist's top 40 similar artists.

  3. For each artist, hit YouTube's public api, searching for artist name, returning the top 10 results.

  4. Run each result through several tests, selecting the first one that passes all tests. This could be the first result or the last... or none. The tests are: isNotBlocked, isMusic, isNotCoverOrRemix, isNotUserBanned, isNotLive. When we find the video, throw it into the videos array for playing.

How to share: www.tubalr.com/similar/Band+of+Horses www.tubalr.com/similar/Tool www.tubalr.com/similar/Nine+Inch+Nails

Genres Search

How to use: Running a "just" or "similar" search will trigger a genres search if what was searched is considered a genre.

What is does: Actual Method: https://github.com/cjstewart88/Tubalr/blob/master/app/assets/javascripts/playlist.js#L160

  1. Hits EchoNest for the artist's top 40 songs for the given genre.

  2. For each song, hit YouTube's public api, searching for artist name - song title, returning the top 10 results.

  3. Run each result through several tests, selecting the first one that passes all tests. This could be the first result or the last... or none. The tests are: isNotBlocked, isMusic, isNotUserBanned, isNotLive. When we find the video, throw it into the videos array for playing.

How to share: www.tubalr.com/just/indie www.tubalr.com/just/hip+hop www.tubalr.com/just/heavy+metal

YouTube Search

How to use: Running a "just" or "similar" search will trigger a YouTube search if what was searched is not found on EchoNest, is not a genre, or not a reddit search.

What is does: Actual Method: https://github.com/cjstewart88/Tubalr/blob/master/app/assets/javascripts/playlist.js#L192

  1. Hit YouTube's public api, searching for the user's input and returning top 40 results

  2. For each song, hit YouTube's public api, searching for artist name - song title, returning the top 10 results.

  3. Run each result through several tests, selecting the first one that passes all tests. This could be the first result or the last... or none. The tests are: isNotBlocked, isNotUserBanned. When we find the video, throw it into the videos array for playing.

How to share: www.tubalr.com/just/downhill+mountain+biking www.tubalr.com/just/kids+falling+down www.tubalr.com/just/funny+cats+doing+funny+things

Reddit Search

How to use: Running a "just" or "similar" search will trigger a reddit search if what was searched is prefixed with a /r/, also visiting a url like those in the "Hot to share" section below.

What is does: Actual Method: https://github.com/cjstewart88/Tubalr/blob/master/app/assets/javascripts/playlist.js#L235

  1. Hits the public reddit json api for hot links posts for a given subreddit and rips out just the YouTube videos.

How to share: www.tubalr.com/r/indie_rock www.tubalr.com/r/metal www.tubalr.com/r/listentothis