SkillsGrove
SkillsGrove/動画制作/sunapp-ai/sun-to-spotify/sun-to-spotify

sun-to-spotify

インストール

$npx skills add https://github.com/sunapp-ai/sun-to-spotify --skill sun-to-spotify
$git clone --depth 1 https://github.com/sunapp-ai/sun-to-spotify.git /tmp/sun-to-spotify && mkdir -p ~/.claude/skills && cp -r /tmp/sun-to-spotify/. ~/.claude/skills/sun-to-spotify
この Agent Skill をインストールしてください:https://github.com/sunapp-ai/sun-to-spotify/tree/ba95926f43ad9bd758bb92a341961dea83f05b90/ — まず SKILL.md とスクリプトを読み、安全であることを確認してから、私のスキルフォルダにインストールしてください。

概要

原文の説明 · Apache-2.0Generate Sun audio and stream episodes to Spotify as a podcast. Uses the `sun` CLI (or HTTP API) to authenticate, mint a personal API token, create an audio job from a prompt, fetch episodes incrementally as they finish, and upload each episode sequentially to a freshly-created Spotify show.
以下の SKILL.md は sunapp-ai/sun-to-spotify(コミット ba95926)から Apache-2.0 ライセンスに基づいて転載しています。本文は変更しておらず、ファイル先頭のメタデータのみ省略し、画像はリンクとして表示し、非常に長いファイルは途中までの表示としています。Copyright owner or entity authorized by。ライセンス:LICENSE。表示しているのは指示ファイルのみです。スクリプト等は元のリポジトリをご覧ください。

sun-to-spotify — Sun Audio Generation + Streaming Spotify Upload

sun-to-spotify produces audio through the Sun public API, then streams each finished episode to Spotify as a podcast episode. Given a prompt and a target duration, it creates a job, fetches episodes incrementally as they finish, and uploads each one in order to a Spotify show (a new show is created by default — one Sun audio = one Spotify show).

The skill is built around the sun CLI (>=0.2.1 for incremental fetch). For environments where the CLI isn't available, the same flow can run directly against the HTTP API.

Naming: the canonical CLI subcommand is sun audio. sun courses still works as a hidden alias that prints a one-line deprecation warning on stderr. Use sun audio in all new examples.

Framing note: when talking to the user, describe the output as a podcast, audiobook, or audio course (whichever fits the topic and duration best — short topical takes lean podcast, long narratives lean audiobook, structured multi-segment lessons lean audio course). Avoid framing this as a "course generator" — it's a versatile audio-experience generator.

Reference Directory

Load only the file you need — don't inline them.

  • references/cli-usage.md — sun CLI commands: login, whoami, tokens, audio. Install methods, flags (including --partial and --callback-url), output layout, JSON mode, env-var overrides, troubleshooting.
  • references/http-api.md — HTTP-only flow when the CLI isn't installed: auth-config discovery, Supabase password grant, token mint, audio create / status / result (with ?include_partial=true and callback_url), signed-URL audio download, rate-limit headers, error envelope.

Install

The sun CLI is independently installable — no monorepo checkout required. Four options, in order of recommendation for external users:

# 1. curl installer (simplest — picks uv/pipx/pip automatically)
# Download first, then inspect, then run — avoids piping remote scripts directly to a shell.
curl -fsSL https://sunapp-ai.github.io/sun-to-spotify/install.sh -o install.sh
bash install.sh

# 2. uv tool (manual, fastest)
uv tool install 'sun-cli>=0.2.1'

# 3. pipx (isolated)
pipx install 'sun-cli>=0.2.1'

# 4. pip
pip install 'sun-cli>=0.2.1'

Verify:

sun --help
sun --version    # prints "sun-cli <version>"

PyPI package name is sun-cli; the installed binary is sun. The curl installer is hosted on GitHub Pages from the sunapp-ai/sun-to-spotify repo and requires uv, pipx, or pip to already be available; if none is, it prints install instructions and exits.

If sun --help fails after install, ask the user how they installed it before troubleshooting. See references/cli-usage.md for monorepo-dev install (uv sync + uv run sun) and platform-specific notes.


Core Principles

Inputs come from the user

Don't invent a prompt. If the user said "make a podcast / audiobook / audio course about X", that's the prompt. If they didn't supply one, ask. Never substitute a creative prompt of your own.

Save incrementally

Write the job_id to disk (or echo it back to the user) immediately after the 202 response. If polling crashes mid-loop, the job keeps generating server-side — re-poll with the same job_id rather than restarting.

Stream — don't wait for the full course

