Search in sources :

Example 11 with DirectoryContent

use of com.github.hakko.musiccabinet.domain.model.aggr.DirectoryContent in project musiccabinet by hakko.

the class DirectoryBrowserService method getDirectoryDiff.

public DirectoryContent getDirectoryDiff(int directoryId) {
    Directory dir = dao.getDirectory(directoryId);
    Set<String> dbSubDirs = presenceDao.getSubdirectories(dir.getPath());
    Set<File> dbFiles = presenceDao.getFiles(dir.getPath());
    DirectoryContent found = getContent(dir);
    removeIntersection(dbSubDirs, found.getSubDirectories());
    removeIntersection(dbFiles, found.getFiles());
    return found;
}
Also used : DirectoryContent(com.github.hakko.musiccabinet.domain.model.aggr.DirectoryContent) File(com.github.hakko.musiccabinet.domain.model.library.File) Directory(com.github.hakko.musiccabinet.domain.model.library.Directory)

Example 12 with DirectoryContent

use of com.github.hakko.musiccabinet.domain.model.aggr.DirectoryContent in project musiccabinet by hakko.

the class LibraryScanner method preVisitDirectory.

@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
    DirectoryContent parentContent = map.get(dir.getParent());
    if (parentContent != null) {
        parentContent.getSubDirectories().add(dir.toString());
    }
    map.put(dir, new DirectoryContent(dir.toString()));
    return CONTINUE;
}
Also used : DirectoryContent(com.github.hakko.musiccabinet.domain.model.aggr.DirectoryContent)

Aggregations

DirectoryContent (com.github.hakko.musiccabinet.domain.model.aggr.DirectoryContent)12 File (com.github.hakko.musiccabinet.domain.model.library.File)5 Directory (com.github.hakko.musiccabinet.domain.model.library.Directory)4 Test (org.junit.Test)4 File (java.io.File)2 LibraryPresenceDao (com.github.hakko.musiccabinet.dao.LibraryPresenceDao)1 UnittestLibraryUtil.getFile (com.github.hakko.musiccabinet.util.UnittestLibraryUtil.getFile)1 IOException (java.io.IOException)1 DirectoryIteratorException (java.nio.file.DirectoryIteratorException)1 Path (java.nio.file.Path)1 BasicFileAttributeView (java.nio.file.attribute.BasicFileAttributeView)1 BasicFileAttributes (java.nio.file.attribute.BasicFileAttributes)1 HashSet (java.util.HashSet)1 ApplicationContextException (org.springframework.context.ApplicationContextException)1 PollableChannel (org.springframework.integration.core.PollableChannel)1