Skip to content

Commit

Permalink
Maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
seabamirum committed Jul 6, 2023
1 parent 3ead9ba commit 3a5dc17
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 15 deletions.
16 changes: 8 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fun.seabird</groupId>
<artifactId>ebird-media-sorter</artifactId>
<version>2.2.8</version>
<version>2.2.9</version>
<name>ebird-media-sorter</name>

<build>
Expand Down Expand Up @@ -49,7 +49,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
<version>32.1.1-jre</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.drewnoakes/metadata-extractor -->
Expand All @@ -76,21 +76,21 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
<version>2.13.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.openjfx/javafx-base -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>20</version>
<version>20.0.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.openjfx/javafx-controls -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>20</version>
<version>20.0.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
Expand All @@ -104,21 +104,21 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.4.6</version>
<version>1.4.8</version>
</dependency>

<!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.6</version>
<version>1.4.8</version>
</dependency>

<!-- https://mvnrepository.com/artifact/io.projectreactor/reactor-core -->
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>3.5.5</version>
<version>3.5.7</version>
</dependency>

<dependency>
Expand Down
24 changes: 21 additions & 3 deletions src/main/java/fun/seabird/MediaSortTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private void parseCsvLine(EbirdCsvRow row)
String subId = row.getSubId();
if (!checklistStatsMap.containsKey(subId)) {

LocalDateTime subBeginTime = row.getDate().atTime(row.getTime());
LocalDateTime subBeginTime = row.dateTime();
LocalDateTime subEndTime = subBeginTime.plusMinutes(duration);

checklistStatsMap.putIfAbsent(subId, new SubStats(subBeginTime,row.getSubnat1Code(),row.getSubnat2Name(),row.getLocName()));
Expand Down Expand Up @@ -223,7 +223,7 @@ private void moveFile(Path from, Path to) throws IOException {
}
}

private Path createDirIfNotExists(Path path) throws IOException {
private static Path createDirIfNotExists(Path path) throws IOException {
return Files.createDirectories(path);
}

Expand All @@ -232,6 +232,13 @@ public static String getFileExtension(String fileName) {
return (dotIndex == -1) ? "" : fileName.substring(dotIndex + 1);
}

/**
Transcodes the video file to a smaller size if it exceeds the maximum ML upload size.
@param file The path to the video file to transcode.
@param parentDir The directory where the transcoded video file will be saved.
@throws IOException If an I/O error occurs during the transcoding process.
*/
private void transcodeVideo(Path file, Path parentDir) throws IOException {
long fileSizeInBytes = Files.size(file);
long fileSizeInMB = fileSizeInBytes / (1024 * 1024);
Expand Down Expand Up @@ -267,6 +274,17 @@ private void transcodeVideo(Path file, Path parentDir) throws IOException {
}
}

/**
* Checks the metadata of a file and moves it to the appropriate directory based on the metadata information.
*
* @param file The file to check and move.
* @param outputDir The output directory where the file will be moved.
* @param hrsOffset The hour offset for adjusting creation date.
* @param subIds A set to store the unique subIds encountered.
* @param sepYearDir Flag indicating whether to separate files into year directories.
* @param folderGroup The folder grouping mode.
* @throws IOException If an I/O error occurs while performing the operation.
*/
private void checkMetadataAndMove(Path file, Path outputDir, Long hrsOffset, Set<String> subIds, boolean sepYearDir,
FolderGroup folderGroup) throws IOException {
LocalDateTime mediaTime = null;
Expand Down Expand Up @@ -372,7 +390,7 @@ protected Path call() throws Exception {
Set<String> subIds = new TreeSet<>();
Long hrsOffset = msc.getHrsOffset();

AtomicInteger i = new AtomicInteger(0);
AtomicInteger i = new AtomicInteger();
List<Path> eligibleFiles = new ArrayList<>();
logger.info("Analyzing files...");

Expand Down
4 changes: 1 addition & 3 deletions src/main/java/fun/seabird/MediaSorter.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package fun.seabird;

import java.io.IOException;

import javafx.application.Application;

public abstract class MediaSorter
{
public static void main(String[] args) throws IOException
public static void main(String[] args)
{
Application.launch(MediaSorterApplication.class, args);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/fun/seabird/MediaSorterApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class MediaSorterApplication extends Application
* @param msc the media sorting configuration to be used for the task
* @param msr the media sorting results to be updated after the task completes
*/
private void runMediaSortTask(Button runBut, Button resBtn, ProgressBar pb, ScrollPane scroll, MediaSortCmd msc, MediaSortResult msr)
private static void runMediaSortTask(Button runBut, Button resBtn, ProgressBar pb, ScrollPane scroll, MediaSortCmd msc, MediaSortResult msr)
{
runBut.setDisable(true);
resBtn.setDisable(true);
Expand Down

0 comments on commit 3a5dc17

Please sign in to comment.