Giter Club home page Giter Club logo

yihack-onedrive-uploader's Introduction

OneDrive-uploader for Yi IP Cameras

To visitors and cloners:

  • Any issue ๐Ÿ› is welcome if you find a bug or have a question to ask
  • Test feedback on your camera is invaluable to all users at anytime
  • Please note that OneDrive resumable API for uploading file larger than 4MB is not very reliable for my case, see issue. However, YMMV.
  • A star ๐ŸŒŸ from you is the best encouragement to me if you think this repository helps you.

This repository is inspired by roleoroleo's yi-hack-MStar.gdrive uploader. The gdrive uploader does provide some convenience, however, my Google drive has only 15GB space shared with Gmail and other account applications, and it is very easy to get storage fully packed with uploaded media files. Fortunately, I've subscribed Microsoft 365 Developer Program which provides 5TB storage space. I think uploading files to OneDrive is a better option for me.

If you have a subscription of Microsoft OneDrive Stroage or Microsoft 365 Developer Program, you will get more storage space, which can allow you to store your camera videos and pictures to it other than paying an expensive manufacturer's storage premium plan.

Features

  • much easier to set up on your camera
    • use a JSON file to configure
    • only few instructions you need to run on your terminal
  • unattended upload your video (.mp4) and image (.jpg) files once set up successfully
  • both personal and tenant Microsoft accounts are supported
  • auto organize uploaded folders into multi-levels by months and dates
  • safe auto-clean of your earliest files when storage reaches the specified threshold
  • Re-transmission control is used to assure files upload reliability

Supported camera models

Yi cameras hacked with the same file hiearacy or builtin applications are more likely to be supported. Anyway, your own separate tests are necessary before you use it. I've tested on my own camera.

  • model y201c(Yi 1080p Dome BFUS) with firmware 4.6.0.0A_201908271549 and yi-hack-MStar 0.4.7 by denven
  • welcome to test it on your camera ๐Ÿ˜„

How to use the uploader?

Prerequisites

  1. make sure you've hacked your camera, please check yi-hack-MStar
  2. you have an OneDrive account assosiated with your Microsoft Azure account, you'd better have some knowledge of using the Azure portal.

Create Azure application for your uploader

  1. use App registrations to register an application on Azure portal
  • for the Supported account types choice: choose Accounts in this organizational directory only if your are a Azure Directory Single tenant; choose Personal Microsoft accounts only if you are using your own Personal OneDrive.
  • for the Redirect URI setting, choose WEB type and put a live redirectable URL, you can clone OAuth2 callback and use the code to serve a local redirect url http://localhost:8080/callback
    Register application
  1. set up the required Graph API permissions
  • For business/organization tenant user, add Files.ReadWrite.All Set up API Permissions Set up API Permissions
  • For personal account user, add Files.ReadWrite and Files.ReadWrite.All Set up API Permissions
  1. get your application client id, and tenant id (used for tenant account only, ignore it for personal account) Get application id and tenant id

  2. create a client secret and save the secret Value for next steps Get client credential

  3. Authentication setting for personal account type only Authentication

