Closed eeyoredk2 closed 2 years ago
Hi Bazarr has updated their API, so that is why your script is no longer blacklisting failed syncs https://github.com/morpheus65535/bazarr/blob/254304490cd5c0b68687319b28b123089c052752/bazarr/api.py#L1504
Hello, Thanks, I didn't knew somebody used it besides myself. Looks like it is now checking for auth. Can you check if it's working if you temporarily set authentication to none in bazarr? I can't test it myself because I have modified 0.9.3 version.
Hi It is already off. According to the developer of Bazarr, they have reworked their API, and that is why it is not working.
I will try to update it when v0.9.4 stable is released, until then i think they are still working on the API and can change things up again (ex. https://github.com/morpheus65535/bazarr/commit/26dc35556e3ac14c4702b9d0e413d2125475d762).
That would be much appreciated :) I can get the API to return data, but have no idea on how to get POST working.
I found this awesome script and started playing with it. I might fork it with some changes I made, but I found with Bazarr 1.0.2 you have to pass some things on the query string and some in the payload. I think the api key can still be part of the payload but I like to put it in the headers.
Something like this: Note: This has been tweaked for my version of the script, so it is probably not a 100% drop in, but it should be 98%
# SubSync Failed
if series_id == '':
# This is a movie
url = f'/api/movies/blacklist?radarrid={episode_id}'
else:
# This is an episode
url = f'/api/episodes/blacklist?seriesid={series_id}&episodeid={episode_id}'
try:
url = bazarr_url + url
headers = {
'X-API-KEY': api_key
}
# At some point, it looks like the code might want
# forced, hi flags?
payload = {
'provider': provider,
'subs_id': subtitle_id,
'language': sub_code2,
'subtitles_path': sub_file
}
requests.request('POST', url, data=payload, headers=headers, timeout=10)
except requests.exceptions.ReadTimeout:
pass
Thanks @randellhodges, I was able to make it work like this:
# SubSync Failed
if series_id == '':
# This is a movie
url = bazarr_url + f'/api/movies/blacklist?radarrid={episode_id}'
headers = {
'X-API-KEY': apikey
}
payload = {
'provider': provider,
'subs_id': subtitle_id,
'language': sub_code2,
'subtitles_path': sub_file
}
else:
# This is an episode
url = bazarr_url + f'/api/episodes/blacklist?seriesid={series_id}&episodeid={episode_id}'
headers = {
'X-API-KEY': apikey
}
payload = {
'provider': provider,
'subs_id': subtitle_id,
'language': sub_code2,
'subtitles_path': sub_file
}
try:
requests.request('POST', url, data=payload, headers=headers, timeout=10)
except requests.exceptions.ReadTimeout:
pass
But I have another "issue" now. Bazarr log now contains the entire log from SubSync and not just the last line. Have you experienced this?
Hi, sorry for the delay. I updated my script, thanks for your input. The log problem should be fixed too, and I added some tweaks for files with multiple audio tracks (hopefully).
Hi
First of all, thanks for your work on this. It works so much better that the sync feature build into Bazarr.
On the latest beta versions of v0.9.4, failed syncs are no longer blacklisted. Perhaps it is due to changes to API or similar. Unfortunately I don't have the skills to fix it. I hope you can help with this, I will be much appreciated :)
Update: The failed sync does get noted in the Bazarr log: BAZARR Post-processing result for file XXXXXX.mkv : Sync failed - wrong subs. Lang: en, Provider: supersubtitles, Sub id: XXXXXX
From SubSyncStarter.log: 2021-03-28 08:35:28,464 - DEBUG: Output: [-] couldn't synchronize! 2021-03-28 08:35:28,464 - DEBUG: Output: 2021-03-28 08:35:28,464 - DEBUG: Error: None 2021-03-28 08:35:28,464 - DEBUG: Exit code: 2 2021-03-28 08:35:28,582 - DEBUG: Starting new HTTP connection (1): XXX.XXX.XXX.XXX:6767 2021-03-28 08:35:28,586 - DEBUG: http://XXX.XXX.XXX.XXX:6767 "POST /api/blacklist_episode_subtitles_add HTTP/1.1" 405 178 2021-03-28 08:35:28,586 - WARNING: Sync failed - wrong subs. Lang: en, Provider: supersubtitles, Sub id: XXXXXX