Skip to content

Commit

Permalink
feat(cli): cache paths of parent ilias items while syncing
Browse files Browse the repository at this point in the history
  • Loading branch information
thetric committed Mar 9, 2017
1 parent e616428 commit 15b25b1
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.github.thetric.iliasdownloader.service.model.CourseFile
import com.github.thetric.iliasdownloader.service.model.CourseFolder
import com.github.thetric.iliasdownloader.service.model.IliasItem
import groovy.transform.CompileStatic
import groovy.transform.Memoized
import groovy.transform.PackageScope
import groovy.util.logging.Log4j2

Expand Down Expand Up @@ -35,6 +36,7 @@ final class SyncHandlerImpl implements SyncHandler {
return parentItemPath.resolve(sanitizeFileName(iliasItem.name))
}

@Memoized
private Path resolvePathOfParent(IliasItem parentItem) {
if (!parentItem) return basePath
def itemNamesInPath = []
Expand Down Expand Up @@ -62,8 +64,6 @@ final class SyncHandlerImpl implements SyncHandler {
@Override
void handle(Course course) {
log.info("Visiting course '${course.name}' (id: ${course.id}")
// do NOT create folders for empty courses
// def coursePath = resolvePathAndCreateMissingDirs(course)
}
@Override
Expand All @@ -73,14 +73,14 @@ final class SyncHandlerImpl implements SyncHandler {
@Override
void handle(CourseFolder folder) {
log.info("Visiting folder '${folder.name}'")
log.debug("Visiting folder '${folder.name}'")
// do NOT create directories for empty course folders
// def folderPath = resolvePathAndCreateMissingDirs(folder)
}
@Override
void handle(CourseFile file) {
log.info("Visiting file ${file.name}")
log.debug("Visiting file ${file.name}")
def filePath = resolvePathAndCreateMissingDirs(file)
if (needsToSync(filePath, file)) {
log.info("Downloading file $file")
Expand Down

0 comments on commit 15b25b1

Please sign in to comment.