pulsejets / srt-translator

srt/mkv translater with support for Nzbget
GNU General Public License v3.0
1 stars 1 forks source link

jq: invalid JSON text passed to --argjson #1

Open pitylee opened 5 months ago

pitylee commented 5 months ago

I think folder names with spaces or something will mess things up:

DEBUG : Command: mkvmerge -J "/mnt/user0/Media/Downloads/ash.downloader/Series/JU ON Origins/@Korean_Drama_English_JU_ON_Origins_S01E03_Episode_3_720p_NF_WEB.mkv" | jq -r --arg lang "eng" '.tracks[] | select(.type == "subtitles" and .properties.language == $lang and ((.properties.track_name // "") | test("SDH") | not)).id' jq: invalid JSON text passed to --argjson Use jq --help for help with command-line options, or see the jq manpage, or online docs at https://jqlang.github.io/jq /mnt/user0/Media/Downloads/ash.downloader/Series/JU ON Origins/@Korean_Drama_English_JU_ON_Origins_S01E03_Episode_3_720p_NF_WEB.mkv The codec ( )type is not suported yet. root@Tower:/mnt/ssd/projects/media#

pulsejets commented 5 months ago

Hi , can you paste the output off mkvmerge -J "/mnt/user0/Media/Downloads/ash.downloader/Series/JU ON Origins/@Korean_Drama_English_JU_ON_Origins_S01E03_Episode_3_720p_NF_WEB.mkv"

pitylee commented 5 months ago

Hi,

In the meantime I removed the spaces from paths to fix the issues.

clear && docker-compose run --rm srt bash -c "mkvmerge -J /mnt/user0/Media/Downloads/ash.downloader/Series/JU_ON_Origins/@Korean_Drama_English_JU_ON_Origins_S01E03_Episode_3_720p_NF_WEB.mkv"

gives: { "attachments": [], "chapters": [], "container": { "properties": { "container_type": 17, "date_local": "2020-07-03T15:25:23+00:00", "date_utc": "2020-07-03T15:25:23Z", "duration": 1742624000000, "is_providing_timestamps": true, "muxing_application": "libebml v1.3.6 + libmatroska v1.4.9", "segment_uid": "07e0f7c7b3ceca722e1c4ef7e5548992", "title": "Shadow (BonsaiHD.Fun)", "writing_application": "mkvmerge v31.0.0 ('Dolores In A Shoestand') 64-bit" }, "recognized": true, "supported": true, "type": "Matroska" }, "errors": [], "file_name": "/mnt/user0/Media/Downloads/ash.downloader/Series/JU_ON_Origins/@Korean_Drama_English_JU_ON_Origins_S01E03_Episode_3_720p_NF_WEB.mkv", "global_tags": [], "identification_format_version": 18, "track_tags": [], "tracks": [ { "codec": "AVC/H.264/MPEG-4p10", "id": 0, "properties": { "codec_id": "V_MPEG4/ISO/AVC", "codec_private_data": "0164001fffe100266764001facca5014016ec044000003000400000300c38980006acfc0003567e930c01e30632c01000568e93b2c8b", "codec_private_length": 54, "default_duration": 41666666, "default_track": true, "display_dimensions": "1280x720", "display_unit": 0, "enabled_track": true, "forced_track": false, "language": "und", "minimum_timestamp": 0, "num_index_entries": 302, "number": 1, "packetizer": "mpeg4_p10_video", "pixel_dimensions": "1280x720", "uid": 2272743688559705345 }, "type": "video" }, { "codec": "AC-3", "id": 1, "properties": { "audio_channels": 6, "audio_sampling_frequency": 48000, "codec_id": "A_AC3", "codec_private_length": 0, "default_duration": 32000000, "default_track": true, "enabled_track": true, "forced_track": false, "language": "eng", "minimum_timestamp": 0, "num_index_entries": 0, "number": 2, "track_name": "Shadow (BonsaiHD.Fun)", "uid": 5755486898011758823 }, "type": "audio" }, { "codec": "SubRip/SRT", "id": 2, "properties": { "codec_id": "S_TEXT/UTF8", "codec_private_length": 0, "default_track": false, "enabled_track": true, "encoding": "UTF-8", "forced_track": false, "language": "eng", "num_index_entries": 271, "number": 3, "text_subtitles": true, "track_name": "Shadow (BonsaiHD.Fun)", "uid": 13654370641859917658 }, "type": "subtitles" }, { "codec": "SubRip/SRT", "id": 3, "properties": { "codec_id": "S_TEXT/UTF8", "codec_private_length": 0, "default_track": true, "enabled_track": true, "encoding": "UTF-8", "forced_track": true, "language": "eng", "num_index_entries": 12, "number": 4, "text_subtitles": true, "track_name": "Shadow (BonsaiHD.Fun)", "uid": 3594226948390281161 }, "type": "subtitles" } ], "warnings": [] }