Use the repository code and setup on your camera

  1. clone the repository code to your local computer and enter the code directory
  2. use the data fetched from Azure application to fill in your config.json file before uploading the files to camera. Please refer to the following example to edit the config.json file in your directory:
{
  "grant_type": "authorization_code",
  "client_id": "9083c44f-605d-4d31-9d16-955e48d69965",
  "client_secret": "dFE8Q~bUtscYyoTUCxt3RLawrfsnyVGARFhGdcH7",
  "tenant_id": "e2a801f7-46fe-4dcf-91b7-6d4409c7760e",
  "scope": "https://graph.microsoft.com/.default",
  "video_root_folder": "yihack_videos",
  "convert_utc_path_name": "false",
  "auto_clean_threshold": "100",
  "enable_idle_transfer": "false"
}
Configuration key Default value Description
grant_type authorization_code
client_id "" fill in with your data
client_secret "" fill in with your data
tenant_id "" for personal account, set it as "consumers"; for tenant account, set a specific tenant id
scope https://graph.microsoft.com/.default not required
video_root_folder yihack_videos name string without white spaces
upload_video_only true not required; set it false will upload *.jpg files in the record folders
convert_utc_path_name false not required; set it to true if you don't like the uploaded folders are in UTC time (for firmware v0.4.9 and later)
auto_clean_threshold 100 value in range [50, 100) will enable this feature
enable_idle_transfer false setting to true has chances of files upload delayed
  1. upload code and dependent files to your camera sd card via ssh with root account or a FTP tool, the target path: /tmp/sd/yi-hack:

    • create an empty directory named onedrive in path /tmp/sd/yi-hack
    • upload init.sh, stop.sh and scripts and bin directory to /tmp/sd/yi-hack/onedrive
    • upload your own config.json file to /tmp/sd/yi-hack/onedrive
  2. sign in your Microsoft Azure account first

  3. run the entry Shell script init.sh to complete the application authorization grant flow

cd /tmp/sd/yi-hack/onedrive/
./init.sh

Ahthorize uploader

  • Follow the URL redirections to consent, sign in, etc. and then you will get a authorization code, copy the code to your camera terminal and continue.
  • Now, you've set up yourOneDrive uploader. The script will begin to search media files not uploaded from camera sd card to upload, it may throw some information or error messages on your terminal. Error message like curl: option --data-binary: out of memory is tolerable and has no issue to the file upload. Successful configuration
  • Check your uploaded folder structure, you will find folders are organized by months and dates, which are more convenient to find and view. Successful configuration
  1. optional: reboot your camera
reboot -f # reboot without -f option cannot work on my camera

Maintenance

  • In case you run into an issue or you just want to stop the uploader, run the stop.sh script to kill the running uploader.
cd /tmp/sd/yi-hack/onedrive
./stop.sh
  • You might have messed up the configuration or you are not content with the running situation, you want to start again from the beginning.
    • first, stop the uploader first by following above;
    • delete all generated data (or keep file data/last_upload.json if you want the uploader to resume your uploading without any repetitive uploads);
    • run ./init.sh again to get your access tokens again;
    • reboot the camera to run it unattendedly with the new configuration.
rm -rf data
rm -rf log
./init.sh  
reboot -f
  • If you want to setup with another OneDrive account (or Azure application data), you can delete or edit your current config.json, or replace it with a new one as well.
  • Once you have deleted data directory or changed application credentials in config.json files, you must run the init.sh script manually to setup or reload your uploader again.
./init.sh
reboot -f
  • โš ๏ธ be cautious to delete file ./data/last_upload.json if you want to restart the uploader and resume the upload to avoid repeatitive upload of all recorded files.

yihack-onedrive-uploader's People

Contributors

denven avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

yihack-onedrive-uploader's Issues

CompactToken validation failed with reason code: 80049228

Bug details:

  • Errors existed continuously for many lines and then recovered
create_upload_session /tmp/sd/record/2023Y01M04D05H/08M00S60.mp4, Error: CompactToken validation failed with reason code: 80049228.
upload_small_file /tmp/sd/record/2023Y01M07D00H/52M00S60.jpg, Error: CompactToken validation failed with reason code: 80049228.
  • Result in no file can be uploaded before error disappeared

Fail on Yi Home IFUS

Hello,

