Why Vidmuster? How to Use It to Get More Information about Videos

Why did I create Vidmuster.com?

I use YouTube a lot. There are so many times I wished there was a way I could get more information about a particular video. I frequently went to Wikipedia or google to find out more about the video. Before I knew Lady Gaga, for instance, I would after watching “Alejandro” google why she sang the song and under what context. As I more frequently did this, I decided I could just create a website that sums all the information about a video and presents it easily to the user. That’s how vidmuster.com was born (mustering videos alongside information).

I created vidmuster.com mostly for educational reasons and absolutely not for any pecuniary reasons. The construction of the site served as a way to familiarize myself with various technologies including but not limited to: HTML5, CSS2 & 3, advanced JavaScript, advanced jQuery (and extensive use of plugins), including the creation of some custom jQuery plug-ins to power some features (like the Accordion video menu the user can use to manage his playlists).  It, furthermore, serves as a way for me (and others who are working on the site or who will work on the site in the future) to practice some software development & planning as we update/improve and even revamp the site; in the process we would, inadvertently, become pros. in our various fields able to face technological problems on the horizon. Ok, enough!

Succinct list of features on the Site:

  • YouTube instant Search: This is not the main feature. It’s already been implemented by feross.
  • News and Tweets instant Search parallel to YouTube instant search: The app. gets info about a video (the currently searched term) from freebase, google news, and twitter via their REST API’s.
  • Playlist Management: I felt video playlist management goes hand in hand with video viewing because a user would want to, occasionally, save his searches and go back to it or share it.
  • Sharing Videos: The user has to be logged in to share videos and/or play-lists. The user could share the videos (individual videos) on his/her play-list by clicking on the share button next to the video thumb in the play-list Accordion area. He or her could share videos with friends via Facebook, twitter, or google buzz.
  • Sharing Playlists: The user could share whole play-lists by correspondingly sharing unique SEO-friendly urls via Facebook, twitter, or google buzz or just manually (as in copying and pasting in emails, in forums, while chatting, et al.)
  • Facebook OAuth 2.0 (Authentication): The user is able to login via Facebook. Easy. Fast. Reliable enough. We only use your email to as does Facebook, uniquely identify the user. Nothing else. We don’t care about what friends you have. And we don’t plan to send you a confirmation email on registration.
  • And other features I can’t readily remember or that is either not that important or somewhat inconspicuous.

How to use some Features

How to use the Instant Search Feature

To search for videos on the site. Just easily use the search bar. Use the links in the freebase, google news, and twitter links to refer back to the original full articles/tweets concerning the currently Searched term.

How to use the Playlists

A major part of the app lies in the playlist functionality. It enables the user save some videos for reference sake or that he wants to share with friends. Just drag and drop a thumb in the Search Trunk (each thumb represents a video) to a playlist you’ve made on the right of the Trunk. That’s it! It would be added to the specified playlist. Should you want to delete a video in the playlist, just press the button, delete. To add or delete whole playlists, use the Play-list lightbox. Click on the manage button on the header bar. You would see a lightbox in which you can add/delete/share playlists.

At the moment, there isn’t too much functionality. But we’re growing and would continue to maintain the site, adding more functionality with time and if necessary and useful, cleaning up any redundant features, beautifying the site, and securing it the more.

Please support this site by Visiting it. Here are some interesting things I found out about pop culture since I started using the site:

  • Lady Gaga wore a meat dress (a lot of people already saw it; but I didn’t). Check it out now and see what others are tweeting about Lady gaga or her meat dress: Lady Gaga at Vidmuster.
  • Eminem has a total of 13 Grammy awards and he is the first rapper to win best rap album for three consecutive LP’s.
  • Rihanna is Barbadian. Maybe a lot of people already knew this but I didn’t.
  • And many more introductory, fun, intriguing, and sometimes pesky news.

Thanks.

“Everyone’s got an API. I want mine!”

First of all, for the record, I didn’t say “Everyone’s got an API. I want mine!”; it’s just the title of this post. Secondly, that is the wrong frame of mine for anyone to have in anything because it’s not good to go into creating/building something if you are primarily motivated to be “second best.” I shouldn’t divert from the main topic here. I’m writing to shed some light on some API business. I’m mainly concerned about the REST API Web Service because it is by far the most popular and useful Web Service out there. This Web service is very popular among JavaScript programmers because JSON is one of the formats by which REST API’s transfer/relay state. SOAP does not support JSON!

Some people might have heard about the SOAP and REST Web Services but might be puzzled on what services these two really provide and which to choose to solve some specific problems.  SOAP stands for Simple Object Access Protocol while REST stands for Representational State Transfer. So that I don’t bore you with so many technical details as would some others, I would say that the main pragmatic difference between these two is that REST as a service ships in more versatile formats like JSON, XML, YAML (sometimes) while XML is the message format that SOAP ships in and depends on. Applications that implement a RESTful architecture are usually said to be RESTful.

Who uses REST and why do people use it? A lot of companies! All of Yahoo’s web services use REST, including Flickr. Del.icio.us API uses it, pubsub, bloglines, technorati, and both eBay, and Amazon have web services for REST. Here are the defining qualities that make REST stand out:

  • Lightweight – excludes much of the redundancy that accompanies SOAP.
  • Easy to build – no special toolkits required.

