diff --git a/doc/masterindex.html b/doc/masterindex.html index 7f5faef..61fa4e2 100644 --- a/doc/masterindex.html +++ b/doc/masterindex.html @@ -40,7 +40,7 @@

A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9

diff --git a/doc/robo_files.html b/doc/robo_files.html index d774566..199d9de 100644 --- a/doc/robo_files.html +++ b/doc/robo_files.html @@ -32,7 +32,7 @@

A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9

diff --git a/doc/robo_functions.html b/doc/robo_functions.html index 1f41a99..feb1036 100644 --- a/doc/robo_functions.html +++ b/doc/robo_functions.html @@ -35,7 +35,7 @@

A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9

diff --git a/doc/robo_sourcefiles.html b/doc/robo_sourcefiles.html index 274bd9e..90d2a3f 100644 --- a/doc/robo_sourcefiles.html +++ b/doc/robo_sourcefiles.html @@ -37,7 +37,7 @@ streamsaver diff --git a/doc/robo_variables.html b/doc/robo_variables.html index f83fdfc..2ef64ab 100644 --- a/doc/robo_variables.html +++ b/doc/robo_variables.html @@ -33,7 +33,7 @@

A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9

diff --git a/doc/streamsaver.html b/doc/streamsaver.html index 099f088..5a90837 100644 --- a/doc/streamsaver.html +++ b/doc/streamsaver.html @@ -186,70 +186,97 @@ -segment_format "$FORMAT" \ -strftime 1 "$SLICES_DIR/$FILE_NAME" +

+ Пример иерархии файлового хранилища: +

+
        FILES
+        ├── archive
+        │   ├── TK04
+        │   │   └── CH4098
+        │   │       └── 2016-07-12_13:41:47-TK#4-4098.mp2
+        │   ├── TK05
+        │   │   └── CH4098
+        │   │       └── 2016-07-12_13:41:45-TK#5-4098.mp2
+        │   └── TK06
+        │       └── CH53
+        │           └── 2016-07-12_13:41:49-TK#6-53.mp2
+        └── fragments
+            ├── TK04
+            │   └── CH4098
+            │       ├── 2016-07-12_13:41:47-TK#4-4098.mp2
+            │       └── 2016-07-12_13:41:50-TK#4-4098.mp2
+            ├── TK05
+            │   └── CH4098
+            │       ├── 2016-07-12_13:41:45-TK#5-4098.mp2
+            │       └── 2016-07-12_13:41:50-TK#5-4098.mp2
+            └── TK06
+                └── CH53
+                    └── 2016-07-12_13:41:49-TK#6-53.mp2
+

RESULT

    Команда ffmpeg, которую можно передать на выполнение.
 

SOURCE

