• Shortcuts and JSON help

    From Chris Schram@chrispam1@me.com to comp.sys.mac.apps on Sun Oct 8 20:16:04 2023
    From Newsgroup: comp.sys.mac.apps

    A few things first:
    I live in an area where "high=speed Internet" means early 1950s copper
    wire. Fortunately our local public library has the good stuff.

    I recently updated my iMac to macOS Sonoma, and have been trying to play
    with the Aerial screen savers. This is mostly a fool's errand, as all my available bandwidth gets sucked up, and I can't do anything else online.

    I have a MacBook Air that's stuck at macOS Monterey that I can take to
    the aforementioned library. That along with the contents of the file... </Library/Application Support/com.apple.idleassetsd/Customer/entries.json> ...gives me everything I need to download ALL the videos

    All that said, I want to write a Shortcuts script that can parse each "Dictionary" from the "assets" array, and extract "url-4_240FPS" and
    "id" so I can build a shell script I can take to the library on my old
    MacBook to download ALL the videos.

    I have parsed simple JSON files before in Shortcuts, but it was some
    time ago, and whatever I learned has escaped my elderly brain.

    Can someone help me out here, or point me to a site where the answer
    lies? Thanks.
    --
    chrispam1@me.com is a filtered spam magnet. Email replies may be lost.
    You're better off replying to this newsgroup.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Jolly Roger@jollyroger@pobox.com to comp.sys.mac.apps on Sun Oct 8 20:38:34 2023
    From Newsgroup: comp.sys.mac.apps

    On 2023-10-08, Chris Schram <chrispam1@me.com> wrote:
    A few things first:
    I live in an area where "high=speed Internet" means early 1950s copper
    wire. Fortunately our local public library has the good stuff.

    I recently updated my iMac to macOS Sonoma, and have been trying to play
    with the Aerial screen savers. This is mostly a fool's errand, as all my available bandwidth gets sucked up, and I can't do anything else online.

    I have a MacBook Air that's stuck at macOS Monterey that I can take to
    the aforementioned library. That along with the contents of the file...
    </Library/Application Support/com.apple.idleassetsd/Customer/entries.json>
    ...gives me everything I need to download ALL the videos

    All that said, I want to write a Shortcuts script that can parse each "Dictionary" from the "assets" array, and extract "url-4_240FPS" and
    "id" so I can build a shell script I can take to the library on my old MacBook to download ALL the videos.

    I have parsed simple JSON files before in Shortcuts, but it was some
    time ago, and whatever I learned has escaped my elderly brain.

    Can someone help me out here, or point me to a site where the answer
    lies? Thanks.

    I don't have /Library/Application Support/com.apple.idleassetsd on my
    Ventura systems, and am not running Monterey anymore. So I can't look at
    this file.

    Anywa, the Shortcuts User Guide has a section under Advanced shortcuts
    about using Web APIS in shortcuts with a whole section about working
    with JSON:

    <https://support.apple.com/guide/shortcuts/welcome/ios>

    And in the spirit of not reinventing the wheel, have you considered
    simply installing the open source Aerial screen saver?

    <https://aerialscreensaver.github.io>
    --
    E-mail sent to this address may be devoured by my ravenous SPAM filter.
    I often ignore posts from Google. Use a real news client instead.

    JR
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Chris Schram@chrispam1@me.com to comp.sys.mac.apps on Mon Oct 9 09:12:55 2023
    From Newsgroup: comp.sys.mac.apps

    On 2023-10-08, Jolly Roger <jollyroger@pobox.com> wrote:
    On 2023-10-08, Chris Schram <chrispam1@me.com> wrote:
    A few things first:
    I live in an area where "high=speed Internet" means early 1950s copper
    wire. Fortunately our local public library has the good stuff.

    I recently updated my iMac to macOS Sonoma, and have been trying to play
    with the Aerial screen savers. This is mostly a fool's errand, as all my
    available bandwidth gets sucked up, and I can't do anything else online.

    I have a MacBook Air that's stuck at macOS Monterey that I can take to
    the aforementioned library. That along with the contents of the file... >></Library/Application Support/com.apple.idleassetsd/Customer/entries.json>
    ...gives me everything I need to download ALL the videos

    All that said, I want to write a Shortcuts script that can parse each
    "Dictionary" from the "assets" array, and extract "url-4_240FPS" and
    "id" so I can build a shell script I can take to the library on my old
    MacBook to download ALL the videos.

    That should have been "url-4K-SDR-240FPS" up there. I hadn't noticed my
    JSON reader truncated it.

    I have parsed simple JSON files before in Shortcuts, but it was some
    time ago, and whatever I learned has escaped my elderly brain.

    Can someone help me out here, or point me to a site where the answer
    lies? Thanks.

    I don't have /Library/Application Support/com.apple.idleassetsd on my
    Ventura systems, and am not running Monterey anymore. So I can't look at
    this file.

    That path is found only in Sonoma. It's where all the Aerial screensaver
    magic happens. I may have caused some confusion intermingling Monterey
    and Sonoma in my original post. Rather than lug my Sonoma iMac to the
    library, I'll be doing my downloads on my Monterey MacBook Air.

    Anywa, the Shortcuts User Guide has a section under Advanced shortcuts
    about using Web APIS in shortcuts with a whole section about working
    with JSON:

    <https://support.apple.com/guide/shortcuts/welcome/ios>

    I am very disappointed with the Shortcuts User Guide. It's like it was
    written for someone who doesn't need a Shortcuts User Guide. There are a
    couple of Take Control books that cover Shortcuts, but JSON seems to get
    short shrift.

    I DID eventually create a usable script, by trial-and-error hacking
    until things started working. It generates the essence of a brute-force
    shell script with a whole mess of lines in the form:

    curl <url-4K-SDR-240FPS> --output <id>.mov

    And in the spirit of not reinventing the wheel, have you considered
    simply installing the open source Aerial screen saver?

    <https://aerialscreensaver.github.io>

    I have uses Aerial.saver in the past, and I actually manually (!) went
    through (almost) all of its videos and changed their filenames to the
    indirect ones that the Sonoma screensaver likes. (Except I made a bunch
    of errors.)

    One advantage Aerial.saver has is you can download its videos in lower resolution 1080p, potentially saving a whole lot of storage space.

    When I fed those renamed files into Sonoma, it displayed them OK, but
    then proceeded to redownload each one, It did keep them at the lower
    resolution however. Go figure.
    --
    chrispam1@me.com is a filtered spam magnet. Email replies may be lost.
    You're better off replying to this newsgroup.
    --- Synchronet 3.20a-Linux NewsLink 1.114