Starting in 0.2.1, episodes finish one-by-one and are visible via sun audio get --partial. As soon as episode 1 lands, start uploading to Spotify. Don't block on SUCCESS before kicking off Spotify uploads — that wastes minutes per episode and the user loses the streaming benefit.

Don't cache signed URLs

audio_url values are signed for 7 days, but the result endpoint re-signs them on every read. Always fetch fresh URLs from sun audio get (which calls /v1/public/courses/{job_id}) right before downloading; never persist them.

Treat SUCCESS and show_uri as eventually consistent

Two surfaces in this pipeline are eventually consistent. Plan for both — neither is a bug:

  • sun audio status returns SUCCESS before every episode's audio_url is signed. Generation completes per-episode, then signed URLs land on a slight delay. Keep calling sun audio get --partial after SUCCESS until every audio_url in the manifest is non-null (equivalently: every NNN-*.mp3 file has appeared under episodes/). Don't treat post-SUCCESS null audio_urls as failures, and don't exit the loop on SUCCESS alone — exit only when every episode has been downloaded and uploaded.
  • save-to-spotify shows create can return {"show_uri": null} and succeed seconds later on retry. Show creation is queued; the URI is confirmed on a short delay. Watch out for jq -r .show_uri rendering JSON null as the literal string "null" — that's not a valid URI. Use jq -r '.show_uri // empty' so the result is empty on null, then retry the same shows create call on the next poll until a real URI lands. Never upload with --show-id null.

The streaming loop in section 2 implements both rules. If you adapt it, preserve those guards.

Surface server-reported errors verbatim

The API returns a bare {"error": {"code": "...", "message": "...", ...}} envelope on every non-2xx. When something fails, show the user the error.message and error.code — don't paraphrase or hide them. For 429, read Retry-After instead of computing waits yourself.


Required Inputs

Before generating, confirm the user has supplied:

  1. Prompt — the topic for the audio (podcast, audiobook, or audio course). 1-4000 chars. Mandatory.
  2. Duration — minutes of audio. 5-120, default 30. Optional.
  3. Voice — voice UUID. Optional. If not given, the API picks a default.
  4. Output directory — where to save the manifest + downloaded MP3s. Optional; default to ./audio-<short-job-id>/.
  5. Spotify show choice — defaults to creating a new show named after the manifest's name field. Only switch to "publish under an existing show" if the user explicitly asks.
  6. Spotify cover image — defaults to the cover.<ext> file sun audio get downloads. Only ask for a replacement path if the user explicitly wants one, or if Spotify rejects the auto cover for size/format reasons.

If the prompt is missing, ask once and stop. Don't proceed without it.


Execution Checklist

Run these in order. Do not skip preflight.

0. Preflight — CLI presence and auth

sun --help              # verify the CLI is on PATH and runnable
sun whoami              # verify there's an active session + token
  • If sun --help fails, the CLI isn't installed. Show the user the Install section above and ask them to confirm before running the installer. If install isn't possible, fall back to the HTTP flow in references/http-api.md.
  • If whoami reports unauthenticated: do not run sun login from the agent. sun login opens a browser for the loopback POST handoff — this won't complete in an agent context, and there is no --email/--password fallback. Ask the user to run sun login themselves in their terminal and re-invoke the skill. If the user is signing up for the first time, remind them to click the confirmation email link on the same machine where sun login is still running — the original loopback completes automatically post-confirmation, no second sun login needed. The same applies to the password-reset flow. For CI / fully non-interactive contexts, the user must first run sun login interactively on a machine with a browser, then carry the resulting ~/.config/sun/credentials.json (or a minted SUN_TOKEN) over to the headless environment.
  • If whoami reports authenticated but no active token, run sun tokens create <name> (<name> matches ^[a-z0-9-]+$, 1-64 chars). The full secret prints to stdout once and is stored as the active token; surface it to the user but never log it elsewhere.

1. Create the audio job

sun audio create \
  --prompt "<the user's prompt>" \
  --duration-minutes <N> \
  --json
# Prints {"job_id": "...", ...} to stdout. Do NOT pass --wait — we need
# control of the streaming loop in the next step.
  • Pass --voice-id <uuid> if the user specified a voice.
  • Pass the prompt via --input <path> or stdin if it's longer than a comfortable shell argument.
  • A 429 response means the user hit their daily limit. Show them error.message, Retry-After, and X-RateLimit-Reset. Do not auto-retry.

Save the job_id immediately:

JOB_ID=$(sun audio create --prompt "..." --duration-minutes 30 --json | jq -r .job_id)
echo "$JOB_ID" > "$OUT_DIR/.sun-job-id"   # so a crash + restart can resume

2. Stream episodes → Spotify as they finish

