Skip to content

Commit

Permalink
Merge branch 'release/v1.0.0' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymillergh committed Oct 19, 2020
2 parents 8297f99 + a8e6d38 commit 3ebb771
Show file tree
Hide file tree
Showing 28 changed files with 1,101 additions and 31 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# (2020-10-19)


### Bug Fixes

* add a public class ([c04008e](https://github.com/johnnymillergh/media-streaming/commit/c04008e472f85db9b3e19ef357d5622518d61e6e))
* add method comments ([0da2555](https://github.com/johnnymillergh/media-streaming/commit/0da25556a5f2a15cd56a29d8bafd5f8f7b1fa5b6))
* delete unknown tag `date` ([8297f99](https://github.com/johnnymillergh/media-streaming/commit/8297f99461cb65d82107e3a292cce7daad466c24))
* **Travis:** add file permission before install ([70496a9](https://github.com/johnnymillergh/media-streaming/commit/70496a93d587fc7885809b9c556ca8225a098ae5))


### Build System

* **Project:** initial project ([6a1d485](https://github.com/johnnymillergh/media-streaming/commit/6a1d485af78e802e4ccc8a3c147fdcba72516be7))


### Features

* **Exception:** add class `MediaStreamingExceptionHandler` ([c682c3a](https://github.com/johnnymillergh/media-streaming/commit/c682c3a6bb8c613c12cb646a8b95129d2a197f28))
* **Exception:** add customized exception class ([4cc6667](https://github.com/johnnymillergh/media-streaming/commit/4cc6667c1424e52e94622177d60c974ea9efeda2))
* **media-streaming:** implement basic media streaming ability ([2ff9cd0](https://github.com/johnnymillergh/media-streaming/commit/2ff9cd0e00bb3c8d3fe8f104a0d6145d1d2fbfcf))
* **WebFlux:** integrate and configure WebFlux ([4b14363](https://github.com/johnnymillergh/media-streaming/commit/4b143635f395ec69b60675524b21b91c9284b6cd))


### BREAKING CHANGES

* **media-streaming:** implement basic media streaming ability
* **Project:** built the basic structure for
media-streaming-spring-boot-starter



10 changes: 5 additions & 5 deletions media-streaming-sample-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
<parent>
<groupId>com.jmframework.boot</groupId>
<artifactId>media-streaming</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.0.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>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-web</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>com.jmframework.boot</groupId>
<artifactId>media-streaming-spring-boot-starter</artifactId>
Expand Down

This file was deleted.

2 changes: 2 additions & 0 deletions media-streaming-sample-app/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
media-streaming:
video-directory-on-file-system: 'C:\\Users\\Johnny\\Videos\\Mine'
32 changes: 30 additions & 2 deletions media-streaming-spring-boot-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,45 @@
<parent>
<groupId>com.jmframework.boot</groupId>
<artifactId>media-streaming</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.0.0</version>
</parent>
<artifactId>media-streaming-spring-boot-autoconfigure</artifactId>
<name>Media Streaming :: Spring Boot Autoconfigure</name>
<description>Demo project for Spring Boot</description>
<description>Media Streaming :: Spring Boot Autoconfigure</description>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.drewnoakes</groupId>
<artifactId>metadata-extractor</artifactId>
<version>2.15.0</version>
</dependency>
</dependencies>
</project>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.jmframework.boot.mediastreamingspringbootautoconfigure.api;

import com.jmframework.boot.mediastreamingspringbootautoconfigure.handler.VideoRouteHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.function.server.RequestPredicate;
import org.springframework.web.reactive.function.server.RequestPredicates;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;

import static org.springframework.web.reactive.function.server.RequestPredicates.path;
import static org.springframework.web.reactive.function.server.RouterFunctions.route;

/**
* Description: VideoRoutes, change description here.
*
* @author Johnny Miller (锺俊), email: [email protected], date: 10/19/2020 4:38 PM
**/
@Configuration
public class VideoRoutes {
@Bean
RouterFunction<ServerResponse> videoEndPoint(VideoRouteHandler videoRouteHandler) {
return route()
.nest(path("/videos"), builder -> builder.GET("", videoRouteHandler::listVideos)
.nest(path("/{name}"), videoBuilder -> videoBuilder.GET("", param("partial"),
videoRouteHandler::getPartialContent).GET("", videoRouteHandler::getFullContent)
)
).build();
}

private static RequestPredicate param(String parameter) {
return RequestPredicates.all().and(request -> request.queryParam(parameter).isPresent());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.jmframework.boot.mediastreamingspringbootautoconfigure.configuration;

import com.jmframework.boot.mediastreamingspringbootautoconfigure.model.Video;
import com.jmframework.boot.mediastreamingspringbootautoconfigure.repository.VideoRepository;
import com.jmframework.boot.mediastreamingspringbootautoconfigure.services.FileService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
* Description: Bootstrap, change description here.
*
* @author 钟俊, email: [email protected], date: 10/19/2020 2:51 PM
**/
@Slf4j
@Component
@RequiredArgsConstructor
public class Bootstrap implements CommandLineRunner {
private final VideoRepository videoRepository;
private final FileService fileService;

@Override
public void run(String... args) {
fileService.getAllFiles()
.doOnNext(path -> log.debug("found file in path: " + path.toUri() + " FileName: " + path.getFileName()))
.flatMap(path -> {
Video video = new Video();
video.setName(path.getFileName().toString());
video.setLocation(path);
return videoRepository.addVideo(video);
})
.subscribe();

videoRepository.getAllVideos()
.doOnNext(video -> log.info("Registered video: " + video.getName()))
.subscribe();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.jmframework.boot.mediastreamingspringbootautoconfigure.configuration;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

/**
* Description: MediaStreamingAutoConfiguration, change description here.
*
* @author 钟俊, email: [email protected], date: 10/19/2020 2:51 PM
**/
@Slf4j
@Configuration
@RequiredArgsConstructor
@EnableConfigurationProperties(MediaStreamingProperties.class)
public class MediaStreamingAutoConfiguration {
private final MediaStreamingProperties mediaStreamingProperties;

@PostConstruct
public void afterInitialization() {
log.info("afterInitialization: {}", mediaStreamingProperties);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.jmframework.boot.mediastreamingspringbootautoconfigure.configuration;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
* Description: MediaStreamingProperties, change description here.
*
* @author Johnny Miller (锺俊), email: [email protected]
* date 10/19/2020 3:28 PM
**/
@Data
@ConfigurationProperties(prefix = MediaStreamingProperties.PREFIX)
public class MediaStreamingProperties {
public static final String PREFIX = "media-streaming";
/**
* Video directory on file system
*/
private String videoDirectoryOnFileSystem;
}
Loading

0 comments on commit 3ebb771

Please sign in to comment.