-
148 makeCMD() {
-149         #Правило именования файлов
-150         FILE_NAME="${config[filename_prefix]}-${config[channel_name]}.${config[filename_suffix]}"
-151 
-152         #Минимальная команда
-153         CMD="${config[cmd]} -i ${config[stream]} -f ${config[output_format]}"
-154 
-155         #КОДИРОВАНИЕ
-156         # enableOption output_format -c %%
-157 
-158         #ICECAST
-159         enableOption input_channel -map %%
-160         enableOption channel_name \
-161                 -legacy_icecast 1 \
-162                 -content_type audio/mpeg \
-163                 -ice_name %%
-164 
-165         enableOption channel_descr \
-166                 -ice_description %%
-167 
-168         enableOption icecast \
-169                 icecast://source:${config[password]}@${config[icecast]}/${config[mountpoint]}
-170 
-171         # АРХИВ
-172         enableOption input_channel -map %%
-173         enableOption archive_log \
-174                 -segment_list %% \
-175                 -segment_list_entry_prefix "${config[archive_dir]}" \
-176                 -segment_list_type csv \
-177                 -segment_list_flags live
-178 
-179         # +СЕГМЕНТИРОВАНИЕ
-180         enableOption archive_dir \
-181                 -segment_atclocktime 1 \
-182                 -acodec "${config[output_format]}" \
-183                 -fi segment \
-184                 -segment_time   "${config[archive_time]}" \
-185                 -segment_format "${config[output_format]}" \
-186                 -strftime 1     "${config[archive_dir]}/$FILE_NAME"
-187 
-188         # АНАЛИЗ
-189         enableOption input_channel -map %%
-190         enableOption slices_log \
-191                 -segment_list %% \
-192                 -segment_list_entry_prefix "${config[slices_dir]}" \
-193                 -segment_list_type csv \
-194                 -segment_list_flags live
+
173 makeCMD() {
+174         #Правило именования файлов
+175         FILE_NAME="${config[filename_prefix]}-${config[channel_name]}-${config[channel_number]}.${config[filename_suffix]}"
+176 
+177         #Минимальная команда
+178         CMD="${config[cmd]} -i ${config[stream]} -f ${config[output_format]}"
+179 
+180         #КОДИРОВАНИЕ
+181         # enableOption output_format -c %%
+182 
+183         #ICECAST
+184         enableOption input_channel -map 0:%%
+185         enableOption channel_name \
+186                 -legacy_icecast 1 \
+187                 -content_type audio/mpeg \
+188                 -ice_name %%
+189 
+190         enableOption channel_descr \
+191                 -ice_description %%
+192 
+193         enableOption icecast \
+194                 icecast://source:${config[password]}@${config[icecast]}/${config[mountpoint]}
 195 
-196         # +СЕГМЕНТИРОВАНИЕ
-197         enableOption slices_dir \
-198                 -segment_atclocktime 1 \
-199                 -acodec "${config[output_format]}" \
-200                 -fi segment \
-201                 -segment_time   "${config[slices_time]}" \
-202                 -segment_format "${config[output_format]}" \
-203                 -strftime 1     "${config[slices_dir]}/$FILE_NAME"
-204 
-205         echo "$CMD"
-206 }
+196         # АРХИВ
+197         enableOption input_channel -map 0:%%
+198         enableOption archive_log \
+199                 -segment_list %% \
+200                 -segment_list_entry_prefix "${config[archive_dir]}" \
+201                 -segment_list_type csv \
+202                 -segment_list_flags live
+203 
+204         # +СЕГМЕНТИРОВАНИЕ
+205         enableOption archive_dir \
+206                 -segment_atclocktime 1 \
+207                 -acodec "${config[output_format]}" \
+208                 -fi segment \
+209                 -segment_time   "${config[archive_time]}" \
+210                 -segment_format "${config[output_format]}" \
+211                 -strftime 1     "${config[archive_dir]}/$FILE_NAME"
+212 
+213         # АНАЛИЗ
+214         enableOption input_channel -map 0:%%
+215         enableOption slices_log \
+216                 -segment_list %% \
+217                 -segment_list_entry_prefix "${config[slices_dir]}" \
+218                 -segment_list_type csv \
+219                 -segment_list_flags live
+220 
+221         # +СЕГМЕНТИРОВАНИЕ
+222         enableOption slices_dir \
+223                 -segment_atclocktime 1 \
+224                 -acodec "${config[output_format]}" \
+225                 -fi segment \
+226                 -segment_time   "${config[slices_time]}" \
+227                 -segment_format "${config[output_format]}" \
+228                 -strftime 1     "${config[slices_dir]}/$FILE_NAME"
+229 
+230         echo "$CMD"
+231 }
 

@@ -265,29 +292,30 @@
    enableOption, readOption, readXML, makeCMD
 

SOURCE

-
222 typeset -A config
-223 
-224 config=(
-225         [stream]=""
-226         [icecast]="http://localhost:8000/"
-227         [password]="hackme"
-228         [channel_name]=""
-229         [channel_descr]=""
-230         [mountpoint]=""
-231         [cmd]="ffmpeg"
-232         [input_format]="mpegts"
-233         [input_channel]="0"
-234         [archive_dir]=""
-235         [archive_time]="3600"
-236         [archive_log]="/var/log/tuc01_archive.log"
-237         [slices_dir]=""
-238         [slices_time]=10
-239         [slices_log]="/var/log/tuc01_slices.log"
-240         [filename_prefix]="%Y-%m-%d_%H:%M:%S"
-241         [filename_suffix]="mp2"
-242         [output_format]="mp2"
-243         [audio_bitrate]="256k"
-244 )
+
247 typeset -A config
+248 
+249 config=(
+250         [stream]=""
+251         [icecast]="http://localhost:8000/"
+252         [password]="hackme"
+253         [channel_name]=""
+254         [channel_number]=""
+255         [channel_descr]=""
+256         [mountpoint]=""
+257         [cmd]="ffmpeg"
+258         [input_format]="mpegts"
+259         [input_channel]="0"
+260         [archive_dir]=""
+261         [archive_time]="3600"
+262         [archive_log]="/var/log/tuc01_archive.log"
+263         [slices_dir]=""
+264         [slices_time]=10
+265         [slices_log]="/var/log/tuc01_slices.log"
+266         [filename_prefix]="%Y-%m-%d_%H:%M:%S"
+267         [filename_suffix]="mp2"
+268         [output_format]="mp2"
+269         [audio_bitrate]="256k"
+270 )
 

