net.shredzone.ifish.db
Class Sync

java.lang.Object
  extended by net.shredzone.ifish.db.Sync

public class Sync
extends Object

The purpose of this class is to synchronize the database with the iHP harddisk.

Version:
$Id: Sync.java 291 2009-04-28 21:29:27Z shred $

Constructor Summary
Sync(NaviDb navi)
          Create a new synchronizer.
Sync(NaviDb navi, PlaylistDb playlist)
          Create a new synchronizer.
 
Method Summary
protected  String createPlaylistName()
          Construct a playlist name for the given model and playlist.
 String getNewEntrantName()
          Get the playlist name of the New Entrant playlist.
 boolean isCheckModified()
          Check whether the modification date is to be checked.
 boolean isCheckTrackNumbers()
          Check whether the track numbers are to be checked in the file names.
 boolean isCreateCommentPlaylist()
          Chech whether playlists are to be created from tag comments.
 boolean isCreateNewEntrantPlaylist()
          Check whether playlists are to be created from all new entrants.
 boolean isDeleteResourceFork()
          Check whether MacOS X resource fork emulation files are to be deleted
 void setCheckModified(boolean b)
          Set if the modification date is to be checked.
 void setCheckTrackNumbers(boolean b)
          Set if the track numbers are to be checked in the file names.
 void setCreateCommentPlaylist(boolean b)
          Set if playlists are to be created from tag comments.
 void setCreateNewEntrantPlaylist(boolean b)
          Set if playlists are to be created from all new entrants.
 void setDeleteResourceFork(boolean b)
          Set if MacOS X resource fork emulation files are to be deleted
 void setNewEntrantName(String s)
          Set the playlist name of the New Entrant playlist.
 void syncDir(File base)
          Synchronizes a directory with this database.
 void syncDir(File base, StatusCallback cb, RenameCallback rcb)
          Synchronizes a directory with this database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sync

public Sync(NaviDb navi)
Create a new synchronizer. It only synchronizes the directory with the database. The playlists are not touched at all.

Parameters:
navi - The NaviDb to synchronize with.

Sync

public Sync(NaviDb navi,
            PlaylistDb playlist)
Create a new synchronizer. It synchronizes both the directory with the database, and the playlists.

Parameters:
navi - The NaviDb to synchronize with.
playlist - The PlaylistDb to synchronize with.
Method Detail

setCheckModified

public void setCheckModified(boolean b)
Set if the modification date is to be checked.

Parameters:
b - true: check modification date, false: ignore

isCheckModified

public boolean isCheckModified()
Check whether the modification date is to be checked.

Returns:
true: check modification date, false: ignore

setCheckTrackNumbers

public void setCheckTrackNumbers(boolean b)
Set if the track numbers are to be checked in the file names.

Parameters:
b - true: check track numbers, false: ignore

isCheckTrackNumbers

public boolean isCheckTrackNumbers()
Check whether the track numbers are to be checked in the file names.

Returns:
true: check track numbers, false: ignore

setDeleteResourceFork

public void setDeleteResourceFork(boolean b)
Set if MacOS X resource fork emulation files are to be deleted

Parameters:
b - true: delete resource fork files, false: keep

isDeleteResourceFork

public boolean isDeleteResourceFork()
Check whether MacOS X resource fork emulation files are to be deleted

Returns:
true: check modification date, false: ignore

setCreateCommentPlaylist

public void setCreateCommentPlaylist(boolean b)
Set if playlists are to be created from tag comments.

Parameters:
b - true: Create Playlists from tag comments.

isCreateCommentPlaylist

public boolean isCreateCommentPlaylist()
Chech whether playlists are to be created from tag comments.

Returns:
true: Create Playlists from tag comments.

setCreateNewEntrantPlaylist

public void setCreateNewEntrantPlaylist(boolean b)
Set if playlists are to be created from all new entrants.

Parameters:
b - true: Create Playlists from all new entrants

isCreateNewEntrantPlaylist

public boolean isCreateNewEntrantPlaylist()
Check whether playlists are to be created from all new entrants.

Returns:
true: Create Playlists from all new entrants

setNewEntrantName

public void setNewEntrantName(String s)
Set the playlist name of the New Entrant playlist. A "{s}" will be replaced by the last synchronization date, a "{d}" will be replaced by the current date.

Default is "{s}".

Parameters:
s - The New Entrant playlist name

getNewEntrantName

public String getNewEntrantName()
Get the playlist name of the New Entrant playlist. A "{s}" will be replaced by the last synchronization date, a "{d}" will be replaced by the current date.

Returns:
The new entrant playlist name

createPlaylistName

protected String createPlaylistName()
Construct a playlist name for the given model and playlist. If no PlaylistDb was set, null will be returned.

First a short date format ("yyyyMMdd") is tried. If there already is a playlist with that name, a long date format ("yyyyMMdd-HHmmss") is tried instead.

Returns:
Playlist name

syncDir

public void syncDir(File base)
             throws IOException,
                    DatabaseException
Synchronizes a directory with this database. Usually this is the same directory the database file was located in.

Parameters:
base - Base directory
Throws:
IOException
DatabaseException

syncDir

public void syncDir(File base,
                    StatusCallback cb,
                    RenameCallback rcb)
             throws IOException,
                    DatabaseException
Synchronizes a directory with this database. Usually this is the same directory the database file was located in.

Parameters:
base - Base directory
cb - StatusCallback to be used, null for none
rcb - RenameCallback to be used, null for default
Throws:
IOException
DatabaseException


Copyright © 2007-2011 shredzone.org. All Rights Reserved.