This is the new core flow. The skill polls sun audio get --partial every ~10 seconds. As each new episode lands in episodes/NNN-<slug>.mp3, it uploads to Spotify in order. The first episode to land also triggers Spotify show creation (we need the cover and the manifest's name to seed the show).

Output layout (after at least one sun audio get --partial)

<OUT_DIR>/
  overview.json                                                # the manifest (source of truth)
  cover.<ext>                                                  # downloaded cover image (Spotify show cover)
  episodes/
    001-<slug>.mp3                                             # first episode audio
    001-<slug>.<ext>                                           # first episode artwork (optional)
    002-<slug>.mp3
    002-<slug>.<ext>
    ...

Filename convention: NNN-<slug>.mp3 where NNN is the zero-padded episode number (001, 002, …). The slug is the episode title slugified by the CLI. 001 is the first episode and is always uploaded first; sequential ordering is preserved.

Show creation policy

  • Default: create a new Spotify show. One Sun audio = one Spotify show.
  • Title: overview.json .name field.
  • Summary: overview.json .description field (may be empty mid-generation; re-read after SUCCESS if you want the refined description).
  • Cover: the cover.<ext> file under <OUT_DIR>/.
  • Only deviate from "create new" if the user explicitly says "publish under my existing show <X>".

The streaming loop

OUT_DIR=./audio-${JOB_ID:0:8}
mkdir -p "$OUT_DIR"
SHOW_URI=""
COVER=""
declare -a UPLOADED=()    # episode numbers we've already uploaded

while true; do
  STATUS=$(sun audio status "$JOB_ID" --json | jq -r .status)

  # Pull whatever's ready right now. The CLI quietly skips episodes whose
  # audio_url is still null, so it's safe to call repeatedly.
  sun audio get "$JOB_ID" --partial --out "$OUT_DIR" >/dev/null 2>&1 || true

  # Create the Spotify show on first episode arrival (we now have cover + name).
  # `shows create` is eventually consistent: it can return show_uri=null and succeed
  # on the next call. Retry while SHOW_URI is empty — never persist literal "null".
  if [ -z "$SHOW_URI" ] && \
     [ -f "$OUT_DIR/overview.json" ] && \
     ls "$OUT_DIR"/episodes/001-*.mp3 >/dev/null 2>&1; then
    COVER=$(ls "$OUT_DIR"/cover.* 2>/dev/null | head -1)
    SHOW_TITLE=$(jq -r '.name'                "$OUT_DIR/overview.json")
    SHOW_DESC=$( jq -r '.description // ""'    "$OUT_DIR/overview.json")

    SHOW_URI=$(save-to-spotify --json shows create \
      --title   "$SHOW_TITLE" \
      --summary "$SHOW_DESC" \
      --image   "$COVER" \
      | jq -r '.show_uri // empty')   # `// empty` collapses JSON null to "" instead of "null"
    if [ -n "$SHOW_URI" ]; then
      echo "[show ] created: $SHOW_TITLE → $SHOW_URI"
    else
      echo "[show ] not ready yet — will retry next poll"
    fi
  fi

  # If the show is ready, upload each new episode in order.
  if [ -n "$SHOW_URI" ] && [ -f "$OUT_DIR/overview.json" ]; then
    TOTAL=$(jq -r '.lectures | length' "$OUT_DIR/overview.json")
    NEXT=$(( ${#UPLOADED[@]} + 1 ))

    while [ "$NEXT" -le "$TOTAL" ]; do
      FILE=$(ls "$OUT_DIR"/episodes/$(printf "%03d" "$NEXT")-*.mp3 2>/dev/null | head -1)
      [ -z "$FILE" ] && break   # not ready yet — try again next poll

      TITLE=$(jq -r --argjson n "$NEXT" '.lectures[] | select(.number == $n) | .title' "$OUT_DIR/overview.json")

      save-to-spotify --json upload "$FILE" \
        --title   "$TITLE" \
        --show-id "$SHOW_URI" \
        --image   "$COVER" >/dev/null

      UPLOADED+=( "$NEXT" )
      echo "[upload] episode $NEXT/$TOTAL: $TITLE"
      NEXT=$(( NEXT + 1 ))
    done

    # Progress checklist after each iteration.
    print_checklist "$TOTAL" "${UPLOADED[@]}"
  fi

  # Terminate when sun says SUCCESS AND every episode has been uploaded.
  # SUCCESS can fire before every audio_url is signed — keep iterating so the
  # next `sun audio get --partial` picks up late-signed episodes.
  if [ "$STATUS" = "SUCCESS" ] && [ -n "$SHOW_URI" ] && \
     [ "${#UPLOADED[@]}" -eq "$TOTAL" ]; then
    break
  fi
  if [ "$STATUS" = "ERROR" ]; then
    echo "Generation failed. Read 'sun audio status $JOB_ID --json' for details." >&2
    exit 1
  fi

  sleep 10
done

echo "[done ] All $TOTAL episodes uploaded to $SHOW_URI"

print_checklist formats one line per episode. Render it after every upload so the user can watch progress live:

Sun → Spotify upload progress (5/10):
  [x] 001 — From Manya to Governess: Early Years and Formative Struggles
  [x] 002 — Paris and the Pursuit of Science
  [x] 003 — Discovering Radioactivity
  [x] 004 — Polonium and Radium: The Discovery of New Elements
  [x] 005 — Nobel Prizes and International Recognition
  [ ] 006 — generating…
  [ ] 007 — generating…
  [ ] 008 — generating…
  [ ] 009 — generating…
  [ ] 010 — generating…

For each line, look up the title from overview.json by episode number. Episodes still mid-generation will be in the manifest but their audio_url will be null — surface them as "generating…" so the user can see the total expected count from the start.

Webhook alternative

If the user is running their own publicly-reachable HTTP endpoint, you can register it with --callback-url at job creation and replace the polling loop with a push-driven upload. The webhook body is:

{
  "event": "episode_ready",
  "job_id": "...",
  "episode_id": "...",
  "episode_number": 1,
  "title": "...",
  "audio_url": "https://...signed.../l1.mp3?token=..."
}

Treat the webhook as a hint — still fetch sun audio get --partial --out DIR for the manifest + a fresh signed URL before uploading. Webhooks are best-effort (fire-and-forget on the server). The polling loop is the recommended default; the webhook is for users with an existing HTTP receiver.

3. Final verification

When the loop exits, confirm the manifest's lecture count matches the uploaded count:

TOTAL=$(jq -r '.lectures | length' "$OUT_DIR/overview.json")
echo "Manifest expected $TOTAL episodes; uploaded ${#UPLOADED[@]}."
test "$TOTAL" -eq "${#UPLOADED[@]}" || echo "WARNING: count mismatch — re-run the loop to pick up missing episodes." >&2

If counts disagree, re-run the streaming loop once. The CLI's --partial fetch re-signs URLs and fills in any episode whose audio_url was transiently null on the previous pass. If they still disagree, surface the gap to the user — don't loop indefinitely.


End-to-end example

User request: "Make me a 30-minute course on Marie Curie and publish it to Spotify."

sun --help >/dev/null || { echo "CLI not installed"; exit 1; }
sun whoami >/dev/null || { echo "Not logged in. Run 'sun login' in your terminal first."; exit 1; }
save-to-spotify --json auth status >/dev/null \
  || { echo "Not authed with Spotify. Run 'save-to-spotify auth login' first."; exit 1; }

JOB_ID=$(sun audio create \
  --prompt "The life and scientific contributions of Marie Curie" \
  --duration-minutes 30 \
  --json | jq -r .job_id)

OUT_DIR="./audio-${JOB_ID:0:8}"
mkdir -p "$OUT_DIR"
echo "$JOB_ID" > "$OUT_DIR/.sun-job-id"
echo "job_id: $JOB_ID"

# Then run the streaming loop in section 2. After it returns,
# `$SHOW_URI` holds the Spotify show URI for the user.

When the user wants the rich save-to-spotify production flow

If the user wants save-to-spotify's content production (custom timeline with chapters, image companions, external links, Spotify entity cards, polished cover generation) rather than a straight upload of sun's MP3s, that's outside this skill's scope. Defer to the full save-to-spotify skill — it owns the rich-timeline production pipeline.

sun-to-spotify only does sun audio → straight Spotify upload. It hands off to save-to-spotify's auth, shows, and upload surfaces; it does not invoke save-to-spotify's interview, scripting, TTS, or timeline production.


Error handling

Surface save-to-spotify errors verbatim — its JSON envelope already carries error.code and error.message. Do not auto-retry on 429 or auth_required.

If Spotify rejects the cover image on shows create (wrong dimensions, wrong format, file too small), tell the user the exact error and ask for a replacement path. Spotify requires roughly 3000×3000 JPG/PNG, ≤500KB; the auto-downloaded cover.<ext> usually meets this but isn't guaranteed.


When the CLI isn't available

If sun isn't installable (sandboxed env, restricted shell, etc.), the HTTP API supports the same operations. See references/http-api.md — it covers auth-config discovery, the Supabase password grant for token minting, audio create / status / result (including ?include_partial=true and callback_url), and the audio-download loop in pure curl or httpx.

ライセンス全文を見る(Apache-2.0)
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.