File tree 2 files changed +6
-11
lines changed
2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -3,3 +3,4 @@ writeShellApplication {
3
3
name = "srtcpy" ;
4
4
text = builtins . readFile ./srtcpy.sh ;
5
5
}
6
+ # see https://hackage.haskell.org/package/subtitleParser
Original file line number Diff line number Diff line change @@ -5,25 +5,19 @@ if [ -z "$1" ]; then
5
5
fi
6
6
7
7
filename=" $1 "
8
+ srt_filename=" ${filename% .* } .srt" # Remove extension (if any) and append .srt
8
9
9
- # Check if the file has a .srt extension
10
- if [[ " $filename " != * .srt ]]; then
11
- echo " Error: File '$filename ' is not a .srt file."
12
- exit 1
13
- fi
14
-
15
- # Check if the file exists
16
- if [ ! -f " $filename " ]; then
17
- echo " Error: File '$filename ' not found."
10
+ # Check if the .srt file exists
11
+ if [ ! -f " $srt_filename " ]; then
12
+ echo " Error: File '$srt_filename ' not found."
18
13
exit 1
19
14
fi
20
15
21
16
instructions=" Instructions: Summarize the following article."
22
17
start_tag=" [START ARTICLE]"
23
18
end_tag=" [END ARTICLE]"
24
19
25
-
26
- output=$( tr -d ' \r' < " $filename " | \
20
+ output=$( tr -d ' \r' < " $srt_filename " | \
27
21
sed -e ' /^[[:space:]]*$/d' -e ' /^[0-9]/d' | \
28
22
uniq)
29
23
You can’t perform that action at this time.
0 commit comments