Skip to content

Commit

Permalink
Merge branch 'release/1.2.0' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymillergh committed Oct 22, 2020
2 parents a38677a + 1f3eafc commit fb74b7e
Show file tree
Hide file tree
Showing 38 changed files with 354 additions and 147 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ build/

### VS Code ###
.vscode/

### Custom Ignored ###
/.travis/**.asc
51 changes: 42 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,60 @@
# https://docs.travis-ci.com/user/languages/java/
language: java

# https://docs.travis-ci.com/user/multi-os/
os: linux

# We can specify a list of JDKs to be used for testing. A list of available JDKs in Trusty can be seed in:
# https://docs.travis-ci.com/user/reference/trusty/#jvm-clojure-groovy-java-scala-images
jdk: oraclejdk11

# Each job in Travis CI has several steps:
# https://docs.travis-ci.com/user/job-lifecycle#skipping-the-installation-phase
install: skip

# To prevent error like:
# xxx.sh: Permission denied
before_script:
- chmod +x .travis/install.sh
- chmod +x .travis/deploy.sh
- chmod +x mvnw

# Custom Maven install script:
# https://docs.travis-ci.com/user/job-lifecycle/
# The 'language: java' directive sets up sane defaults to test common java applications.
# We customize the script for compiling Maven application. For more about customizing the build:
# https://docs.travis-ci.com/user/customizing-the-build
script:
- ./mvnw install -Dmaven.javadoc.skip=true -B -V
- "./.travis/install.sh"

before_install:
- chmod +x mvnw
# Decrypt file `gpg.asc.enc` before deployment
# https://docs.travis-ci.com/user/encrypting-files/
before_deploy:
- openssl aes-256-cbc -K $encrypted_4f0d00631887_key -iv $encrypted_4f0d00631887_iv -in .travis/gpg.asc.enc -out .travis/gpg.asc -d

# This is to enable Codecov's coverage. If the build is successful, the code is submitted for code coverage analysis.
#after_success:
# - bash <(curl -s https://codecov.io/bash)
deploy:
- skip_cleanup: true
provider: script
script: ./.travis/deploy.sh
on:
branch:
- feature/**
- release/**
- hotfix/**
- skip_cleanup: true
provider: script
script: ./.travis/deploy.sh
on:
tags: true

# https://docs.travis-ci.com/user/notifications#default-notification-settings
notifications:
email:
on_success: change
on_failure: always

# https://docs.travis-ci.com/user/environment-variables/
# https://docs.travis-ci.com/user/encryption-keys#usage
env:
global:
- secure: "DwQw/xajbyrBUpx0/TBmAsUArKn08Ko0ncHWKp5vF+Y09gGWuLSRrkOUURXU5zsakewGnwgwSl72NCH1wrgjNUpL0v0Btgkfpbaz1PW5oOPCfgcoY4gCBBp5kCwUg2ONErgyoRN/ePPN1pYK/LVKlockunT+8cffiK1DkjH8yx6izk0ZmkWwdP1ZULlFL0VnFR2wIUY9cosCjY2rddd3iBBk9UjcTXiCgu3nUL/qMZJBd1TUNEIDUCINK4RUkkOBqfzsXZR4ydUjYCGkb/Ul3FkNzs+mFpzTTtKl4qYbVSfcv6Yn5oUz7EXNcELYMSQ+yiGEdRWQx3iLxEU/lGjSe2dgPH6RbNPa4QEj/nndvLiiMBoxlzzqKfaDSCao4taby6uzfyEAipqicDIA9pVA6u7ILKebKX6DJVBh7QBlMPv5JTs7Ghd5QrkzIsXmq0P+dt2PztK+5JX6g7ytPGvN8oZ76dc1IF2t7E1pZSIMAw7rQBL1dyYXPtpQwrRIs0vF8C4vL2XI3utz/7V6JB6ao80Svk6D7O+wSDUN/qX8u/krV2SjOv5GKvk6M6MvzC/JSSn+xw18SrEaCMrTZcNuFCfkuyMJUkCsEm/qDU8fmIfcIRWyOKtaySyGrAfJI0qDDLc+GlPdka/fWCcG3e/BxkoyHLSG+3NLJTnLkUBtGZE="
- secure: "HGBiKhMbdj28wGxCzyGcWOUC9AxvkwhXrSxotySM+xBEVIm161U5uuC0El4/A3qU0feSRav+kA9xnte48QZUZc1yc4sdtT0J5rspZgx+4VGgNVjI+AUsrgbbcjZmk78GI2i0lXPIMXtyTzknriglruu2E+Ov7znDnWqiSUsWeaWA0QdTLWNFPONrsR2tgYGvzXhuVzONAVqucyvwZy/9WsnGOvJ3wlMbv8TKgsgfl/ntN2rijf7tzVVdefdRt9T5e9EJkTOJDvaUbbTOW7rBkM/WyrZxgbXsYmzi2Icg2o/h7pkT/+iZ/2MQYnDGJY3hRmRzHPKbAB90nVC0VQ42s9QL6gKWNTLAvM92/DhXu6anmowNEaLQGAYVIvPSngY16Nio0ZoJimVWPjb1dQ9l6vMY9+CJUlKW3LVTeqAfZ+6RW4COxNXoULEU7LlIExP8axtm0hl/mp0tv8IO/vuZs0/10g2s0cBw4ztWGg4FSGSgzpj5b6ezQCdS7jhhheLyws+rs2y0zOme7CU3ZqlwDwYnIyWpBcn0Za0OFObo4N0JX6CeuQBBf8bFLZJhMKVBfLTlVg3fcIPO5TybBUNsOhzsvURe9RDj/phDOwfxZNL9Plm0SOfX9lzeuQDFCurpt5zlhdXWmYlTX7zp2aRbAYV+BWlz2fd23Ujqn0RL2mo="
- secure: "OmBHPARnSc3XBK2HmjqurypOZMdNJOT2p3UHk/fHIA5YThvMI/EXJfT+3mAgvK5sCXOXBARKr1bVp+gAFZbCCj964czUKP0Dqp87fxDok4tpejgnbdBFF3asQB2r4t1b1ZlUOKhAVQIPZGIqnSbD3jvMxcGD5DTCu7F/2sIue02OV7X+P1rFujL9EYyPG7LdOie+54+9njZZ3Vz1NhPOpOf6xoWsKFjUTaN+qpYDoMAruN3LG3ZrIxLnkjlbfrIjkmO/XP1CUnenDT63sBx3Ub7DQyvCXppunmxCAA9HTfkIRzprcyGiIr8hAo585TUKZlCUlRyg5BbfZ5X1J+YYmi6vVgvOSAzcUkHTmbGB/zAiBylA37v4Dl6OHOf98SDgm5bpQUCVTScmVumKFMCpe135hN8pWK7xrQUUpku9BsK9TTXy5vMPOTFmG2oUrsjzoF870+ZudD5we8eDl5FaZt8EW5qH230AIz2OqygtRm4TESa3pbFdZ7G6zyf9W5aLFoBBtBRJW+ks2KDtWRhimF6dAVVsW9XZ6jdLL89LE7kztkc7QffuYN5aCWGGueg67WHoI1PbWFe2zub2e3ZAHE/WVZu5bUzOhF0VbS6HBHBPyUr2u23NaDiTofKkVwUpUi0Ts5J9b08cfuTANmOpGPZdfzxJ4rCY/Uy7uq4JopM="
- secure: "bZCSd5Bq7Cicoe8tqoLpK2JYKNfqy11+kh1FxFsMAduv5ul2kH5jaLum1rK6oN9+wYdAWBaVR68L2atvc9VkJBvbS4E+/tHP6btwy9J+ESfgYanG2WCNMGqa8WpF2zlwDXm7BEgTgKk5WzgZQU6sI7JQ62M4zgw8dW/z0WeKIVFtbBEHO9E2COP70gV/3ixdYitsYoNTrUWO8TJ1hNvt4xNRrzYzaBqib8KFFOKUfwzbxpbsGq4LcDiUKmB8R/WK9BNpx10z9iIyFKq/Gsz0IGNEPlA1Dyry4AmK7vdToZivOaJw+xMkSJcl7MjDaLuy53lmz2uEQawDTxiqii7tewzNNafV/rPawb2fVJ4ccZajIsUgiFf8mKUjutzO3xDslJgxx7ht+Epf7hfZOGMawasTL/JJHozQ+f90SvhT8Wf2cyjyfaKiwIUeN6SfJVAU/5aW/RhljEwuWG+SfUhitvB46KPvmwcyADv/7xau46YZnyEXOIGmbfOuxZxqXoyCeQ6QvFQ5bTl0F6vOd3OtyTU64saHBEFSr+rP+OIdeJ1TB5SSCRf8zSaEqq922MrLf0zETNStjH8F2eF7XPNMUp5QKe587Ue2LNQrd+cUc6NcDDU8m4Rxjz+MSaYYv8b9gjQytr0C6Gl9eAX5oligxQ3kR/w9P9khcz7TZDoIs4M="
55 changes: 55 additions & 0 deletions .travis/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash
# expects variables to be set:
# - OSSRH_USERNAME
# - OSSRH_PASSWORD
# - GPG_KEY_NAME
# - GPG_PASSPHRASE
# expects file to exist:
# - .travis/gpg.asc

set -e

# Check the variables are set
if [ -z "$OSSRH_USERNAME" ]; then
echo "[Deployment] ERROR - Missing environment value: OSSRH_USERNAME" >&2
exit 1
fi

if [ -z "$OSSRH_PASSWORD" ]; then
echo "[Deployment] ERROR - Missing environment value: OSSRH_PASSWORD" >&2
exit 1
fi

if [ -z "$GPG_KEY_NAME" ]; then
echo "[Deployment] ERROR - Missing environment value: GPG_KEY_NAME" >&2
exit 1
fi

if [ -z "$GPG_PASSPHRASE" ]; then
echo "[Deployment] ERROR - Missing environment value: GPG_PASSPHRASE" >&2
exit 1
fi

echo "[Deployment] INFO - All expected variables are set. OSSRH_USERNAME, OSSRH_PASSWORD, GPG_KEY_NAME and GPG_PASSPHRASE"

# If decrypted file .travis/gpg.asc not exists
if [ ! -f "${TRAVIS_BUILD_DIR}/.travis/gpg.asc" ]; then
echo "[Deployment] ERROR - Missing decrypted file: .travis/gpg.asc" >&2
exit 1
else
echo "[Deployment] INFO - Found decrypted file: .travis/gpg.asc"
fi

# Prepare the local keyring (requires travis to have decrypted the file beforehand)
gpg --fast-import .travis/gpg.asc

# If `TRAVIS_TAG` string is not empty
if [ -n "$TRAVIS_TAG" ]; then
echo "[Deployment] INFO - Maven deploy on a tag -> set pom.xml <version> to TRAVIS_TAG: $TRAVIS_TAG"
mvn --settings "${TRAVIS_BUILD_DIR}/.travis/maven-settings.xml" org.codehaus.mojo:versions-maven-plugin:2.7:set -DnewVersion=$TRAVIS_TAG 1>/dev/null 2>/dev/null
else
echo "[Deployment] INFO - Maven deploy not on a tag -> keep snapshot version in pom.xml"
fi

# Run the maven deploy steps
mvn deploy -P publish -DskipTests=true --quiet --settings "${TRAVIS_BUILD_DIR}/.travis/maven-settings.xml"
Binary file added .travis/gpg.asc.enc
Binary file not shown.
4 changes: 4 additions & 0 deletions .travis/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# Run the maven install
./mvnw clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet --batch-mode --show-version
26 changes: 26 additions & 0 deletions .travis/maven-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>ossrh</id>
<username>${env.OSSRH_USERNAME}</username>
<password>${env.OSSRH_PASSWORD}</password>
</server>
</servers>

<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.keyname>${env.GPG_KEY_NAME}</gpg.keyname>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# [1.2.0](https://github.com/johnnymillergh/media-streaming/compare/v1.1.1...1.2.0) (2020-10-22)


### Build System

* **POM:** update POM (except groupId and package) for sonatype ([4c40ad9](https://github.com/johnnymillergh/media-streaming/commit/4c40ad96c7a51acd6c9f317f9c33847aabf62410))
* **Project:** change `groupId` and package name ([cbb793d](https://github.com/johnnymillergh/media-streaming/commit/cbb793dc81281745c06b73a7e7e7cdcea388e7b7))
* **Travis:** update Travis CI process ([fde74b4](https://github.com/johnnymillergh/media-streaming/commit/fde74b476593747db879b4db2e3ea545458a6f69))


### Performance Improvements

* **media-streaming:** release resources when shutdown ([44a54cc](https://github.com/johnnymillergh/media-streaming/commit/44a54cc4cd5b3f859c7cfb451ddf9db3a87dffca))
* **sample-app:** enable graceful shutdown ([58f423c](https://github.com/johnnymillergh/media-streaming/commit/58f423c5aa414dc87a965ad7fe6934a17c02cf60))


### BREAKING CHANGES

* **Travis:** deploy artifact based on Travis CI
* **Project:** change `groupId` and package name
* **POM:** update POM (except groupId and package) for sonatype



## 1.1.1 (2020-10-20)

* fix(README): correct README.md ([4d568b0](https://github.com/johnnymillergh/media-streaming/commit/4d568b0))
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<div style="position: relative; text-align: center;">
<img src="https://raw.githubusercontent.com/johnnymillergh/MaterialLibrary/master/data-structures-and-algorithms/data-structures-and-algorithms-social-image.png" alt="Media Streaming Social Image"/>
<div style="position: absolute; top: 34%; left: 34%; transform: translate(-50%, -50%); color: rgb(7, 156, 58); font-size: 60px; font-weight: bolder;">
<img src="https://raw.githubusercontent.com/johnnymillergh/MaterialLibrary/master/media-streaming/media-streaming-social-image.png" alt="Media Streaming Social Image"/>
<!--<div style="position: absolute; top: 34%; left: 34%; transform: translate(-50%, -50%); color: rgb(7, 156, 58); font-size: 60px; font-weight: bolder;">
Media Streaming<br>
Spring Boot Starter
</div>
</div>-->
</div>

[![GitHub release](https://img.shields.io/github/release/johnnymillergh/media-streaming.svg)](https://github.com/johnnymillergh/media-streaming/releases)
[![Build Status](https://travis-ci.com/johnnymillergh/media-streaming.svg?branch=master)](https://travis-ci.com/johnnymillergh/media-streaming)
[![Maven Package](https://github.com/johnnymillergh/media-streaming/workflows/Maven%20Package/badge.svg?branch=master)](https://github.com/johnnymillergh?tab=packages&repo_name=media-streaming)
[![Media Streaming](https://maven-badges.herokuapp.com/maven-central/com.github.johnnymillergh.boot/media-streaming-spring-boot-starter/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.johnnymillergh.boot/media-streaming-spring-boot-starter/)
[![GitHub issues](https://img.shields.io/github/issues/johnnymillergh/media-streaming)](https://github.com/johnnymillergh/media-streaming/issues)
[![GitHub forks](https://img.shields.io/github/forks/johnnymillergh/media-streaming)](https://github.com/johnnymillergh/media-streaming/network)
[![GitHub stars](https://img.shields.io/github/stars/johnnymillergh/media-streaming)](https://github.com/johnnymillergh/media-streaming)
Expand All @@ -35,13 +35,13 @@ Here is the highlights of **Media Streaming**:

## Installation

The easiest way is to install the library via its [Maven package](http://search.maven.org/#search|gav|1|g%3A"com.drewnoakes" AND a%3A"metadata-extractor").
The easiest way is to install the library via [Nexus Repository Manager](https://oss.sonatype.org/#nexus-search;gav~com.github.johnnymillergh.boot~media-streaming-spring-boot-starter~~~).

```xml
<dependency>
<groupId>com.jmframework.boot</groupId>
<groupId>com.github.johnnymillergh.boot</groupId>
<artifactId>media-streaming-spring-boot-starter</artifactId>
<version>1.0.1</version>
<version>1.2.0-SNAPSHOT</version>
</dependency>
```

Expand Down
7 changes: 3 additions & 4 deletions media-streaming-sample-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.jmframework.boot</groupId>
<groupId>com.github.johnnymillergh.boot</groupId>
<artifactId>media-streaming</artifactId>
<version>1.1.1</version>
<version>1.2.0</version>
</parent>
<groupId>com.jmsoftware.boot</groupId>
<artifactId>media-streaming-sample-app</artifactId>
<name>Media Streaming :: Sample App</name>
<description>Media Streaming :: Sample App</description>
Expand All @@ -20,7 +19,7 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>-->
<dependency>
<groupId>com.jmframework.boot</groupId>
<groupId>com.github.johnnymillergh.boot</groupId>
<artifactId>media-streaming-spring-boot-starter</artifactId>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.jmsoftware.boot.mediastreamingsampleapp;
package com.github.johnnymillergh.boot.mediastreamingsampleapp;

import lombok.extern.slf4j.Slf4j;
import lombok.val;
Expand Down
7 changes: 5 additions & 2 deletions media-streaming-sample-app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
media-streaming:
video-directory-on-file-system: 'C:\\Users\\Johnny\\Videos\\Mine'
video-directory-on-file-system: '/Users/johnny/Movies/Mine'

# Configure logging level of Media Streaming
logging:
level:
com.jmframework.boot.mediastreamingspringbootautoconfigure: DEBUG
com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure: DEBUG

server:
shutdown: graceful
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.jmsoftware.boot.mediastreamingsampleapp;
package com.github.johnnymillergh.boot.mediastreamingsampleapp;

import com.jmframework.boot.mediastreamingspringbootautoconfigure.model.Video;
import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.model.Video;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
4 changes: 2 additions & 2 deletions media-streaming-spring-boot-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.jmframework.boot</groupId>
<groupId>com.github.johnnymillergh.boot</groupId>
<artifactId>media-streaming</artifactId>
<version>1.1.1</version>
<version>1.2.0</version>
</parent>
<artifactId>media-streaming-spring-boot-autoconfigure</artifactId>
<name>Media Streaming :: Spring Boot Autoconfigure</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.jmframework.boot.mediastreamingspringbootautoconfigure.configuration;
package com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.configuration;

import com.jmframework.boot.mediastreamingspringbootautoconfigure.handler.MediaStreamingExceptionHandler;
import com.jmframework.boot.mediastreamingspringbootautoconfigure.handler.VideoRouteHandler;
import com.jmframework.boot.mediastreamingspringbootautoconfigure.repository.VideoRepository;
import com.jmframework.boot.mediastreamingspringbootautoconfigure.repository.impl.InMemoryVideoOnFileSystemRepository;
import com.jmframework.boot.mediastreamingspringbootautoconfigure.services.FileService;
import com.jmframework.boot.mediastreamingspringbootautoconfigure.services.VideoService;
import com.jmframework.boot.mediastreamingspringbootautoconfigure.services.impl.FileServiceImpl;
import com.jmframework.boot.mediastreamingspringbootautoconfigure.services.impl.VideoServiceImpl;
import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.handler.MediaStreamingExceptionHandler;
import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.handler.VideoRouteHandler;
import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.repository.VideoRepository;
import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.repository.impl.InMemoryVideoOnFileSystemRepository;
import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.services.FileService;
import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.services.VideoService;
import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.services.impl.FileServiceImpl;
import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.services.impl.VideoServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package com.jmframework.boot.mediastreamingspringbootautoconfigure.configuration;
package com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.configuration;

import com.jmframework.boot.mediastreamingspringbootautoconfigure.filewatch.FileWatcher;
import com.jmframework.boot.mediastreamingspringbootautoconfigure.filewatch.FileWatcherHandler;
import com.jmframework.boot.mediastreamingspringbootautoconfigure.model.Video;
import com.jmframework.boot.mediastreamingspringbootautoconfigure.repository.VideoRepository;
import com.jmframework.boot.mediastreamingspringbootautoconfigure.services.FileService;
import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.filewatch.FileWatcher;
import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.filewatch.FileWatcherHandler;
import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.model.Video;
import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.repository.VideoRepository;
import com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.services.FileService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import reactor.core.publisher.Mono;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.nio.file.Path;

/**
Expand All @@ -24,12 +25,12 @@ public class MediaStreamingBootstrap implements CommandLineRunner {
private final VideoRepository videoRepository;
private final FileService fileService;
private final MediaStreamingProperties mediaStreamingProperties;
private FileWatcher fileWatcher;

@PostConstruct
private void postConstruct() {
log.debug("MediaStreamingBootstrap initialization is done. Start to process videos.");
log.debug("Starting FileWatcher...");
FileWatcher fileWatcher;
try {
fileWatcher = new FileWatcher(mediaStreamingProperties.getVideoDirectoryOnFileSystem());
} catch (Exception e) {
Expand Down Expand Up @@ -80,4 +81,10 @@ public void run(String... args) {
.doOnNext(video -> log.debug("Registered video: " + video.getName()))
.subscribe();
}

@PreDestroy
private void preDestroy() {
log.debug("Destroying {}, fileWatcher: {}", this.getClass().getSimpleName(), fileWatcher);
fileWatcher.destroy();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.jmframework.boot.mediastreamingspringbootautoconfigure.configuration;
package com.github.johnnymillergh.boot.mediastreamingspringbootautoconfigure.configuration;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
Expand Down
Loading

0 comments on commit fb74b7e

Please sign in to comment.