@@ -20,8 +20,8 @@ fn run_command(command: &str) {
20
20
println ! ( "{}" , result) ;
21
21
}
22
22
23
- pub fn create_preview_gif ( input : & str , output : & str ) {
24
- let path = format ! ( "{}/gif " , output) ;
23
+ pub fn create_preview_gif ( input : & str , subpath : & str , output : & str ) {
24
+ let path = format ! ( "{}/{} " , output, subpath ) ;
25
25
if fs:: metadata ( & path) . is_err ( ) {
26
26
fs:: create_dir_all ( & path) . unwrap ( ) ;
27
27
}
@@ -33,8 +33,8 @@ pub fn create_preview_gif(input: &str, output: &str) {
33
33
run_command ( & command) ;
34
34
}
35
35
36
- pub fn create_preview_image ( input : & str , output : & str ) {
37
- let path = format ! ( "{}/lg " , output) ;
36
+ pub fn create_preview_image ( input : & str , subpath : & str , output : & str ) {
37
+ let path = format ! ( "{}/{} " , output, subpath ) ;
38
38
if fs:: metadata ( & path) . is_err ( ) {
39
39
fs:: create_dir_all ( & path) . unwrap ( ) ;
40
40
}
@@ -47,10 +47,10 @@ pub fn create_preview_image(input: &str, output: &str) {
47
47
run_command ( & command) ;
48
48
}
49
49
50
- pub fn create_thumbnails ( input : & str , output : & str ) {
50
+ pub fn create_thumbnails ( input : & str , subpath : & str , output : & str ) {
51
51
println ! ( "\n create_thumbnails" ) ;
52
52
53
- let thumbs_path = format ! ( "{}/thumbs " , output) ;
53
+ let thumbs_path = format ! ( "{}/{} " , output, subpath ) ;
54
54
55
55
println ! ( "Path: {}" , thumbs_path) ;
56
56
if fs:: metadata ( & thumbs_path) . is_err ( ) {
@@ -65,11 +65,13 @@ pub fn create_thumbnails(input: &str, output: &str) {
65
65
run_command ( & command) ;
66
66
}
67
67
68
- pub fn create_hls_encoding ( input : & str , output : & str ) {
68
+ pub fn create_hls_encoding ( input : & str , subpath : & str , output : & str ) {
69
69
println ! ( "\n pub create_hls_encoding" ) ;
70
70
71
- if fs:: metadata ( output) . is_err ( ) {
72
- fs:: create_dir_all ( output) . unwrap ( ) ;
71
+ let hls_path = format ! ( "{}/{}" , output, subpath) ;
72
+
73
+ if fs:: metadata ( & hls_path) . is_err ( ) {
74
+ fs:: create_dir_all ( & hls_path) . unwrap ( ) ;
73
75
}
74
76
75
77
// TODO: Sub add paths
@@ -91,7 +93,7 @@ pub fn create_hls_encoding(input: &str, output: &str) {
91
93
-window_size 0 -adaptation_sets \" id=0,streams=v id=1,streams=a\" -hls_playlist 1 -seg_duration 4 \
92
94
-streaming 0 -f dash \
93
95
-hls_segment_filename \
94
- -hls_playlist_type {}/vod \
95
- {}/720p_%03d.m3u8 {}/720p.m3u8", input, output , output , output ) ;
96
+ -hls_playlist_type {}/vod \
97
+ {}/720p_%03d.m3u8 {}/720p.m3u8", input, hls_path , hls_path , hls_path ) ;
96
98
run_command ( & command) ;
97
99
}
0 commit comments