pitylee commented 5 months ago

What I've been seeing lately is:

Processing file: /mnt/user0/Media/Downloads/ash.downloader/Series/Lovestruck_in_the_City/Lovestruck_in_the_City_S01E12_1080p_NF_WEB_DL_ENG_KOR_DDP2_0_x264.mkv from /mnt/user0/Media/Downloads/ash.downloader/Series/Lovestruck_in_the_City
Executing command: /app/srt-translator/translater.sh -f "/mnt/user0/Media/Downloads/ash.downloader/Series/Lovestruck_in_the_City/Lovestruck_in_the_City_S01E12_1080p_NF_WEB_DL_ENG_KOR_DDP2_0_x264.mkv" -s en -t hu -F -o
rm: can't remove '/mnt/user0/Media/Downloads/ash.downloader/Series/Lovestruck_in_the_City/Lovestruck_in_the_City_S01E12_1080p_NF_WEB_DL_ENG_KOR_DDP2_0_x264.hu.forced.srt': No such file or directory
The MKV file contains SubRip/SRT subtitles.
Extracting track 2 with the CodecID 'S_TEXT/UTF8' to the file 'tmp/Lovestruck_in_the_City_S01E12_1080p_NF_WEB_DL_ENG_KOR_DDP2_0_x264.en.srt'. Container format: SRT text subtitles
Progress: 100%

[==                                                                              ] 2/71

[==                                                                              ] 2/66
[===                                                                             ] 2/53
adding /mnt/user0/Media/Downloads/ash.downloader/Series/Lovestruck_in_the_City/Lovestruck_in_the_City_S01E12_1080p_NF_WEB_DL_ENG_KOR_DDP2_0_x264.hu.forced.srt subtitle to /mnt/user0/Media/Downloads/ash.downloader/Series/Lovestruck_in_the_City/Lovestruck_in_the_City_S01E12_1080p_NF_WEB_DL_ENG_KOR_DDP2_0_x264.mkv
mkvmerge v81.0 ('Milliontown') 64-bit
Error: The type of file '/mnt/user0/Media/Downloads/ash.downloader/Series/Lovestruck_in_the_City/Lovestruck_in_the_City_S01E12_1080p_NF_WEB_DL_ENG_KOR_DDP2_0_x264.hu.forced.srt' could not be recognized.
mkvmerge failed with exit code 1

For some reason the type of srt could not be recognized.

I guess this is when it tries to insert the newly created srt into the mkv file.

pulsejets commented 5 months ago

does the srt file exsist : /mnt/user0/Media/Downloads/ash.downloader/Series/Lovestruck_in_the_City/Lovestruck_in_the_City_S01E12_1080p_NF_WEB_DL_ENG_KOR_DDP2_0_x264.hu.forced.srt' could not be recognized.

pitylee commented 5 months ago

Yes, right now it has been already created.

I run it with -o, but even if it doesn't exist, it won't attach it to the mkv.

I just removed every srt file in the folder:

Processing file:
***@***.***_Drama_English_Extracurricular_2020_S01E01_720p_WEB_Rip_x264.mkv
from /mnt/user0/Media/Downloads/ash.downloader/Series/Extracurricular
Executing command: /app/srt-translator/translater.sh -f
***@***.***_Drama_English_Extracurricular_2020_S01E01_720p_WEB_Rip_x264.mkv"
-s en -t hu -F -o
rm: can't remove
***@***.***_Drama_English_Extracurricular_2020_S01E01_720p_WEB_Rip_x264.hu.forced.srt':
No such file or directory
The MKV file contains SubRip/SRT subtitles.
Extracting track 2 with the CodecID 'S_TEXT/UTF8' to the file
***@***.***_Drama_English_Extracurricular_2020_S01E01_720p_WEB_Rip_x264.en.srt'.
Container format: SRT text subtitles
Progress: 100%

