samsung-tv-ws-api icon indicating copy to clipboard operation
samsung-tv-ws-api copied to clipboard

stuck at upload()

Open vandenbrakel opened this issue 2 years ago • 11 comments

Hi Thanks for the Frame Support!

I'm testing the upload function on an Rpi. When uploading a png, it seems just stuck from there. I have logging on info, but no output so far.

Anything I can do / test to get more info on progress etc?

vandenbrakel avatar Mar 29 '22 12:03 vandenbrakel

After some investigation and logging on debug I see the upload command results in error -1. Anyone has some info on this?

DEBUG:samsungtvws.connection:SamsungTVWS websocket command: {"method": "ms.channel.emit", "params": {"event": "art_app_request", "to": "host", "data": "{"request": "send_image", "file_type": "png", "conn_info": {"d2d_mode": "socket", "connection_id": 2825700145, "id": "3d99854f-a8cf-4971-afd6-058b7151da16"}, "image_date": "2022:04:06 08:52:23", "matte_id": "modern_apricot", "file_size": 16123877, "id": "3d99854f-a8cf-4971-afd6-058b7151da16"}"}} DEBUG:samsungtvws.helper:Processing API response: {"data":"{"id":"3d99854f-a8cf-4971-afd6-058b7151da16","event":"error","request_data":"{\"request\": \"send_image\", \"file_type\": \"png\", \"conn_info\": {\"d2d_mode\": \"socket\", \"connection_id\": 2825700145, \"id\": \"3d99854f-a8cf-4971-afd6-058b7151da16\"}, \"image_date\": \"2022:04:06 08:52:23\", \"matte_id\": \"modern_apricot\", \"file_size\": 16123877, \"id\": \"3d99854f-a8cf-4971-afd6-058b7151da16\"}","error_code":"-1","target_client_id":"ada14710-7e2e-47bb-885b-1715512a2d40"}","event":"d2d_service_message","from":"83a74979-99b1-41c6-96b4-a463bcfc2bdd"}

DEBUG:samsungtvws.connection:SamsungTVWS websocket event: {'data': '{"id":"3d99854f-a8cf-4971-afd6-058b7151da16","event":"error","request_data":"{\"request\": \"send_image\", \"file_type\": \"png\", \"conn_info\": {\"d2d_mode\": \"socket\", \"connection_id\": 2825700145, \"id\": \"3d99854f-a8cf-4971-afd6-058b7151da16\"}, \"image_date\": \"2022:04:06 08:52:23\", \"matte_id\": \"modern_apricot\", \"file_size\": 16123877, \"id\": \"3d99854f-a8cf-4971-afd6-058b7151da16\"}","error_code":"-1","target_client_id":"ada14710-7e2e-47bb-885b-1715512a2d40"}', 'event': 'd2d_service_message', 'from': '83a74979-99b1-41c6-96b4-a463bcfc2bdd'} DEBUG:samsungtvws.helper:Processing API response: {"data":{"attributes":{"name":"U2Ftc3VuZ1R2UmVtb3Rl"},"connectTime":1649231541956,"deviceName":"U2Ftc3VuZ1R2UmVtb3Rl","id":"af6db873-dd46-4cf0-b6be-f145fd606caf","isHost":false},"event":"ms.channel.clientDisconnect"}

vandenbrakel avatar Apr 06 '22 08:04 vandenbrakel

After some investigation and logging on debug I see the upload command results in error -1. Anyone has some info on this? Got exactly the same error. Model : QE55LS03RAUXXC So excited ! And after hours...😞

Can't get any light from TCP dump. Infinite websocket ping/pong... 2022-05-31_23h20_35

Got the same from rpi, Windows, WSL2... maybe a configuration on the TV... but which one ? I've tried many options...

bubizar avatar May 31 '22 21:05 bubizar

Hi @vandenbrakel, have you managed this mess ?

bubizar avatar Sep 21 '22 16:09 bubizar

same here. got here by way of a couple other projects using this as a dep.

audibleblink avatar Nov 24 '22 18:11 audibleblink

Hi. I have the same issue. Anyone able to overcome this?

nat38 avatar Dec 26 '22 14:12 nat38

My code works perfectly on a newer Frame running firmware version 2401, however, I have the same issue as above on a Frame 65" 2019 model running firmware 1401, the latest version for this model.

tom-murray avatar Jan 31 '23 10:01 tom-murray

Interesting,

Can you share your working code?

Op di 31 jan. 2023 om 11:42 schreef Thomas Murray @.***

:

My code works perfectly on a newer Frame running firmware version 2401, however, I have the same issue as above on a Frame 65" 2019 model running firmware 1401, the latest version for this model.

— Reply to this email directly, view it on GitHub https://github.com/xchwarze/samsung-tv-ws-api/issues/106#issuecomment-1410130093, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2HB2UZP3A5MP7R6EEIEXLWVDUARANCNFSM5R6J4W3A . You are receiving this because you were mentioned.Message ID: @.***>

vandenbrakel avatar Jan 31 '23 11:01 vandenbrakel

This is a snippet of code, I'm going to unsplash then downloading a new photo each day and uploading to the Frame and deleting the previous.

response = requests.get(image)

img=Image.open(BytesIO(response.content))
img.thumbnail((3840,2160))
img.save('bg.jpg')

# Normal constructor
tv = SamsungTVWS("<REPLACE WITH THE IP>")

# Get current image
current_img = tv.art().get_current()

# Upload new image 
file = open('bg.jpg', 'rb')
data = file.read()
uploadedID = tv.art().upload(data, file_type="JPEG", matte='none')
tv.art().select_image(uploadedID)

# Delete old image
tv.art().delete(current_img['content_id'])

tom-murray avatar Jan 31 '23 13:01 tom-murray

I created a quick PR to not remain stuck forever on the error and exit eagerly

https://github.com/xchwarze/samsung-tv-ws-api/pull/120

thypon avatar May 02 '23 00:05 thypon

Screenshot 2023-05-02 at 10 24 59

I have the suspect that d2d socket connection is not supported on 14xx firmwares. Attached a successful send_image command picture.

thypon avatar May 02 '23 08:05 thypon

I've had the same issue with a hang-up on uploading an image, and it failed both using xchwarze's as well as thypon's forks. However, it did work fine with the fork I took from https://github.com/NickWaterton/samsung-tv-ws-api. My Frame's FW version is 1640.9.

TB-dotcom avatar Sep 12 '24 20:09 TB-dotcom