[
  {
    "path": ".github/CODEOWNERS",
    "content": ".github/* @frenck\n"
  },
  {
    "path": ".github/CODE_OF_CONDUCT.md",
    "content": "# Contributor Covenant 3.0 Code of Conduct\n\n## Our Pledge\n\nWe pledge to make our community welcoming, safe, and equitable for all.\n\nWe are committed to fostering an environment that respects and promotes the\ndignity, rights, and contributions of all individuals, regardless of\ncharacteristics including race, ethnicity, caste, color, age, physical\ncharacteristics, neurodiversity, disability, sex or gender, gender identity or\nexpression, sexual orientation, language, philosophy or religion, national or\nsocial origin, socio-economic position, level of education, or other status.\nThe same privileges of participation are extended to everyone who participates\nin good faith and in accordance with this Covenant.\n\n## Encouraged Behaviors\n\nWhile acknowledging differences in social norms, we all strive to meet our\ncommunity's expectations for positive behavior. We also understand that our\nwords and actions may be interpreted differently than we intend based on\nculture, background, or native language.\n\nWith these considerations in mind, we agree to behave mindfully toward each\nother and act in ways that center our shared values, including:\n\n1. Respecting the **purpose of our community**, our activities, and our ways of\n   gathering.\n2. Engaging **kindly and honestly** with others.\n3. Respecting **different viewpoints** and experiences.\n4. **Taking responsibility** for our actions and contributions.\n5. Gracefully giving and accepting **constructive feedback**.\n6. Committing to **repairing harm** when it occurs.\n7. Behaving in other ways that promote and sustain the **well-being of our\n   community**.\n\n## Restricted Behaviors\n\nWe agree to restrict the following behaviors in our community. Instances,\nthreats, and promotion of these behaviors are violations of this Code of\nConduct.\n\n1. **Harassment.** Violating explicitly expressed boundaries or engaging in\n   unnecessary personal attention after any clear request to stop.\n2. **Character attacks.** Making insulting, demeaning, or pejorative comments\n   directed at a community member or group of people.\n3. **Stereotyping or discrimination.** Characterizing anyone's personality or\n   behavior on the basis of immutable identities or traits.\n4. **Sexualization.** Behaving in a way that would generally be considered\n   inappropriately intimate in the context or purpose of the community.\n5. **Violating confidentiality**. Sharing or acting on someone's personal or\n   private information without their permission.\n6. **Endangerment.** Causing, encouraging, or threatening violence or other\n   harm toward any person or group.\n7. Behaving in other ways that **threaten the well-being** of our community.\n\n### Other Restrictions\n\n1. **Misleading identity.** Impersonating someone else for any reason, or\n   pretending to be someone else to evade enforcement actions.\n2. **Failing to credit sources.** Not properly crediting the sources of content\n   you contribute.\n3. **Promotional materials**. Sharing marketing or other commercial content in\n   a way that is outside the norms of the community.\n4. **Irresponsible communication.** Failing to responsibly present content\n   which includes, links or describes any other restricted behaviors.\n\n## Reporting an Issue\n\nTensions can occur between community members even when they are trying their\nbest to collaborate. Not every conflict represents a code of conduct violation,\nand this Code of Conduct reinforces encouraged behaviors and norms that can\nhelp avoid conflicts and minimize harm.\n\nWhen an incident does occur, it is important to report it promptly. To report a\npossible violation, send an email to `opensource@frenck.dev`.\n\nCommunity Moderators take reports of violations seriously and will make every\neffort to respond in a timely manner. They will investigate all reports of code\nof conduct violations, reviewing messages, logs, and recordings, or interviewing\nwitnesses and other participants. Community Moderators will keep investigation\nand enforcement actions as transparent as possible while prioritizing safety and\nconfidentiality. In order to honor these values, enforcement actions are carried\nout in private with the involved parties, but communicating to the whole\ncommunity may be part of a mutually agreed upon resolution.\n\n## Addressing and Repairing Harm\n\nIf an investigation by the Community Moderators finds that this Code of Conduct\nhas been violated, the following enforcement ladder may be used to determine how\nbest to repair harm, based on the incident's impact on the individuals involved\nand the community as a whole. Depending on the severity of a violation, lower\nrungs on the ladder may be skipped.\n\n1. Warning\n   1. Event: A violation involving a single incident or series of incidents.\n   2. Consequence: A private, written warning from the Community Moderators.\n   3. Repair: Examples of repair include a private written apology,\n      acknowledgement of responsibility, and seeking clarification on\n      expectations.\n2. Temporarily Limited Activities\n   1. Event: A repeated incidence of a violation that previously resulted in a\n      warning, or the first incidence of a more serious violation.\n   2. Consequence: A private, written warning with a time-limited cooldown\n      period designed to underscore the seriousness of the situation and give\n      the community members involved time to process the incident. The cooldown\n      period may be limited to particular communication channels or interactions\n      with particular community members.\n   3. Repair: Examples of repair may include making an apology, using the\n      cooldown period to reflect on actions and impact, and being thoughtful\n      about re-entering community spaces after the period is over.\n3. Temporary Suspension\n   1. Event: A pattern of repeated violation which the Community Moderators have\n      tried to address with warnings, or a single serious violation.\n   2. Consequence: A private written warning with conditions for return from\n      suspension. In general, temporary suspensions give the person being\n      suspended time to reflect upon their behavior and possible corrective\n      actions.\n   3. Repair: Examples of repair include respecting the spirit of the\n      suspension, meeting the specified conditions for return, and being\n      thoughtful about how to reintegrate with the community when the suspension\n      is lifted.\n4. Permanent Ban\n   1. Event: A pattern of repeated code of conduct violations that other steps\n      on the ladder have failed to resolve, or a violation so serious that the\n      Community Moderators determine there is no way to keep the community safe\n      with this person as a member.\n   2. Consequence: Access to all community spaces, tools, and communication\n      channels is removed. In general, permanent bans should be rarely used,\n      should have strong reasoning behind them, and should only be resorted to\n      if working through other remedies has failed to change the behavior.\n   3. Repair: There is no possible repair in cases of this severity.\n\nThis enforcement ladder is intended as a guideline. It does not limit the\nability of Community Managers to use their discretion and judgment, in keeping\nwith the best interests of our community.\n\n## Scope\n\nThis Code of Conduct applies within all community spaces, and also applies when\nan individual is officially representing the community in public or other spaces.\nExamples of representing our community include using an official email address,\nposting via an official social media account, or acting as an appointed\nrepresentative at an online or offline event.\n\n## Attribution\n\nThis Code of Conduct is adapted from the Contributor Covenant, version 3.0,\npermanently available at\n[https://www.contributor-covenant.org/version/3/0/](https://www.contributor-covenant.org/version/3/0/).\n\nContributor Covenant is stewarded by the Organization for Ethical Source and\nlicensed under CC BY-SA 4.0. To view a copy of this license, visit\n[https://creativecommons.org/licenses/by-sa/4.0/](https://creativecommons.org/licenses/by-sa/4.0/)\n\nFor answers to common questions about Contributor Covenant, see the FAQ at\n[https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq).\nTranslations are provided at\n[https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations).\nAdditional enforcement and community guideline resources can be found at\n[https://www.contributor-covenant.org/resources](https://www.contributor-covenant.org/resources).\nThe enforcement ladder was inspired by the work of\n[Mozilla's code of conduct team](https://github.com/mozilla/inclusion).\n"
  },
  {
    "path": ".github/CONTRIBUTING.md",
    "content": "# Contributing\n\nWhen contributing to this repository, please first discuss the change you wish\nto make via issue, email, or any other method with the owners of this repository\nbefore making a change.\n\nPlease note we have a code of conduct, please follow it in all your interactions\nwith the project.\n\n## Issues and feature requests\n\nYou've found a bug in the source code, a mistake in the documentation or maybe\nyou'd like a new feature? You can help us by submitting an issue to our\n[GitHub Repository][github]. Before you create an issue, make sure you search\nthe archive, maybe your question was already answered.\n\nEven better: You could submit a pull request with a fix / new feature!\n\n## Pull request process\n\n1. Search our repository for open or closed [pull requests][prs] that relates\n   to your submission. You don't want to duplicate effort.\n\n1. You may merge the pull request in once you have the sign-off of two other\n   developers, or if you do not have permission to do that, you may request\n   the second reviewer to merge it for you.\n\n[github]: https://github.com/hassio-addons/app-plex/issues\n[prs]: https://github.com/hassio-addons/app-plex/pulls\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "---\ngithub: frenck\npatreon: frenck\ncustom: https://frenck.dev/donate/\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "content": "# Problem/Motivation\n\n> (Why the issue was filed)\n\n## Expected behavior\n\n> (What you expected to happen)\n\n## Actual behavior\n\n> (What actually happened)\n\n## Steps to reproduce\n\n> (How can someone else make/see it happen)\n\n## Proposed changes\n\n> (If you have a proposed change, workaround or fix,\n> describe the rationale behind it)\n"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "content": "# Proposed Changes\n\n> (Describe the changes and rationale behind them)\n\n## Related Issues\n\n> ([Github link][autolink-references] to related issues or pull requests)\n\n[autolink-references]: https://help.github.com/articles/autolinked-references-and-urls/\n"
  },
  {
    "path": ".github/SECURITY.md",
    "content": "# Security Policy\n\nWe take the security of this project seriously. We appreciate your efforts to responsibly disclose your findings and will make every effort to acknowledge your contributions.\n\n## Reporting a Vulnerability\n\n**Please do not report security vulnerabilities through public GitHub issues.**\n\nIf you discover a security vulnerability, please report it via GitHub's private vulnerability reporting:\n\n1. Navigate to the Security tab of this repository\n2. Click \"Report a vulnerability\"\n3. Provide a description of the vulnerability and steps to reproduce\n\nAfter the initial report, we will keep you informed of the progress towards a fix and may ask for additional information or guidance.\n\nWe aim to address reported vulnerabilities within 90 days.\n\nThank you for helping keep this project secure!\n"
  },
  {
    "path": ".github/labels.yml",
    "content": "---\n- name: \"breaking-change\"\n  color: ee0701\n  description: \"A breaking change for existing users.\"\n- name: \"bugfix\"\n  color: ee0701\n  description: \"Inconsistencies or issues which will cause a problem for users or implementors.\"\n- name: \"documentation\"\n  color: 0052cc\n  description: \"Solely about the documentation of the project.\"\n- name: \"enhancement\"\n  color: 1d76db\n  description: \"Enhancement of the code, not introducing new features.\"\n- name: \"refactor\"\n  color: 1d76db\n  description: \"Improvement of existing code, not introducing new features.\"\n- name: \"performance\"\n  color: 1d76db\n  description: \"Improving performance, not introducing new features.\"\n- name: \"new-feature\"\n  color: 0e8a16\n  description: \"New features or options.\"\n- name: \"maintenance\"\n  color: 2af79e\n  description: \"Generic maintenance tasks.\"\n- name: \"ci\"\n  color: 1d76db\n  description: \"Work that improves the continue integration.\"\n- name: \"dependencies\"\n  color: 1d76db\n  description: \"Upgrade or downgrade of project dependencies.\"\n\n- name: \"in-progress\"\n  color: fbca04\n  description: \"Issue is currently being resolved by a developer.\"\n- name: \"stale\"\n  color: fef2c0\n  description: \"There has not been activity on this issue or PR for quite some time.\"\n- name: \"no-stale\"\n  color: fef2c0\n  description: \"This issue or PR is exempted from the stable bot.\"\n\n- name: \"security\"\n  color: ee0701\n  description: \"Marks a security issue that needs to be resolved asap.\"\n- name: \"incomplete\"\n  color: fef2c0\n  description: \"Marks a PR or issue that is missing information.\"\n- name: \"invalid\"\n  color: fef2c0\n  description: \"Marks a PR or issue that is missing information.\"\n\n- name: \"beginner-friendly\"\n  color: 0e8a16\n  description: \"Good first issue for people wanting to contribute to the project.\"\n- name: \"help-wanted\"\n  color: 0e8a16\n  description: \"We need some extra helping hands or expertise in order to resolve this.\"\n\n- name: \"hacktoberfest\"\n  description: \"Issues/PRs are participating in the Hacktoberfest.\"\n  color: fbca04\n- name: \"hacktoberfest-accepted\"\n  description: \"Issues/PRs are participating in the Hacktoberfest.\"\n  color: fbca04\n\n- name: \"priority-critical\"\n  color: ee0701\n  description: \"This should be dealt with ASAP. Not fixing this issue would be a serious error.\"\n- name: \"priority-high\"\n  color: b60205\n  description: \"After critical issues are fixed, these should be dealt with before any further issues.\"\n- name: \"priority-medium\"\n  color: 0e8a16\n  description: \"This issue may be useful, and needs some attention.\"\n- name: \"priority-low\"\n  color: e4ea8a\n  description: \"Nice addition, maybe... someday...\"\n\n- name: \"major\"\n  color: b60205\n  description: \"This PR causes a major version bump in the version number.\"\n- name: \"minor\"\n  color: 0e8a16\n  description: \"This PR causes a minor version bump in the version number.\"\n"
  },
  {
    "path": ".github/release-drafter.yml",
    "content": "---\nname-template: \"v$RESOLVED_VERSION\"\ntag-template: \"v$RESOLVED_VERSION\"\nchange-template: \"- $TITLE @$AUTHOR (#$NUMBER)\"\nsort-direction: ascending\n\ncategories:\n  - title: \"🚨 Breaking changes\"\n    labels:\n      - \"breaking-change\"\n  - title: \"✨ New features\"\n    labels:\n      - \"new-feature\"\n  - title: \"🐛 Bug fixes\"\n    labels:\n      - \"bugfix\"\n  - title: \"🚀 Enhancements\"\n    labels:\n      - \"enhancement\"\n      - \"refactor\"\n      - \"performance\"\n  - title: \"🧰 Maintenance\"\n    labels:\n      - \"maintenance\"\n      - \"ci\"\n  - title: \"📚 Documentation\"\n    labels:\n      - \"documentation\"\n  - title: \"⬆️ Dependency updates\"\n    labels:\n      - \"dependencies\"\n    collapse-after: 5\n\nversion-resolver:\n  major:\n    labels:\n      - \"major\"\n      - \"breaking-change\"\n  minor:\n    labels:\n      - \"minor\"\n      - \"new-feature\"\n  patch:\n    labels:\n      - \"bugfix\"\n      - \"chore\"\n      - \"ci\"\n      - \"dependencies\"\n      - \"documentation\"\n      - \"enhancement\"\n      - \"performance\"\n      - \"refactor\"\n  default: patch\n\ntemplate: |\n  ## What’s changed\n\n  $CHANGES\n"
  },
  {
    "path": ".github/renovate.json",
    "content": "{\n  \"$schema\": \"https://docs.renovatebot.com/renovate-schema.json\",\n  \"extends\": [\"helpers:pinGitHubActionDigests\"],\n  \"rebaseWhen\": \"behind-base-branch\",\n  \"dependencyDashboard\": true,\n  \"labels\": [\"dependencies\", \"no-stale\"],\n  \"commitMessagePrefix\": \"⬆️\",\n  \"commitMessageTopic\": \"{{depName}}\",\n  \"customDatasources\": {\n    \"plex\": {\n      \"defaultRegistryUrlTemplate\": \"https://plex.tv/api/downloads/5.json\",\n      \"transformTemplates\": [\n        \"{\\\"releases\\\": [{\\\"version\\\": $.computer.Linux.version}]}\"\n      ]\n    }\n  },\n  \"customManagers\": [\n    {\n      \"customType\": \"regex\",\n      \"managerFilePatterns\": [\"//Dockerfile$/\", \"//build.yaml$/\"],\n      \"matchStringsStrategy\": \"any\",\n      \"matchStrings\": [\n        \"ARG BUILD_FROM=(?<depName>.*?):(?<currentValue>.*?)\\\\s+\",\n        \"(aarch64|amd64):\\\\s[\\\"']?(?<depName>.*?):(?<currentValue>.*?)[\\\"']?\\\\s\"\n      ],\n      \"datasourceTemplate\": \"docker\"\n    },\n    {\n      \"customType\": \"regex\",\n      \"managerFilePatterns\": [\"//Dockerfile$/\"],\n      \"matchStrings\": [\"ARG PLEX_VERSION=(?<currentValue>[^\\\\s]+)\\\\s+\"],\n      \"depNameTemplate\": \"plexmediaserver\",\n      \"datasourceTemplate\": \"custom.plex\",\n      \"versioningTemplate\": \"loose\"\n    },\n    {\n      \"customType\": \"regex\",\n      \"managerFilePatterns\": [\"//Dockerfile$/\"],\n      \"matchStringsStrategy\": \"any\",\n      \"matchStrings\": [\n        \"\\\\s\\\\s(?<depName>[a-z0-9][a-z0-9-]+)=(?<currentValue>[a-z0-9-:_+~.]+)\\\\s+\"\n      ],\n      \"versioningTemplate\": \"deb\",\n      \"datasourceTemplate\": \"repology\",\n      \"depNameTemplate\": \"debian_13/{{depName}}\"\n    }\n  ],\n  \"packageRules\": [\n    {\n      \"matchDatasources\": [\"repology\"],\n      \"automerge\": true\n    },\n    {\n      \"groupName\": \"App base image\",\n      \"matchDatasources\": [\"docker\"]\n    },\n    {\n      \"groupName\": \"App base image\",\n      \"matchDatasources\": [\"docker\"],\n      \"matchUpdateTypes\": [\"minor\", \"patch\"],\n      \"automerge\": true\n    },\n    {\n      \"matchManagers\": [\"github-actions\"],\n      \"addLabels\": [\"github_actions\"],\n      \"rangeStrategy\": \"pin\"\n    },\n    {\n      \"matchManagers\": [\"github-actions\"],\n      \"matchUpdateTypes\": [\"minor\", \"patch\"],\n      \"automerge\": true\n    }\n  ]\n}\n"
  },
  {
    "path": ".github/workflows/ci.yaml",
    "content": "---\nname: CI\n\n# yamllint disable-line rule:truthy\non:\n  pull_request:\n    types:\n      - opened\n      - reopened\n      - synchronize\n  workflow_dispatch:\n\npermissions:\n  actions: read\n  contents: write\n  pull-requests: read\n  packages: read\n  security-events: write\n\njobs:\n  workflows:\n    uses: hassio-addons/workflows/.github/workflows/app-ci.yaml@3846ae0fd09acec8ac1ac308ceacd052b9d01bec # v2.0.6\n"
  },
  {
    "path": ".github/workflows/deploy.yaml",
    "content": "---\nname: Deploy\n\n# yamllint disable-line rule:truthy\non:\n  push:\n    branches:\n      - main\n  release:\n    types:\n      - published\n\npermissions: {}\n\njobs:\n  ci:\n    permissions:\n      actions: read\n      contents: write\n      pull-requests: read\n      packages: read\n      security-events: write\n    uses: hassio-addons/workflows/.github/workflows/app-ci.yaml@3846ae0fd09acec8ac1ac308ceacd052b9d01bec # v2.0.6\n\n  deploy:\n    needs: ci\n    permissions:\n      contents: read\n      packages: write\n    uses: hassio-addons/workflows/.github/workflows/app-deploy.yaml@3846ae0fd09acec8ac1ac308ceacd052b9d01bec # v2.0.6\n    secrets:\n      DISPATCH_TOKEN: ${{ secrets.DISPATCH_TOKEN }}\n"
  },
  {
    "path": ".github/workflows/labels.yaml",
    "content": "---\nname: Sync labels\n\n# yamllint disable-line rule:truthy\non:\n  schedule:\n    - cron: \"34 5 * * *\"\n  workflow_dispatch:\n\npermissions:\n  issues: write\n\njobs:\n  workflows:\n    uses: hassio-addons/workflows/.github/workflows/labels.yaml@3846ae0fd09acec8ac1ac308ceacd052b9d01bec # v2.0.6\n"
  },
  {
    "path": ".github/workflows/lock.yaml",
    "content": "---\nname: Lock\n\n# yamllint disable-line rule:truthy\non:\n  schedule:\n    - cron: \"0 9 * * *\"\n  workflow_dispatch:\n\npermissions:\n  issues: write\n  pull-requests: write\n\njobs:\n  workflows:\n    uses: hassio-addons/workflows/.github/workflows/lock.yaml@3846ae0fd09acec8ac1ac308ceacd052b9d01bec # v2.0.6\n"
  },
  {
    "path": ".github/workflows/pr-labels.yaml",
    "content": "---\nname: PR Labels\n\n# yamllint disable-line rule:truthy\non:\n  pull_request:\n    types:\n      - opened\n      - labeled\n      - unlabeled\n      - synchronize\n\npermissions: {}\n\njobs:\n  workflows:\n    uses: hassio-addons/workflows/.github/workflows/pr-labels.yaml@3846ae0fd09acec8ac1ac308ceacd052b9d01bec # v2.0.6\n"
  },
  {
    "path": ".github/workflows/release-drafter.yaml",
    "content": "---\nname: Release Drafter\n\n# yamllint disable-line rule:truthy\non:\n  push:\n    branches:\n      - main\n  workflow_dispatch:\n\npermissions:\n  contents: read\n\njobs:\n  release-drafter:\n    name: ✏️ Draft release\n    runs-on: ubuntu-latest\n    permissions:\n      contents: write\n      pull-requests: write\n    steps:\n      - name: 🚀 Run Release Drafter\n        uses: release-drafter/release-drafter@563bf132657a13ded0b01fcb723c5a58cdd824e2 # v7.2.1\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n"
  },
  {
    "path": ".github/workflows/stale.yaml",
    "content": "---\nname: Stale\n\n# yamllint disable-line rule:truthy\non:\n  schedule:\n    - cron: \"0 8 * * *\"\n  workflow_dispatch:\n\npermissions:\n  issues: write\n  pull-requests: write\n\njobs:\n  workflows:\n    uses: hassio-addons/workflows/.github/workflows/stale.yaml@3846ae0fd09acec8ac1ac308ceacd052b9d01bec # v2.0.6\n"
  },
  {
    "path": ".mdlrc",
    "content": "rules \"~MD024\""
  },
  {
    "path": ".yamllint",
    "content": "---\nrules:\n  braces:\n    level: error\n    min-spaces-inside: 0\n    max-spaces-inside: 1\n    min-spaces-inside-empty: -1\n    max-spaces-inside-empty: -1\n  brackets:\n    level: error\n    min-spaces-inside: 0\n    max-spaces-inside: 0\n    min-spaces-inside-empty: -1\n    max-spaces-inside-empty: -1\n  colons:\n    level: error\n    max-spaces-before: 0\n    max-spaces-after: 1\n  commas:\n    level: error\n    max-spaces-before: 0\n    min-spaces-after: 1\n    max-spaces-after: 1\n  comments:\n    level: error\n    require-starting-space: true\n    min-spaces-from-content: 1\n  comments-indentation:\n    level: error\n  document-end:\n    level: error\n    present: false\n  document-start:\n    level: error\n    present: true\n  empty-lines:\n    level: error\n    max: 1\n    max-start: 0\n    max-end: 1\n  hyphens:\n    level: error\n    max-spaces-after: 1\n  indentation:\n    level: error\n    spaces: 2\n    indent-sequences: true\n    check-multi-line-strings: false\n  key-duplicates:\n    level: error\n  line-length: false\n  new-line-at-end-of-file:\n    level: error\n  new-lines:\n    level: error\n    type: unix\n  trailing-spaces:\n    level: error\n  truthy:\n    level: error\n"
  },
  {
    "path": "LICENSE.md",
    "content": "# MIT License\n\nCopyright (c) 2018-2026 Franck Nijhof\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# Home Assistant Community App: Plex Media Server\n\n[![GitHub Release][releases-shield]][releases]\n![Project Stage][project-stage-shield]\n[![License][license-shield]](LICENSE.md)\n\n![Supports aarch64 Architecture][aarch64-shield]\n![Supports amd64 Architecture][amd64-shield]\n\n[![Github Actions][github-actions-shield]][github-actions]\n![Project Maintenance][maintenance-shield]\n[![GitHub Activity][commits-shield]][commits]\n\n[![Discord][discord-shield]][discord]\n[![Community Forum][forum-shield]][forum]\n\n[![Sponsor Frenck via GitHub Sponsors][github-sponsors-shield]][github-sponsors]\n\n[![Support Frenck on Patreon][patreon-shield]][patreon]\n\nYour recorded media, live TV, online news, and podcasts, beautifully organized\nand ready to stream.\n\n[:books: Read the full app documentation][docs]\n\n## About\n\nThe plex app brings your favorite media together in one place, making it\nbeautiful and easy to enjoy. The Plex Media Server provided by this app,\norganizes your personal video, music, and photo collections\nand streams them to all of your devices.\n\n## Support\n\nGot questions?\n\nYou have several options to get them answered:\n\n- The [Home Assistant Community Apps Discord chat server][discord] for app\n  support and feature requests.\n- The [Home Assistant Discord chat server][discord-ha] for general Home\n  Assistant discussions and questions.\n- The Home Assistant [Community Forum][forum].\n- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit]\n\nYou could also [open an issue here][issue] GitHub.\n\n## Contributing\n\nThis is an active open-source project. We are always open to people who want to\nuse the code or contribute to it.\n\nWe have set up a separate document containing our\n[contribution guidelines](.github/CONTRIBUTING.md).\n\nThank you for being involved! :heart_eyes:\n\n## Authors & contributors\n\nThe original setup of this repository is by [Franck Nijhof][frenck].\n\nFor a full list of all authors and contributors,\ncheck [the contributor's page][contributors].\n\n## We have got some Home Assistant apps for you\n\nWant some more functionality to your Home Assistant instance?\n\nWe have created multiple apps for Home Assistant. For a full list, check out\nour [GitHub Repository][repository].\n\n## License\n\nMIT License\n\nCopyright (c) 2018-2026 Franck Nijhof\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg\n[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg\n[commits-shield]: https://img.shields.io/github/commit-activity/y/hassio-addons/app-plex.svg\n[commits]: https://github.com/hassio-addons/app-plex/commits/main\n[contributors]: https://github.com/hassio-addons/app-plex/graphs/contributors\n[discord-ha]: https://discord.gg/c5DvZ4e\n[discord-shield]: https://img.shields.io/discord/478094546522079232.svg\n[discord]: https://discord.me/hassioaddons\n[docs]: https://github.com/hassio-addons/app-plex/blob/main/plex/DOCS.md\n[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg\n[forum]: https://community.home-assistant.io/t/home-assistant-community-add-on-plex-media-server/54383?u=frenck\n[frenck]: https://github.com/frenck\n[github-actions-shield]: https://github.com/hassio-addons/app-plex/workflows/CI/badge.svg\n[github-actions]: https://github.com/hassio-addons/app-plex/actions\n[github-sponsors-shield]: https://frenck.dev/wp-content/uploads/2019/12/github_sponsor.png\n[github-sponsors]: https://github.com/sponsors/frenck\n[issue]: https://github.com/hassio-addons/app-plex/issues\n[license-shield]: https://img.shields.io/github/license/hassio-addons/app-plex.svg\n[maintenance-shield]: https://img.shields.io/maintenance/yes/2026.svg\n[patreon-shield]: https://frenck.dev/wp-content/uploads/2019/12/patreon.png\n[patreon]: https://www.patreon.com/frenck\n[project-stage-shield]: https://img.shields.io/badge/project%20stage-production%20ready-brightgreen.svg\n[reddit]: https://reddit.com/r/homeassistant\n[releases-shield]: https://img.shields.io/github/release/hassio-addons/app-plex.svg\n[releases]: https://github.com/hassio-addons/app-plex/releases\n[repository]: https://github.com/hassio-addons/repository\n"
  },
  {
    "path": "plex/.README.j2",
    "content": "# Home Assistant Community App: Plex Media Server\n\n[![Release][release-shield]][release] ![Project Stage][project-stage-shield] ![Project Maintenance][maintenance-shield]\n\n[![Discord][discord-shield]][discord] [![Community Forum][forum-shield]][forum]\n\n[![Sponsor Frenck via GitHub Sponsors][github-sponsors-shield]][github-sponsors]\n\n[![Support Frenck on Patreon][patreon-shield]][patreon]\n\nYour recorded media, live TV, online news, and podcasts, beautifully organized\nand ready to stream.\n\n## About\n\nThe plex app brings your favorite media together in one place, making it\nbeautiful and easy to enjoy. The Plex Media Server provided by this app,\norganizes your personal video, music, and photo collections\nand streams them to all of your devices.\n\n{% if channel == \"edge\" %}\n## WARNING! THIS IS AN EDGE VERSION!\n\nThis Home Assistant Apps repository contains edge builds of apps.\nEdge builds apps are based upon the latest development version.\n\n- They may not work at all.\n- They might stop working at any time.\n- They could have a negative impact on your system.\n\nThis repository was created for:\n\n- Anybody willing to test.\n- Anybody interested in trying out upcoming apps or app features.\n- Developers.\n\nIf you are more interested in stable releases of our apps:\n\n<https://github.com/hassio-addons/repository>\n\n{% endif %}\n{% if channel == \"beta\" %}\n## WARNING! THIS IS A BETA VERSION!\n\nThis Home Assistant Apps repository contains beta releases of apps.\n\n- They might stop working at any time.\n- They could have a negative impact on your system.\n\nThis repository was created for:\n\n- Anybody willing to test.\n- Anybody interested in trying out upcoming apps or app features.\n\nIf you are more interested in stable releases of our apps:\n\n<https://github.com/hassio-addons/repository>\n\n{% endif %}\n[discord-shield]: https://img.shields.io/discord/478094546522079232.svg\n[discord]: https://discord.me/hassioaddons\n[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg\n[forum]: https://community.home-assistant.io/t/home-assistant-community-add-on-plex-media-server/54383?u=frenck\n[github-sponsors-shield]: https://frenck.dev/wp-content/uploads/2019/12/github_sponsor.png\n[github-sponsors]: https://github.com/sponsors/frenck\n[maintenance-shield]: https://img.shields.io/maintenance/yes/2026.svg\n[patreon-shield]: https://frenck.dev/wp-content/uploads/2019/12/patreon.png\n[patreon]: https://www.patreon.com/frenck\n[project-stage-shield]: https://img.shields.io/badge/project%20stage-production%20ready-brightgreen.svg\n[release-shield]: https://img.shields.io/badge/version-{{ version }}-blue.svg\n[release]: {{ repo }}/tree/{{ version }}\n"
  },
  {
    "path": "plex/DOCS.md",
    "content": "# Home Assistant Community App: Plex Media Server\n\nThe plex app brings your favorite media together in one place, making it\nbeautiful and easy to enjoy. The Plex Media Server provided by this app,\norganizes your personal video, music, and photo collections\nand streams them to all of your devices.\n\n## Installation\n\nThe installation of this app is pretty straightforward and not different in\ncomparison to installing any other Home Assistant app.\n\n1. Click the Home Assistant My button below to open the app on your Home\n   Assistant instance.\n\n   [![Open this app in your Home Assistant instance.][app-badge]][app]\n\n1. Click the \"Install\" button to install the app.\n1. Surf to <https://www.plex.tv/claim> and get your claim token.\n1. Update the app config with the claim code you've got in the previous step.\n1. Save the app configuration.\n1. Start the \"Plex Media Server\" app.\n1. Check the logs of the \"Plex Media Server\" to see if everything went well.\n1. Login to the Plex admin interface and complete the setup process.\n\n**NOTE**: When adding media locations, please use `/share` and `/media`\nas the base directories.\n\n## Configuration\n\n**Note**: _Remember to restart the app when the configuration is changed._\n\nExample app configuration:\n\n```yaml\nlog_level: info\nclaim_code: claim-cAMrqFrenckFU4x445Tn\n```\n\n**Note**: _This is just an example, don't copy and paste it! Create your own!_\n\n### Option: `log_level`\n\nThe `log_level` option controls the level of log output by the app and can\nbe changed to be more or less verbose, which might be useful when you are\ndealing with an unknown issue. Possible values are:\n\n- `trace`: Show every detail, like all called internal functions.\n- `debug`: Shows detailed debug information.\n- `info`: Normal (usually) interesting events.\n- `warning`: Exceptional occurrences that are not errors.\n- `error`: Runtime errors that do not require immediate action.\n- `fatal`: Something went terribly wrong. App becomes unusable.\n\nPlease note that each level automatically includes log messages from a\nmore severe level, e.g., `debug` also shows `info` messages. By default,\nthe `log_level` is set to `info`, which is the recommended setting unless\nyou are troubleshooting.\n\n### Option: `claim_code`\n\nTo allow your server to sign-in to your Plex account, it needs a so-called\n\"Claim Code\". Sign-ing into Plex allows Plex to locate and connect to\nyour server and unlocks all kinds of features as well.\n\nIn order to get your code surf to <https://www.plex.tv/claim>.\n\nThis code is only used once by the app. As soon as the\nserver is successfully authenticated with Plex, the code may be removed.\n\n## Solving connection issues with Plex\n\nPlex is pretty straightforward and pretty easy to set up. Most of the\nsettings are detected automatically. Nevertheless, it fails to recognize\nits IP on your home network. This may cause connection issues with some\nPlex apps, e.g., the Samsung Tizen Plex app.\n\nThis is not Plex its fault but is because of the Docker ecosystem, in\nwhich this app runs. Luckily, there is an option in Plex to help\nwith that, but it is a little hidden.\n\n- Login to the Plex web interface.\n- Goto setting.\n- Click the server tab.\n- On the left side, choose \"Network\".\n- Be sure you are looking at the advanced view.\n  There is a button \"Show Advanced\" in the top right.\n- Add your custom URLs to \"Custom server access URLs\" field.\n\nThe custom URLs are additional URLs Plex clients will use to try to connect\nto Plex. You can list multiple if you'd like, separated by a comma.\n\nExample:\n\n```txt\nhttp://homeassistant.local:32400,http://192.168.1.88:32400,http://mydomain.duckdns.org:32400\n```\n\n## Known issues and limitations\n\n- This app will be able to run on a Raspberry Pi. While it still can be\n  useful, don't expect too much. In general, the Pi lacks the processing power\n  and is probably not able to stream your media; therefore it is not\n  recommended using this app on such a device.\n- This app cannot add/mount any additional USB or other devices for you.\n  This is a Home Assistant limitation. In case you'd like to use extra devices,\n  you'll have to modify the host system yourself and is not supported by the\n  Home Assistant project or Community Apps team.\n- A Plex Pass gives you exclusive access to new features, which are\n  available through a Beta version channel of the media server. At this\n  time, running this \"Beta\" version, is not supported by this app.\n- This app does not support Plex over DLNA.\n\n## Changelog & Releases\n\nThis repository keeps a change log using [GitHub's releases][releases]\nfunctionality.\n\nReleases are based on [Semantic Versioning][semver], and use the format\nof `MAJOR.MINOR.PATCH`. In a nutshell, the version will be incremented\nbased on the following:\n\n- `MAJOR`: Incompatible or major changes.\n- `MINOR`: Backwards-compatible new features and enhancements.\n- `PATCH`: Backwards-compatible bugfixes and package updates.\n\n## Support\n\nGot questions?\n\nYou have several options to get them answered:\n\n- The [Home Assistant Community Apps Discord chat server][discord] for app\n  support and feature requests.\n- The [Home Assistant Discord chat server][discord-ha] for general Home\n  Assistant discussions and questions.\n- The Home Assistant [Community Forum][forum].\n- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit]\n\nYou could also [open an issue here][issue] GitHub.\n\n## Authors & contributors\n\nThe original setup of this repository is by [Franck Nijhof][frenck].\n\nFor a full list of all authors and contributors,\ncheck [the contributor's page][contributors].\n\n## License\n\nMIT License\n\nCopyright (c) 2018-2026 Franck Nijhof\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n[app-badge]: https://my.home-assistant.io/badges/supervisor_addon.svg\n[app]: https://my.home-assistant.io/redirect/supervisor_addon/?addon=a0d7b954_plex&repository_url=https%3A%2F%2Fgithub.com%2Fhassio-addons%2Frepository\n[contributors]: https://github.com/hassio-addons/app-plex/graphs/contributors\n[discord-ha]: https://discord.gg/c5DvZ4e\n[discord]: https://discord.me/hassioaddons\n[forum]: https://community.home-assistant.io/t/home-assistant-community-add-on-plex-media-server/54383?u=frenck\n[frenck]: https://github.com/frenck\n[issue]: https://github.com/hassio-addons/app-plex/issues\n[reddit]: https://reddit.com/r/homeassistant\n[releases]: https://github.com/hassio-addons/app-plex/releases\n[semver]: https://semver.org/spec/v2.0.0.html\n"
  },
  {
    "path": "plex/Dockerfile",
    "content": "ARG BUILD_FROM=ghcr.io/hassio-addons/debian-base:9.3.0\n# hadolint ignore=DL3006\nFROM ${BUILD_FROM}\n\n# Set shell\nSHELL [\"/bin/bash\", \"-o\", \"pipefail\", \"-c\"]\n\n# Setup base system\nARG BUILD_ARCH=amd64\nARG PLEX_VERSION=1.43.1.10611-1e34174b1\n\n# hadolint ignore=DL3008\nRUN \\\n    echo \"deb http://deb.debian.org/debian trixie contrib non-free\" \\\n        >> /etc/apt/sources.list \\\n    && apt-get update \\\n    \\\n    && apt-get install -y --no-install-recommends \\\n        xmlstarlet>=\"1.6.1-4\" \\\n        uuid-runtime=2.41-5 \\\n        unrar=1:7.1.8-1 \\\n    \\\n    && if [ \"${BUILD_ARCH}\" = \"aarch64\" ]; then ARCH=\"arm64\"; fi \\\n    && if [ \"${BUILD_ARCH}\" = \"amd64\" ]; then ARCH=\"amd64\"; fi \\\n    \\\n    && curl -J -L -o /tmp/plexmediaserver.deb \\\n        \"https://downloads.plex.tv/plex-media-server-new/${PLEX_VERSION}/debian/plexmediaserver_${PLEX_VERSION}_${ARCH}.deb\" \\\n    \\\n    && dpkg --install /tmp/plexmediaserver.deb \\\n    \\\n    && apt-get -y clean \\\n    && rm -fr \\\n        /tmp/* \\\n        /var/{cache,log}/* \\\n        /var/lib/apt/lists/*\n\n# Copy root filesystem\nCOPY rootfs /\n\n# Build arguments\nARG BUILD_ARCH\nARG BUILD_DATE\nARG BUILD_DESCRIPTION\nARG BUILD_NAME\nARG BUILD_REF\nARG BUILD_REPOSITORY\nARG BUILD_VERSION\n\n# Labels\nLABEL \\\n    io.hass.name=\"${BUILD_NAME}\" \\\n    io.hass.description=\"${BUILD_DESCRIPTION}\" \\\n    io.hass.arch=\"${BUILD_ARCH}\" \\\n    io.hass.type=\"addon\" \\\n    io.hass.version=${BUILD_VERSION} \\\n    maintainer=\"Franck Nijhof <opensource@frenck.dev>\" \\\n    org.opencontainers.image.title=\"${BUILD_NAME}\" \\\n    org.opencontainers.image.description=\"${BUILD_DESCRIPTION}\" \\\n    org.opencontainers.image.vendor=\"Home Assistant Community Apps\" \\\n    org.opencontainers.image.authors=\"Franck Nijhof <opensource@frenck.dev>\" \\\n    org.opencontainers.image.licenses=\"MIT\" \\\n    org.opencontainers.image.url=\"https://frenck.dev/home-assistant-apps\" \\\n    org.opencontainers.image.source=\"https://github.com/${BUILD_REPOSITORY}\" \\\n    org.opencontainers.image.documentation=\"https://github.com/${BUILD_REPOSITORY}/blob/main/README.md\" \\\n    org.opencontainers.image.created=${BUILD_DATE} \\\n    org.opencontainers.image.revision=${BUILD_REF} \\\n    org.opencontainers.image.version=${BUILD_VERSION}\n"
  },
  {
    "path": "plex/build.yaml",
    "content": "---\nbuild_from:\n  aarch64: ghcr.io/hassio-addons/debian-base:9.3.0\n  amd64: ghcr.io/hassio-addons/debian-base:9.3.0\n"
  },
  {
    "path": "plex/config.yaml",
    "content": "---\nname: Plex Media Server\nversion: dev\nslug: plex\ndescription: Recorded media, live TV, online news, and podcasts ready to stream.\nurl: https://github.com/hassio-addons/app-plex\nwebui: http://[HOST]:[PORT:32400]/web\nstartup: services\ninit: false\narch:\n  - aarch64\n  - amd64\nmap:\n  - media:rw\n  - share:rw\n  - ssl\ndevices:\n  - /dev/dri\n  - /dev/dri/card0\n  - /dev/dri/card1\n  - /dev/dri/renderD128\n  - /dev/vchiq\nports:\n  3005/tcp: 3005\n  8324/tcp: 8324\n  32400/tcp: 32400\n  32410/udp: 32410\n  32412/udp: 32412\n  32413/udp: 32413\n  32414/udp: 32414\n  32469/tcp: 32469\nports_description:\n  3005/tcp: Plex Home Theater via Plex Companion\n  8324/tcp: Plex for Roku via Plex Companion\n  32400/tcp: Plex Media Server Interface\n  32410/udp: GDM network discovery\n  32412/udp: GDM network discovery\n  32413/udp: GDM network discovery\n  32414/udp: GDM network discovery\n  32469/tcp: Plex DLNA Server\nhassio_api: true\nbackup_exclude:\n  - \"**/Plex Media Server/Cache/**\"\n  - \"**/Plex Media Server/Plug-in Support/Caches/**\"\n  - \"**/Plex Media Server/Logs/**\"\n  - \"**/Plex Media Server/Crash Reports/**\"\n  - \"**/Plex Media Server/Diagnostics/**\"\n  - \"**/Plex Media Server/Media/**\"\n  - \"**/Plex Media Server/Metadata/**\"\noptions:\n  claim_code: \"\"\nschema:\n  log_level: list(trace|debug|info|notice|warning|error|fatal)?\n  claim_code: str\n"
  },
  {
    "path": "plex/rootfs/etc/s6-overlay/s6-rc.d/init-plex/dependencies.d/base",
    "content": ""
  },
  {
    "path": "plex/rootfs/etc/s6-overlay/s6-rc.d/init-plex/run",
    "content": "#!/command/with-contenv bashio\n# shellcheck shell=bash\n# ==============================================================================\n# Home Assistant Community App: Plex Media Server\n# Initializes all kinds of stuff on the first run of the Plex Media Server\n# ==============================================================================\nreadonly prefs=\"/data/Plex Media Server/Preferences.xml\"\nreadonly claim=\"/data/claim_code\"\n\nfunction getPref {\n    local key=\"$1\"\n\n    xmlstarlet sel -T -t -m \"/Preferences\" -v \"@${key}\" -n \"${prefs}\"\n}\n\nfunction setPref {\n    local key=\"$1\"\n    local value=\"$2\"\n\n    count=\"$(xmlstarlet sel -t -v \"count(/Preferences/@${key})\" \"${prefs}\")\"\n    count=$((count + 0))\n    if [[ $count -gt 0 ]]; then\n        xmlstarlet ed --inplace --update \\\n            \"/Preferences/@${key}\" -v \"${value}\" \"${prefs}\"\n    else\n        xmlstarlet ed --inplace --insert \\\n            \"/Preferences\"  --type attr -n \"${key}\" -v \"${value}\" \"${prefs}\"\n    fi\n}\n\nif ! bashio::fs.file_exists \"${claim}\"; then\n    touch \"${claim}\"\nfi\n\nif ! bashio::fs.file_exists \"${prefs}\"; then\n    if ! bashio::config.has_value \"claim_code\"; then\n        bashio::log.fatal\n        bashio::log.fatal \"App configuration is incomplete!\"\n        bashio::log.fatal\n        bashio::log.fatal \"Plex requires a claim code on the first run!\"\n        bashio::log.fatal\n        bashio::log.fatal \"Please check the installation manual of the app.\"\n        bashio::log.fatal\n        bashio::exit.nok\n    fi\n\n    bashio::log.info 'First run! Initializing configuration files...'\n\n    mkdir -p \"$(dirname \"${prefs}\")\"\n    cat > \"${prefs}\" <<-EOF\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Preferences/>\nEOF\n\n    serial=$(uuidgen)\n    clientId=$(sha1sum <<< \"${serial} - Home Assistant Plex app\" | cut -b 1-40)\n\n    setPref \"MachineIdentifier\" \"${serial}\"\n    setPref \"ProcessedMachineIdentifier\" \"${clientId}\"\n    setPref \"FriendlyName\" \"Home Assistant\"\n\n    mkdir -p \"/share/transcode\"\n    setPref \"TranscoderTempDirectory\" \"/share/transcode\"\nfi\n\nprevious_claim_code=$(<\"${claim}\")\nclaim_code=$(bashio::config 'claim_code')\nif bashio::var.has_value \"${claim_code}\" && [[ \"${previous_claim_code}\" != \"${claim_code}\" ]]; then\n    bashio::log.debug \"Generating unique serial & client id's...\"\n    clientId=$(getPref \"ProcessedMachineIdentifier\")\n    if ! response=$(curl --silent --show-error \\\n        --write-out '\\n%{http_code}' --request POST \\\n        -H \"X-Plex-Client-Identifier: ${clientId}\" \\\n        -H 'X-Plex-Product: Plex Media Server' \\\n        -H 'X-Plex-Version: 1.1' \\\n        -H 'X-Plex-Provides: server' \\\n        -H 'X-Plex-Platform: Linux' \\\n        -H 'X-Plex-Platform-Version: 1.0' \\\n        -H 'X-Plex-Device-Name: PlexMediaServer' \\\n        -H 'X-Plex-Device: Linux' \\\n        \"https://plex.tv/api/claim/exchange?token=${claim_code}\"\n    ); then\n        bashio::log.debug \"${response}\"\n        bashio::log.fatal\n        bashio::log.fatal \"Something went wrong contacting the Plex API\"\n        bashio::log.fatal \"Maybe your claim code is wrong or expired?\"\n        bashio::log.fatal\n        bashio::exit.nok\n    fi\n\n    status=${response##*$'\\n'}\n    response=\"${response%\"$status\"}\"\n\n    if [[ \"${status}\" -ne 200 ]]; then\n        bashio::log.debug \"${response}\"\n        bashio::log.fatal\n        bashio::log.fatal \"Something went wrong contacting the Plex API\"\n        bashio::log.fatal \"Maybe your claim code is wrong or expired?\"\n        bashio::exit.nok\n    fi\n\n    bashio::log.debug \"Plex API HTTP Response code: ${status}\"\n    bashio::log.debug \"Plex API Response: ${response}\"\n\n    token=\"$(echo \"${response}\" | sed -n 's/.*<authentication-token>\\(.*\\)<\\/authentication-token>.*/\\1/p')\"\n\n    setPref \"PlexOnlineToken\" \"${token}\"\n    echo \"${claim_code}\" > \"${claim}\"\nfi\n"
  },
  {
    "path": "plex/rootfs/etc/s6-overlay/s6-rc.d/init-plex/type",
    "content": "oneshot\n"
  },
  {
    "path": "plex/rootfs/etc/s6-overlay/s6-rc.d/init-plex/up",
    "content": "/etc/s6-overlay/s6-rc.d/init-plex/run\n"
  },
  {
    "path": "plex/rootfs/etc/s6-overlay/s6-rc.d/plex/dependencies.d/init-plex",
    "content": ""
  },
  {
    "path": "plex/rootfs/etc/s6-overlay/s6-rc.d/plex/finish",
    "content": "#!/command/with-contenv bashio\n# shellcheck shell=bash\n# ==============================================================================\n# Home Assistant Community App: Plex Media Server\n# Take down the S6 supervision tree when the Plex Media Server fails\n# ==============================================================================\nreadonly exit_code_container=$(</run/s6-linux-init-container-results/exitcode)\nreadonly exit_code_service=\"${1}\"\nreadonly exit_code_signal=\"${2}\"\nreadonly service=\"Plex Media Server\"\n\nbashio::log.info \\\n  \"Service ${service} exited with code ${exit_code_service}\" \\\n  \"(by signal ${exit_code_signal})\"\n\nif [[ \"${exit_code_service}\" -eq 256 ]]; then\n  if [[ \"${exit_code_container}\" -eq 0 ]]; then\n    echo $((128 + $exit_code_signal)) > /run/s6-linux-init-container-results/exitcode\n  fi\n  [[ \"${exit_code_signal}\" -eq 15 ]] && exec /run/s6/basedir/bin/halt\nelif [[ \"${exit_code_service}\" -ne 0 ]]; then\n  if [[ \"${exit_code_container}\" -eq 0 ]]; then\n    echo \"${exit_code_service}\" > /run/s6-linux-init-container-results/exitcode\n  fi\n  exec /run/s6/basedir/bin/halt\nfi\n"
  },
  {
    "path": "plex/rootfs/etc/s6-overlay/s6-rc.d/plex/run",
    "content": "#!/command/with-contenv bashio\n# shellcheck shell=bash\n# ==============================================================================\n# Home Assistant Community App: Plex Media Server\n# Runs the Plex Media Server\n# ==============================================================================\nbashio::log.info 'Starting the Plex Media Server...'\n\nexport LD_LIBRARY_PATH=/usr/lib/plexmediaserver\nexport PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver\nexport PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6\nexport PLEX_MEDIA_SERVER_INFO_DEVICE=\"Hass.io\"\nexport PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/data\n\n# Check if \"/data/Plex Media Server/plexmediaserver.pid\" exists, if so remove it\nif bashio::fs.file_exists '/data/Plex Media Server/plexmediaserver.pid'; then\n    bashio::log.debug 'Removing stale PID file...'\n    rm -f /data/Plex\\ Media\\ Server/plexmediaserver.pid\nfi\n\n# Run the Plex Media Server\nexec /usr/lib/plexmediaserver/Plex\\ Media\\ Server\n"
  },
  {
    "path": "plex/rootfs/etc/s6-overlay/s6-rc.d/plex/type",
    "content": "longrun\n"
  },
  {
    "path": "plex/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/init-plex",
    "content": ""
  },
  {
    "path": "plex/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/plex",
    "content": ""
  },
  {
    "path": "plex/translations/en.yaml",
    "content": "---\nconfiguration:\n  log_level:\n    name: Log level\n    description: >-\n      Controls the level of log details the app provides.\n  claim_code:\n    name: Claim code\n    description: >-\n      To allow your server to sign-in to your Plex account, it needs a so-called\n      \"Claim Code\". In order to get your code surf to: https://www.plex.tv/claim\nnetwork:\n  3005/tcp: Plex Home Theater via Plex Companion\n  8324/tcp: Plex for Roku via Plex Companion\n  32400/tcp: Plex Media Server Interface\n  32410/udp: GDM network discovery\n  32412/udp: GDM network discovery\n  32413/udp: GDM network discovery\n  32414/udp: GDM network discovery\n  32469/tcp: Plex DLNA Server\n"
  }
]