[==
     ] 2/64

[==
     ] 2/61
[==
     ] 2/59
[==
     ] 2/64

[==
     ] 2/64

adding
***@***.***_Drama_English_Extracurricular_2020_S01E01_720p_WEB_Rip_x264.hu.forced.srt
subtitle to
***@***.***_Drama_English_Extracurricular_2020_S01E01_720p_WEB_Rip_x264.mkv
mkvmerge v81.0 ('Milliontown') 64-bit
Error: The type of file
***@***.***_Drama_English_Extracurricular_2020_S01E01_720p_WEB_Rip_x264.hu.forced.srt'
could not be recognized.
mkvmerge failed with exit code 1
pulsejets commented 5 months ago

could you try to remove the @ from filename!

pitylee commented 5 months ago

Tried, and I shortened the file name:

Processing file: /media/Downloads/ash.downloader/Series/Girl.From.Nowhere.2018/Girl.From.Nowhere.2018.S01E07.720p.WEB.DL.mkv from /media/Downloads/ash.downloader/Series/Girl.From.Nowhere.2018
Executing command: /app/srt-translator/translater.sh -f "/media/Downloads/ash.downloader/Series/Girl.From.Nowhere.2018/Girl.From.Nowhere.2018.S01E07.720p.WEB.DL.mkv" -w "/media/Downloads/ash.downloader/Series/Girl.From.Nowhere.2018" -s en -t hu -F -o
rm: can't remove '/media/Downloads/ash.downloader/Series/Girl.From.Nowhere.2018/Girl.From.Nowhere.2018.S01E07.720p.WEB.DL.hu.forced.srt': No such file or directory
The MKV file contains SubRip/SRT subtitles.
Extracting track 3 with the CodecID 'S_TEXT/UTF8' to the file '/media/Downloads/ash.downloader/Series/Girl.From.Nowhere.2018/Girl.From.Nowhere.2018.S01E07.720p.WEB.DL.en.srt'. Container format: SRT text subtitles
Progress: 100%

[==                                                                              ] 2/63

adding /media/Downloads/ash.downloader/Series/Girl.From.Nowhere.2018/Girl.From.Nowhere.2018.S01E07.720p.WEB.DL.hu.forced.srt subtitle to /media/Downloads/ash.downloader/Series/Girl.From.Nowhere.2018/Girl.From.Nowhere.2018.S01E07.720p.WEB.DL.mkv
mkvmerge v81.0 ('Milliontown') 64-bit
Error: The type of file '/media/Downloads/ash.downloader/Series/Girl.From.Nowhere.2018/Girl.From.Nowhere.2018.S01E07.720p.WEB.DL.hu.forced.srt' could not be recognized.
mkvmerge failed with exit code 1

Similar to that:

cd /mnt/ssd/projects/media && docker-compose run --rm srt bash -c "mkvmerge -o "/media/Downloads/ash.downloader/Series/Extracurricular.2020/Extracurricular.2020.S01E02.720p.WEB.Rip.x264.mkv.tmp"  "/media/Downloads/ash.downloader/Series/Extracurricular.2020/Extracurricular.2020.S01E02.720p.WEB.Rip.x264.mkv" --language 0:"hun" "/media/Downloads/ash.downloader/Series/Extracurricular.2020/Extracurricular.2020.S01E02.720p.WEB.Rip.x264.hu.forced.srt""
mkvmerge v81.0 ('Milliontown') 64-bit
Error: The type of file '/media/Downloads/ash.downloader/Series/Extracurricular.2020/Extracurricular.2020.S01E02.720p.WEB.Rip.x264.hu.forced.srt' could not be recognized.

The error existed because the start of .srt files looked like:

2

�FF1
first text

I had to convert to unicode and add a new 0 timestamp when it looked like this, because of this mkvmerge wouldn't recognize the file:

2
00:00:01,000 --> 00:00:01,000

EZ FIKCI MŰ,

I created a pull request for this. #2