Closed tfabris closed 4 months ago
Checked:
I wonder if I need to quote-enclose or escape that key somehow?
NOTE: It's not the "-r" in the key, I tried it at the command line and even if I replaced the key with just numbers, it still failed, and got only the first four digits:
wget -qO- --load-cookies wgetcookies.txt --timeout=10 "http://localhost:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.YoutubeLive&method=Save&version=1&key=1234-1234-1234-1234-1234"
Fails, gets only the first four digits:
Works:
So it is something to do with the key, but I know not what yet, exactly. Some keys fail others succeed.
Even URL-encoding every single digit in the string (including safe digits) like this, causes only the first four digits to be saved:
It's got something to do with the fact that the first group of the key is four base-10 digits. For instance, using the API to save this key fails:
But saving this key works:
Note that the issue with saving the key only exists when using the API to save the key. The keys which fail only fail with the WGET api command that I'm using. If I paste the key directly into the Surveillance Station Web UI (into the Live Broadcast widget) then it works.
I temporarily worked around the problem by hand-updating the key in Surveillance Station, and it worked and the stream started going again. Shortly thereafter, the system decided that it needed to split the stream at midday and created a new live broadcast with a new key, this time the key didn't have four pure decimal digits at the front, so it also worked as expected.
I don't know what this is?
I think the latter is more likely, but it seems to me like the workaround will be the same regardless of the bug's root cause.
To do:
I have done the following:
To do:
2024-05-01 12:36:37 CrowCam Controller - Updating local Synology stream name/key to be 6930-xb**-****-****-****
2024-05-01 12:36:38 CrowCam Controller - Re-querying local stream key to ensure the update succeeded.
2024-05-01 12:36:39 CrowCam Controller - Update failed: Local Synology stream key does not match YouTube stream name/key. Possible recurrence of GitHub issue #91. Creating new YouTube stream to work around the issue.
2024-05-01 12:36:40 CrowCam Controller - Creating new YouTube Live Broadcast.
2024-05-01 12:36:56 CrowCam Controller - New video is live. Video ID: 7R7_Flc1MNY Status: active Key: gbds-13**-****-****-****.
2024-05-01 12:37:03 CrowCam Controller - The categoryId of the video UxIqdJJpXBnjaEy5yq1wZQ1714592202666342 titled CrowCam was - This does not match the desired categoryId of 15 - Fixing the categoryId now.
2024-05-01 12:37:03 CrowCam Controller - Error setting categoryId to 15 on the video UxIqdJJpXBnjaEy5yq1wZQ1714592202666342. Output was { "error": { "code": 403, "message": "Forbidden", "errors": [ { "message": "Forbidden", "domain": "youtube.video", "reason": "forbidden" } ] }}.
2024-05-01 12:37:07 CrowCam Controller - The video UxIqdJJpXBnjaEy5yq1wZQ1714592202666342 titled CrowCam was not found at the top of playlist PL8Fzg-YTf-GbfOHNxAAZEW9dixstuSztl titled CrowCam Archives - Instead the video 7R7_Flc1MNY was found in that slot - Fixing the playlist now.
2024-05-01 12:37:07 CrowCam Controller - Error adding video UxIqdJJpXBnjaEy5yq1wZQ1714592202666342 to playlist id PL8Fzg-YTf-GbfOHNxAAZEW9dixstuSztl titled CrowCam Archives - Output was { "error": { "code": 404, "message": "Video not found.", "errors": [ { "message": "Video not found.", "domain": "youtube.playlistItem", "reason": "videoNotFound" } ] }}.
2024-05-01 12:37:10 CrowCam Controller - Error uploading thumbnail to video UxIqdJJpXBnjaEy5yq1wZQ1714592202666342. Output was { "error": { "code": 500, "message": "Internal error encountered.", "errors": [ { "message": "Internal error encountered.", "domain": "global", "reason": "backendError" } ], "status": "INTERNAL" }}.
I got a response from Synology support about my bugreport. They suggested a workaround of putting double quotes around the key, something I hadn't tried. I had already tried single quotes around the key, but that had only partially worked; the full key did save, but it also saved the single quotes into the key itself, thus making the key invalid. I hadn't thought to go forward and try double quotes around the key. Turns out that fixes it.
Though instead of doing double quotes in my script (since other parts of the code which touch that string are already using double quotes as other delimiters), I am using %22 instead, which also works successfully: &key=%221234-1234-1234-1234-1234%22
This should permanently fix the issue. Checkin 1e7904a adds the %22's around the key. I believe this is the true workaround to the bug so that it should never recur.
The prior checkin bcd0859, where it double-checks that the key got saved and creates a new stream if it didn't save correctly, that code is still in there as belt-and-suspenders protection if something else goes wrong with the key. But that code theoretically shouldn't get hit any more except in extreme emergencies. So I don't need to do my other "to do" items from above because the orphaned stream and the additional error messages shouldn't be hit regularly any more.
The crowCam got into a situation today where YouTube showed that there was a scheduled stream waiting to start, but no stream was forthcoming, it just sat there in the Scheduled state all day. Logs looked like this:
The above repeated all day.
After the first creation of the Live Broadcast, it did not try to create a new one, it just kept updating the key, but the key is wrong every time, local key is just the first four digits.
Investigating.