Is there any chance to implement it also on unsupported Yi 1080p Home IFUS with Owner avatar
yi-hack-Allwinner-v2?
I did try it and it look good in logs, directory gets created on OneDrive, but it is empty. Already on this camera GDrive hack is working (do not know if this is a root cause. Any ideas what to check?

From the installation log ./init.sh: line 1: ls: Argument list too long occurs periodically.

Using your authorization code to get an access token ...
Get OneDrive access tokens successfully
Enabled OneDrive Uploader auto-run when camera boots up.
Success: get_drive_status
You have used 6.20GB(0.59%) of your storage space, with 1047.80GB(99.41%) space remaining.
Check './data/drive_status.json' to see your drive quota details.
Your OneDrive access is available.
Success: create_folder yihack_videos
Created folder yihack_videos to store your video files successfully.
Configuration is done.
Start to check camera video and image files for uploading...
./init.sh: line 1: ls: Argument list too long
All files were uploaded, wait for a new recorded video or image file.
./init.sh: line 1: ls: Argument list too long
All files were uploaded, wait for a new recorded video or image file.

mp4 files are not uploaded after some time unknown

Bug details:

  • Personal OneDrive account (not sure will it happen to the business account
  • found uploading stopped of *.mp4 file, but previously some mp4 files were uploaded
  • image files are still being uploaded
  • check the upload logs, and found a few errors as below:
create_upload_session /tmp/sd/record/2023Y01M04D05H/08M00S60.mp4, Error: CompactToken validation failed with reason code: 80049228.
upload_small_file /tmp/sd/record/2023Y01M07D00H/52M00S60.jpg, Error: CompactToken validation failed with reason code: 80049228.

Upload speed and success rate for larger video files (YMMV)

Although the uploader works normally on most occasions when re-transmission is added to tackle large file uploading failures. however, after a whole night's monitoring of the upload logs, I found sometimes it still experiences a high rate of re-transmission of chunks, a few cases of abortion with too many transmission retries

  • too many re-transmission happened
upload chunk: 0, length: 3276800, bytes: 0-3276799 
upload chunk: 0, length: 3276800, bytes: 0-3276799 
upload chunk: 0, length: 3276800, bytes: 0-3276799 
upload chunk: 1, length: 3276800, bytes: 3276800-6553599 
upload chunk: 1, length: 3276800, bytes: 3276800-6553599 
upload chunk: 1, length: 3276800, bytes: 3276800-6553599 
upload chunk: 1, length: 3276800, bytes: 3276800-6553599 
upload chunk: 2, length: 3276800, bytes: 6553600-9830399 
upload chunk: 2, length: 3276800, bytes: 6553600-9830399 
upload chunk: 2, length: 3276800, bytes: 6553600-9830399 
upload chunk: 2, length: 3276800, bytes: 6553600-9830399 
upload chunk: 3, length: 614500, bytes: 9830400-10444899 
  • failed with max retry times ( I set it 5 as max continuous failures)
upload chunk: 0, length: 3276800, bytes: 0-3276799 
upload chunk: 1, length: 3276800, bytes: 3276800-6553599 
upload chunk: 2, length: 3276800, bytes: 6553600-9830399 
upload chunk: 2, length: 3276800, bytes: 6553600-9830399 
upload chunk: 2, length: 3276800, bytes: 6553600-9830399 
upload chunk: 2, length: 3276800, bytes: 6553600-9830399 
upload chunk: 3, length: 523886, bytes: 9830400-10354285 
upload chunk: 3, length: 523886, bytes: 9830400-10354285 
upload chunk: 3, length: 523886, bytes: 9830400-10354285 
upload chunk: 3, length: 523886, bytes: 9830400-10354285 
upload chunk: 3, length: 523886, bytes: 9830400-10354285 
  • slow speed of successful uploads (one file takes more than 1 minute)
Sun Jan 15 10:21:33 PST 2023: /tmp/sd/record/2023Y01M15D07H/34M00S60.mp4
Sun Jan 15 10:28:09 PST 2023: /tmp/sd/record/2023Y01M15D07H/35M00S60.mp4
Sun Jan 15 10:29:53 PST 2023: /tmp/sd/record/2023Y01M15D07H/36M00S60.mp4
Sun Jan 15 10:32:06 PST 2023: /tmp/sd/record/2023Y01M15D07H/37M00S60.mp4
Sun Jan 15 10:36:39 PST 2023: /tmp/sd/record/2023Y01M15D07H/38M00S60.mp4
Sun Jan 15 10:39:30 PST 2023: /tmp/sd/record/2023Y01M15D07H/39M00S60.mp4
Sun Jan 15 11:12:52 PST 2023: /tmp/sd/record/2023Y01M15D07H/40M00S60.mp4
Sun Jan 15 11:13:36 PST 2023: /tmp/sd/record/2023Y01M15D07H/41M00S60.mp4
Sun Jan 15 11:18:15 PST 2023: /tmp/sd/record/2023Y01M15D07H/42M00S60.mp4
Sun Jan 15 11:20:20 PST 2023: /tmp/sd/record/2023Y01M15D07H/43M00S60.mp4

If this situation is intensive and continues for some time, the upload speed will decline dramatically, and if the camera is recording a new video every minute, the video files will never be uploaded in time, and more and more video files will be delayed uploading on camera's sd card.

Video upload fails with {"error":{"code":"itemNotFound","message":"The upload session was not found"}}

This issue hasn't happened to the consumers basic personal account before, and I am currently using an Azure Directory tenant account to upload all video files uploaded to a larger size OneDrive space.

The upload job worked perfectly since I installed the camera outside yesterday. After trying to change some settings from the mobile app, I found there were no new videos uploaded, then I checked the logs, and video files are still being generated, but each video file fails to complete the final step during uploading each fragment.

2023-04-22 18:59:52 upload chunk: 0, length: 3932160, bytes: 0-3932159
2023-04-22 19:00:11 upload chunk: 1, length: 3932160, bytes: 3932160-7864319
2023-04-22 19:00:28 upload chunk: 2, length: 3525868, bytes: 7864320-11390187
{"error":{"code":"itemNotFound","message":"The upload session was not found"}}

Rebooting or resetting this uploader sometimes worked for a short time, but it will fail into this issue again and all video files will not be uploaded successfully after a while.

Uploaded file is broken, file upload fails or uploaded file are gone with OneDrive resumable API to upload large files by chunks

Seems it happened today:

  1. the first-time, the video file is uploaded with full size, but cannot be played
    image

  2. curl throws an error of the ongoing uploads and no files can actually be uploaded (Previously, it seems this was just a warning message but the file was still uploaded)

curl: option --data-binary: out of memory
curl: try 'curl --help' for more information
upload chunk: 1, length: 5898240, bytes: 0-5898239
curl: option --data-binary: out of memory
curl: try 'curl --help' for more information
upload chunk: 2, length: 3550165, bytes: 5898240-9448404
  • the full curl information is below:
Start to upload /tmp/sd/record/2023Y01M14D10H/06M24S36.mp4
Success: create_upload_session /tmp/sd/record/2023Y01M14D10H/06M24S36.mp4
upload_large_file_by_chunks /tmp/sd/record/2023Y01M14D10H/06M24S36.mp4, 6.29MB
*   Trying 13.107.42.12:443...
* TCP_NODELAY set
* Connected to api.onedrive.com (13.107.42.12) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* error setting certificate verify locations, continuing anyway:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: C=US; ST=WA; L=Redmond; O=Microsoft Corporation; OU=Microsoft Corporation; CN=storage.live.com
*  start date: Jun 13 20:46:06 2022 GMT
*  expire date: Jun  8 20:46:06 2023 GMT
*  issuer: C=US; O=Microsoft Corporation; CN=Microsoft Azure TLS Issuing CA 01
*  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x263d30)
> PUT /rup/be8ddd0b7f4904f6/eyJSZXNvdXJjZUlEIjoiQkU4REREMEI3RjQ5MDRGNiE0MjA2IiwiUmVsYXRpb25zaGlwTmFtZSI6IjA2TTI0UzM2Lm1wNCJ9/4macv3OHZ2mMNWkT0ZP1VQrIS8At8uAONk5CPDtApUn7aq5antryO-PE6gXJQzokuGl36s79ac55F-o_GqlMErptYaXSBkdZsE5hr-JAl7QWg/eyJuYW1lIjoiMDZNMjRTMzYubXA0IiwiQG5hbWUuY29uZmxpY3RCZWhhdmlvciI6InJlcGxhY2UifQ/4wqRpwZTj3-HeGRk59wK16jYtmt-vrvXFgbUOq33ro4h8G2qAFfOd1O_p1gg-ANuQaeEtfy5Bs0Gs2L8RGQhY31aw4zjZd5fmsOzhAX3YXzxYe4gfQr_U-9qfVg-8jcw27Ihxw5W2wzXFVUDF8AMHubYXqdDydQhzG1zWNpejvByJ_x7m9eoD040qPdKy379X-X8pcD13S6hsMiVeEWRCHJl_bEN4UgDl78VgdCUTiye_0TiC01R6O7jyTkP_HXoPbDpDBM0vozoRD3AJ4aYZPfg1t2jixgltW7P-_WWlwF8I73OzqLmLCpEvNaCEMB7yJWuO8qOul6jjZo2VR09EXkgyKPH8lEIOBy94ehbWb3k0SLgr7rPO4aZCYph9CZSupwUasuzxTZZSkXCY_-W1gKwsG2hWVXqaHieUmTVF4j7d1mNgzE3bxFq-5GxQYVy9anh9b3XzjddTjEEKzp9AhE8xAfEI-uP_EyyqGv4noMFPGVVSl9mBz7BnwSU-R1iWW8jniWuiFbJ1Njd0zpzg2rfLzKyEb6Fs37xo5bJWxx7qFcfYatNZVifj3VNnwnZupccdIuJTi5aEyCFA0BJlVNw HTTP/2
> Host: api.onedrive.com
> user-agent: curl/7.68.0
> accept: */*
> content-length: 5898240
> content-range: bytes 0-5898239/6595575
> content-type: application/x-www-form-urlencoded
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 202
< content-length: 90
< content-type: application/json; charset=utf-8
< p3p: CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"
< x-msnserver: BN6PPF90571263D
< strict-transport-security: max-age=31536000; includeSubDomains
< ms-cv: hq/Jwns3jUSX46FTqzSHGQ.0
< x-asmversion: UNKNOWN; 19.1058.1201.2010
< x-cache: CONFIG_NOCACHE
< x-msedge-ref: Ref A: 7D9FFEC337AA44B6B0F94B69F081252A Ref B: YVR311000109027 Ref C: 2023-01-15T01:50:08Z
< date: Sun, 15 Jan 2023 01:50:21 GMT
<
* We are completely uploaded and fine
* Connection #0 to host api.onedrive.com left intact
{"expirationDateTime":"2023-01-20T01:50:07.271Z","nextExpectedRanges":["5898240-6595574"]}upload chunk: 1, length: 5898240, bytes: 0-5898239
*   Trying 13.107.42.12:443...
* TCP_NODELAY set
* Connected to api.onedrive.com (13.107.42.12) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* error setting certificate verify locations, continuing anyway:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: C=US; ST=WA; L=Redmond; O=Microsoft Corporation; OU=Microsoft Corporation; CN=storage.live.com
*  start date: Jun 13 20:46:06 2022 GMT
*  expire date: Jun  8 20:46:06 2023 GMT
*  issuer: C=US; O=Microsoft Corporation; CN=Microsoft Azure TLS Issuing CA 01
*  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x263d40)
> PUT /rup/be8ddd0b7f4904f6/eyJSZXNvdXJjZUlEIjoiQkU4REREMEI3RjQ5MDRGNiE0MjA2IiwiUmVsYXRpb25zaGlwTmFtZSI6IjA2TTI0UzM2Lm1wNCJ9/4macv3OHZ2mMNWkT0ZP1VQrIS8At8uAONk5CPDtApUn7aq5antryO-PE6gXJQzokuGl36s79ac55F-o_GqlMErptYaXSBkdZsE5hr-JAl7QWg/eyJuYW1lIjoiMDZNMjRTMzYubXA0IiwiQG5hbWUuY29uZmxpY3RCZWhhdmlvciI6InJlcGxhY2UifQ/4wqRpwZTj3-HeGRk59wK16jYtmt-vrvXF1gg-ANuQaeEtfy5Bs0Gs2L8RGQhY31aw4zjZd5fmsOzhAX3YXzxYe4gfQr_U-9qfVg-8jcw27Ihxw5W2wzXFVUDF8AMHubYXqdDydQhzG1zWNpejvByJ_x7m9eoD040qPdKy379X-X8pcD13S6hsMiVeEWRCHJl_bEN4UgDl78VgdCUTiye_0TiC01R6O7jyTkP_HXoPbDpDBM0vozoRD3AJ4aYZPfg1t2jixgltW7P-_WWlwF8I73OzqLmLCpEvNaCEMB7yJWuO8qOul6jjZo2VR09EXkgyKPH8lEIOBy94ehbWb3k0SLgr7rPO4aZCYph9CZSupwUasuzxTZZSkXCY_-W1gKwsG2hWVXqaHieUmTVF4j7d1mNgzE3bxFq-5GxQYVy9anh9b3XzjddTjEEKzp9AhE8xAfEI-uP_EyyqGv4noMFPGVVSl9mBz7BnwSU-R1iWW8jniWuiFbJ1Njd0zpzg2rfLzKyEb6Fs37xo5bJWxx7qFcfYatNZVifj3VNnwnZupccdIuJTi5aEyCFA0BJlVNw HTTP/2
> Host: api.onedrive.com
> user-agent: curl/7.68.0
> accept: */*
> content-length: 697335
> content-range: bytes 5898240-6595574/6595575
> content-type: application/x-www-form-urlencoded
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 201
< content-length: 2273
< content-type: application/json; charset=utf-8
< p3p: CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"
< x-msnserver: BN6PPF11E39FAF5
< strict-transport-security: max-age=31536000; includeSubDomains
< ms-cv: JVEanuotCUawcZsRhcg0kQ.0
< x-asmversion: UNKNOWN; 19.1058.1201.2010
< x-cache: CONFIG_NOCACHE
< x-msedge-ref: Ref A: 4455123FA14941A48CB62A84C01078B8 Ref B: YVR311000112019 Ref C: 2023-01-15T01:50:22Z
< date: Sun, 15 Jan 2023 01:50:23 GMT
<
{"createdBy":{"application":{"id":"44d45bee"},"user":{"id":"be8ddd0b7f4904f6"}},"createdDateTime":"2023-01-15T01:50:23.84Z","cTag":"aYzpCRThEREQwQjdGNDkwNEY2ITQyMDguMjU3","eTag":"aQkU4REREMEI3RjQ5MDRGNiE0MjA4LjA","id":"BE8DDD0B7F4904F6!4208","lastModifiedBy":{"application":{"id":"44d45bee"},"user":{"id":"be8ddd0b7f4904f6"}},"lastModifiedDateTime":"2023-01-15T01:50:23.84Z","name":"06M24S36.mp4","parentReference":{"driveId":"be8ddd0b7f4904f6","driveType":"personal","id":"BE8DDD0B7F4904F6!4206","name":"2023Y01M14D10H","path":"/drive/root:/yihack_videos/2023Y01M14D10H"},"size":6595575,"webUrl":"https://1drv.ms/i/s!APYESX8L3Y2-oHA","items":[],"file":{"hashes":{"quickXorHash":"kKSjmO45QijFJDhODrM/ZO5EMqU=","sha1Hash":"D71DE76A73C6A374A20FE4B44E89F1DDEEF25573","sha256Hash":"7A5F976074A06CDBB00786BB2EF1B069142A191E1DAEA6A9D93CD070727DD157"},"mimeType":"video/mp4","processingMetadata":true},"fileSystemInfo":{"createdDateTime":"2023-01-15T01:50:23.84Z","lastModifiedDateTime":"2023-01-15T01:50:23.84Z"},"reactions":{"commentCount":0},"photo":{},"tags":[],"lenses":[],"thumbnails":[{"id":"0","large":{"height":800,"url":"https://yvkzbg.bn.files.1drv.com/y4pR8cf35cf-VLa7ZZurIc2Y7rVNYl6k0u-1aKqZftxI3j9VuPVhlTMRZYrdtYb55a3OpL7wyBUV13kwi11EonXYH9lZuYA81n8-i3FoZkOx5VUYBUcUoZY7jmBv3Z_S5mRjug0JEE9FB-tYuXlJTyrhkCF4M0vzu9Yyuz0MUrahzKEyNkSA4S1LIKzn4aUwHdqU3LKG8PUXEhOG-68XAs9aP-h30kdCmm6vsEd5lXf5rbGC8PZ1nPy_hsqzjF1x-lIhXSv1oeEG6MhB8L3GV8b5A?width=800&height=800&cropmode=none","width":800},"medium":{"height":176,"url":"https://yvkzbg.bn.files.1drv.com/y4pR8cf35cf-VLa7ZZurIc2Y7rVNYl6k0u-1aKqZftxI3j9VuPVhlTMRZYrdtYb55a3OpL7wyBUV13kwi11EonXYH9lZuYA81n8-i3FoZkOx5VUYBUcUoZY7jmBv3Z_S5mRjug0JEE9FB-tYuXlJTyrhkCF4M0vzu9Yyuz0MUrahzKEyNkSA4S1LIKzn4aUwHdqU3LKG8PUXEhOG-68XAs9aP-h30kdCmm6vsEd5lXf5rbGC8PZ1nPy_hsqzjF1x-lIhXSv1oeEG6MhB8L3GV8b5A?width=176&height=176&cropmode=none","width":176},"small":{"height":96,"url":"https://yvkzbg.bn.files.1drv.com/y4pR8cf35cf-VLa7ZZurIc2Y7rVNYl6k0u-1aKqZftxI3j9VuPVhlTMRZYrdtYb55a3OpL7wyBUV13kwi11EonXYH9lZuYA81n8-i3FoZkOx5VUYBUcUoZY7jmBv3Z_S5mRjug0JEE9FB-tYuXlJTyrhkCF4M0vzu9Yyuz0MUrahzKEyNkSA4S1LIKzn4aUwHdqU3LKG8PUXEhOG-68XAs9aP-h30kdCmm6vsEd5lXf5rbGC8PZ1nPy_hsqzjF1x-lIhXSv1oeEG6MhB8L3GV8b5A?width=96&height=96&cropmode=none","width":96}}]}* We are completely uploaded and fine
* Connection #0 to host api.onedrive.com left intact
upload chunk: 2, length: 697335, bytes: 5898240-6595574
Success: upload_large_file_by_chunks /tmp/sd/record/2023Y01M14D10H/06M24S36.mp4
Start to upload /tmp/sd/record/2023Y01M14D10H/07M00S60.mp4
Success: create_upload_session /tmp/sd/record/2023Y01M14D10H/07M00S60.mp4
upload_large_file_by_chunks /tmp/sd/record/2023Y01M14D10H/07M00S60.mp4, 10.29MB
curl: option --data-binary: out of memory
curl: try 'curl --help' for more information
upload chunk: 1, length: 5898240, bytes: 0-5898239
curl: option --data-binary: out of memory
curl: try 'curl --help' for more information
upload chunk: 2, length: 4886500, bytes: 5898240-10784739

Chance of reboot when uploading files

when uploading large files (>4Mb), the camera has a chance of rebooting. It doesn't happen to each large mp4 file uploading, after uploading several large files, the camera reboots at some time.

Auto upload stopped

after several days of uploading, no more new recorded files will be uploaded to Onedrive

CompactToken parsing failed with error code: 80049217

Bug description:

  • When I formatted the camera SD card and re-hacked my camera with firmware. I found the built-in curl in /usr/bin directory ran with Segment fault failure, so I grabbed the latest curl from official and it worked for the initial setup using the first-time redeemed access token;
  • When the onedrive-uploader runs a second time (be killed and run again or with a camera reboot), the refreshed access token cannot be used to access OneDrive API successfully, and found the error in the log file as this bug's title;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.