MovieLibrary
Class Utils

java.lang.Object
  extended by MovieLibrary.Utils

public class Utils
extends java.lang.Object

Various Utils functions

Author:
Alex Della-Croce

Field Summary
static java.lang.String avi
          video file extension avi
static java.lang.String avs
          video file extension avs
static java.lang.String exe
          application extension exe
static java.lang.String flv
          video file extension flv
static java.lang.String m4v
          video file extension m4v
static java.lang.String mka
          video file extension mka
static java.lang.String mkv
          video file extension mkv
static java.lang.String mov
          video file extension mov
static java.lang.String mp4
          video file extension mp4
static java.lang.String mpeg
          video file extension mpeg
static java.lang.String mpg
          video file extension mpg
static java.lang.String srt
          subtitle file extension srt
static java.lang.String sub
          subtitle file extension sub
static java.lang.String threegp
          video file extension 3gp
static java.lang.String ts
          video file extension ts
static java.lang.String vob
          video file extension vob
static java.lang.String wmv
          video file extension wmv
static java.lang.String xml
          library file extension xml
 
Constructor Summary
Utils()
           
 
Method Summary
 void accessDatabase()
           
static java.lang.Object[] checkAllFiles(java.io.File dir, java.lang.Object[] listToCheck)
           
static java.lang.Object[] checkFileListForDir(java.lang.Object[] listToCheck)
           
static java.io.File checkFileName(java.io.File fileToCheck)
           
static java.lang.String checkHTMLValid(java.lang.String stringToCheck)
           
static java.lang.String convertHexToBinary(char hexValue)
          Convert the given hexadecimal value to binary
static java.lang.String correctHTMLCodes(java.lang.String stringToCheck)
          converts html ascii codes to symbol and updates the string
static void errorMsg(java.awt.Container container, java.lang.String msg)
          Show given error message on given container
 VideoObject[] getDetailedVideoInfo(java.io.File file, java.lang.String reqFileName, java.lang.String serverAddress, java.sql.Connection con)
           
static java.lang.String getExtension(java.io.File f)
          get the extension of the given file
static java.lang.String getFFmpegAudioCodecCode(java.lang.String audioCodecName)
           
static java.lang.String getFFmpegVideoCodecCode(java.lang.String videoCodecName)
           
static java.lang.String getMencoderAudioCodecCode(java.lang.String audioCodecName)
           
static java.lang.String getMencoderVideoCodecCode(java.lang.String videoCodecName)
           
static java.lang.String getNameWithoutExtension(java.io.File f)
          get the name of the file minus the extension
 VideoObject getVideoInfo(java.io.File file, java.lang.String reqFileName, java.lang.String serverAddress, java.sql.Connection con)
          Links to the online database to get an exact match of video information for the given video
 java.lang.Object[] getVideoInfoFromImdb(java.io.File file, java.lang.String filmTitle, int videoID)
          Searches imdb database and returns a set of matches
static boolean isInteger(java.lang.String testString)
           
static boolean isKeyValue(int i)
          returns if the given value is a license key value
static boolean isNumeric(java.lang.String testString)
           
static boolean isPossibleNameChar(char character)
          is a valid video naming character
static boolean isVideoFile(java.io.File fileToCheck)
          checks if the file given is of valid (supported) video format
 void saveInfoToDB(java.util.ArrayList<VideoInfo> videoInfo)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

avi

public static final java.lang.String avi
video file extension avi

See Also:
Constant Field Values

mpeg

public static final java.lang.String mpeg
video file extension mpeg

See Also:
Constant Field Values

mpg

public static final java.lang.String mpg
video file extension mpg

See Also:
Constant Field Values

mp4

public static final java.lang.String mp4
video file extension mp4

See Also:
Constant Field Values

mov

public static final java.lang.String mov
video file extension mov

See Also:
Constant Field Values

vob

public static final java.lang.String vob
video file extension vob

See Also:
Constant Field Values

wmv

public static final java.lang.String wmv
video file extension wmv

See Also:
Constant Field Values

exe

public static final java.lang.String exe
application extension exe

See Also:
Constant Field Values

xml

public static final java.lang.String xml
library file extension xml

See Also:
Constant Field Values

srt

public static final java.lang.String srt
subtitle file extension srt

See Also:
Constant Field Values

sub

public static final java.lang.String sub
subtitle file extension sub

See Also:
Constant Field Values

threegp

public static final java.lang.String threegp
video file extension 3gp

