public class MusicMakerTunesHelper extends Object
metaData JSON files
and html files to
annotate all the directories. It uses the Tunes Package Artist
, Album
, Song
classes to deserialize the files and directory structures.Modifier and Type | Field and Description |
---|---|
static boolean |
albumHtml_ |
Vector<Artist> |
artists_ |
private String |
columnDelimitor |
static boolean |
debug_all_ |
static boolean |
debug_dir_ |
static boolean |
debug_info_ |
static boolean |
debug_song_ |
static String |
DEFAULT_COLUMN_DELIMITOR |
static String |
DEFAULT_MUSICMAKER_IP |
String |
fileType |
String |
FILETYPE
The file extension (type) to load
|
private static String |
imagesSubPath_ |
private static String |
metadataFilename_ |
private String |
musicMakerIP_ |
short |
numAlb_ |
short |
numArt_ |
int |
numSndDirs_ |
short |
numSongs_ |
private char[] |
refKEY_
The 1 digit HEX char/byte Reference KEY for this root sub-dir .
|
File[] |
sndDirFiles_ |
Vector<File> |
songDuds |
static String |
SYSTEM_FILE_SEPERATOR
A holder for this clients System File Separator.
|
static String |
SYSTEM_LINE_SEPERATOR
A holder for this clients System line termination separator.
|
static boolean |
testing_ |
static boolean |
toLongs_ |
static boolean |
toShorts_ |
private String |
tunesFredRootPath_ |
private String |
tunesNasRootPath_ |
File |
tunesRootDirMetaFile_ |
private String |
tunesRootPath_ |
private static String |
tunesSubPath_ |
static String |
USERDIR
The users pwd ditrectory.
|
static boolean |
verboseOut |
Constructor and Description |
---|
MusicMakerTunesHelper()
Constructor for the MusicMakerTunesHelper object.
|
MusicMakerTunesHelper(String tunesRootPath)
Constructor for the TunesHelper object to allow custom root path, but uses the default context = 'tunes'.
|
Modifier and Type | Method and Description |
---|---|
private static Map<String,Boolean> |
buildConfig(String... options) |
void |
cleanDir(String dirToClean) |
void |
cleanDir(String dirToClean,
boolean recurse)
Parses the dir (recursive is optional) and removes non-song files and any useless subdirs (like @eadirs).
|
private String |
cleanJSON(StringBuilder sb)
Performs some simple removal of extra line seperators.
|
String |
createCSSFile(String topDirFilename)
.
|
void |
createHtmlFiles(String topDirFilename)
Parses the TOP dir and reads in all the snd subirs creating Metadata files as is recurses.
|
void |
createMetadataFiles()
Parses the TOP dir and reads in all the snd subirs creating Metadata files as is recurses.
|
private void |
createMetadataFiles(String topDirFilename)
Parses the TOP dir and reads in all the snd subirs creating Metadata files as is recurses.
|
String[] |
getArtistNames() |
String[] |
getArtistNames(boolean removeSpaces) |
Vector<Artist> |
getArtists() |
Vector<Artist> |
getArtists(boolean sorted) |
String |
getHtmlDiv(String topDirFilename)
Parses the TOP dir and reads in all the snd subirs creating Metadata files as is recurses.
|
int |
getNumberOfAlbums() |
int |
getNumberOfAlbums(String artist) |
int |
getNumberOfArtists() |
int |
getNumberOfSongs() |
String |
getRefKeyString() |
String |
getTunesDirPath()
Gets the full file path to the tunes dir.
|
static String |
getTunesSubPath()
Get Method for class field 'tunesSubPath_'.
|
static String |
jsonFormat(JsonStructure json,
String... options)
helper to format json string
|
static void |
main(String[] args)
Main
|
void |
parseTopTunesDir(String tunesRootDir)
Parses the TOP tunes dir and reads in all the snd subirs.
|
void |
parseTunesDir(File artistRootDirFile)
Parses the tunes sub-dirs and reads in all the artists_.
|
void |
parseTunesDir(String artistRootDir)
Parses the tunes sub-dirs and reads in all the artists_.
|
static String |
prettyPrint(JsonStructure json)
helper to format json string - This is the preferredformatter.
|
private void |
renameTo(boolean toShorts,
String topDir,
String parentRefKey) |
private void |
renameToLongs(String topDir,
String parentRefKey) |
private void |
renameToShorts(String topDir,
String parentRefKey) |
static void |
setTunesSubPath(String tunesSubPath)
Set Method for class field 'tunesSubPath_'.
|
String |
toJsonString()
Lists all songs in all artists albums in a JSON string.
|
String |
toMetaJsonArtDir()
NOT USED - See Artist class .
|
String |
toMetaJsonSndDir(String currSnd,
int refKey)
Cobbles together the meta-data information about this SND sub-Directory in a JSON string.
|
String |
toMetaJsonTopDir()
Cobbles together the meta-data information about this Artist Directory in a JSON string.
|
String |
toMetaJsonTopDir(boolean recurseDirs,
DirFileRef.DirState dirState)
Cobbles together the meta-data information about this TOP Directory in a JSON string.
|
void |
writeArtistAlbumHtmlFiles()
Using this class object's tunesRootPath_ and existing MetaData Files data,
write the album.html file in each Artist Album directory; overwritingexisitng files if needed.
|
void |
writeArtistAlbumHtmlFiles(boolean doingRefURLS)
Using this class object's tunesRootPath_ and existing MetaData Files data,
write the album.html file in each Artist Album directory; overwritingexisitng files if needed.
|
void |
writeArtistAlbumHtmlFiles(String preUrlStr,
String postUrlStr,
boolean doingRefURLS)
Using this class object's tunesRootPath_ and existing MetaData Files data,
write the album.html file in each Artist Album directory; overwritingexisitng files if needed.
|
void |
writeArtistAlbumHtmlFiles(String tunesRootDir,
String preUrlStr,
String postUrlStr,
boolean doingRefURLS)
Using existing MetaData Files data, write the album.html file in
each Artist Album directory; overwritingexisitng files if needed.
|
public static final String SYSTEM_FILE_SEPERATOR
public static final String SYSTEM_LINE_SEPERATOR
public static final String DEFAULT_COLUMN_DELIMITOR
public static final String DEFAULT_MUSICMAKER_IP
private String columnDelimitor
private String musicMakerIP_
private String tunesNasRootPath_
private String tunesFredRootPath_
private String tunesRootPath_
private static String tunesSubPath_
private static String imagesSubPath_
private static String metadataFilename_
public static boolean testing_
public static boolean toShorts_
public static boolean toLongs_
public static boolean albumHtml_
public static boolean verboseOut
public static boolean debug_info_
public static boolean debug_dir_
public static boolean debug_song_
public static boolean debug_all_
public File tunesRootDirMetaFile_
public int numSndDirs_
public File[] sndDirFiles_
public short numArt_
public short numAlb_
public short numSongs_
private char[] refKEY_
public MusicMakerTunesHelper()
public MusicMakerTunesHelper(String tunesRootPath)
public void createMetadataFiles()
private void createMetadataFiles(String topDirFilename)
public void cleanDir(String dirToClean, boolean recurse)
public void parseTopTunesDir(String tunesRootDir)
public void parseTunesDir(File artistRootDirFile)
public void parseTunesDir(String artistRootDir)
public String getRefKeyString()
private void renameToShorts(String topDir, String parentRefKey)
private void renameToLongs(String topDir, String parentRefKey)
public void writeArtistAlbumHtmlFiles()
public void writeArtistAlbumHtmlFiles(boolean doingRefURLS)
public void writeArtistAlbumHtmlFiles(String preUrlStr, String postUrlStr, boolean doingRefURLS)
preUrlStr
- is a string to pre-pend to all directorys represneting URLs; it can be an empty string to treat them as relative URLs.public void writeArtistAlbumHtmlFiles(String tunesRootDir, String preUrlStr, String postUrlStr, boolean doingRefURLS)
tunesRootDir
- is the top tunesdir holding the snd sub-dirspreUrlStr
- is a string to pre-pend to all directorys represneting URLs; it can be an empty string to treat them as relative URLs.public String createCSSFile(String topDirFilename)
public void createHtmlFiles(String topDirFilename)
public String getHtmlDiv(String topDirFilename)
public String toMetaJsonTopDir()
public String toMetaJsonTopDir(boolean recurseDirs, DirFileRef.DirState dirState)
{ "dirFile": "/home/tgutwin/Music", "dirType": "TOPDIR", "dirState": "LONG", "refKey": "0", "numSndDirs": 2, "sndDirs": [ { "refKey": "0", "dirFile": "ogg", "dirType": "SNDROOT", "dirState": "LONG" }, { "refKey": "1", "dirFile": "mp3", "dirType": "SNDROOT", "dirState": "LONG" } ] }
public String toMetaJsonSndDir(String currSnd, int refKey)
public String toMetaJsonArtDir()
public static String prettyPrint(JsonStructure json)
public static String jsonFormat(JsonStructure json, String... options)
private static Map<String,Boolean> buildConfig(String... options)
public Vector<Artist> getArtists()
public Vector<Artist> getArtists(boolean sorted)
public String[] getArtistNames()
public String[] getArtistNames(boolean removeSpaces)
public int getNumberOfArtists()
public int getNumberOfAlbums()
public int getNumberOfAlbums(String artist)
public int getNumberOfSongs()
public static void setTunesSubPath(String tunesSubPath)
tunesSubPath
- is the value to set this class field to.public static String getTunesSubPath()
public String getTunesDirPath()
private String cleanJSON(StringBuilder sb)
public String toJsonString()
[ { url: "http://warp4.webarts.bc.ca/tunes/mythTunes/3DoorsDown/3DoorsDown/3DoorsDown03-It'sNotMyTime.ogg", file: "3DoorsDown03-It'sNotMyTime.ogg", title: "It'sNotMyTime", album: "3DoorsDown", artist: "3DoorsDown", number: "03", index: "26" }, { url: "http://warp4.webarts.bc.ca/tunes/mythTunes/3DoorsDown/3DoorsDown/3DoorsDown04-LetMeBeMyself.ogg", file: "3DoorsDown04-LetMeBeMyself.ogg", title: "LetMeBeMyself", album: "3DoorsDown", artist: "3DoorsDown", number: "04", index: "27" }, { url: "http://warp4.webarts.bc.ca/tunes/mythTunes/3DoorsDown/3DoorsDown/3DoorsDown05-Pages.ogg", file: "3DoorsDown05-Pages.ogg", title: "Pages", album: "3DoorsDown", artist: "3DoorsDown", number: "05", index: "28" } ]
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses