1215 % 2 == 1 : Syntax error in expression (wrong symbol is " 1215 % 2 == 1 ")
Maloupi opened this issue · 0 comments
Maloupi commented
On some books, i got this error :
((: 0
1215 % 2 == 1 : Syntax error in expression (wrong symbol is " 1215 % 2 == 1 ")
This is because ffprobe find an error in the cover file :
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
[mjpeg @ 0x55ed7ccd3600] EOI missing, emulating
Input #0, image2, from '/home/nausicaa/mp3/Richard Bach - Jonathan Livingston le Goéland/cover.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 31782 kb/s
Stream #0:0: Video: mjpeg (Progressive), yuvj420p(pc, bt470bg/unknown/unknown), 1215x1215 [SAR 1:1 DAR 1:1], 25 fps, 25 tbr, 25 tbn
so the regex to get the width :
ffprobe -i "/home/nausicaa/mp3/Richard Bach - Jonathan Livingston le Goéland/cover.jpg" 2>&1 | $GREP -Po "[0-9]+(?=x[0-9]+)")
give this result :
0
1215
Grep think the error code is a width.
To fix this, just say width should be at least 2 numbers :
cover_width=$(ffprobe -i "${cover_file}" 2>&1 | $GREP -Po "[0-9]{2,}+(?=x[0-9]{2,}+)")