{"id":20103214,"url":"https://github.com/lorenzschmid/pytransfermultipart","last_synced_at":"2025-05-06T08:31:13.152Z","repository":{"id":94724534,"uuid":"134050930","full_name":"lorenzschmid/pyTransferMultipart","owner":"lorenzschmid","description":"Small daemon to transfer and strip multipart JSON messages","archived":false,"fork":false,"pushed_at":"2018-05-19T12:27:24.000Z","size":6,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-05T03:53:13.126Z","etag":null,"topics":["homeassistant","json","multipart","plex","request","transfer"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lorenzschmid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-19T10:08:53.000Z","updated_at":"2019-08-11T01:18:30.000Z","dependencies_parsed_at":"2023-04-06T07:47:06.099Z","dependency_job_id":null,"html_url":"https://github.com/lorenzschmid/pyTransferMultipart","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorenzschmid%2FpyTransferMultipart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorenzschmid%2FpyTransferMultipart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorenzschmid%2FpyTransferMultipart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lorenzschmid%2FpyTransferMultipart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lorenzschmid","download_url":"https://codeload.github.com/lorenzschmid/pyTransferMultipart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252648578,"owners_count":21782406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["homeassistant","json","multipart","plex","request","transfer"],"created_at":"2024-11-13T17:35:10.388Z","updated_at":"2025-05-06T08:31:13.138Z","avatar_url":"https://github.com/lorenzschmid.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyTransferMultipart\n\nThis repository consists of a small daemon written in Python and its corresponding `service` configuration. The goal of the daemon is to accept multipart requests and only forward the first found JSON part of the multipart request to a given (remote) server.\n\nThe idea is to link a [Plex Media Server](https://www.plex.tv/downloads/#plex-media-server) (with a [Premium subscription](https://www.plex.tv/features/plex-pass/)) and a [Home Assistant](https://www.home-assistant.io) instance. A Plex Media Server provides so called [webhooks](https://support.plex.tv/articles/115002267687-webhooks/) to quickly inform external services about its state. Unfortunately, Plex sends its updates as [multipart messages](https://github.com/home-assistant/home-assistant/issues/6080) while Home Assistant (via its [scripts](https://www.home-assistant.io/docs/scripts/) [API](https://developers.home-assistant.io/docs/en/external_api_rest.html)) is expecting pure JSON messages. Now, instead of directly calling the Home Assistant API, the Plex Media Server can send its update to this daemon which then only forwards the valid JSON to the Home Assistant instance.\n\n## Installation\n\n1. Copy `transfer-multipart.py` to your Home Assistant home directory, e.g. `/srv/homeassistant`\n2. Make it executable: `chmod +x transfer-multipart.py`\n3. Create a corresponding service by copying `transfer-multipart.service` to `/etc/systemd/system/` (if your Linux distribution is `systemd` based)\n4. Change `transfer-multipart.service` according to your system's structure (values to change in `\u003c` and `\u003e`)\n5. Reload `systemd`: `sudo systemctl --system daemon-reload`\n6. Enable the new service to automatically start upon boot: `sudo systemctl enable transfer-multipart`\n7. Start the service `sudo systemctl start transfer-multipart`\n\n## Command Line Interface\n\nThe Python script comes with a command line interface which works as following:\n\n```\nusage: transfer-multipart.py [-h] [-r URL] [-p PORT] [-l HOST] [--daemon]\n                             [--pid-file PID_FILE] [--log-file LOG_FILE]\n\nTransfer and strip multipart JSON messages\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -r URL, --url URL     Remote target URL (multiple URLs separated by comma\n                        possible)\n  -p PORT, --port PORT  Local port to listen on\n  -l HOST, --host HOST  Local host address to listen on\n  --daemon              Run script as daemon in background\n  --pid-file PID_FILE   Daemon PID file path\n  --log-file LOG_FILE   Daemon LOG file path\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Florenzschmid%2Fpytransfermultipart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Florenzschmid%2Fpytransfermultipart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Florenzschmid%2Fpytransfermultipart/lists"}