{"id":29568631,"url":"https://github.com/ryanwalder/sync-music","last_synced_at":"2025-10-10T05:36:38.485Z","repository":{"id":304945563,"uuid":"1020296708","full_name":"ryanwalder/sync-music","owner":"ryanwalder","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-16T08:15:39.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-07T12:44:42.603Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/ryanwalder.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,"zenodo":null}},"created_at":"2025-07-15T16:37:40.000Z","updated_at":"2025-07-16T08:15:42.000Z","dependencies_parsed_at":"2025-07-17T14:53:02.340Z","dependency_job_id":"9726b44d-d952-4cbd-8f40-99441d0ba8de","html_url":"https://github.com/ryanwalder/sync-music","commit_stats":null,"previous_names":["ryanwalder/sync-music"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ryanwalder/sync-music","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanwalder%2Fsync-music","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanwalder%2Fsync-music/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanwalder%2Fsync-music/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanwalder%2Fsync-music/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanwalder","download_url":"https://codeload.github.com/ryanwalder/sync-music/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanwalder%2Fsync-music/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002893,"owners_count":26083468,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-07-19T01:05:48.375Z","updated_at":"2025-10-10T05:36:38.433Z","avatar_url":"https://github.com/ryanwalder.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sync Music\n\nScript to convert/copy FLAC/MP3 files from an input dir to an output dir.\n\nDesigned to be used in conjunction with [Syncthing](https://syncthing.net/)\nto sync the output to my phone.\n\n- If MP3 \u003e Copy\n- If FLAC \u003e Convert to MP3\n  - Uses [ffmpeg](https://ffmpeg.org/) with the\n    [lame](https://lame.sourceforge.io/) encoder\n  - Ability to set desired quality profile\n- Maintains dir structure\n- Maintains tags\n- Only processes files if they do not exist in the output dir so it's as quick\n  as possible\n- Deletes files from output dir if they are removed from the input dir\n- Safety check to make sure a file isn't being modified before processing\n  - Handles files being written to and waits for them to complete\n  - Handles files deleted after scanning but deleted before processing\n  - Note: This adds processing time for each file as it performs the check on\n    each file. set `STABILITY_CHECK_TIME` to disable this functionality.\n\n## Configuration\n\nThe script is configured using environmental variables:\n\n\u003c!-- markdownlint-disable MD013 --\u003e\n\n| Variable               | Default  | Description                                                                              |\n| ---------------------- | -------- | ---------------------------------------------------------------------------------------- |\n| `INPUT_DIR`            | `/input` | Input directory                                                                          |\n| `OUTPUT_DIR`           | `/ouput` | Output directory                                                                         |\n| `LAME_QUALITY`         | `0`      | LAME [quality preset](https://trac.ffmpeg.org/wiki/Encode/MP3) used for conveerted files |\n| `LOOP`                 | `true`   | Whether continually run so if adding new files they get converted                        |\n| `SLEEP_TIME`           | `900`    | Time to wait between LOOPs, no effect if LOOP =! true                                    |\n| `STABILITY_CHECK_TIME` | `2`      | Time to wait when checking if a files is being copied into the input dir                 |\n| `STABILITY_MAX_WAIT`   | `300`    | Max time to wait for a file to be copied into the input dir                              |\n\n\u003c!-- markdownlint-enable --\u003e\n\n## Usage\n\n### Local\n\n```sh\nexport INPUT_DIR=\"/path/to/input/files\"\nexport OUTPUT_DIR=\"/path/to/output/files\"\n./sync-music.sh\n```\n\n### Docker\n\nWhen running via Docker you need to mount your input/output dirs via volumes.\nThe `PUID`/`GUID` must have access to read from the `input` dir and access to\nwrite to the `output dir`.\n\nExtra Environment Variables used by the container:\n\n\u003c!-- markdownlint-disable MD013 --\u003e\n\n| Variable | Default | Description                                                                                                    |\n| -------- | ------- | -------------------------------------------------------------------------------------------------------------- |\n| `PUID`   | `1000`  | UID to run the script as, must have read access to `INPUT_DIR`. Will be used for `OUTPUT_DIR` and output files |\n| `PGID`   | `1000`  | GID to run the script as, must have read access to `INPUT_DIR`. Will be used for `OUTPUT_DIR` and output files |\n| `UMASK`  | `0022`  | UMASK to use for output files/dirs                                                                             |\n\n\u003c!-- markdownlint-enable --\u003e\n\n#### Docker Command\n\n\u003c!-- markdownlint-disable MD013 --\u003e\n\n```sh\ndocker run \\\n  -e PUID=\"1000\" \\\n  -e PGID=\"1000\" \\\n  -e UMASK=\"0022\" \\\n  -v /path/to/input/files:/input:ro \\\n  -v /path/to/output/files:/output:rw \\\n  ghcr.io/ryanwalder/sync-music:latest\n```\n\n\u003c!-- markdownlint-enable --\u003e\n\n#### Docker Compose\n\n```yaml\nservices:\n  sync-music:\n    image: ghcr.io/ryanwalder/sync-music:latest\n    environment:\n      PUID: \"1000\"\n      PGID: \"1000\"\n      UMASK: \"0022\"\n    volumes:\n      - /path/to/input/files:/input:ro\n      - /path/to/output/files:/output:rw\n    restart: on-failure:5\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanwalder%2Fsync-music","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanwalder%2Fsync-music","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanwalder%2Fsync-music/lists"}