MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    New Module to download photos from Apple iCloud

    Scheduled Pinned Locked Moved Entertainment
    15 Posts 3 Posters 825 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • msimon360M
      msimon360 @sdetweil
      last edited by

      @sdetweil I was testing on an album with only 4 photos and set to sequential. What I found, with help of Claude, was Before the Dec 2023 fetch rewrite, every completed request did:

      if (retry) {
        self.scheduleUpdate(self.loaded ? -1 : self.config.retryDelay);
      }
      

      After the rewrite it became:

      if (!photosResponse.ok) {
        if (retry) self.scheduleUpdate(...);
      }
      

      So the directory list only refreshed on HTTP failure, not every getInterval. I have an updated MMM-ImagesPhotos.js with a fix but I don’t know the best way to send it. Would you like a diff, patch, GitHub branch, other?

      S 1 Reply Last reply
      Reply Quote 0
      • S
        sdetweil @msimon360
        last edited by

        @msimon360 ImagePhotos isn’t mine, I have a fork…

        so, generally how you do this , for any change to any repo on github

        on github, find the source module repo
        make a fork (copy on YOUR github)
        checkout your fork
        make a new branch
        make the changes
        commit to local branch
        push to your github fork
        github will see this and offer to create a PULL request to the original source , and the author can execute that PULL , from yours to theirs (merge is the operation)

        once its merged, then you can delete your branch
        and then sync the source to your fork (if you still want the fork)
        git pull on your fork to get the update,
        OR
        delete your local copy of the fork, and redownload the original repo again
        and maybe delete your fork on github, if you think you will never need it again

        as for the bug

        retry is a bad choice of variable, if its not in a failure path!.. lol…

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        msimon360M 1 Reply Last reply
        Reply Quote 0
        • msimon360M
          msimon360 @sdetweil
          last edited by

          @sdetweil Thanks for the detailed instructions. I am using your fork and I made the pull request. The only files changed are MMM-ImagesPhotos.js and I put my GitHub link in the README.md.

          S 1 Reply Last reply
          Reply Quote 0
          • S
            sdetweil @msimon360
            last edited by

            @msimon360 merged… also merged support for apple HEIC images…

            git pull
            to get the latest
            or sync your fork, then git pull

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            msimon360M 1 Reply Last reply
            Reply Quote 0
            • msimon360M
              msimon360 @sdetweil
              last edited by

              @sdetweil I gave it a try and no photos displayed. I went back to my repo. The explanation I got from AI was this;
              Why photos disappeared
              non-fullscreen (bottom_center) crashes in getDomnotFS because EXIF is appended to this.wrapper (fullscreen-only) instead of the local wrapper. With default showExifDate: true, getDom throws → blank module.

              S 1 Reply Last reply
              Reply Quote 0
              • S
                sdetweil @msimon360
                last edited by

                @msimon360 ok. Set the showexif: false

                Will review

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                S 1 Reply Last reply
                Reply Quote 0
                • S
                  sdetweil @sdetweil
                  last edited by

                  I fixed the crash, git pull

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  msimon360M 1 Reply Last reply
                  Reply Quote 0
                  • msimon360M
                    msimon360 @sdetweil
                    last edited by

                    @sdetweil It still failed to show photos. I merged the latest sdetweil/MMM-ImagesPhotos master into my fork and pushed it to https://github.com/msimon360/MMM-ImagesPhotos (6bb682d). The changes below are working on my Raspberry Pi, where MMM-iCloudPhotos drops files into uploads and the module is not fullscreen.

                    MMM-ImagesPhotos.js

                    getPhotos() requests /MMM-ImagesPhotos/photos/?t= with cache: “no-store”, so the browser does not reuse an old photo list.
                    After a successful fetch it always calls scheduleUpdate(), so getInterval keeps rereading the folder. Previously the next read was scheduled only when the response failed, so new uploads never appeared.
                    A failed fetch retries after retryDelay.
                    notificationReceived() reloads the list when it receives MMM_IMAGESPHOTOS_REFRESH. That is what MMM-iCloudPhotos sends after a sync.
                    scheduleUpdate() clears any pending refresh timer before setting the next one.
                    In the non-fullscreen layout, the EXIF date is appended to the local wrapper. this.wrapper exists only for fullscreen, so the old this.wrapper.appendChild(exifDate) threw when the module was in a normal region such as bottom_center.
                    Both the normal and fullscreen city lookups check photoImage.lat before reading .length, so a photo with no GPS data does not crash.
                    The default for showExifDate stays false, from upstream.

                    node_helper.js

                    extraRoutes() registers the photo routes once per module id.
                    The photo-list response sets Cache-Control: no-store.
                    getPhotosImages() reads EXIF per file inside its own try/catch. A file with no EXIF, or a parse error, is still added to the list with empty date and coordinates.
                    The list is always sent, including when the EXIF loop fails. Upstream’s outer try did not see errors inside the async EXIF loop, so the response could never be sent and the slideshow never started.

                    README.md

                    Notes that a failed EXIF read no longer blocks the slideshow, that the folder is refreshed on getInterval, and that other modules can send MMM_IMAGESPHOTOS_REFRESH.
                    package.json

                    Version is 0.3.0.
                    Repository URL is https://github.com/msimon360/MMM-ImagesPhotos.
                    Mark

                    S 1 Reply Last reply
                    Reply Quote 0
                    • S
                      sdetweil @msimon360
                      last edited by

                      @msimon360 thanks… I merged your code…

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      msimon360M 1 Reply Last reply
                      Reply Quote 0
                      • msimon360M
                        msimon360 @sdetweil
                        last edited by

                        @sdetweil Thanks, it is working. I am going to see if I can get the EXIF date to display in the div. Is there a better way to communicate than posting here?

                        S 1 Reply Last reply
                        Reply Quote 0
                        • S
                          sdetweil @msimon360
                          last edited by

                          @msimon360 open an issue on the module, comment there…
                          best path

                          Sam

                          How to add modules

                          learning how to use browser developers window for css changes

                          1 Reply Last reply
                          Reply Quote 0

                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                          With your input, this post could be even better 💗

                          Register Login
                          • 1 / 1
                          • First post
                            Last post
                          Enjoying MagicMirror? Please consider a donation!
                          MagicMirror created by Michael Teeuw.
                          Forum managed by Sam, technical setup by Karsten.
                          This forum is using NodeBB as its core | Contributors
                          Contact | Privacy Policy