See Also:
Constant Field Values

mkv

public static final java.lang.String mkv
video file extension mkv

See Also:
Constant Field Values

mka

public static final java.lang.String mka
video file extension mka

See Also:
Constant Field Values

flv

public static final java.lang.String flv
video file extension flv

See Also:
Constant Field Values

m4v

public static final java.lang.String m4v
video file extension m4v

See Also:
Constant Field Values

avs

public static final java.lang.String avs
video file extension avs

See Also:
Constant Field Values

ts

public static final java.lang.String ts
video file extension ts

See Also:
Constant Field Values
Constructor Detail

Utils

public Utils()
Method Detail

errorMsg

public static void errorMsg(java.awt.Container container,
                            java.lang.String msg)
Show given error message on given container

Parameters:
container - container on which to display error message
msg - message to display on given container

convertHexToBinary

public static java.lang.String convertHexToBinary(char hexValue)
Convert the given hexadecimal value to binary

Parameters:
hexValue - hex value to be converted to binary
Returns:
string binary representation of the given hex value

getExtension

public static java.lang.String getExtension(java.io.File f)
get the extension of the given file

Returns:
string extension of the given file

getNameWithoutExtension

public static java.lang.String getNameWithoutExtension(java.io.File f)
get the name of the file minus the extension

Parameters:
f - file to get the name of
Returns:
string name of given file minus extension

isKeyValue

public static boolean isKeyValue(int i)
returns if the given value is a license key value

Parameters:
i - given value to check
Returns:
if given value is a key license value or not (true=key value)

isPossibleNameChar

public static boolean isPossibleNameChar(char character)
is a valid video naming character

Parameters:
character - characted to check
Returns:
if the given character is a valid file naming characted or not

isVideoFile

public static boolean isVideoFile(java.io.File fileToCheck)
checks if the file given is of valid (supported) video format

Parameters:
fileToCheck - file to check the format of
Returns:
if the file given is a supported video format

getVideoInfo

public VideoObject getVideoInfo(java.io.File file,
                                java.lang.String reqFileName,
                                java.lang.String serverAddress,
                                java.sql.Connection con)
Links to the online database to get an exact match of video information for the given video

Parameters:
file - video file to find database info for
reqFileName - video file name to check for possible match from the database
serverAddress - address of the database server to connect to
con - connection to use to connect to the database server
Returns:
the video object containing the info found from the database if any, null otherwise

getDetailedVideoInfo

public VideoObject[] getDetailedVideoInfo(java.io.File file,
                                          java.lang.String reqFileName,
                                          java.lang.String serverAddress,
                                          java.sql.Connection con)

checkFileListForDir

public static java.lang.Object[] checkFileListForDir(java.lang.Object[] listToCheck)

checkAllFiles

public static java.lang.Object[] checkAllFiles(java.io.File dir,
                                               java.lang.Object[] listToCheck)

checkFileName

public static java.io.File checkFileName(java.io.File fileToCheck)

isNumeric

public static boolean isNumeric(java.lang.String testString)

getMencoderAudioCodecCode

public static java.lang.String getMencoderAudioCodecCode(java.lang.String audioCodecName)

getFFmpegAudioCodecCode

public static java.lang.String getFFmpegAudioCodecCode(java.lang.String audioCodecName)

getMencoderVideoCodecCode

public static java.lang.String getMencoderVideoCodecCode(java.lang.String videoCodecName)

getFFmpegVideoCodecCode

public static java.lang.String getFFmpegVideoCodecCode(java.lang.String videoCodecName)

isInteger

public static boolean isInteger(java.lang.String testString)

checkHTMLValid

public static java.lang.String checkHTMLValid(java.lang.String stringToCheck)

getVideoInfoFromImdb

public java.lang.Object[] getVideoInfoFromImdb(java.io.File file,
                                               java.lang.String filmTitle,
                                               int videoID)
Searches imdb database and returns a set of matches

Parameters:
file - file from the library
filmTitle - video title to check
Returns:
results found

correctHTMLCodes

public static java.lang.String correctHTMLCodes(java.lang.String stringToCheck)
converts html ascii codes to symbol and updates the string

Parameters:
stringToCheck - string to be checked and updated
Returns:
updated string with symbols instead of html ascii codes

accessDatabase

public void accessDatabase()

saveInfoToDB

public void saveInfoToDB(java.util.ArrayList<VideoInfo> videoInfo)