Now let’s get to the real business: How do you build a REST API (I hope you are convinced enough that REST is easier to produce and use than SOAP). I could write a bunch of pages on how to write a REST API using WSDL (Web Services Description Language) or a server-side language like PHP or Ruby but would be reinventing the wheel by doing so. I have a list of tutorials that I believe people can benefit from just as I did and learn how to create their own REST API’s. Please remember that when following these tutorials, you should take note of third-party libraries like SoapServer in PHP. It is very tedious, slow, and not wise to start building your own library from ground up without using any helper libraries. Take a look at this list of resources on API creation and development:

Ok, that’s it folks! Follow more than one of these tutorials (make sure you listen to the google tech video; it’s priceless!).

Python script to mirror a directory on another (unix/linux/mac)

For some time now, I’ve been trying to figure how to mirror a directory recursively so that all files (in any depth of the source directory) in the source directory will be in the destination direction. In addition, if any files on the source directory changed, we could update the destination directory just by running the program again.

Precondition:
For the program to run, you need to make the variables, from_dir and to_dir, point to the source and destination directories respectively.

At the moment, the script works excellently well and is well commented to elucidate the workings of the script and my intentions. On the other hand, I believe there can be some improvements to the script like:

  • Enabling input facilities in the python script so that the client will only need to enter the values of from_dir and to_dir variables.
  • Make it cleaner by commenting more.
  • Or even package it into a class.
  • Or if we (or you or I) feel very challenged (or less lazy), we/you/I could distribute it as a python third-party package.

Please modify as you please! This code is in the public domain.

#!/usr/bin/env python

# Python script to compare two directories, from_dir and to_dir
# and copy or files from from_dir that are not in to_dir
# it does this recursively as it walks on directories
# author Daniel Alabi
# date
import os
import os.path
import re
import subprocess

# change from_dir and to_dir as appropriate
from_dir = "/home/daniel/jquery/"
to_dir = "/home/daniel/jquery-alias/"

# getExtDir gets the remaning path of the full
# path when "from_dir" has been removed from
# dir
def getExtDir(dir):
    if re.search(from_dir, dir):
    return re.sub(from_dir, "", dir)

# getUpperLevelDir gets the full path of the present
# directory (".")
def getUpperLevelDir(dirString):
# handle the case where dirString already has a
# trailing "/"
    if (dirString[-1] == "/"):
        dirString = dirString[0:-1]
    to = dirString.rfind("/")
    return dirString[0:to] + "/"

# updateDirs recursively updates to_here until
# it has the same files (up-to-date ones) and
# structure as from_here
def updateDirs(from_here, to_here):
    os.chdir(from_here) # cd to from_here

    # walk the from_here directory
    for file_or_dir in os.listdir(from_here):
        to_file_or_dir = to_here + file_or_dir
        from_file_or_dir = from_here + file_or_dir

        # check if to_file_or_dir is a dir by first determining if it
        # is supposed to be a dir
        # if it is a dir, first of all attach a trailing forward slash
        # this will make it easier for the remaining part of
        # the program to deal with the directories, from_here and to_here
        if (os.path.isdir(file_or_dir)):
            to_file_or_dir += "/"
            from_file_or_dir += "/"

            # check if to_file_or_dir (as a dir) exists
            # if it doesn't make the directory
            if (not os.path.exists(to_file_or_dir)):
                os.mkdir(to_file_or_dir)

            upperleveldir = getUpperLevelDir(from_file_or_dir)

            # now we are sure that to_file_or_dir
            # exists and is a dir; recurse into it
            updateDirs(from_file_or_dir, to_file_or_dir)

            # cd back to where you came from
            os.chdir(upperleveldir)
        else:
            # it is a file

            # check if the file exists
            if (os.path.exists(to_file_or_dir)):
                # get the times when they were modified last
                modified_to = os.stat(to_file_or_dir).st_mtime
                modified_from = os.stat(from_file_or_dir).st_mtime

                # here we check if the modified times of to_file_or_dir
                # is the same as that of from_file_or_dir
                # Since we just want to make sure that the file
                # in to_here (the directory we are going to) mirrors
                # the one in from_here, we just check that the modified
                # times are equal
                # if they aren't we copy the one from from_here
                # to the one in to_here and remove
                # the already existing one in to_here 

                if (modified_from > modified_to):
                    copyString = from_file_or_dir + " " + getUpperLevelDir(\
                        to_file_or_dir)
                # print useful messages to screen about the update
                # i'm about to make
                    print from_file_or_dir, "has been modified and",\
                         to_here, "not updated"
                    print "Copying" , from_file_or_dir, "from", \
                         from_here, "to", to_here

                    subprocess.Popen('cp ' + copyString, shell=True)
                    os.remove(to_file_or_dir)

            else:
                # the file to_file_or_dir does not exist
                # so we copy the file from from_here
                # to to_here
                copyString = from_file_or_dir + " " + getUpperLevelDir(\
                      to_file_or_dir)

                # print useful message to screen about copying
                # from_file_or_dir to to_here
                print from_file_or_dir, "does not exist in",\
                      to_here
                print "Copying" , from_file_or_dir, "from", \
                      from_here, "to", to_here

                subprocess.Popen('cp ' + copyString, shell=True)

# traditional main that does calls
# updateDirs -- the recursive function
def main():
    print "***Updating files in", to_dir, "to mirror the ones in", \
         from_dir, "***\n"

    updateDirs(from_dir, to_dir)

    print "***FINISHED***"

if __name__ == "__main__":
    main()

End of Program

Note: There might be some indentation mistakes in the above script which might have occurred in the process of copying the source from my editor to the WordPress post textArea. Bear with me!