@@ -322,6 +350,8 @@ <password>hackme</password> <!-- Точка подключения канала --> <mountpoint>tuc02</mountpoint> + <!-- Программа/канал из потока --> + <input_channel>0:p:4098</input_channel>

@@ -368,7 +398,7 @@

SOURCE

-
308 SETTINGS="$1"
+
336 SETTINGS="$1"
 

@@ -380,30 +410,30 @@
    streamsaver
 

SOURCE

-
319 #Проверка на наличие файла настроек
-320 if [ -z "$SETTINGS" ]; then
-321         echo "USAGE: $(basename $0) <settings.xml>" >&2
-322         exit 1
-323 elif [ ! -r "$SETTINGS" ]; then
-324         echo "Unable open file $1." >&2
-325         echo "USAGE: $(basename $0) <settings.xml>" >&2
-326         exit 1
-327 fi
-328 
-329 #Чтение настроек
-330 readXML "$SETTINGS"
-331 
-332 #Создание директорий хранения файлов, если требуется
-333 mkdir -p ${config[archive_dir]}
-334 mkdir -p ${config[slices_dir]}
-335 
-336 #Создание команды оцифровки сигнала
-337 makeCMD
+
347 #Проверка на наличие файла настроек
+348 if [ -z "$SETTINGS" ]; then
+349         echo "USAGE: $(basename $0) <settings.xml>" >&2
+350         exit 1
+351 elif [ ! -r "$SETTINGS" ]; then
+352         echo "Unable open file $1." >&2
+353         echo "USAGE: $(basename $0) <settings.xml>" >&2
+354         exit 1
+355 fi
+356 
+357 #Чтение настроек
+358 readXML "$SETTINGS"
+359 
+360 #Создание директорий хранения файлов, если требуется
+361 mkdir -p ${config[archive_dir]}
+362 mkdir -p ${config[slices_dir]}
+363 
+364 #Создание команды оцифровки сигнала
+365 makeCMD
 
diff --git a/doc/tobo_toplevel.html b/doc/tobo_toplevel.html index 6f2df95..51e59bb 100644 --- a/doc/tobo_toplevel.html +++ b/doc/tobo_toplevel.html @@ -32,7 +32,7 @@

A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9

diff --git a/doc/toc_index.html b/doc/toc_index.html index 526eb2c..30a8bd5 100644 --- a/doc/toc_index.html +++ b/doc/toc_index.html @@ -41,7 +41,7 @@ diff --git a/streamsaver b/streamsaver index d625ccf..fde049b 100755 --- a/streamsaver +++ b/streamsaver @@ -140,6 +140,31 @@ readXML() { # -segment_format "$FORMAT" \ # -strftime 1 "$SLICES_DIR/$FILE_NAME" # +# Пример иерархии файлового хранилища: +# FILES +# ├── archive +# │   ├── TK04 +# │   │   └── CH4098 +# │   │   └── 2016-07-12_13:41:47-TK#4-4098.mp2 +# │   ├── TK05 +# │   │   └── CH4098 +# │   │   └── 2016-07-12_13:41:45-TK#5-4098.mp2 +# │   └── TK06 +# │   └── CH53 +# │   └── 2016-07-12_13:41:49-TK#6-53.mp2 +# └── fragments +#    ├── TK04 +#    │   └── CH4098 +#    │   ├── 2016-07-12_13:41:47-TK#4-4098.mp2 +#    │   └── 2016-07-12_13:41:50-TK#4-4098.mp2 +#    ├── TK05 +#    │   └── CH4098 +#    │   ├── 2016-07-12_13:41:45-TK#5-4098.mp2 +#    │   └── 2016-07-12_13:41:50-TK#5-4098.mp2 +#    └── TK06 +#    └── CH53 +#    └── 2016-07-12_13:41:49-TK#6-53.mp2 +# # RESULT # Команда ffmpeg, которую можно передать на выполнение. #