├── .github ├── dependabot.yml └── workflows │ ├── release.yml │ └── test.yml ├── .gitignore ├── .npmrc ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── build ├── README.md ├── icon.icns └── icon.ico ├── docs ├── README.md ├── architecture.graffle ├── hyperamp-icon.png ├── hyperamp-icon.sketch ├── ipc.graffle ├── screenshot-2.png ├── screenshot.png ├── splash-square.png └── splash.jpg ├── lib └── README.md ├── main ├── README.md ├── artwork.js ├── config.js ├── index.js ├── lib │ ├── artwork-cache │ │ ├── README.md │ │ ├── index.js │ │ ├── test-data │ │ │ ├── index.js │ │ │ ├── loop.mp3 │ │ │ └── needle.mp3 │ │ ├── test.js │ │ └── util.js │ └── audio-library │ │ ├── README.md │ │ ├── filter.js │ │ ├── index.js │ │ ├── sort.js │ │ ├── test-data │ │ ├── library-a.json │ │ └── library-b.json │ │ └── test.js ├── menu.js ├── track-dict.js └── windows │ ├── audio.js │ └── player.js ├── package.json ├── renderer ├── README.md ├── audio │ ├── audio-player.js │ ├── index.html │ ├── index.js │ ├── loader.js │ └── needle.mp3 ├── player │ ├── default-artwork.png │ ├── elements │ │ ├── button │ │ │ ├── button-group.js │ │ │ ├── index.js │ │ │ └── styles.js │ │ ├── form │ │ │ └── styles.js │ │ ├── header │ │ │ ├── index.js │ │ │ └── search.js │ │ ├── icon.js │ │ ├── loader.js │ │ ├── player │ │ │ ├── artwork.js │ │ │ ├── controls.js │ │ │ ├── index.js │ │ │ ├── meta.js │ │ │ ├── progress.js │ │ │ └── volume.js │ │ ├── playlist │ │ │ ├── index.js │ │ │ ├── lib.js │ │ │ ├── styles.js │ │ │ ├── test.js │ │ │ └── track-view.js │ │ └── range.js │ ├── index.html │ ├── index.js │ ├── lib │ │ └── constants.js │ ├── loader.js │ ├── pages │ │ ├── main.js │ │ ├── preferences.js │ │ └── styles.js │ └── stores │ │ ├── config.js │ │ ├── library.js │ │ └── player.js └── shared │ ├── README.md │ ├── css │ ├── base.css │ ├── index.css │ ├── range.css │ ├── scrollbar.css │ └── variables.css │ └── file-url.js ├── scripts ├── README.md └── clear.js └── test ├── README.md └── index.js /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file 2 | version: 2 3 | updates: 4 | - package-ecosystem: "npm" 5 | directory: "/" 6 | schedule: 7 | interval: "daily" 8 | - package-ecosystem: "github-actions" 9 | directory: "/" 10 | schedule: 11 | interval: "daily" 12 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: npm bump 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | newversion: 7 | description: "npm version {major,minor,patch}" 8 | required: true 9 | 10 | env: 11 | node_version: "lts/*" 12 | FORCE_COLOR: 1 13 | 14 | concurrency: # prevent concurrent releases 15 | group: npm-bump 16 | cancel-in-progress: true 17 | 18 | jobs: 19 | version_and_release: 20 | runs-on: ubuntu-latest 21 | outputs: 22 | tagName: ${{ steps.npm-bump.outputs.release_tag }} 23 | steps: 24 | - uses: actions/checkout@v4 25 | with: 26 | # fetch full history so things like auto-changelog work properly 27 | fetch-depth: 0 28 | - name: Use Node.js ${{ env.node_version }} 29 | uses: actions/setup-node@v4 30 | with: 31 | node-version: ${{ env.node_version }} 32 | # setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED 33 | registry-url: 'https://registry.npmjs.org' 34 | - run: npm i 35 | - run: npm test 36 | - name: npm version && npm publish 37 | id: npm-bump 38 | uses: bcomnes/npm-bump@v2 39 | with: 40 | git_email: bcomnes@gmail.com 41 | git_username: ${{ github.actor }} 42 | newversion: ${{ github.event.inputs.newversion }} 43 | github_token: ${{ secrets.GITHUB_TOKEN }} 44 | publish_cmd: npm run release 45 | - name: Archive lockfile 46 | uses: actions/upload-artifact@v4 47 | with: 48 | name: pacakge-lock-version-and-release.json 49 | path: package-lock.json 50 | 51 | 52 | build-release: 53 | needs: version_and_release 54 | runs-on: ${{ matrix.os }} 55 | 56 | strategy: 57 | matrix: 58 | os: [ubuntu-latest, macos-latest, windows-latest] 59 | 60 | permissions: 61 | pull-requests: write 62 | contents: write 63 | steps: 64 | - run: echo ${{needs.version_and_release.outputs.tagName}} 65 | - uses: actions/checkout@v4 66 | with: 67 | ref: ${{needs.version_and_release.outputs.tagName}} 68 | - name: Use Node.js ${{ matrix.node-version }} 69 | uses: actions/setup-node@v4 70 | with: 71 | node-version: ${{ env.node_version }} 72 | - run: npm i 73 | - name: Build unsigned 74 | run: npm run pkg 75 | if: matrix.os != 'macos-latest' 76 | env: 77 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # built in actions token. Passed tp gh-release if in use. 78 | - name: Prep signing files 79 | if: matrix.os == 'macos-latest' 80 | run: | 81 | echo "$APPLE_API_KEY_B64" | base64 -d > /tmp/AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8 82 | env: 83 | APPLE_API_KEY_B64: ${{ secrets.APPLE_API_KEY_B64 }} 84 | - name: Build signed 85 | run: npm run pkg 86 | if: matrix.os == 'macos-latest' 87 | env: 88 | CSC_LINK: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION }} 89 | CSC_KEY_PASSWORD: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION_PASSWORD }} 90 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # built in actions token. Passed tp gh-release if in use. 91 | APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }} 92 | APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} 93 | APPLE_API_KEY: "/tmp/AuthKey_${{ secrets.APPLE_API_KEY_ID }}.p8" 94 | - name: Archive lockfile 95 | uses: actions/upload-artifact@v4 96 | with: 97 | name: pacakge-lock-${{ matrix.os }}.json 98 | path: package-lock.json 99 | 100 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test and Build 2 | 3 | on: [pull_request, push] 4 | 5 | env: 6 | FORCE_COLOR: 1 7 | node_version: 'lts/*' 8 | 9 | jobs: 10 | test: 11 | runs-on: ${{ matrix.os }} 12 | 13 | strategy: 14 | fail-fast: false 15 | matrix: 16 | os: [ubuntu-latest, macos-latest, windows-latest] 17 | 18 | steps: 19 | - uses: actions/checkout@v4 20 | - name: Use Node.js ${{ env.node_version }} 21 | uses: actions/setup-node@v4 22 | with: 23 | node-version: ${{ env.node_version }} 24 | - run: npm i 25 | - run: npm test --color=always 26 | - run: npm run build 27 | - name: Archive lockfile 28 | uses: actions/upload-artifact@v4 29 | with: 30 | name: pacakge-lock-${{ matrix.os }}.json 31 | path: package-lock.json 32 | 33 | 34 | automerge: 35 | needs: test 36 | runs-on: ubuntu-latest 37 | permissions: 38 | pull-requests: write 39 | contents: write 40 | steps: 41 | - uses: fastify/github-action-merge-dependabot@v3 42 | if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' && contains(github.head_ref, 'dependabot/github_actions') }} 43 | with: 44 | github-token: ${{secrets.github_token}} 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | *.pid.lock 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # nyc test coverage 19 | .nyc_output 20 | 21 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 22 | .grunt 23 | 24 | # node-waf configuration 25 | .lock-wscript 26 | 27 | # Compiled binary addons (http://nodejs.org/api/addons.html) 28 | build/Release 29 | 30 | # Dependency directories 31 | node_modules 32 | jspm_packages 33 | 34 | # Optional npm cache directory 35 | .npm 36 | 37 | # Optional eslint cache 38 | .eslintcache 39 | 40 | # Optional REPL history 41 | .node_repl_history 42 | 43 | # Our stuff 44 | renderer/**/bundle.js 45 | 46 | !.keep 47 | 48 | dist 49 | 50 | .vscode 51 | 52 | yarn.lock 53 | package-lock.json 54 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=true 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). 9 | 10 | ## [v1.2.0](https://github.com/hypermodules/hyperamp/compare/v1.1.11...v1.2.0) 11 | 12 | ### Merged 13 | 14 | - Bump npm-run-all2 from 6.2.6 to 7.0.1 [`#390`](https://github.com/hypermodules/hyperamp/pull/390) 15 | 16 | ### Commits 17 | 18 | - Fix drag n drop file loading [`1aa9cf4`](https://github.com/hypermodules/hyperamp/commit/1aa9cf4caf8541fee4c8b4f9c681bb5bdedd9f02) 19 | - Fix lint [`205bfda`](https://github.com/hypermodules/hyperamp/commit/205bfda6a914b0174274f30474ca25d8bae4f039) 20 | - Add support for flac [`077a466`](https://github.com/hypermodules/hyperamp/commit/077a4668de66149252a41e5d69308056145b2f41) 21 | 22 | ## [v1.1.11](https://github.com/hypermodules/hyperamp/compare/v1.1.10...v1.1.11) - 2024-10-15 23 | 24 | ### Merged 25 | 26 | - Bump electron from 32.2.0 to 33.0.0 [`#388`](https://github.com/hypermodules/hyperamp/pull/388) 27 | 28 | ### Commits 29 | 30 | - Merge pull request #386 from hypermodules/dependabot/npm_and_yarn/electron-builder-25.0.5 [`bd08110`](https://github.com/hypermodules/hyperamp/commit/bd0811066cc4266ab3cc26a143737a4da5c78029) 31 | - Bump electron-builder from 24.13.3 to 25.0.5 [`7b5c56f`](https://github.com/hypermodules/hyperamp/commit/7b5c56fda633e7758a05b9aac526c527c9e23f5d) 32 | 33 | ## [v1.1.10](https://github.com/hypermodules/hyperamp/compare/v1.1.9...v1.1.10) - 2024-08-21 34 | 35 | ### Commits 36 | 37 | - Merge pull request #383 from hypermodules/dependabot/npm_and_yarn/electron-32.0.1 [`265b79e`](https://github.com/hypermodules/hyperamp/commit/265b79e0353e63a848fd4b27695bffea1d9cbf09) 38 | - Bump electron from 31.4.0 to 32.0.1 [`cbda350`](https://github.com/hypermodules/hyperamp/commit/cbda350d9378174045ce94a35f4b66f31cf90af5) 39 | 40 | ## [v1.1.9](https://github.com/hypermodules/hyperamp/compare/v1.1.8...v1.1.9) - 2024-06-11 41 | 42 | ### Merged 43 | 44 | - Bump electron from 30.1.0 to 31.0.0 [`#372`](https://github.com/hypermodules/hyperamp/pull/372) 45 | 46 | ## [v1.1.8](https://github.com/hypermodules/hyperamp/compare/v1.1.7...v1.1.8) - 2024-05-01 47 | 48 | ### Merged 49 | 50 | - Bump electron-debug from 3.2.0 to 4.0.0 [`#370`](https://github.com/hypermodules/hyperamp/pull/370) 51 | 52 | ### Commits 53 | 54 | - Fix imports [`fcf792e`](https://github.com/hypermodules/hyperamp/commit/fcf792ea03ef382d6a877d7757d001ea2afeda85) 55 | 56 | ## [v1.1.7](https://github.com/hypermodules/hyperamp/compare/v1.1.6...v1.1.7) - 2024-04-23 57 | 58 | ### Commits 59 | 60 | - Remove release patch [`9968883`](https://github.com/hypermodules/hyperamp/commit/9968883fcf444cc5ee2d8eb9a83dd77f3646599e) 61 | - Bump through2-filter from 3.1.0 to 4.0.0 [`22524e5`](https://github.com/hypermodules/hyperamp/commit/22524e533e87edc882d841842b9a35ffcbd0f6a2) 62 | - Bump electron from 29.3.1 to 30.0.1 [`8eb18c9`](https://github.com/hypermodules/hyperamp/commit/8eb18c9e4b1091239746282b4b262fcfb2fa91e2) 63 | 64 | ## [v1.1.6](https://github.com/hypermodules/hyperamp/compare/v1.1.5...v1.1.6) - 2024-02-23 65 | 66 | ### Merged 67 | 68 | - Bump electron from 28.2.4 to 29.0.1 [`#366`](https://github.com/hypermodules/hyperamp/pull/366) 69 | 70 | ## [v1.1.5](https://github.com/hypermodules/hyperamp/compare/v1.1.4...v1.1.5) - 2024-01-16 71 | 72 | ### Commits 73 | 74 | - Update README.md [`c4174c5`](https://github.com/hypermodules/hyperamp/commit/c4174c5cf1ecec66efa33ee2f3b74ceb116d0d91) 75 | 76 | ## [v1.1.4](https://github.com/hypermodules/hyperamp/compare/v1.1.3...v1.1.4) - 2023-12-24 77 | 78 | ### Commits 79 | 80 | - Package zip and dmg [`8408dff`](https://github.com/hypermodules/hyperamp/commit/8408dffcc09a7a7e4db027e8826df95f9c301054) 81 | 82 | ## [v1.1.3](https://github.com/hypermodules/hyperamp/compare/v1.1.2...v1.1.3) - 2023-12-24 83 | 84 | ### Commits 85 | 86 | - Remove dependency overrides [`d1c42cc`](https://github.com/hypermodules/hyperamp/commit/d1c42cc34c627f55e4135bdf0e27a42b1396c941) 87 | 88 | ## [v1.1.2](https://github.com/hypermodules/hyperamp/compare/v1.1.1...v1.1.2) - 2023-12-24 89 | 90 | ### Commits 91 | 92 | - Revert "Fix logging" [`b55d6f6`](https://github.com/hypermodules/hyperamp/commit/b55d6f6fee6ebc32ee4bfb300066ef33c6c03929) 93 | - More auto updater fixes [`5bfaa4e`](https://github.com/hypermodules/hyperamp/commit/5bfaa4e446b25fa91bf3f2925f771f3843c2d1f7) 94 | - Revert "Fix logging" [`e01b0c4`](https://github.com/hypermodules/hyperamp/commit/e01b0c4cc213876438b9d3be4fb3f4845e0a125a) 95 | 96 | ## [v1.1.1](https://github.com/hypermodules/hyperamp/compare/v1.1.0...v1.1.1) - 2023-12-24 97 | 98 | ### Commits 99 | 100 | - Fix logging [`9e2a9d5`](https://github.com/hypermodules/hyperamp/commit/9e2a9d5493f849719d87ccfba5ae70578f4f796b) 101 | 102 | ## [v1.1.0](https://github.com/hypermodules/hyperamp/compare/v1.0.10...v1.1.0) - 2023-12-23 103 | 104 | ### Commits 105 | 106 | - Fix meda keys on macos and support navigator.mediaSession [`d9aa7b8`](https://github.com/hypermodules/hyperamp/commit/d9aa7b811a54fc5d8f264e37dbc5c5b5b58496fc) 107 | - Re-enable auto update [`a6c9965`](https://github.com/hypermodules/hyperamp/commit/a6c9965c5ac6d73ebf89c66eac3ecb641cf091d9) 108 | 109 | ## [v1.0.10](https://github.com/hypermodules/hyperamp/compare/v1.0.9...v1.0.10) - 2023-12-20 110 | 111 | ### Commits 112 | 113 | - Notarize macOS builds [`a47a3e4`](https://github.com/hypermodules/hyperamp/commit/a47a3e45fad0c2266e39d79f240db8afff68e3d0) 114 | 115 | ## [v1.0.9](https://github.com/hypermodules/hyperamp/compare/v1.0.8...v1.0.9) - 2023-12-17 116 | 117 | ### Merged 118 | 119 | - Bump electron from 27.1.3 to 28.0.0 [`#363`](https://github.com/hypermodules/hyperamp/pull/363) 120 | - Bump actions/upload-artifact from 3 to 4 [`#364`](https://github.com/hypermodules/hyperamp/pull/364) 121 | - Bump actions/setup-node from 3 to 4 [`#362`](https://github.com/hypermodules/hyperamp/pull/362) 122 | 123 | ### Commits 124 | 125 | - Re-enabled code signing [`fce2b22`](https://github.com/hypermodules/hyperamp/commit/fce2b2215a8cae872432e90c0f2fb9c38072808d) 126 | 127 | ## [v1.0.8](https://github.com/hypermodules/hyperamp/compare/v1.0.7...v1.0.8) - 2023-10-22 128 | 129 | ### Merged 130 | 131 | - Bump electron from 26.4.0 to 27.0.1 [`#361`](https://github.com/hypermodules/hyperamp/pull/361) 132 | - Bump actions/checkout from 3 to 4 [`#359`](https://github.com/hypermodules/hyperamp/pull/359) 133 | 134 | ## [v1.0.7](https://github.com/hypermodules/hyperamp/compare/v1.0.6...v1.0.7) - 2023-08-15 135 | 136 | ### Merged 137 | 138 | - Bump electron from 25.5.0 to 26.0.0 [`#358`](https://github.com/hypermodules/hyperamp/pull/358) 139 | - Bump p-temporary-directory from 1.1.1 to 2.0.1 [`#357`](https://github.com/hypermodules/hyperamp/pull/357) 140 | - Bump electron-builder from 23.6.0 to 24.4.0 [`#356`](https://github.com/hypermodules/hyperamp/pull/356) 141 | 142 | ## [v1.0.6](https://github.com/hypermodules/hyperamp/compare/v1.0.5...v1.0.6) - 2023-05-30 143 | 144 | ### Commits 145 | 146 | - Merge pull request #355 from hypermodules/dependabot/npm_and_yarn/electron-25.0.0 [`b7d1e1f`](https://github.com/hypermodules/hyperamp/commit/b7d1e1f296cf7b009ea1df73006e14dd04559e61) 147 | - Bump electron from 24.4.0 to 25.0.0 [`5841885`](https://github.com/hypermodules/hyperamp/commit/58418852c8b3638a071edd972535637b7fac5aae) 148 | 149 | ## [v1.0.5](https://github.com/hypermodules/hyperamp/compare/v1.0.4...v1.0.5) - 2023-05-03 150 | 151 | ### Commits 152 | 153 | - (bug) Handle cancel action when opening files [`b86b150`](https://github.com/hypermodules/hyperamp/commit/b86b1509620d345af9c204ce93478682012fa0cd) 154 | 155 | ## [v1.0.4](https://github.com/hypermodules/hyperamp/compare/v1.0.3...v1.0.4) - 2023-04-04 156 | 157 | ### Commits 158 | 159 | - Restore media button functionality [`bdcd18e`](https://github.com/hypermodules/hyperamp/commit/bdcd18ef55955b3ab3412d58be78ed3b57600e81) 160 | 161 | ## [v1.0.3](https://github.com/hypermodules/hyperamp/compare/v1.0.2...v1.0.3) - 2023-04-04 162 | 163 | ### Commits 164 | 165 | - Merge pull request #354 from hypermodules/dependabot/npm_and_yarn/electron-24.0.0 [`fbd3ea1`](https://github.com/hypermodules/hyperamp/commit/fbd3ea17b1312c41597b7176c2f6cadf1776aa83) 166 | - Bump electron from 23.2.2 to 24.0.0 [`e70b163`](https://github.com/hypermodules/hyperamp/commit/e70b163889a93f0a0d088dc798fbf8fb59182f37) 167 | 168 | ## [v1.0.2](https://github.com/hypermodules/hyperamp/compare/v1.0.1...v1.0.2) - 2023-03-12 169 | 170 | ### Commits 171 | 172 | - Fix track recall functionality [`fadf303`](https://github.com/hypermodules/hyperamp/commit/fadf3031e09abf76b8f9da316c22c8397bbdc615) 173 | 174 | ## [v1.0.1](https://github.com/hypermodules/hyperamp/compare/v1.0.0...v1.0.1) - 2023-03-12 175 | 176 | ### Commits 177 | 178 | - Fix file loading regressions [`754b97d`](https://github.com/hypermodules/hyperamp/commit/754b97d34ea4d8a6ee9bba38bccb7eb252607871) 179 | 180 | ## [v1.0.0](https://github.com/hypermodules/hyperamp/compare/v0.6.11...v1.0.0) - 2023-03-12 181 | 182 | ### Commits 183 | 184 | - Update README.md [`2cd1d21`](https://github.com/hypermodules/hyperamp/commit/2cd1d21bd0dcff322209e252c74c50065024a387) 185 | - Fix test command [`8db2c3b`](https://github.com/hypermodules/hyperamp/commit/8db2c3b1f6e39e7ed742880dd0b2ff16e1be8c43) 186 | 187 | ## [v0.6.11](https://github.com/hypermodules/hyperamp/compare/v0.6.10...v0.6.11) - 2023-03-11 188 | 189 | ### Commits 190 | 191 | - Fix build targets [`f145813`](https://github.com/hypermodules/hyperamp/commit/f14581348d887a550e22ac627215d81c23913c58) 192 | 193 | ## [v0.6.10](https://github.com/hypermodules/hyperamp/compare/v0.6.9...v0.6.10) - 2023-03-11 194 | 195 | ### Commits 196 | 197 | - Enable dependabot again [`64ad0c9`](https://github.com/hypermodules/hyperamp/commit/64ad0c986a182d4176a1a79e741690abafedf45f) 198 | - Removed failed cross platform tools [`e143c37`](https://github.com/hypermodules/hyperamp/commit/e143c37895ee3544ca3806261cfbf4102397084d) 199 | - Update README.md [`39ae593`](https://github.com/hypermodules/hyperamp/commit/39ae5937812a226da2ba7681e1d61f7e07a74bc1) 200 | 201 | ## [v0.6.9](https://github.com/hypermodules/hyperamp/compare/v0.6.8...v0.6.9) - 2023-03-11 202 | 203 | ### Commits 204 | 205 | - Fix release type [`adf2489`](https://github.com/hypermodules/hyperamp/commit/adf24892fb961cfde833d30f9bde4fbb7e8c9cfb) 206 | 207 | ## [v0.6.8](https://github.com/hypermodules/hyperamp/compare/v0.6.7...v0.6.8) - 2023-03-11 208 | 209 | ### Commits 210 | 211 | - Fix tag checkout action code [`0abbde6`](https://github.com/hypermodules/hyperamp/commit/0abbde67a07742af8376bad9188d92886667e901) 212 | 213 | ## [v0.6.7](https://github.com/hypermodules/hyperamp/compare/v0.6.6...v0.6.7) - 2023-03-11 214 | 215 | ### Commits 216 | 217 | - Fix release token [`20dcb39`](https://github.com/hypermodules/hyperamp/commit/20dcb39bdd01c31d09bb14202311890d203711d0) 218 | 219 | ## [v0.6.6](https://github.com/hypermodules/hyperamp/compare/v0.6.5...v0.6.6) - 2023-03-11 220 | 221 | ### Commits 222 | 223 | - Tweak build some more [`87b6c76`](https://github.com/hypermodules/hyperamp/commit/87b6c76ec9d5a5ffe0bd6baaff24a9e336b4817b) 224 | 225 | ## [v0.6.5](https://github.com/hypermodules/hyperamp/compare/v0.6.4...v0.6.5) - 2023-03-11 226 | 227 | ### Commits 228 | 229 | - Set token on release [`6ccf299`](https://github.com/hypermodules/hyperamp/commit/6ccf299e96740abf1dfb336c85123fa85484abc1) 230 | - Action typo [`b14136a`](https://github.com/hypermodules/hyperamp/commit/b14136ada3010eb4f849b56903e2e139df3d5654) 231 | 232 | ## [v0.6.4](https://github.com/hypermodules/hyperamp/compare/v0.6.3...v0.6.4) - 2023-03-11 233 | 234 | ### Merged 235 | 236 | - Greenkeeper/music metadata 4.8.0 [`#331`](https://github.com/hypermodules/hyperamp/pull/331) 237 | - Update bl to the latest version 🚀 [`#329`](https://github.com/hypermodules/hyperamp/pull/329) 238 | - chore(package): update electron to version 6.0.8 [`#328`](https://github.com/hypermodules/hyperamp/pull/328) 239 | - Update electron-store to the latest version 🚀 [`#327`](https://github.com/hypermodules/hyperamp/pull/327) 240 | - chore(package): update electron to version 6.0.7 [`#326`](https://github.com/hypermodules/hyperamp/pull/326) 241 | - Update electron-context-menu to the latest version 🚀 [`#324`](https://github.com/hypermodules/hyperamp/pull/324) 242 | - Update standard to the latest version 🚀 [`#322`](https://github.com/hypermodules/hyperamp/pull/322) 243 | - Update rimraf to the latest version 🚀 [`#321`](https://github.com/hypermodules/hyperamp/pull/321) 244 | - Update dependencies to enable Greenkeeper 🌴 [`#320`](https://github.com/hypermodules/hyperamp/pull/320) 245 | 246 | ### Commits 247 | 248 | - Update build to latest deps [`d9b8879`](https://github.com/hypermodules/hyperamp/commit/d9b88796390b963be1b6651f4d9c512397fa722f) 249 | - Upload artifacts [`7f9166f`](https://github.com/hypermodules/hyperamp/commit/7f9166f40695f9379f50700ab14c399a182ef3e0) 250 | - Fix tests [`4178f30`](https://github.com/hypermodules/hyperamp/commit/4178f3091a0de37c0bc7583c8af1734ff41615ef) 251 | 252 | ## [v0.6.3](https://github.com/hypermodules/hyperamp/compare/v0.6.2...v0.6.3) - 2019-07-10 253 | 254 | ### Merged 255 | 256 | - Update dependencies [`#318`](https://github.com/hypermodules/hyperamp/pull/318) 257 | 258 | ### Commits 259 | 260 | - bump deps again [`ba0b35c`](https://github.com/hypermodules/hyperamp/commit/ba0b35cc2e1b65a1279ea6c8a0a20828694917e7) 261 | - add total downloads [`5f23563`](https://github.com/hypermodules/hyperamp/commit/5f23563f702c84e6151d25a7dc64e27de322cef3) 262 | - CHANGELOG [`dcf79b3`](https://github.com/hypermodules/hyperamp/commit/dcf79b333e260abc605f8944e97f3ffea5ffa780) 263 | 264 | ## [v0.6.2](https://github.com/hypermodules/hyperamp/compare/v0.6.1...v0.6.2) - 2018-11-04 265 | 266 | ### Merged 267 | 268 | - Update deps [`#316`](https://github.com/hypermodules/hyperamp/pull/316) 269 | 270 | ### Commits 271 | 272 | - CHANGELOG [`23b5d8d`](https://github.com/hypermodules/hyperamp/commit/23b5d8d504d1fbf14a7b11afcf5c2ce214ca65cf) 273 | 274 | ## [v0.6.1](https://github.com/hypermodules/hyperamp/compare/v0.6.0...v0.6.1) - 2018-08-07 275 | 276 | ### Merged 277 | 278 | - Electron3 + CSP [`#315`](https://github.com/hypermodules/hyperamp/pull/315) 279 | 280 | ### Commits 281 | 282 | - CSP work [`428f22f`](https://github.com/hypermodules/hyperamp/commit/428f22ffea7d457b35832044c7575f996c20943b) 283 | - Changelog [`5394e56`](https://github.com/hypermodules/hyperamp/commit/5394e5667ae74789d0fe1ec88a00d17cecb392ce) 284 | - Update to a newer electron api [`f5a4ce3`](https://github.com/hypermodules/hyperamp/commit/f5a4ce38c873324341ed0b831c9fc22678aff381) 285 | 286 | ## [v0.6.0](https://github.com/hypermodules/hyperamp/compare/v0.5.15...v0.6.0) - 2018-08-02 287 | 288 | ### Merged 289 | 290 | - feat(player): add always-on-top view menu item [`#313`](https://github.com/hypermodules/hyperamp/pull/313) 291 | - feat(player): pause playback when waking from sleep [`#314`](https://github.com/hypermodules/hyperamp/pull/314) 292 | 293 | ### Commits 294 | 295 | - Update deps [`d05d918`](https://github.com/hypermodules/hyperamp/commit/d05d91852a571b5815451527c4050aefda76070a) 296 | - deps [`2619bc8`](https://github.com/hypermodules/hyperamp/commit/2619bc87eab32c1e344537128d35d5fbc53871fb) 297 | - Pause on sleep rather than wake [`5c49015`](https://github.com/hypermodules/hyperamp/commit/5c49015ad40ccd89bf762106ed594cf5f402adfa) 298 | 299 | ## [v0.5.15](https://github.com/hypermodules/hyperamp/compare/v0.5.14...v0.5.15) - 2018-05-22 300 | 301 | ### Commits 302 | 303 | - chore: update deps [`f9c94d9`](https://github.com/hypermodules/hyperamp/commit/f9c94d9647b97ee4eb6cdd08f57327abf1fef605) 304 | 305 | ## [v0.5.14](https://github.com/hypermodules/hyperamp/compare/v0.5.13...v0.5.14) - 2018-05-15 306 | 307 | ### Commits 308 | 309 | - Format [`8e4caa3`](https://github.com/hypermodules/hyperamp/commit/8e4caa339f97065b8dbdc9610275be050a1e0ae1) 310 | - Update deps [`7b123ac`](https://github.com/hypermodules/hyperamp/commit/7b123ac2cc7282bd423ff4fafbbb7175afb086ef) 311 | 312 | ## [v0.5.13](https://github.com/hypermodules/hyperamp/compare/v0.5.12...v0.5.13) - 2018-03-06 313 | 314 | ### Merged 315 | 316 | - feat: add genre to columns & search (#307) [`#309`](https://github.com/hypermodules/hyperamp/pull/309) 317 | 318 | ## [v0.5.12](https://github.com/hypermodules/hyperamp/compare/v0.5.11...v0.5.12) - 2018-03-03 319 | 320 | ### Commits 321 | 322 | - docs(contributing): add release process (#298) [`540cedc`](https://github.com/hypermodules/hyperamp/commit/540cedcba01941e7c03c66a97ea096949305a7ac) 323 | - fix(build): specify AppImage as linux target [`8d1ead0`](https://github.com/hypermodules/hyperamp/commit/8d1ead07c6b28059f9c01188c2d04dc82cd4836d) 324 | - chore(pkg): add release script [`3e4cf4b`](https://github.com/hypermodules/hyperamp/commit/3e4cf4bac7f7078026bc8c07a9d97ff74a805b02) 325 | 326 | ## [v0.5.11](https://github.com/hypermodules/hyperamp/compare/0.5.10...v0.5.11) - 2018-02-23 327 | 328 | ### Merged 329 | 330 | - fix(menu): do not strip "bugs" from package (#304) [`#305`](https://github.com/hypermodules/hyperamp/pull/305) 331 | 332 | ### Commits 333 | 334 | - Update README.md [`e8c4994`](https://github.com/hypermodules/hyperamp/commit/e8c499488ada480742a3cd27f9e0c287a0dcb42d) 335 | 336 | ## [0.5.10](https://github.com/hypermodules/hyperamp/compare/v0.5.10...0.5.10) - 2018-02-14 337 | 338 | ## [v0.5.10](https://github.com/hypermodules/hyperamp/compare/v0.5.9...v0.5.10) - 2018-02-14 339 | 340 | ### Merged 341 | 342 | - Bretkeeper [`#303`](https://github.com/hypermodules/hyperamp/pull/303) 343 | 344 | ### Commits 345 | 346 | - Update deps n changelog [`0b02015`](https://github.com/hypermodules/hyperamp/commit/0b02015be1fe0ff4486af7a0040e3ba52c10b840) 347 | - Add missing devdep [`ea27455`](https://github.com/hypermodules/hyperamp/commit/ea274557733303e7a931de936bb5022d7b25c34e) 348 | 349 | ## [v0.5.9](https://github.com/hypermodules/hyperamp/compare/v0.5.8...v0.5.9) - 2018-01-27 350 | 351 | ### Merged 352 | 353 | - fix(security): electron@1.7.11 [`#300`](https://github.com/hypermodules/hyperamp/pull/300) 354 | 355 | ### Commits 356 | 357 | - fix(deps): electron-builder@19.55.2, electron-updater@2.20.1 [`c9f9b4e`](https://github.com/hypermodules/hyperamp/commit/c9f9b4e73d56bfcf29438cd2fe46edf3e8c3bd8d) 358 | 359 | ## [v0.5.8](https://github.com/hypermodules/hyperamp/compare/v0.5.7...v0.5.8) - 2017-12-21 360 | 361 | ### Commits 362 | 363 | - refactor: organize main index [`0e5c3fe`](https://github.com/hypermodules/hyperamp/commit/0e5c3fe18e5e0b634ff0feeb3ae838e2b145ac0f) 364 | - update add button, refactor button groups [`043950e`](https://github.com/hypermodules/hyperamp/commit/043950ea761a66e3eb2c8244add5c21e519de6b4) 365 | - chore: reorganize directories [`d5414b8`](https://github.com/hypermodules/hyperamp/commit/d5414b8029fb2ce21f9e1fbe0d3e2e536033be4e) 366 | 367 | ## [v0.5.7](https://github.com/hypermodules/hyperamp/compare/v0.5.6...v0.5.7) - 2017-12-03 368 | 369 | ### Merged 370 | 371 | - Disable nanotiming [`#285`](https://github.com/hypermodules/hyperamp/pull/285) 372 | 373 | ### Commits 374 | 375 | - update readme, screenshots, contribs, dirs [`acc44b6`](https://github.com/hypermodules/hyperamp/commit/acc44b6685545b483ca5b59aabf6d2feba5f027e) 376 | - Fix range slider mutations [`a0649f6`](https://github.com/hypermodules/hyperamp/commit/a0649f6cee49bbb46c1528bfbffe739a0f10255a) 377 | - Update changelog [`338781a`](https://github.com/hypermodules/hyperamp/commit/338781a04af4f31cfd20414992f4c35b9b0b202a) 378 | 379 | ## [v0.5.6](https://github.com/hypermodules/hyperamp/compare/v0.5.5...v0.5.6) - 2017-11-11 380 | 381 | ### Commits 382 | 383 | - Improve sentry reporting [`f855247`](https://github.com/hypermodules/hyperamp/commit/f855247f1dd99dc559f85aeb44efac7484b9650b) 384 | 385 | ## [v0.5.5](https://github.com/hypermodules/hyperamp/compare/v0.5.4...v0.5.5) - 2017-11-11 386 | 387 | ### Merged 388 | 389 | - Add sentry [`#267`](https://github.com/hypermodules/hyperamp/pull/267) 390 | - Add dep badges [`#268`](https://github.com/hypermodules/hyperamp/pull/268) 391 | - Auto update ipc [`#264`](https://github.com/hypermodules/hyperamp/pull/264) 392 | - Fix windows lifecycle [`#265`](https://github.com/hypermodules/hyperamp/pull/265) 393 | 394 | ### Fixed 395 | 396 | - Add sentry [`#176`](https://github.com/hypermodules/hyperamp/issues/176) 397 | 398 | ### Commits 399 | 400 | - Emit auto-update into ipc [`6bee7cf`](https://github.com/hypermodules/hyperamp/commit/6bee7cf0549fd6470326f6fe43c59a546b3f2afd) 401 | - Name sentry stuff [`cf62498`](https://github.com/hypermodules/hyperamp/commit/cf6249898f0e24378ed51e5ae379270165be7442) 402 | - Prevent multiple instances of the app [`3d45676`](https://github.com/hypermodules/hyperamp/commit/3d45676651b68c590de394fee83c4410e5ada611) 403 | 404 | ## [v0.5.4](https://github.com/hypermodules/hyperamp/compare/v0.5.3...v0.5.4) - 2017-11-10 405 | 406 | ### Merged 407 | 408 | - Fix top level update function [`#263`](https://github.com/hypermodules/hyperamp/pull/263) 409 | - Update choo-devtools [`#262`](https://github.com/hypermodules/hyperamp/pull/262) 410 | 411 | ### Commits 412 | 413 | - Update devtools and electron [`a3ea888`](https://github.com/hypermodules/hyperamp/commit/a3ea88864007c9ede405d630144795db7539b327) 414 | - Update changelog [`77bd6b0`](https://github.com/hypermodules/hyperamp/commit/77bd6b02228fcbb6f1751162104d5ff47370943d) 415 | - Update CHANGELOG.md [`267ceaa`](https://github.com/hypermodules/hyperamp/commit/267ceaa25e896fa543c25f4fda46ab9f7db420cf) 416 | 417 | ## [v0.5.3](https://github.com/hypermodules/hyperamp/compare/v0.5.2...v0.5.3) - 2017-11-09 418 | 419 | ### Merged 420 | 421 | - Fixing state transfer bugs [`#260`](https://github.com/hypermodules/hyperamp/pull/260) 422 | 423 | ### Commits 424 | 425 | - Add changelog [`864118b`](https://github.com/hypermodules/hyperamp/commit/864118b163e23ff480aaa191de4422d36a7d076b) 426 | - Fix now playing index bugs [`960880c`](https://github.com/hypermodules/hyperamp/commit/960880cf9e51b3861e19f9d771cb43a49871b584) 427 | - Fix some delayed update bugs in player [`a88e82c`](https://github.com/hypermodules/hyperamp/commit/a88e82ced0593d95ce88bb4ed7852b0707d68e3b) 428 | 429 | ## [v0.5.2](https://github.com/hypermodules/hyperamp/compare/v0.5.1...v0.5.2) - 2017-11-08 430 | 431 | ### Merged 432 | 433 | - Update metadata parser [`#253`](https://github.com/hypermodules/hyperamp/pull/253) 434 | - Commit IPC loggig graffle [`#254`](https://github.com/hypermodules/hyperamp/pull/254) 435 | - Add auto updater events [`#255`](https://github.com/hypermodules/hyperamp/pull/255) 436 | - Update electron-builder [`#256`](https://github.com/hypermodules/hyperamp/pull/256) 437 | - Scroll to current index on window open [`#251`](https://github.com/hypermodules/hyperamp/pull/251) 438 | 439 | ### Commits 440 | 441 | - Use music-metadata instead of musicmetadata [`6cdb83f`](https://github.com/hypermodules/hyperamp/commit/6cdb83f6b44c240520833bd45b96c93dba429cb5) 442 | - Use buffer list and fix tests [`4c9f62a`](https://github.com/hypermodules/hyperamp/commit/4c9f62a4588261a2c54ae31d1b1b8a12f320a8fc) 443 | - Remove dead code [`0dd5483`](https://github.com/hypermodules/hyperamp/commit/0dd54837eb2e5336dadd153976b9127bd4284475) 444 | 445 | ## [v0.5.1](https://github.com/hypermodules/hyperamp/compare/v0.5.0...v0.5.1) - 2017-10-31 446 | 447 | ## v0.5.0 - 2017-10-31 448 | 449 | ### Merged 450 | 451 | - Fix builds [`#250`](https://github.com/hypermodules/hyperamp/pull/250) 452 | - Re-register media shortcuts when window activate [`#248`](https://github.com/hypermodules/hyperamp/pull/248) 453 | - Fix race condition (maybe) [`#249`](https://github.com/hypermodules/hyperamp/pull/249) 454 | - simplify index.html logic [`#245`](https://github.com/hypermodules/hyperamp/pull/245) 455 | - Enable browserify build process [`#240`](https://github.com/hypermodules/hyperamp/pull/240) 456 | - Add engines field [`#241`](https://github.com/hypermodules/hyperamp/pull/241) 457 | - docs: flesh out contributing guidelines [`#239`](https://github.com/hypermodules/hyperamp/pull/239) 458 | - GPL-3.0 [`#236`](https://github.com/hypermodules/hyperamp/pull/236) 459 | - Start AudioLibrary state management class [`#234`](https://github.com/hypermodules/hyperamp/pull/234) 460 | - docs(readme): update irc badge [`#233`](https://github.com/hypermodules/hyperamp/pull/233) 461 | - rework track list [`#224`](https://github.com/hypermodules/hyperamp/pull/224) 462 | - Sticky headers [`#225`](https://github.com/hypermodules/hyperamp/pull/225) 463 | - Testing proposed nc 6.0.0-1 changes [`#219`](https://github.com/hypermodules/hyperamp/pull/219) 464 | - windows fixes [`#216`](https://github.com/hypermodules/hyperamp/pull/216) 465 | - Use nanocomponent 6 [`#217`](https://github.com/hypermodules/hyperamp/pull/217) 466 | - Fix scroll bug between nav [`#214`](https://github.com/hypermodules/hyperamp/pull/214) 467 | - Add choo-expose [`#212`](https://github.com/hypermodules/hyperamp/pull/212) 468 | - attempt to add loader to playlist [`#210`](https://github.com/hypermodules/hyperamp/pull/210) 469 | - Upgrade to Choo 6 [`#208`](https://github.com/hypermodules/hyperamp/pull/208) 470 | - refactor: reorganize & simply file structure [`#207`](https://github.com/hypermodules/hyperamp/pull/207) 471 | - Properly restore now-playing when window is closed [`#204`](https://github.com/hypermodules/hyperamp/pull/204) 472 | - Properly encode file URLs in audio process [`#201`](https://github.com/hypermodules/hyperamp/pull/201) 473 | - add clear script [`#198`](https://github.com/hypermodules/hyperamp/pull/198) 474 | - Implement naive shuffle [`#197`](https://github.com/hypermodules/hyperamp/pull/197) 475 | - Better sort [`#195`](https://github.com/hypermodules/hyperamp/pull/195) 476 | - Fix highlight on scroll.. Mostly [`#183`](https://github.com/hypermodules/hyperamp/pull/183) 477 | - Remove level dependency [`#181`](https://github.com/hypermodules/hyperamp/pull/181) 478 | - Content + DOM addressable image cache [`#179`](https://github.com/hypermodules/hyperamp/pull/179) 479 | - npm 5 test [`#178`](https://github.com/hypermodules/hyperamp/pull/178) 480 | - Fix reflow [`#177`](https://github.com/hypermodules/hyperamp/pull/177) 481 | - Handle ∞ lists [`#171`](https://github.com/hypermodules/hyperamp/pull/171) 482 | - Table Component [`#169`](https://github.com/hypermodules/hyperamp/pull/169) 483 | - Update dependencies to enable Greenkeeper 🌴 [`#168`](https://github.com/hypermodules/hyperamp/pull/168) 484 | - Make the 'footer' a component [`#166`](https://github.com/hypermodules/hyperamp/pull/166) 485 | - update screenshots [`#163`](https://github.com/hypermodules/hyperamp/pull/163) 486 | - Implement player buttons component [`#162`](https://github.com/hypermodules/hyperamp/pull/162) 487 | - experimental alternate layout & style [`#159`](https://github.com/hypermodules/hyperamp/pull/159) 488 | - Update xvfb-maybe to version 0.2.1 🚀 [`#160`](https://github.com/hypermodules/hyperamp/pull/160) 489 | - Update electron to version 1.6.6 🚀 [`#157`](https://github.com/hypermodules/hyperamp/pull/157) 490 | - Cache Elements [`#153`](https://github.com/hypermodules/hyperamp/pull/153) 491 | - Update electron-builder to version 17.0.1 🚀 [`#150`](https://github.com/hypermodules/hyperamp/pull/150) 492 | - Update electron-context-menu to version 0.9.0 🚀 [`#152`](https://github.com/hypermodules/hyperamp/pull/152) 493 | - chore(package): update electron to version 1.6.5 [`#151`](https://github.com/hypermodules/hyperamp/pull/151) 494 | - chore(package): update snazzy to version 7.0.0 [`#145`](https://github.com/hypermodules/hyperamp/pull/145) 495 | - Update cache-element to version 3.0.0 🚀 [`#141`](https://github.com/hypermodules/hyperamp/pull/141) 496 | - Update nanocomponent to version 3.0.2 🚀 [`#140`](https://github.com/hypermodules/hyperamp/pull/140) 497 | - Update standard to version 10.0.1 🚀 [`#144`](https://github.com/hypermodules/hyperamp/pull/144) 498 | - Prevent Linux crash; support Ogg Vorbis [`#135`](https://github.com/hypermodules/hyperamp/pull/135) 499 | - Update choo-log to version 6.0.0 🚀 [`#137`](https://github.com/hypermodules/hyperamp/pull/137) 500 | - add select, double click behavior to list items [`#134`](https://github.com/hypermodules/hyperamp/pull/134) 501 | - Update electron-builder to version 16.1.0 🚀 [`#132`](https://github.com/hypermodules/hyperamp/pull/132) 502 | - Choo5 [`#127`](https://github.com/hypermodules/hyperamp/pull/127) 503 | - Album art [`#117`](https://github.com/hypermodules/hyperamp/pull/117) 504 | - fix borked message passing [`#116`](https://github.com/hypermodules/hyperamp/pull/116) 505 | - Enable all buttons! [`#114`](https://github.com/hypermodules/hyperamp/pull/114) 506 | - Implement queue [`#113`](https://github.com/hypermodules/hyperamp/pull/113) 507 | - Update electron-builder to version 15.1.1 🚀 [`#111`](https://github.com/hypermodules/hyperamp/pull/111) 508 | - chore(package): update standard to version 9.0.0 [`#91`](https://github.com/hypermodules/hyperamp/pull/91) 509 | - Set up basic packaging [`#87`](https://github.com/hypermodules/hyperamp/pull/87) 510 | - Spectron tests [`#86`](https://github.com/hypermodules/hyperamp/pull/86) 511 | - A bunch of minor tweaks from music-library experiments [`#85`](https://github.com/hypermodules/hyperamp/pull/85) 512 | - chore(package): update electron to version 1.4.15 [`#79`](https://github.com/hypermodules/hyperamp/pull/79) 513 | - chore(package): update electron to version 1.4.14 [`#78`](https://github.com/hypermodules/hyperamp/pull/78) 514 | - use search field instead of text input [`#76`](https://github.com/hypermodules/hyperamp/pull/76) 515 | - fix search, add album sort, tweak th style [`#75`](https://github.com/hypermodules/hyperamp/pull/75) 516 | - Sticky headers FTW [`#74`](https://github.com/hypermodules/hyperamp/pull/74) 517 | - fix preferences view [`#73`](https://github.com/hypermodules/hyperamp/pull/73) 518 | - put the * selector back [`#72`](https://github.com/hypermodules/hyperamp/pull/72) 519 | - improve range and table styles [`#71`](https://github.com/hypermodules/hyperamp/pull/71) 520 | - Implement Button groups [`#70`](https://github.com/hypermodules/hyperamp/pull/70) 521 | - Update choo [`#67`](https://github.com/hypermodules/hyperamp/pull/67) 522 | - chore(package): update electron-context-menu to version 0.8.0 [`#56`](https://github.com/hypermodules/hyperamp/pull/56) 523 | - Css refactor [`#62`](https://github.com/hypermodules/hyperamp/pull/62) 524 | - Update electron to version 1.4.12 🚀 [`#60`](https://github.com/hypermodules/hyperamp/pull/60) 525 | - chore(package): update electron to version 1.4.11 [`#59`](https://github.com/hypermodules/hyperamp/pull/59) 526 | - Update electron to version 1.4.10 🚀 [`#58`](https://github.com/hypermodules/hyperamp/pull/58) 527 | - chore(package): update electron to version 1.4.8 [`#55`](https://github.com/hypermodules/hyperamp/pull/55) 528 | - Update electron to version 1.4.7 🚀 [`#51`](https://github.com/hypermodules/hyperamp/pull/51) 529 | - Update electron to version 1.4.6 🚀 [`#49`](https://github.com/hypermodules/hyperamp/pull/49) 530 | - Update electron-context-menu to version 0.7.0 🚀 [`#48`](https://github.com/hypermodules/hyperamp/pull/48) 531 | - Update electron to version 1.4.5 🚀 [`#47`](https://github.com/hypermodules/hyperamp/pull/47) 532 | - Update electron to version 1.4.3 🚀 [`#41`](https://github.com/hypermodules/hyperamp/pull/41) 533 | - Update electron to version 1.4.2 🚀 [`#40`](https://github.com/hypermodules/hyperamp/pull/40) 534 | - Update choo-location-electron to version 2.0.0 🚀 [`#38`](https://github.com/hypermodules/hyperamp/pull/38) 535 | - Update electron to version 1.4.1 🚀 [`#36`](https://github.com/hypermodules/hyperamp/pull/36) 536 | - Update electron-context-menu to version 0.6.0 🚀 [`#34`](https://github.com/hypermodules/hyperamp/pull/34) 537 | - Update electron to version 1.4.0 🚀 [`#33`](https://github.com/hypermodules/hyperamp/pull/33) 538 | - Retrieve assets out of node_modules. [`#32`](https://github.com/hypermodules/hyperamp/pull/32) 539 | - Update electron to version 1.3.5 🚀 [`#29`](https://github.com/hypermodules/hyperamp/pull/29) 540 | - Update electron-context-menu to version 0.5.0 🚀 [`#31`](https://github.com/hypermodules/hyperamp/pull/31) 541 | - Experimenting with sheetify [`#20`](https://github.com/hypermodules/hyperamp/pull/20) 542 | - move audio to hidden process [`#25`](https://github.com/hypermodules/hyperamp/pull/25) 543 | - Update standard to version 8.0.0 🚀 [`#19`](https://github.com/hypermodules/hyperamp/pull/19) 544 | - add discount audio for maximum great sound [`#14`](https://github.com/hypermodules/hyperamp/pull/14) 545 | - populate library with real metadata [`#13`](https://github.com/hypermodules/hyperamp/pull/13) 546 | 547 | ### Fixed 548 | 549 | - Add engines field [`#189`](https://github.com/hypermodules/hyperamp/issues/189) 550 | - Fix scroll bug between nav [`#213`](https://github.com/hypermodules/hyperamp/issues/213) 551 | - Properly restore now-playing when window is closed [`#196`](https://github.com/hypermodules/hyperamp/issues/196) 552 | - Properly encode file URLs in audio process [`#200`](https://github.com/hypermodules/hyperamp/issues/200) 553 | - Implement a naive shuffle mode [`#184`](https://github.com/hypermodules/hyperamp/issues/184) 554 | - Improve song sort [`#155`](https://github.com/hypermodules/hyperamp/issues/155) 555 | - Fix highlight on scroll.. Mostly [`#175`](https://github.com/hypermodules/hyperamp/issues/175) 556 | - update screenshots [`#161`](https://github.com/hypermodules/hyperamp/issues/161) 557 | - implement a queue action [`#101`](https://github.com/hypermodules/hyperamp/issues/101) 558 | - Sticky headers FTW (#74) [`#17`](https://github.com/hypermodules/hyperamp/issues/17) 559 | - populate library with real metadata [`#11`](https://github.com/hypermodules/hyperamp/issues/11) 560 | 561 | ### Commits 562 | 563 | - Some tests and shuffling [`3533075`](https://github.com/hypermodules/hyperamp/commit/353307523b2ec525de3eb26775e5bf766929e90d) 564 | - Delete package-lock.json [`b573eba`](https://github.com/hypermodules/hyperamp/commit/b573eba64ea7df3b6a5573b5bc8e424b0c319081) 565 | - simplify stores [`8341619`](https://github.com/hypermodules/hyperamp/commit/8341619518f3d1ac7b7a69c564da4a04144ac715) 566 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | Thanks for wanting to help make Hyperamp better! Here are some general guidelines for helping out. 4 | 5 | ## Code of Conduct 6 | 7 | This project is intended to be a safe, welcoming space for collaboration. All contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. Thank you for being kind to each other! 8 | 9 | ## Contributions welcome! 10 | 11 | **Before spending lots of time on something, ask for feedback on your idea first!** 12 | 13 | Please search [issues](../../issues/) and [pull requests](../../pulls/) before adding something new! This helps avoid duplicating efforts and conversations. 14 | 15 | This project welcomes any kind of contribution! Here are a few suggestions: 16 | 17 | - **Ideas**: participate in an issue thread or start your own to have your voice heard. 18 | - **Writing**: contribute your expertise in an area by helping expand the included content. 19 | - **Copy editing**: fix typos, clarify language, and generally improve the quality of the content. 20 | - **Formatting**: help keep content easy to read with consistent formatting. 21 | - **Code**: help maintain and improve the project codebase. 22 | 23 | ## Code Style 24 | 25 | [![standard][standard-image]][standard-url] 26 | 27 | This repository uses [`standard`][standard-url] to maintain code style and consistency, and to avoid style arguments. 28 | 29 | [standard-image]: https://cdn.rawgit.com/feross/standard/master/badge.svg 30 | [standard-url]: https://github.com/feross/standard 31 | 32 | ## Developing 33 | 34 | Hyperamp is an experimental audio player built with web technologies ([choo](https://github.com/yoshuawuyts/choo) + [electron](https://github.com/electron/electron)). We recommend getting familiar with JavaScript, HTML, and CSS before jumping into coding. 35 | 36 | ### Install 37 | 38 | This project is a [module party](http://module.party). That just means everything you should need to get it up and running after cloning the repository is summed up by these three lines: 39 | 40 | ``` 41 | npm install 42 | npm test 43 | npm start 44 | ``` 45 | 46 | **TL;DR:** before getting started, make sure to run `npm install`. 47 | 48 | ### Scripts 49 | 50 | - `start` - start the app in development mode 51 | - `prod` - start the app in production mode 52 | - `test` - run all tests 53 | - `build` - create a test build of the app for debugging purposes 54 | - `pkg` - package the production version of the app for release 55 | - `release` - create a new release 56 | 57 | ### Directory Structure 58 | 59 | These directories are included in the packaged application. 60 | 61 | - `lib` - files shared by `main` and `renderer` 62 | - `main` - files for the main electron process 63 | - `renderer` - files for the renderer processes (player & audio) 64 | 65 | #### Excluded from Build 66 | 67 | These directories are **not** included in the packaged application. 68 | 69 | - `build` - build resources for `electron-builder` 70 | - `dist` - this is where the app gets built to when packaging the app 71 | - `docs` - any files related to documentation 72 | - `scripts` - miscellaneous scripts for development tasks 73 | - `test` - files for testing the application 74 | 75 | ### Release Process 76 | 77 | 1. Ensure all tests are passing. 78 | 1. Create the new version section in `CHANGELOG.md`. 79 | 1. Bump the version in `package.json`. Should match the version you just created in `CHANGELOG.md`. 80 | 1. Run `npm run release`. This will create a github release draft. 81 | 1. Travis-CI (for Linux and Mac) and Appveyor (for Windows) will start uploading builds to the release draft. 82 | 1. Wait for uploads to finish. Check that everything worked during build by checking CI logs. 83 | 1. Make sure tag format is `vX.X.X` (auto-update is picky about URL names). 84 | 1. Publish the draft. 85 | 1. Clients will automatically download the new version next time they start. 86 | 87 | Our release process is based on [electron-builder](https://github.com/electron-userland/electron-builder)'s [Recommended GitHub Releases Workflow](https://github.com/electron-userland/electron-builder/blob/master/docs/configuration/publish.md#recommended-github-releases-workflow). 88 | 89 | ## Project Governance 90 | 91 | **This is an [OPEN Open Source Project](http://openopensource.org/).** 92 | 93 | Individuals making significant and valuable contributions are given commit access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project. 94 | 95 | ### Rules 96 | 97 | There are a few basic ground rules for collaborators: 98 | 99 | 1. **No `--force` pushes to master** or modifying the Git history in any way. 100 | 1. **Non-master branches** ought to be used for ongoing work. 101 | 1. **External API changes and significant modifications** ought to be subject to an **internal pull request** to solicit feedback from other contributors. 102 | 1. Internal pull requests to solicit feedback are *encouraged* for any other non-trivial contribution but left to the discretion of the contributor. 103 | 1. Contributors should attempt to adhere to the prevailing code style. 104 | 105 | ### Releases 106 | 107 | Declaring formal releases remains the prerogative of the project maintainer. 108 | 109 | ### Changes to this arrangement 110 | 111 | This is an experiment and feedback is welcome! This document may also be subject to pull requests or changes by contributors where you believe you have something valuable to add or change. 112 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 |
3 | 4 | Hyperamp 5 | 6 |
7 | Hyperamp 8 |

9 | 10 |

11 | a humble music player 12 |
13 |
14 |

15 | 16 | **NOTE:** This project was a lot of fun, but is thoroughly dead. The repo and builds will be kept around for historical reference as long as the maintenance automation and free hosting will afford. If you want to pick up this project, I recommend starting over however there are still a lot of interesting ideas and designs in this project and issues section. Have fun and happy hacking! 17 | 18 | **Hyperamp** is a project by the [hypermodules](https://hypermodul.es/) team to make a simple and free audio player that anyone can improve. We designed it to be fast and compact, with no strings attached to a store or anything else. Here's what it looks like: 19 | 20 |
21 | 22 | ![](docs/screenshot.png) 23 | ![](docs/screenshot-2.png) 24 | 25 |
26 | 27 | [![Test and Build](https://github.com/hypermodules/hyperamp/actions/workflows/test.yml/badge.svg)](https://github.com/hypermodules/hyperamp/actions/workflows/test.yml) 28 | 29 | ## Download 30 | 31 | See the [releases][release-url] page to download the latest version for your platform. 32 | 33 | [![Total Downloads][release-downloads-img]][release-url] 34 | 35 | ## Contributing 36 | 37 | Want to help make Hyperamp better? Great! Head over to the [contributing guidelines](CONTRIBUTING.md) to get started. 38 | 39 | ## License 40 | 41 | © 2024 [HYPERMODULES LLC](https://hypermodul.es) 42 | [GPLv3](LICENSE.md) 43 | 44 | [stability-img]: https://img.shields.io/badge/stability-experimental-orange.svg 45 | [stability-url]: https://nodejs.org/api/documentation.html#documentation_stability_index 46 | [build-img]: https://img.shields.io/travis/hypermodules/hyperamp/master.svg 47 | [build-url]: https://travis-ci.org/hypermodules/hyperamp 48 | [standard-img]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg 49 | [standard-url]: https://github.com/feross/standard 50 | [appveyor-img]: https://ci.appveyor.com/api/projects/status/so74ca9bg452qpny/branch/master?svg=true 51 | [appveyor-url]: https://ci.appveyor.com/project/bcomnes/hyperamp/branch/master 52 | [irc-url]: https://www.irccloud.com/invite?channel=%23hypermodules&hostname=irc.freenode.net&port=6697&ssl=1 53 | [irc-img]: https://img.shields.io/badge/freenode-%23hypermodules-1e72ff.svg 54 | [release-version-img]: https://img.shields.io/github/release/hypermodules/hyperamp.svg 55 | [release-downloads-img]: https://img.shields.io/github/downloads/hypermodules/hyperamp/total.svg 56 | [release-url]: https://github.com/hypermodules/hyperamp/releases/latest 57 | -------------------------------------------------------------------------------- /build/README.md: -------------------------------------------------------------------------------- 1 | # Build Resources 2 | 3 | This directory is for storing build resources for `electron-builder`. Please make sure you read and understand the [build configuration](https://www.electron.build/configuration/configuration) before changing anything here. 4 | -------------------------------------------------------------------------------- /build/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hypermodules/hyperamp/899d21de3794946fc29eecad52c13681b2bbdcdf/build/icon.icns -------------------------------------------------------------------------------- /build/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hypermodules/hyperamp/899d21de3794946fc29eecad52c13681b2bbdcdf/build/icon.ico -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Hyperamp Docs 2 | 3 | Welcome to the Hyperamp docs! This area is 🚧 under construction 🚧. 4 | -------------------------------------------------------------------------------- /docs/architecture.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hypermodules/hyperamp/899d21de3794946fc29eecad52c13681b2bbdcdf/docs/architecture.graffle -------------------------------------------------------------------------------- /docs/hyperamp-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hypermodules/hyperamp/899d21de3794946fc29eecad52c13681b2bbdcdf/docs/hyperamp-icon.png -------------------------------------------------------------------------------- /docs/hyperamp-icon.sketch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hypermodules/hyperamp/899d21de3794946fc29eecad52c13681b2bbdcdf/docs/hyperamp-icon.sketch -------------------------------------------------------------------------------- /docs/ipc.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hypermodules/hyperamp/899d21de3794946fc29eecad52c13681b2bbdcdf/docs/ipc.graffle -------------------------------------------------------------------------------- /docs/screenshot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hypermodules/hyperamp/899d21de3794946fc29eecad52c13681b2bbdcdf/docs/screenshot-2.png -------------------------------------------------------------------------------- /docs/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hypermodules/hyperamp/899d21de3794946fc29eecad52c13681b2bbdcdf/docs/screenshot.png -------------------------------------------------------------------------------- /docs/splash-square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hypermodules/hyperamp/899d21de3794946fc29eecad52c13681b2bbdcdf/docs/splash-square.png -------------------------------------------------------------------------------- /docs/splash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hypermodules/hyperamp/899d21de3794946fc29eecad52c13681b2bbdcdf/docs/splash.jpg -------------------------------------------------------------------------------- /lib/README.md: -------------------------------------------------------------------------------- 1 | # Library 2 | 3 | This directory is for program files that need to be shared between `main` and `renderer` processes. 4 | -------------------------------------------------------------------------------- /main/README.md: -------------------------------------------------------------------------------- 1 | # Main 2 | 3 | This directory is for files run in the `main` electron process. 4 | 5 | The entry point of the application is `index.js`. 6 | -------------------------------------------------------------------------------- /main/artwork.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const { app } = require('electron') 3 | const ArtworkCache = require('./lib/artwork-cache') 4 | const artwork = module.exports = { 5 | cache: null, 6 | init 7 | } 8 | 9 | function init () { 10 | const configPath = app.getPath('userData') 11 | artwork.cache = new ArtworkCache(path.join(configPath, 'artwork-cache')) 12 | } 13 | -------------------------------------------------------------------------------- /main/config.js: -------------------------------------------------------------------------------- 1 | const { app } = require('electron') 2 | const Config = require('electron-store') 3 | 4 | const config = new Config({ name: 'hyperamp-config' }) 5 | if (config.size === 0) config.set(defaults()) 6 | 7 | function defaults () { 8 | return { 9 | paths: [app.getPath('music')] 10 | } 11 | } 12 | 13 | module.exports = config 14 | -------------------------------------------------------------------------------- /main/index.js: -------------------------------------------------------------------------------- 1 | const log = require('electron-log') 2 | log.initialize() 3 | const electron = require('electron') 4 | const { app, ipcMain } = electron 5 | const remoteMain = require('@electron/remote/main') 6 | remoteMain.initialize() 7 | const Config = require('electron-store') 8 | const get = require('lodash.get') 9 | const xtend = require('xtend') 10 | const userConfig = require('./config') 11 | const menu = require('./menu') 12 | const artwork = require('./artwork') 13 | const makeTrackDict = require('./track-dict') 14 | const audio = require('./windows/audio') 15 | const player = require('./windows/player') 16 | const AudioLibrary = require('./lib/audio-library') 17 | const autoUpdater = require('electron-updater').autoUpdater 18 | autoUpdater.logger = log 19 | autoUpdater.autoDownload = true 20 | 21 | // handle uncaught exceptions before calling any functions 22 | process.on('uncaughtException', (err) => { 23 | log.error(err) 24 | }) 25 | 26 | const windows = [player, audio] 27 | 28 | const persist = new Config({ name: 'hyperamp-persist' }) 29 | const libraryPersist = new Config({ name: 'hyperamp-library' }) 30 | 31 | const state = xtend({ 32 | paths: [], // USERCONFIG: Paths for searching for songs 33 | loading: false, // Mutex for performing a scan for new tracks 34 | volume: 0.50, 35 | playing: false, 36 | muted: false 37 | }, persist.store, userConfig.store) 38 | 39 | const al = new AudioLibrary(libraryPersist.store) 40 | 41 | module.exports = state 42 | module.exports.al = al 43 | 44 | const gotTheLock = app.requestSingleInstanceLock() 45 | 46 | if (!gotTheLock) { 47 | app.quit() 48 | } 49 | 50 | app.on('second-instance', (commandLine, workingDirectory) => { 51 | // 52 | // Someone tried to run a second instance, we should focus our window. 53 | if (player.win) { 54 | if (player.win.isMinimized()) player.win.restore() 55 | player.win.focus() 56 | } else { 57 | al.recall() 58 | player.init() 59 | } 60 | }) 61 | 62 | app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required') 63 | 64 | app.on('ready', function appReady () { 65 | menu.init() 66 | audio.init() 67 | player.init() 68 | artwork.init() 69 | 70 | electron.powerMonitor.on('suspend', function pauseOnWake () { 71 | log.info('Entering sleep, pausing') 72 | ipcMain.emit('pause') 73 | }) 74 | 75 | // register IPC handlers 76 | ipcMain.on('volume', volume) 77 | ipcMain.on('queue', queue) 78 | ipcMain.on('play', play) 79 | ipcMain.on('playing', playing) 80 | ipcMain.on('pause', pause) 81 | ipcMain.on('paused', paused) 82 | ipcMain.on('prev', prev) 83 | ipcMain.on('next', next) 84 | ipcMain.on('mute', mute) 85 | ipcMain.on('unmute', unmute) 86 | ipcMain.on('shuffle', shuffle) 87 | ipcMain.on('unshuffle', unshuffle) 88 | ipcMain.on('timeupdate', timeupdate) 89 | ipcMain.on('seek', seek) 90 | ipcMain.on('update-library', updateLibrary) 91 | ipcMain.on('search', search) 92 | ipcMain.on('recall', recall) 93 | ipcMain.on('sync-state', syncState) 94 | 95 | // register autoUpdater 96 | if (!process.env.DEV_SERVER) { 97 | setTimeout(() => { 98 | log.info('autoUpdater: Auto update initalized...') 99 | autoUpdater.checkForUpdatesAndNotify() 100 | }, 1000 * 3) 101 | } 102 | 103 | autoUpdater.on('error', (err) => { 104 | broadcast('au:error', err) 105 | console.error(err) 106 | }) 107 | 108 | autoUpdater.on('checking-for-update', () => { 109 | broadcast('log', 'autoUpdater: Checking for update...') 110 | log.info('autoUpdater: Checking for update...') 111 | broadcast('au:checking-for-update') 112 | }) 113 | 114 | autoUpdater.on('update-available', (info) => { 115 | broadcast('log', 'autoUpdater: Update available!') 116 | log.info('autoUpdater: Update available!') 117 | broadcast('au:update-available', info) 118 | }) 119 | 120 | autoUpdater.on('update-not-available', (info) => { 121 | broadcast('log', 'autoUpdater: No update available') 122 | log.info('autoUpdater: No update available') 123 | broadcast('au:update-not-available', info) 124 | }) 125 | 126 | autoUpdater.on('download-progress', (progress) => { 127 | broadcast('au:progress', progress) 128 | }) 129 | 130 | autoUpdater.on('update-downloaded', (info) => { 131 | broadcast('log', 'autoUpdater: Update downloaded') 132 | log.info('autoUpdater: Update downloaded') 133 | broadcast('au:update-downloaded', info) 134 | }) 135 | 136 | // ACTIONS 137 | // NOTE: I really don't like having all of these actions stuck in this scope. 138 | // Would be nice to move this to a separate file eventually. -ungoldman 139 | 140 | // Emit things to all windows 141 | function broadcast (/* args */) { 142 | const args = [].slice.call(arguments, 0) 143 | windows.forEach((winObj) => { 144 | if (winObj.win) winObj.win.send.apply(winObj.win, args) 145 | }) 146 | } 147 | 148 | function volume (ev, level) { 149 | // player -> audio 150 | state.volume = level 151 | if (audio.win) audio.win.send('volume', level) 152 | } 153 | 154 | function queue (ev, newIndex) { 155 | const newTrack = al.queue(newIndex) 156 | broadcast('log', newTrack) 157 | log.info(newTrack) 158 | broadcast('new-track', newTrack) 159 | if (player.win) { 160 | player.win.send('new-index', al.index) 161 | player.win.send('is-new-query', al.isNewQuery) 162 | } 163 | if (state.playing) { broadcast('play') } 164 | updateArtwork() 165 | } 166 | 167 | function updateArtwork () { 168 | if (!get(al, 'currentTrack.artwork')) { 169 | artwork.cache.getPath(al.currentKey, handleGetPath) 170 | } 171 | } 172 | 173 | function handleGetPath (err, blobPath) { 174 | if (err) return broadcast('log', err) 175 | if (err) return log.error(err) 176 | al.currentTrack.artwork = blobPath 177 | if (player.win) { 178 | player.win.send('new-track', al.currentTrack) 179 | player.win.send('new-index', al.index) 180 | } 181 | if (audio.win) { 182 | audio.win.send('new-artwork', al.currentTrack) 183 | } 184 | } 185 | 186 | function play () { 187 | state.playing = true 188 | broadcast('play') 189 | } 190 | 191 | function playing () { 192 | state.playing = true 193 | broadcast('playing') 194 | } 195 | 196 | function pause () { 197 | state.playing = false 198 | broadcast('pause') 199 | } 200 | 201 | function paused () { 202 | state.playing = false 203 | broadcast('paused') 204 | } 205 | 206 | // function playPause () { 207 | // state.playing ? pause() : play() 208 | // } 209 | 210 | function prev () { 211 | broadcast('new-track', al.prev()) 212 | if (player.win) player.win.send('new-index', al.index) 213 | if (state.playing) { broadcast('play') } 214 | updateArtwork() 215 | } 216 | 217 | function next () { 218 | broadcast('new-track', al.next()) 219 | if (player.win) player.win.send('new-index', al.index) 220 | if (state.playing) { broadcast('play') } 221 | updateArtwork() 222 | } 223 | 224 | function mute (ev) { 225 | state.muted = true 226 | broadcast('mute') 227 | } 228 | 229 | function unmute (ev) { 230 | state.muted = false 231 | broadcast('unmute') 232 | } 233 | 234 | function timeupdate (ev, currentTime) { 235 | // audio -> player 236 | state.currentTime = currentTime 237 | if (player.win) player.win.send('timeupdate', currentTime) 238 | } 239 | 240 | function shuffle (ev) { 241 | al.shuffle() 242 | if (player.win) player.win.send('shuffle') 243 | } 244 | 245 | function unshuffle (ev) { 246 | al.unshuffle() 247 | if (player.win) player.win.send('unshuffle') 248 | } 249 | 250 | function seek (ev, newTime) { 251 | // player -> audio 252 | state.currentTime = newTime 253 | if (audio.win) audio.win.send('seek', newTime) 254 | } 255 | 256 | function handleNewTracks (err, newTrackDict) { 257 | state.loading = false 258 | broadcast('loading', false) 259 | if (err) return broadcast('log', err) 260 | if (err) return log.warn(err) 261 | const newState = al.load(newTrackDict) 262 | if (player.win) player.win.send('track-dict', newState.trackDict, newState.order, state.paths) 263 | console.timeEnd('update-library') 264 | broadcast('log', 'Done scanning. Found ' + Object.keys(newState.trackDict).length + ' tracks.') 265 | log.info('Done scanning. Found ' + Object.keys(newState.trackDict).length + ' tracks.') 266 | } 267 | 268 | function updateLibrary (ev, paths) { 269 | if (state.loading) state.loading.destroy() 270 | broadcast('log', 'Updating library with new path(s): ' + paths) 271 | console.time('update-library') 272 | state.paths = paths 273 | state.loading = makeTrackDict(paths, handleNewTracks) 274 | broadcast('loading', true) 275 | } 276 | 277 | function search (ev, searchString) { 278 | if (player.win) { 279 | player.win.send('track-order', al.search(searchString)) 280 | player.win.send('is-new-query', al.isNewQuery) 281 | } 282 | } 283 | 284 | function recall () { 285 | if (player.win) player.win.send('recall', al.recall(), al.searchTerm) 286 | } 287 | 288 | function syncState (event) { 289 | event.sender.send('sync-state', { 290 | trackDict: al.trackDict, 291 | order: al.order, 292 | paths: state.paths 293 | }) 294 | } 295 | }) 296 | 297 | app.on('activate', function activate () { 298 | if (player.win === null) { 299 | al.recall() 300 | player.init() 301 | } 302 | }) 303 | 304 | app.on('will-quit', function (e) { 305 | // nothing 306 | }) 307 | 308 | app.on('before-quit', function beforeQuit (e) { 309 | if (app.isQuitting) return 310 | 311 | app.isQuitting = true 312 | e.preventDefault() 313 | setTimeout(function () { 314 | console.log('Saving state took too long. Quitting.') 315 | app.quit() 316 | }, 20000) // quit after 5 secs, at most 317 | persist.set({ 318 | volume: state.volume 319 | }) 320 | 321 | libraryPersist.set(al.persist()) 322 | app.quit() 323 | }) 324 | -------------------------------------------------------------------------------- /main/lib/artwork-cache/README.md: -------------------------------------------------------------------------------- 1 | # ArtworkCache 2 | 3 | -------------------------------------------------------------------------------- /main/lib/artwork-cache/index.js: -------------------------------------------------------------------------------- 1 | // var electron = require('electron') 2 | const path = require('path') 3 | // var mkdirp = require('mkdirp') 4 | const pump = require('pump') 5 | const crypto = require('crypto') 6 | const { artwork } = require('./util') 7 | const BufferList = require('bl') 8 | const fs = require('fs') 9 | 10 | // var configPath = (electron.app || electron.remote.app).getPath('userData') 11 | // var artworkCachePath = path.join(configPath, 'artwork-cache') 12 | // 13 | // mkdirp.sync(artworkCachePath) 14 | const blobs = require('content-addressable-blob-store') 15 | 16 | class ArtworkCache { 17 | // TODO refeactor callback hexell 18 | constructor (dir) { 19 | this._directory = dir || path.join(process.cwd(), 'artwork-cache') 20 | fs.mkdirSync(this._directory, { recursive: true }) 21 | this._algo = 'sha256' 22 | // this._db = level(path.join(this._directory, 'cache-db')) 23 | this._blobs = blobs({ 24 | path: path.join(this._directory, 'blobs'), 25 | algo: 'sha256' 26 | }) 27 | } 28 | 29 | getPath (filePath, cb) { 30 | const self = this 31 | artwork(filePath, function (err, buff) { 32 | if (err) return cb(err) 33 | if (buff === null) return cb(null, null) 34 | const digest = crypto.createHash(self._algo).update(buff).digest('hex') 35 | self._blobs.resolve(digest, function (err, blobPath) { 36 | if (err) return cb(err) 37 | if (blobPath) { 38 | return cb(null, blobPath) 39 | } else { 40 | const writeStream = self._blobs.createWriteStream() 41 | pump((new BufferList()).append(buff), writeStream, function (err) { 42 | if (err) return cb(err) 43 | return self._blobs.resolve(writeStream.key, cb) 44 | }) 45 | } 46 | }) 47 | }) 48 | } 49 | } 50 | 51 | module.exports = ArtworkCache 52 | -------------------------------------------------------------------------------- /main/lib/artwork-cache/test-data/index.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | exports.mp3WithArtwork = path.join(__dirname, 'needle.mp3') 3 | exports.mp3WithoutArtowork = path.join(__dirname, 'loop.mp3') 4 | -------------------------------------------------------------------------------- /main/lib/artwork-cache/test-data/loop.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hypermodules/hyperamp/899d21de3794946fc29eecad52c13681b2bbdcdf/main/lib/artwork-cache/test-data/loop.mp3 -------------------------------------------------------------------------------- /main/lib/artwork-cache/test-data/needle.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hypermodules/hyperamp/899d21de3794946fc29eecad52c13681b2bbdcdf/main/lib/artwork-cache/test-data/needle.mp3 -------------------------------------------------------------------------------- /main/lib/artwork-cache/test.js: -------------------------------------------------------------------------------- 1 | const test = require('tape') 2 | const { artwork } = require('./util') 3 | const path = require('path') 4 | const concatStream = require('concat-stream') 5 | const isBuffer = require('is-buffer') 6 | const pump = require('pump') 7 | const bufferEqual = require('buffer-equal') 8 | const tmp = require('p-temporary-directory/cb') 9 | const ArtworkCache = require('./index.js') 10 | const testData = require('./test-data') 11 | const BufferList = require('bl') 12 | 13 | test('get artwork from file', function (t) { 14 | artwork(testData.mp3WithArtwork, function (err, imageBuf) { 15 | t.error(err, 'got artwork buffer') 16 | t.true(isBuffer(imageBuf), 'can get arwork from mp3s') 17 | t.end() 18 | }) 19 | }) 20 | 21 | test('can stream buffers', function (t) { 22 | artwork(testData.mp3WithArtwork, bufferTests) 23 | 24 | function bufferTests (err, imageBuf) { 25 | t.error(err, 'got artwork buffer') 26 | const imageBufferStream = new BufferList() 27 | imageBufferStream.append(imageBuf) 28 | const concat = concatStream(gotPic) 29 | let streamedBuff 30 | 31 | function gotPic (buf) { 32 | streamedBuff = buf 33 | } 34 | 35 | function streamEnded (err) { 36 | t.error(err, 'stream ended without error') 37 | t.true(bufferEqual(imageBuf, streamedBuff), 'buffers are the same after streaming') 38 | t.end() 39 | } 40 | 41 | pump(imageBufferStream, concat, streamEnded) 42 | } 43 | }) 44 | 45 | test('artwork cache for existing file', function (t) { 46 | tmp(created) 47 | 48 | function created (err, dir, cleanup) { 49 | t.error(err, 'created temp dir') 50 | const cache = new ArtworkCache(path.join(dir)) 51 | cache.getPath(testData.mp3WithArtwork, handlePath) 52 | 53 | function handlePath (err, blobPath) { 54 | t.error(err, 'got path without error') 55 | t.equal(typeof blobPath, 'string', 'got a path back') 56 | 57 | cache.getPath(testData.mp3WithArtwork, handlePathAgain) 58 | } 59 | 60 | function handlePathAgain (err, blobPath) { 61 | t.error(err, 'got path without error') 62 | t.equal(typeof blobPath, 'string', 'got same path back') 63 | cleanup(cleanedUp) 64 | } 65 | } 66 | 67 | function cleanedUp (err) { 68 | t.error(err, 'cleaned up') 69 | t.end() 70 | } 71 | }) 72 | 73 | test('artwork cache for missing file', function (t) { 74 | tmp(created) 75 | 76 | function created (err, dir, cleanup) { 77 | t.error(err, 'created temp dir') 78 | const cache = new ArtworkCache(path.join(dir)) 79 | cache.getPath(path.join(__dirname, 'foo'), handlePath) 80 | 81 | function handlePath (err, blobPath) { 82 | t.equal(err.code, 'ENOENT', 'errors propgated up from the bottom') 83 | cache.getPath(path.join(__dirname, 'foo'), handlePathAgain) 84 | } 85 | 86 | function handlePathAgain (err, blobPath) { 87 | t.equal(err.code, 'ENOENT', 'errors propgated up from the bottom') 88 | cleanup(cleanedUp) 89 | } 90 | } 91 | 92 | function cleanedUp (err) { 93 | t.error(err, 'cleaned up') 94 | t.end() 95 | } 96 | }) 97 | 98 | test('artwork cache for existing file without art', function (t) { 99 | tmp(created) 100 | 101 | function created (err, dir, cleanup) { 102 | t.error(err, 'created temp dir') 103 | const cache = new ArtworkCache(path.join(dir)) 104 | cache.getPath(testData.mp3WithoutArtowork, handlePath) 105 | 106 | function handlePath (err, blobPath) { 107 | t.error(err, 'no error') 108 | t.equal(blobPath, null, 'blob path is null when it doesnt exist') 109 | cache.getPath(testData.mp3WithoutArtowork, handlePathAgain) 110 | } 111 | 112 | function handlePathAgain (err, blobPath) { 113 | t.error(err, 'no error') 114 | t.equal(blobPath, null, 'blob path is null when it doesnt exist from cache!') 115 | cleanup(cleanedUp) 116 | } 117 | } 118 | 119 | function cleanedUp (err) { 120 | t.error(err, 'cleaned up') 121 | t.end() 122 | } 123 | }) 124 | -------------------------------------------------------------------------------- /main/lib/artwork-cache/util.js: -------------------------------------------------------------------------------- 1 | const mm = require('music-metadata') 2 | const get = require('lodash.get') 3 | const fs = require('fs') 4 | 5 | function metadata (path, cb) { 6 | fs.stat(path, function (err, stats) { 7 | if (err) return cb(err) 8 | mm.parseFile(path, { 9 | native: true, 10 | duration: true, 11 | skipCovers: false 12 | }).then(function (md) { 13 | return cb(null, md) 14 | }).catch(function (err) { 15 | return cb(err) 16 | }) 17 | }) 18 | } 19 | 20 | exports.artwork = artwork 21 | 22 | function artwork (path, cb) { 23 | metadata(path, lookupArtwork) 24 | 25 | function lookupArtwork (err, meta) { 26 | if (err) return cb(err) 27 | const artBuff = get(meta, 'common.picture[0].data') 28 | if (!artBuff) return cb(null, null) 29 | return cb(null, artBuff) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /main/lib/audio-library/README.md: -------------------------------------------------------------------------------- 1 | # AudioLibrary 2 | 3 | A class to manage playback state 4 | 5 | ## API 6 | ### `al = new AudioLibrary([state])` 7 | Create a new `AuditLibrary` instance. Optionally pass a state object with the following values: 8 | 9 | ```js 10 | { 11 | trackDict: {}, // Dictionary of track objects 12 | order: [], // Array of track object keys defining order of display and playback 13 | index: 0, // Index of currently queued track 14 | shuffleOrder: null, // array of index's pointing to keys in the order array 15 | shuffleIndex: 0, // index of shuffleOrder index of order 16 | searchTerm: '' // search term used to generate current order array 17 | } 18 | ``` 19 | 20 | ### `al.isNewQuery` 21 | Getter that returns true if `al` is in a search state. 22 | 23 | ### `al.shuffling` 24 | Getter that returns true if `al` is shuffling playback order. 25 | 26 | ### `al.currentKey` 27 | Getter that returns the key of the currently keyed track. 28 | 29 | ### `al.currentTrack` 30 | Getter that returns the currently queued track object. 31 | 32 | ### `al.visibleOrder` 33 | Getter that returns the correct `order` array to display regardless of query state. 34 | 35 | ### `queuedTrack = al.queue(index)` 36 | Queue the track at `index` in the `visibleOrder` array. If `al` is in a query state, the active query will become the primary order and the query state will be cleared. Returns the track object at `index`. 37 | 38 | ### `nextTrack = al.next()` 39 | Advance playback to correct next track, depending on shuffle state. Does not affect query state and returns the next track in the currently playing `order`. 40 | 41 | ### `prevTrack = al.prev()` 42 | Advance playback to correct previous track, depending on shuffle state. Does not affect query state and returns the previous track in the currently playing `order`. 43 | 44 | ### `al.shuffle()` 45 | Put `al` into shuffle mode. If `al` is already shuffling, the shuffle order will be reshuffled. 46 | 47 | ### `al.unshuffle()` 48 | Resume unshuffle order from the current `index`. 49 | 50 | ### `queryOrder = al.search(term)` 51 | Perform a search on the currently loaded `trackDict`. Puts `al` into query mode (`al.isNewQuery === true`). In query mode `al.visibleOrder` returns the `al.query.order` so that the interface performing the search can preview the results of the search. If `al.queue(index)` is called in query mode, `al.query.order` is assigned to `al.order` and the query is cleared and the query order becomes the play order. 52 | 53 | ### `playOrder = al.recall()` 54 | If in query mode, calling `al.recall()` will clear the query and `al.visibleOrder` returns `al.order`. 55 | 56 | 57 | ### `{trackDict, order} = al.update(newTrackDict)` 58 | Load a new `trackDict`. Returns the minimal state nessisary to display the updated library. 59 | -------------------------------------------------------------------------------- /main/lib/audio-library/filter.js: -------------------------------------------------------------------------------- 1 | function filter (term, [key, track]) { 2 | const { title, album, artist, genre } = track 3 | const artistStr = Array.isArray(artist) ? artist.join('') : artist 4 | const genreStr = Array.isArray(genre) ? genre.join('') : genre 5 | const trackStr = (title + album + artistStr + genreStr).toLowerCase().replace(/\s+/g, '') 6 | 7 | return trackStr.includes(term.toLowerCase().replace(/\s+/g, '')) 8 | } 9 | 10 | module.exports = filter 11 | -------------------------------------------------------------------------------- /main/lib/audio-library/index.js: -------------------------------------------------------------------------------- 1 | const Nanobus = require('nanobus') 2 | const shuffleArray = require('fy-shuffle') 3 | const filter = require('./filter') 4 | const sort = require('./sort') 5 | 6 | class AudioLibrary extends Nanobus { 7 | constructor (state) { 8 | super('AudioLibrary') 9 | 10 | state = Object.assign({ 11 | trackDict: {}, 12 | order: [], 13 | shuffleOrder: null, 14 | index: 0, 15 | shuffleIndex: 0, 16 | searchTerm: '' 17 | }, state) 18 | 19 | this.trackDict = state.trackDict 20 | this.order = state.order.length 21 | ? state.order 22 | : this._search(state.search) 23 | this.shuffleOrder = Array.isArray(state.shuffleOrder) 24 | ? state.shuffleOrder 25 | : null 26 | this.shuffleIndex = state.shuffleIndex 27 | this.index = state.index 28 | this.searchTerm = state.searchTerm 29 | 30 | this.query = null // Set to object so we can clear easily 31 | } 32 | 33 | persist () { 34 | return { 35 | trackDict: this.trackDict, 36 | order: this.order, 37 | index: this.index, 38 | shuffleOrder: this.shuffleOrder, 39 | shuffleIndex: this.shuffleIndex, 40 | searchTerm: this.searchTerm 41 | } 42 | } 43 | 44 | get isNewQuery () { 45 | return !!this.query 46 | } 47 | 48 | get shuffling () { 49 | return Array.isArray(this.shuffleOrder) 50 | } 51 | 52 | get currentKey () { 53 | return this.order[this.index] 54 | } 55 | 56 | get currentTrack () { 57 | return this.trackDict[this.currentKey] 58 | } 59 | 60 | get visibleOrder () { 61 | if (this.isNewQuery) return this.query.order 62 | else return this.order 63 | } 64 | 65 | queue (index) { 66 | this.index = index 67 | 68 | if (this.isNewQuery) { 69 | this.order = this.query.order.slice() 70 | this.searchTerm = this.query.searchTerm 71 | this.recall() 72 | } 73 | 74 | if (this.shuffling) this.shuffle() 75 | 76 | return this.currentTrack 77 | } 78 | 79 | _nextShuffle () { 80 | const newShuffleIndex = this.shuffleIndex < this.shuffleOrder.length - 1 ? this.shuffleIndex + 1 : 0 81 | this.index = this.shuffleOrder[newShuffleIndex] 82 | this.shuffleIndex = newShuffleIndex 83 | return this.currentTrack 84 | } 85 | 86 | _next () { 87 | const newIndex = this.index < this.order.length - 1 ? this.index + 1 : 0 88 | this.index = newIndex 89 | return this.currentTrack 90 | } 91 | 92 | next () { // set and return the next track 🔁 93 | return this.shuffling ? this._nextShuffle() : this._next() 94 | } 95 | 96 | _prevShuffle () { 97 | this.shuffleIndex = this.shuffleIndex > 0 ? this.shuffleIndex - 1 : this.shuffleOrder.length - 1 98 | this.index = this.shuffleOrder[this.shuffleIndex] 99 | return this.currentTrack 100 | } 101 | 102 | _prev () { 103 | this.index = this.index > 0 ? this.index - 1 : this.order.length - 1 104 | return this.currentTrack 105 | } 106 | 107 | prev () { // set and return the prev track 🔁 108 | return this.shuffling ? this._prevShuffle() : this._prev() 109 | } 110 | 111 | shuffle () { 112 | this.shuffleOrder = shuffleArray(Object.keys(this.order).map(Number)) 113 | this.shuffleIndex = this.shuffleOrder.indexOf(this.index) 114 | } 115 | 116 | unshuffle () { 117 | this.shuffleOrder = null 118 | this.shuffleIndex = 0 119 | } 120 | 121 | _search (term) { 122 | return term 123 | ? Object.entries(this.trackDict).filter(filter.bind(null, term)).sort(sort).map(keys) 124 | : Object.entries(this.trackDict).sort(sort).map(keys) 125 | } 126 | 127 | search (term) { 128 | this.query = { 129 | searchTerm: term, 130 | order: this._search(term) 131 | } 132 | return this.query.order 133 | } 134 | 135 | recall () { // reset any outstanding queries and show current play order 136 | this.query = null 137 | return this.order 138 | } 139 | 140 | load (newTrackDict) { 141 | this.trackDict = newTrackDict 142 | this.search('') 143 | this.queue(-1) 144 | return { 145 | trackDict: this.trackDict, 146 | order: this.order 147 | } 148 | } 149 | } 150 | 151 | function keys (entry) { 152 | return entry[0] 153 | } 154 | 155 | module.exports = AudioLibrary 156 | -------------------------------------------------------------------------------- /main/lib/audio-library/sort.js: -------------------------------------------------------------------------------- 1 | const existy = require('existy') 2 | 3 | function sort ([keyA, aObj], [keyB, bObj]) { 4 | // sort by albumartist 5 | // if (aObj.albumartist[0] < bObj.albumartist[0]) return -1 6 | // if (aObj.albumartist[0] > bObj.albumartist[0]) return 1 7 | 8 | // send tracks with no artist to bottom 9 | if (isEmpty(aObj.artist) && !isEmpty(bObj.artist)) return 1 10 | if (!isEmpty(aObj.artist) && isEmpty(bObj.artist)) return -1 11 | 12 | // sort by artist 13 | if (aObj.artist < bObj.artist) return -1 14 | if (aObj.artist > bObj.artist) return 1 15 | 16 | // then by album 17 | if (aObj.album < bObj.album) return -1 18 | if (aObj.album > bObj.album) return 1 19 | 20 | // then by disc no 21 | const aHasDisk = existy(aObj.disk) 22 | const bHasDisk = existy(bObj.disk) 23 | 24 | if (aHasDisk && bHasDisk) { 25 | if (aObj.disk.no < bObj.disk.no) return -1 26 | if (aObj.disk.no > bObj.disk.no) return 1 27 | } 28 | 29 | // then by track no 30 | const aHasTrack = existy(aObj.track) 31 | const bHasTrack = existy(bObj.track) 32 | 33 | if (aHasTrack && bHasTrack) { 34 | if (aObj.track.no < bObj.track.no) return -1 35 | if (aObj.track.no > bObj.track.no) return 1 36 | } 37 | 38 | // then by title 39 | if (aObj.title < bObj.title) return -1 40 | if (aObj.title > bObj.title) return 1 41 | 42 | // then by filepath 43 | if (aObj.filepath < bObj.filepath) return -1 44 | if (aObj.filepath > bObj.filepath) return 1 45 | 46 | return 0 47 | } 48 | 49 | function isEmpty (val) { 50 | return !existy(val) || val === '' 51 | } 52 | 53 | module.exports = sort 54 | -------------------------------------------------------------------------------- /main/lib/audio-library/test.js: -------------------------------------------------------------------------------- 1 | const test = require('tape') 2 | const AudioLibrary = require('./index') 3 | const libraryA = require('./test-data/library-a.json') 4 | const libraryB = require('./test-data/library-b.json') 5 | 6 | test('instantiate, next, prev AudioLibrary', function (t) { 7 | const al = new AudioLibrary(libraryA) 8 | 9 | t.ok(al, 'AudioLibrary can instantiate with library object') 10 | t.equal(al.index, libraryA.index, 'index is instantiated from state correctly') 11 | 12 | t.equal(al.currentKey, libraryA.order[libraryA.index], 'current index is set correctly') 13 | 14 | t.deepEqual(al.visibleOrder, libraryA.order, 'visible order returns the correct order') 15 | 16 | t.ok(al.next(), 'can advance to the next track') 17 | t.ok(al.next(), 'can advance to the next track again') 18 | t.ok(al.next(), 'can advance to the next track one more time') 19 | 20 | t.equal(al.index, libraryA.index + 3, 'index is advanced by 3') 21 | t.deepEqual(al.currentTrack, libraryA.trackDict[libraryA.order[libraryA.index + 3]], 'we get the currentTrack') 22 | 23 | t.ok(al.prev(), 'can advance in reverse to the previous track') 24 | t.ok(al.prev(), 'can advance in reverse to the previous track again') 25 | t.ok(al.prev(), 'can advance in reverse to the previous track one more time') 26 | 27 | t.equal(al.index, libraryA.index, 'index reduced by 3') 28 | t.deepEqual(al.currentTrack, libraryA.trackDict[libraryA.order[libraryA.index]], 'we get the currentTrack') 29 | 30 | t.end() 31 | }) 32 | 33 | function getRandomInt (min, max) { 34 | min = Math.ceil(min) 35 | max = Math.floor(max) 36 | return Math.floor(Math.random() * (max - min)) + min // The maximum is exclusive and the minimum is inclusive 37 | } 38 | 39 | test('instantiate and queue', { timeout: 500 }, function (t) { 40 | const al = new AudioLibrary(libraryA) 41 | 42 | t.plan(2) 43 | 44 | const newIndex = getRandomInt(0, libraryA.length - 1) 45 | 46 | al.queue(newIndex) 47 | t.deepEqual(al.currentTrack, libraryA.trackDict[libraryA.order[newIndex]], 'can queue a track when not searching or sorting') 48 | t.deepEqual(al.visibleOrder, al.order, 'visible order is showing the correct order') 49 | }) 50 | 51 | test('visibleOrder and search', { timeout: 500 }, function (t) { 52 | const al = new AudioLibrary(libraryA) 53 | t.deepEqual(al.visibleOrder, al.order, 'visible order is showing the intial order') 54 | t.equal(al.query, null, 'query is null') 55 | t.equal(al.isNewQuery, false, 'not in a new query state') 56 | 57 | const expectedResults = ['/Users/bret/Resilio Sync/Music/BLVCK CEILING/meridian/08 25 cobainen.mp3'] 58 | console.log('search for 25 cobainen') 59 | const results = al.search('25 cobainen') 60 | 61 | t.deepEqual(results, expectedResults, 'search returns a new order with results') 62 | t.deepEqual(al.query.order, expectedResults, 'there is a new order') 63 | t.equal(al.isNewQuery, true, 'we are in a new query state') 64 | t.deepEqual(al.visibleOrder, al.query.order, 'visible order is showing the new order') 65 | 66 | console.log('next()') 67 | al.next() 68 | t.deepEqual( 69 | al.currentTrack, 70 | libraryA.trackDict[libraryA.order[libraryA.index + 1]], 71 | ' we can still advance and get the next track of whatever is currently playing' 72 | ) 73 | t.deepEqual(al.visibleOrder, al.query.order, 'we are still seeing our new query') 74 | 75 | console.log('recall()') 76 | al.recall() 77 | 78 | t.equal(al.query, null, 'new order cleared') 79 | t.equal(al.isNewQuery, false, 'no longer in a new query') 80 | 81 | console.log('search and queue') 82 | al.search('25 cobainen') 83 | al.queue(0) 84 | 85 | t.deepEqual( 86 | al.currentTrack, 87 | libraryA.trackDict[expectedResults[0]], 88 | 'queuing something from our query saves to order and clears new order' 89 | ) 90 | 91 | t.deepEqual(al.visibleOrder, al.order, 'visible order is showing play order') 92 | t.equal(al.query, null, 'new order cleared') 93 | t.equal(al.isNewQuery, false, 'no longer in a new query') 94 | 95 | console.log('next()') 96 | al.next() 97 | 98 | t.deepEqual( 99 | al.currentTrack, 100 | libraryA.trackDict[expectedResults[0]], 101 | 'only one result so 🔂' 102 | ) 103 | 104 | console.log('search(\'\') and queue()') 105 | al.search('') // clear search 106 | al.queue(0) // play from the full library 107 | 108 | t.equal(al.query, null, 'new order cleared') 109 | t.equal(al.isNewQuery, false, 'no longer in a new query') 110 | 111 | t.equal(al.visibleOrder.length, libraryA.order.length, 'visible order returns the correct order') 112 | 113 | t.end() 114 | }) 115 | 116 | test('truffle shuffle', function (t) { 117 | const al = new AudioLibrary(libraryA) 118 | 119 | console.log('shuffle()') 120 | al.shuffle() 121 | const initialShuffleIndex = al.shuffleIndex 122 | console.log('next()') 123 | console.log('next()') 124 | al.next() 125 | al.next() 126 | 127 | t.equal(al.shuffleIndex, initialShuffleIndex + 2, 'shuffle index advances') 128 | t.deepEqual(al.currentTrack, al.trackDict[al.order[al.shuffleOrder[al.shuffleIndex]]], 'adancing returns the correct next track') 129 | 130 | console.log('prev()') 131 | al.prev() 132 | 133 | t.equal(al.shuffleIndex, initialShuffleIndex + 1, 'go back in shuffle order') 134 | t.deepEqual(al.currentTrack, al.trackDict[al.order[al.shuffleOrder[al.shuffleIndex]]], 'prev returns the previous track') 135 | const preUnshuffleIndex = al.index 136 | 137 | console.log('unshuffle()') 138 | al.unshuffle() 139 | t.equal(al.index, preUnshuffleIndex, 'index stays the same') 140 | t.equal(al.shuffling, false, 'not shuffling any more') 141 | t.equal(al.shuffleOrder, null, 'clear shuffle order') 142 | console.log('next()') 143 | al.next() 144 | t.equal(al.index, preUnshuffleIndex + 1, 'advances in the next direction') 145 | t.end() 146 | }) 147 | 148 | test('just a track dict', function (t) { 149 | console.log('create a AL with just a trackDict') 150 | const al = new AudioLibrary(libraryB) 151 | t.equal(al.index, 0, 'index === 0') 152 | t.deepEqual(al.visibleOrder, al.order, 'visible order returns the play order') 153 | t.equal(al.shuffling, false, 'not shuffling') 154 | 155 | console.log('go forward and back') 156 | t.ok(al.prev()) 157 | t.ok(al.prev()) 158 | t.ok(al.next()) 159 | t.ok(al.next()) 160 | t.ok(al.next()) 161 | 162 | t.equal(al.index, 1, 'index === 1') 163 | 164 | al.shuffle() 165 | t.ok(al.next()) 166 | 167 | t.end() 168 | }) 169 | 170 | test('no state zone!', function (t) { 171 | console.log('create a AL with no state provided') 172 | const al = new AudioLibrary() 173 | 174 | t.deepEqual(al.trackDict, {}, 'trackDict === {}') 175 | t.deepEqual(al.order, [], 'order === []') 176 | t.equal(al.index, 0, 'index === 0') 177 | t.equal(al.shuffleOrder, null, 'shuffleOrder === null') 178 | t.equal(al.shuffleIndex, 0, 'shuffleIndex === 0') 179 | t.equal(al.searchTerm, '', 'searchTerm === \'\'') 180 | t.equal(al.query, null, 'query === null') 181 | 182 | t.equal(al.isNewQuery, false, 'isNewQuery === false') 183 | t.equal(al.shuffling, false, 'shuffling === false') 184 | t.equal(al.currentKey, undefined, 'currentKey === undefined') 185 | t.equal(al.currentTrack, undefined, 'currentTrack === undefined') 186 | t.deepEqual(al.visibleOrder, al.order, 'visibleOrder -> order') 187 | 188 | console.log('next') 189 | al.next() 190 | t.equal(al.currentTrack, undefined, 'currentTrack === undefined') 191 | t.equal(al.index, 0, 'index === 0') 192 | console.log('prev') 193 | al.prev() 194 | t.equal(al.currentTrack, undefined, 'currentTrack === undefined') 195 | t.equal(al.index, -1, 'index === -1') 196 | console.log('next') 197 | al.next() 198 | t.equal(al.currentTrack, undefined, 'currentTrack === undefined') 199 | t.equal(al.index, 0, 'index === 0') 200 | console.log('queue 100') 201 | al.queue(100) 202 | 203 | t.equal(al.isNewQuery, false, 'isNewQuery === false') 204 | t.equal(al.shuffling, false, 'shuffling === false') 205 | t.equal(al.currentKey, undefined, 'currentKey === undefined') 206 | t.equal(al.currentTrack, undefined, 'currentTrack === undefined') 207 | t.deepEqual(al.visibleOrder, al.order, 'visibleOrder -> order') 208 | 209 | console.log('next') 210 | al.next() 211 | t.equal(al.currentTrack, undefined, 'currentTrack === undefined') 212 | t.equal(al.index, 0, 'index === 0') 213 | 214 | console.log('search derp and queue 50') 215 | al.search('derp') 216 | t.deepEqual(al.query, { searchTerm: 'derp', order: [] }, 'query === { searchTerm: \'derp\', order: [] }') 217 | al.queue(50) 218 | 219 | t.equal(al.isNewQuery, false, 'isNewQuery === false') 220 | t.equal(al.shuffling, false, 'shuffling === false') 221 | t.equal(al.currentKey, undefined, 'currentKey === undefined') 222 | t.equal(al.currentTrack, undefined, 'currentTrack === undefined') 223 | t.deepEqual(al.visibleOrder, al.order, 'visibleOrder -> order') 224 | 225 | t.end() 226 | }) 227 | 228 | test('load more state', function (t) { 229 | const al = new AudioLibrary() 230 | 231 | al.load(libraryA.trackDict) 232 | 233 | t.deepEqual(al.trackDict, libraryA.trackDict) 234 | 235 | t.end() 236 | }) 237 | -------------------------------------------------------------------------------- /main/menu.js: -------------------------------------------------------------------------------- 1 | const { app, shell, Menu } = require('electron') 2 | const defaultMenu = require('electron-default-menu') 3 | const audio = require('./windows/audio') 4 | const player = require('./windows/player') 5 | const pkg = require('../package.json') 6 | 7 | module.exports = { 8 | init 9 | } 10 | 11 | function getSubmenu (menus, label) { 12 | return menus.reduce(function (accum, menu) { 13 | if (menu.label === label) return menu 14 | else return accum 15 | }, null).submenu 16 | } 17 | 18 | const menuTemplate = defaultMenu(app, shell) 19 | const viewMenu = getSubmenu(menuTemplate, 'View') 20 | const helpMenu = getSubmenu(menuTemplate, 'Help') 21 | 22 | viewMenu.splice(1, 0, { 23 | label: 'Hard Reload (Clear Cache)', 24 | accelerator: 'CmdOrCtrl+Shift+R', 25 | click (item, focusedWindow) { 26 | if (focusedWindow) focusedWindow.webContents.reloadIgnoringCache() 27 | } 28 | }) 29 | 30 | viewMenu.push({ 31 | label: 'Show Audio Process', 32 | accelerator: process.platform === 'darwin' 33 | ? 'Alt+Command+P' 34 | : 'Ctrl+Shift+P', 35 | click: () => audio.toggleDevTools() 36 | }) 37 | 38 | viewMenu.push({ 39 | label: 'Always On Top', 40 | type: 'checkbox', 41 | click: () => player.toggleAlwaysOnTop() 42 | }) 43 | 44 | helpMenu[0] = { 45 | label: 'Learn More', 46 | click () { shell.openExternal(pkg.homepage) } 47 | } 48 | 49 | helpMenu[1] = { 50 | label: 'Report an Issue', 51 | click () { shell.openExternal(pkg.bugs.url) } 52 | } 53 | 54 | function init () { 55 | const menu = Menu.buildFromTemplate(menuTemplate) 56 | Menu.setApplicationMenu(menu) 57 | } 58 | -------------------------------------------------------------------------------- /main/track-dict.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const walker = require('folder-walker') 3 | const mm = require('music-metadata') 4 | const writer = require('flush-write-stream') 5 | const filter = require('through2-filter') 6 | const pump = require('pump') 7 | const log = require('electron-log') 8 | const validExtensions = ['m4a', 'mp3', 'ogg', 'flac'] 9 | 10 | module.exports = makeTrackDict 11 | 12 | const FileFilter = filter.objCtor(isValidFile) 13 | 14 | function makeTrackDict (paths, cb) { 15 | const newTrackDict = {} 16 | const dest = concatTrackDict(newTrackDict) 17 | pump(walker(paths), FileFilter(), dest, handleEos) 18 | // Return dest so we can destroy it 19 | return dest 20 | 21 | function handleEos (err) { 22 | if (err) return cb(err) 23 | log.info('') 24 | cb(null, newTrackDict) 25 | } 26 | } 27 | function isValidFile (data, enc, cb) { 28 | if (data.type !== 'file') return false 29 | const ext = path.extname(data.basename).substring(1) 30 | return validExtensions.includes(ext) 31 | } 32 | 33 | function concatTrackDict (obj) { 34 | function writeTrackDict (data, enc, cb) { 35 | log.info(`Scanning ${data.filepath}`) 36 | parseMetadata(data, handleMeta) 37 | 38 | function handleMeta (err, meta) { 39 | if (err) throw err 40 | obj[meta.filepath] = meta 41 | cb(null) 42 | } 43 | } 44 | return writer.obj(writeTrackDict) 45 | } 46 | 47 | function parseMetadata (data, cb) { 48 | const { filepath } = data 49 | mm.parseFile(filepath, { 50 | duration: false, 51 | native: false, 52 | skipCovers: true 53 | }).then(meta => { 54 | let { 55 | albumartist, 56 | title, 57 | artist, 58 | album, 59 | year, 60 | track, 61 | disk, 62 | genre 63 | } = meta.common 64 | 65 | const { duration } = meta.format 66 | if (!title) { 67 | const { basename } = data 68 | const ext = path.extname(basename) 69 | title = path.basename(basename, ext) 70 | } 71 | 72 | return Promise.resolve({ 73 | albumartist, 74 | title, 75 | artist, 76 | album, 77 | duration, 78 | filepath, 79 | year, 80 | track, 81 | disk, 82 | genre 83 | }) 84 | }).catch(err => { 85 | // Ignore errors 86 | log.info(err.message += ` (file: ${filepath})`) 87 | const { basename } = data 88 | const ext = path.extname(basename) 89 | const title = path.basename(basename, ext) 90 | return Promise.resolve({ title, filepath }) 91 | }).then(meta => { 92 | cb(null, meta) 93 | }) 94 | } 95 | -------------------------------------------------------------------------------- /main/windows/audio.js: -------------------------------------------------------------------------------- 1 | const { app, BrowserWindow } = require('electron') 2 | const path = require('path') 3 | const log = require('electron-log') 4 | const remoteMain = require('@electron/remote/main') 5 | const AUDIO_WINDOW = 'file://' + path.resolve(__dirname, '..', '..', 'renderer', 'audio', 'index.html') 6 | const audio = module.exports = { 7 | init, 8 | show, 9 | toggleDevTools, 10 | win: null 11 | } 12 | 13 | function init () { 14 | const win = audio.win = new BrowserWindow({ 15 | title: 'hyperamp-hidden-window', 16 | backgroundColor: '#1E1E1E', 17 | center: true, 18 | fullscreen: false, 19 | fullscreenable: false, 20 | height: 100, 21 | maximizable: false, 22 | minimizable: false, 23 | resizable: false, 24 | show: false, 25 | skipTaskbar: true, 26 | useContentSize: true, 27 | width: 200, 28 | webPreferences: { 29 | nodeIntegration: true, 30 | nodeIntegrationInWorker: true, 31 | webSecurity: true, 32 | contextIsolation: false, 33 | enableRemoteModule: true 34 | } 35 | }) 36 | 37 | remoteMain.enable(win.webContents) 38 | 39 | win.loadURL(AUDIO_WINDOW) 40 | 41 | // prevent killing the audio process 42 | win.on('close', function (e) { 43 | if (app.isQuitting) return 44 | e.preventDefault() 45 | win.hide() 46 | }) 47 | } 48 | 49 | function show () { 50 | if (!audio.win) return 51 | audio.win.show() 52 | } 53 | 54 | function toggleDevTools () { 55 | if (!audio.win) return 56 | log.info('[AUDIO] Toggling dev tools') 57 | if (audio.win.webContents.isDevToolsOpened()) { 58 | audio.win.webContents.closeDevTools() 59 | audio.win.hide() 60 | } else { 61 | audio.win.webContents.openDevTools({ detach: true }) 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /main/windows/player.js: -------------------------------------------------------------------------------- 1 | const { BrowserWindow, app } = require('electron') 2 | const windowStateKeeper = require('electron-window-state') 3 | const path = require('path') 4 | const log = require('electron-log') 5 | const remoteMain = require('@electron/remote/main') 6 | const PLAYER_WINDOW = 'file://' + path.resolve(__dirname, '..', '..', 'renderer', 'player', 'index.html') 7 | 8 | const player = module.exports = { 9 | init, 10 | toggleAlwaysOnTop, 11 | win: null, 12 | windowState: null 13 | } 14 | 15 | let alwaysOnTop = false 16 | 17 | import('electron-debug').then(({ default: debug }) => { 18 | debug({ showDevTools: 'undocked' }) 19 | }).catch(err => { 20 | console.error('Failed to load electron-debug:', err) 21 | }) 22 | 23 | import('electron-context-menu').then(({ default: contextMenu }) => { 24 | contextMenu({ 25 | showSaveImageAs: true 26 | }) 27 | }).catch(err => { 28 | console.error('Failed to load electron-context-menu:', err) 29 | }) 30 | 31 | function init () { 32 | player.windowState = windowStateKeeper({ width: 800, height: 600 }) 33 | const win = player.win = new BrowserWindow({ 34 | title: 'Hyper Amp', 35 | x: player.windowState.x, 36 | y: player.windowState.y, 37 | width: player.windowState.width, 38 | height: player.windowState.height, 39 | minWidth: 580, 40 | minHeight: 76, 41 | titleBarStyle: 'hiddenInset', 42 | useContentSize: true, 43 | show: false, 44 | backgroundColor: '#fff', 45 | thickFrame: true, 46 | alwaysOnTop, 47 | webPreferences: { 48 | nodeIntegration: true, 49 | nodeIntegrationInWorker: true, 50 | webSecurity: true, 51 | contextIsolation: false 52 | } 53 | }) 54 | 55 | remoteMain.enable(win.webContents) 56 | 57 | player.windowState.manage(win) 58 | 59 | win.loadURL(PLAYER_WINDOW) 60 | 61 | win.once('ready-to-show', win.show) 62 | 63 | win.on('closed', () => { 64 | player.win = null 65 | }) 66 | 67 | if (process.platform !== 'darwin') { // TODO System tray on windows (maybe linux) 68 | // since window-all-closed doesn't fire with our hidden audio process 69 | player.win.once('closed', () => { 70 | app.quit() 71 | }) 72 | } 73 | } 74 | 75 | function toggleAlwaysOnTop () { 76 | if (!player.win) return 77 | log.info('[PLAYER] Toggling Always on Top') 78 | if (player.win.isAlwaysOnTop()) { 79 | alwaysOnTop = false 80 | player.win.setAlwaysOnTop(alwaysOnTop) 81 | } else { 82 | alwaysOnTop = true 83 | player.win.setAlwaysOnTop(alwaysOnTop) 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hyperamp", 3 | "description": "Indescribable music player", 4 | "version": "1.2.0", 5 | "author": "Hypermodules (https://github.com/hypermodules)", 6 | "browserify": { 7 | "transform": [ 8 | "envify", 9 | "yo-yoify", 10 | "electron-renderify" 11 | ] 12 | }, 13 | "bugs": { 14 | "url": "https://github.com/hypermodules/hyperamp/issues" 15 | }, 16 | "build": { 17 | "appId": "com.hypermodules.hyperamp", 18 | "publish": { 19 | "provider": "github", 20 | "releaseType": "release" 21 | }, 22 | "files": [ 23 | "lib/", 24 | "main/", 25 | "node_modules/", 26 | "renderer/" 27 | ], 28 | "mac": { 29 | "category": "public.app-category.music", 30 | "appId": "com.hypermodules.hyperamp", 31 | "notarize": true, 32 | "hardenedRuntime": true, 33 | "target": [ 34 | { 35 | "target": "default", 36 | "arch": [ 37 | "universal" 38 | ] 39 | } 40 | ] 41 | }, 42 | "linux": { 43 | "category": "Audio", 44 | "target": [ 45 | { 46 | "target": "AppImage", 47 | "arch": [ 48 | "x64", 49 | "armv7l", 50 | "arm64" 51 | ] 52 | } 53 | ] 54 | }, 55 | "nsis": { 56 | "perMachine": true 57 | }, 58 | "win": { 59 | "target": [ 60 | { 61 | "target": "nsis", 62 | "arch": [ 63 | "x64" 64 | ] 65 | } 66 | ] 67 | } 68 | }, 69 | "contributors": [ 70 | "Bret Comnes (http://bret.io)", 71 | "Nate Goldman (http://ungoldman.com)" 72 | ], 73 | "dependencies": { 74 | "@bret/truthy": "^1.0.1", 75 | "@electron/remote": "^2.0.9", 76 | "bl": "^6.0.0", 77 | "choo": "^7.0.0", 78 | "choo-devtools": "^3.0.0", 79 | "classnames": "^2.2.6", 80 | "content-addressable-blob-store": "^5.0.1", 81 | "csjs-inject": "^1.0.1", 82 | "electron-context-menu": "^4.0.0", 83 | "electron-debug": "^4.0.0", 84 | "electron-default-menu": "^1.0.1", 85 | "electron-log": "^5.0.0-beta.16", 86 | "electron-store": "^8.1.0", 87 | "electron-updater": "^6.1.7", 88 | "electron-window-state": "^5.0.2", 89 | "entypo": "^2.1.0", 90 | "existy": "^1.0.1", 91 | "flush-write-stream": "^2.0.0", 92 | "folder-walker": "^3.2.0", 93 | "format-duration": "^3.0.2", 94 | "fy-shuffle": "^1.0.0", 95 | "global": "^4.4.0", 96 | "lodash.get": "^4.4.2", 97 | "mousetrap": "^1.6.3", 98 | "music-metadata": "^7.0.0", 99 | "nanobus": "^4.4.0", 100 | "nanocomponent": "^6.5.2", 101 | "nanologger": "^2.0.0", 102 | "patch-package": "^8.0.0", 103 | "pump": "^3.0.0", 104 | "through2-filter": "^4.0.0", 105 | "xtend": "^4.0.2" 106 | }, 107 | "devDependencies": { 108 | "@tap-format/spec": "^0.2.0", 109 | "auto-changelog": "^2.4.0", 110 | "browserify": "^17.0.0", 111 | "budo": "^11.6.2", 112 | "buffer-equal": "^1.0.0", 113 | "bundle-collapser": "^1.3.0", 114 | "common-shakeify": "^1.1.2", 115 | "concat-stream": "^2.0.0", 116 | "electron": "^33.0.0", 117 | "electron-builder": "^25.0.5", 118 | "electron-renderify": "0.0.2", 119 | "envify": "^4.1.0", 120 | "gh-release": "^7.0.2", 121 | "is-buffer": "^2.0.3", 122 | "npm-run-all2": "^7.0.1", 123 | "p-temporary-directory": "^2.0.1", 124 | "snazzy": "^9.0.0", 125 | "spectron": "^19.0.0", 126 | "standard": "^17.0.0", 127 | "tape": "^5.6.3", 128 | "unassertify": "^3.0.1", 129 | "xvfb-maybe": "^0.2.1", 130 | "yo-yoify": "^4.3.0" 131 | }, 132 | "engines": { 133 | "node": ">=19.0.0", 134 | "npm": ">=9.0.0" 135 | }, 136 | "homepage": "https://github.com/hypermodules/hyperamp", 137 | "keywords": [ 138 | "amp", 139 | "hyper", 140 | "hyperamp", 141 | "library", 142 | "music", 143 | "player" 144 | ], 145 | "license": "GPL-3.0", 146 | "main": "main/index.js", 147 | "productName": "Hyperamp", 148 | "repository": { 149 | "type": "git", 150 | "url": "git+https://github.com/hypermodules/hyperamp.git" 151 | }, 152 | "scripts": { 153 | "build": "run-s clean build:*", 154 | "build:assets": "browserify --no-bundle-external --debug renderer/player/index.js -o renderer/player/bundle.js", 155 | "build:electron": "electron-builder --dir --publish never", 156 | "clean": "rm -rf renderer/**/bundle.js && mkdir -p dist", 157 | "clear": "electron scripts/clear.js", 158 | "pkg": "run-s clean pkg:*", 159 | "pkg:assets": "browserify --no-bundle-external -g unassertify -p common-shakeify -p bundle-collapser/plugin --debug renderer/player/index.js -o renderer/player/bundle.js", 160 | "pkg:electron": "electron-builder --publish always", 161 | "prod": "ELECTRON_IS_DEV=0 DEV_SERVER=1 npm start", 162 | "start": "run-s watch", 163 | "test": "run-s test:*", 164 | "test-skip:tape": "xvfb-maybe tape test/* | tap-format-spec", 165 | "test:lint": "standard | snazzy", 166 | "test:main": "tape main/lib/**/test.js | tap-format-spec", 167 | "test:renderer": "tape renderer/**/test.js | tap-format-spec", 168 | "watch": "run-s clean && run-p watch:*", 169 | "watch:electron": "electron main", 170 | "watch:js": "budo renderer/player/index.js:bundle.js -- --no-bundle-external", 171 | "version": "run-s version:*", 172 | "version:changelog": "auto-changelog -p --template keepachangelog auto-changelog --breaking-pattern 'BREAKING CHANGE:'", 173 | "version:git": "git add CHANGELOG.md", 174 | "release": "git push --follow-tags && gh-release -y", 175 | "postinstall": "patch-package" 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /renderer/README.md: -------------------------------------------------------------------------------- 1 | # Renderer 2 | 3 | This directory is for files that run in a `renderer` electron process. 4 | 5 | The two renderer process in Hyperamp are the Player and Audio windows. 6 | 7 | - `audio` - Background audio process. Exposes interface for HTML audio element over IPC. 8 | - `player` - GUI (playlist, player controls) 9 | - `shared` - resources shared between processes 10 | -------------------------------------------------------------------------------- /renderer/audio/audio-player.js: -------------------------------------------------------------------------------- 1 | /* eslint-env browser */ 2 | const Nanobus = require('nanobus') 3 | const window = require('global/window') 4 | const get = require('lodash.get') 5 | const fs = require('fs').promises 6 | const fileUrlFromPath = require('../shared/file-url') 7 | const setTimeout = window.setTimeout 8 | const clearTimeout = window.clearTimeout 9 | 10 | class AudioPlayer extends Nanobus { 11 | constructor (audioNode, state) { 12 | super('Hyperaudio') 13 | 14 | this.audio = audioNode 15 | this.audio.volume = state.volume 16 | this.audio.muted = state.muted 17 | this.audio.src = get(state.al, 'currentTrack.filepath') || '' 18 | this.seeking = false 19 | this.seekDebounceTimer = null 20 | this.timeupdate = null 21 | this.currentTrack = null // Store current track 22 | 23 | this._endedListener = this.audio.addEventListener('ended', 24 | () => { if (!this.seeking) this.emit('ended') }) 25 | 26 | this._timeListener = this.audio.addEventListener('timeupdate', (ev) => { 27 | if (this.seeking) return 28 | const timeupdate = Math.floor(this.audio.currentTime) 29 | if (this.timeupdate === timeupdate) return 30 | this.timeupdate = timeupdate 31 | this.emit('timeupdate', this.timeupdate) 32 | }) 33 | 34 | this._initMediaSession() 35 | 36 | this.emit('initialized', this) 37 | } 38 | 39 | seekDebounce () { 40 | this.seeking = true 41 | if (this.seekDebounceTimer) clearTimeout(this.seekDebounceTimer) 42 | this.seekDebounceTimer = setTimeout(() => { 43 | this.emit('debounce cleared') 44 | this.seeking = false 45 | this.seekDebounceTimer = null 46 | // TODO: check if we are at the end and we lost the endedEvent 47 | }, 1000) 48 | } 49 | 50 | load (track) { 51 | this.currentTrack = track // Update current track 52 | this._updateMediaSessionMetadata() 53 | const src = fileUrlFromPath(track.filepath) 54 | this.emit('loading', src) 55 | this.audio.src = src || '' 56 | } 57 | 58 | play () { 59 | this.emit('playing') 60 | this.audio.play() 61 | navigator.mediaSession.playbackState = 'playing' 62 | } 63 | 64 | pause () { 65 | this.emit('paused') 66 | this.audio.pause() 67 | navigator.mediaSession.playbackState = 'paused' 68 | } 69 | 70 | volume (lev) { 71 | this.emit('volume', lev) 72 | this.audio.volume = lev 73 | } 74 | 75 | mute () { 76 | this.emit('muted') 77 | this.audio.muted = true 78 | } 79 | 80 | unmute () { 81 | this.emit('unmuted') 82 | this.audio.muted = false 83 | } 84 | 85 | seek (newTime) { 86 | this.seekDebounce() 87 | this.emit('seek', newTime) 88 | this.audio.currentTime = newTime 89 | } 90 | 91 | nextTrack () { 92 | this.emit('next') 93 | } 94 | 95 | previousTrack () { 96 | this.emit('prev') 97 | } 98 | 99 | _initMediaSession () { 100 | navigator.mediaSession.setActionHandler('play', () => this.play()) 101 | navigator.mediaSession.setActionHandler('pause', () => this.pause()) 102 | navigator.mediaSession.setActionHandler('previoustrack', () => this.previousTrack()) 103 | navigator.mediaSession.setActionHandler('nexttrack', () => this.nextTrack()) 104 | navigator.mediaSession.setActionHandler('seekbackward', () => this.seek(this.audio.currentTime - 10)) // Example: seek back 10 seconds 105 | navigator.mediaSession.setActionHandler('seekforward', () => this.seek(this.audio.currentTime + 10)) // Example: seek forward 10 seconds 106 | } 107 | 108 | _updateMediaSessionMetadata () { 109 | if (this.currentTrack) { 110 | navigator.mediaSession.metadata = new MediaMetadata({ 111 | title: this.currentTrack.title, 112 | artist: this.currentTrack.artist, 113 | album: this.currentTrack.album 114 | // artwork: [{ src: fileUrlFromPath(this.currentTrack.artwork), sizes: '96x96', type: 'image/png' }] 115 | }) 116 | } 117 | } 118 | 119 | async _updateArtwork (trackWithArt) { 120 | if (this.currentTrack?.filepath === trackWithArt?.filepath && trackWithArt?.artwork) { 121 | this.currentTrack = trackWithArt 122 | const blob = await fileToBlobUrl(trackWithArt?.artwork) 123 | if (blob) { 124 | navigator.mediaSession.metadata = new MediaMetadata({ 125 | title: this.currentTrack.title, 126 | artist: this.currentTrack.artist, 127 | album: this.currentTrack.album, 128 | artwork: [{ src: blob, sizes: '96x96', type: 'image/png' }] 129 | }) 130 | } 131 | } 132 | } 133 | } 134 | 135 | module.exports = AudioPlayer 136 | 137 | // TODO: move to main thread 138 | // function notify () { 139 | // var key = this.trackOrder[this.currentIndex] 140 | // var track = this.trackDict[key] 141 | // var artwork = fileUrlFromPath(track.artwork ? track.artwork : path.resolve(__dirname, '../../static/splash-mini.png')) 142 | // 143 | // new window.Notification(track.title, { // eslint-disable-line no-new 144 | // // TODO: placeholder. ideally this is album art 145 | // icon: artwork, 146 | // title: track.title, 147 | // body: track.artist[0], 148 | // tag: 'nowPlaying', 149 | // silent: true, 150 | // requireInteraction: false 151 | // }) 152 | // } 153 | 154 | async function fileToBlobUrl (filePath) { 155 | try { 156 | // Read file as buffer 157 | const buffer = await fs.readFile(filePath) 158 | 159 | // Convert buffer to blob (Electron specific) 160 | const blob = new Blob([buffer], { type: 'image/png' }) // Adjust type based on your file's MIME type 161 | 162 | // Create a blob URL (in renderer process of Electron) 163 | const blobUrl = URL.createObjectURL(blob) 164 | 165 | return blobUrl 166 | } catch (error) { 167 | console.error('Error converting file to Blob URL:', error) 168 | return null 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /renderer/audio/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | HyperAmp Audio 5 | 6 | 9 | 10 | 11 | 12 |

🎵

13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /renderer/audio/index.js: -------------------------------------------------------------------------------- 1 | const el = require('electron-log/renderer') 2 | el.info('Log from the autio process') 3 | const { ipcRenderer } = require('electron') 4 | const log = require('nanologger')('player') 5 | const AudioPlayer = require('./audio-player') 6 | const remote = require('@electron/remote') 7 | const path = require('path') 8 | // We don't need to sync-state since we just sync load state 9 | const mainState = remote.require('./index.js') 10 | const needle = 'file://' + path.resolve(__dirname, 'needle.mp3') 11 | let startupNode = document.querySelector('#needle') 12 | 13 | needleSound(startupNode, needle, mainState.volume, mainState.muted) 14 | 15 | const audioNode = document.querySelector('#audio') 16 | const player = window.player = new AudioPlayer(audioNode, mainState) 17 | 18 | player.on('*', function (event, data) { 19 | if (data === undefined) return log.info(event) 20 | log.info(event, data) 21 | }) 22 | 23 | player.on('ended', function () { 24 | ipcRenderer.send('next') 25 | }) 26 | 27 | player.on('timeupdate', function (time) { 28 | ipcRenderer.send('timeupdate', time) 29 | }) 30 | 31 | player.on('playing', function () { 32 | ipcRenderer.send('playing') 33 | }) 34 | 35 | player.on('paused', function () { 36 | ipcRenderer.send('paused') 37 | }) 38 | 39 | player.on('next', function () { 40 | ipcRenderer.send('next') 41 | }) 42 | 43 | player.on('prev', function () { 44 | ipcRenderer.send('prev') 45 | }) 46 | 47 | ipcRenderer.on('new-track', function (ev, track = {}) { 48 | player.load(track) 49 | }) 50 | 51 | ipcRenderer.on('new-artwork', (ev, track = {}) => { 52 | player._updateArtwork(track) 53 | }) 54 | 55 | ipcRenderer.on('play', function (ev, data) { 56 | player.play() 57 | }) 58 | 59 | ipcRenderer.once('play', function (ev, data) { 60 | startupNode.remove() 61 | startupNode = null 62 | }) 63 | 64 | ipcRenderer.on('pause', function (ev, data) { 65 | player.pause() 66 | }) 67 | 68 | ipcRenderer.on('volume', function (ev, lev) { 69 | player.volume(lev) 70 | }) 71 | 72 | ipcRenderer.on('mute', function () { 73 | player.mute() 74 | }) 75 | 76 | ipcRenderer.on('unmute', function () { 77 | player.unmute() 78 | }) 79 | 80 | ipcRenderer.on('seek', function (ev, newTime) { 81 | player.seek(newTime) 82 | }) 83 | 84 | function needleSound (node, file, volume, muted) { 85 | node.volume = volume 86 | node.muted = muted 87 | node.src = file 88 | node.play() 89 | } 90 | -------------------------------------------------------------------------------- /renderer/audio/loader.js: -------------------------------------------------------------------------------- 1 | require('./index.js') 2 | -------------------------------------------------------------------------------- /renderer/audio/needle.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hypermodules/hyperamp/899d21de3794946fc29eecad52c13681b2bbdcdf/renderer/audio/needle.mp3 -------------------------------------------------------------------------------- /renderer/player/default-artwork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hypermodules/hyperamp/899d21de3794946fc29eecad52c13681b2bbdcdf/renderer/player/default-artwork.png -------------------------------------------------------------------------------- /renderer/player/elements/button/button-group.js: -------------------------------------------------------------------------------- 1 | const html = require('choo/html') 2 | const styles = require('./styles') 3 | 4 | function btnGroup (props, children) { 5 | const { className } = props 6 | return html` 7 |
8 | ${children || ''} 9 |
10 | ` 11 | } 12 | 13 | module.exports = btnGroup 14 | -------------------------------------------------------------------------------- /renderer/player/elements/button/index.js: -------------------------------------------------------------------------------- 1 | const html = require('choo/html') 2 | const icon = require('../icon') 3 | const styles = require('./styles') 4 | 5 | function button (props, children) { 6 | const { className, onclick, iconName, disabled } = props 7 | return html` 8 | 14 | ` 15 | } 16 | 17 | module.exports = button 18 | -------------------------------------------------------------------------------- /renderer/player/elements/button/styles.js: -------------------------------------------------------------------------------- 1 | const css = require('csjs-inject') 2 | 3 | module.exports = css` 4 | .btn { 5 | display: inline-flex; 6 | align-items: center; 7 | padding: 3px 8px; 8 | margin-bottom: 0; 9 | font-size: 1em; 10 | line-height: 1.4; 11 | min-height: 24px; 12 | text-align: center; 13 | white-space: nowrap; 14 | vertical-align: middle; 15 | background-image: none; 16 | border: 1px solid transparent; 17 | border-radius: var(--default-border-radius); 18 | -webkit-app-region: no-drag; 19 | color: var(--copy); 20 | background: transparent; 21 | } 22 | 23 | .btn svg { fill: var(--copy) } 24 | .btn.inverse svg { fill: var(--bg) } 25 | .btn:active, .btn.active { color: var(--link) } 26 | .btn:active svg, .btn.active svg { fill: var(--link) } 27 | .btn[disabled] svg { fill: var(--lighter) } 28 | .btn[disabled] { background-color: var(--bg) } 29 | 30 | .btn:focus { 31 | outline: none; 32 | box-shadow: none; 33 | } 34 | 35 | .btnGroup { 36 | display: inline-flex; 37 | flex-direction: row; 38 | justify-content: center; 39 | } 40 | 41 | .btnGroup .btn:not(:last-child) { border-right: none } 42 | .btnGroup .btn:not(:first-child):not(:last-child) { border-radius: 0 } 43 | 44 | .btnGroup .btn:first-child { 45 | border-top-right-radius: 0; 46 | border-bottom-right-radius: 0; 47 | } 48 | 49 | .btnGroup .btn:last-child { 50 | border-top-left-radius: 0; 51 | border-bottom-left-radius: 0; 52 | } 53 | ` 54 | -------------------------------------------------------------------------------- /renderer/player/elements/form/styles.js: -------------------------------------------------------------------------------- 1 | const css = require('csjs-inject') 2 | 3 | module.exports = css` 4 | .form { 5 | padding-bottom: 1em; 6 | margin-bottom: 1em; 7 | border-bottom: var(--border); 8 | } 9 | 10 | .formControl { 11 | color: var(--copy); 12 | display: inline-block; 13 | width: 100%; 14 | min-height: 25px; 15 | padding: var(--padding-less) var(--padding); 16 | font-family: var(--font-family-default); 17 | font-size: var(--font-size-default); 18 | font-weight: var(--font-weight-default); 19 | line-height: var(--line-height-default); 20 | background: var(--darken); 21 | border: var(--border); 22 | border-radius: var(--default-border-radius); 23 | outline: none; 24 | } 25 | 26 | .formControl:focus { 27 | border: 1px solid var(--darker); 28 | } 29 | 30 | .formGroup { 31 | display: flex; 32 | align-items: center; 33 | } 34 | 35 | .formGroup label { 36 | margin-right: 1em; 37 | width: 30%; 38 | white-space: nowrap; 39 | } 40 | 41 | .formGroup input { 42 | display: inline-flex; 43 | flex; 1; 44 | } 45 | ` 46 | -------------------------------------------------------------------------------- /renderer/player/elements/header/index.js: -------------------------------------------------------------------------------- 1 | const remote = require('@electron/remote') 2 | const { webUtils } = require('electron') 3 | const { app, dialog } = remote 4 | const html = require('choo/html') 5 | const Component = require('nanocomponent') 6 | const Search = require('./search') 7 | const button = require('../button') 8 | const config = remote.require('./config.js') 9 | const css = require('csjs-inject') 10 | 11 | const styles = css` 12 | .toolbar { 13 | -webkit-app-region: drag; 14 | height: 40px; 15 | padding: 0 .5em 0 6.5em; 16 | display: flex; 17 | align-items: center; 18 | justify-content: space-between; 19 | } 20 | 21 | .toolbarLeft, .toolbarRight { 22 | display: flex; 23 | align-items: center; 24 | } 25 | .toolbarLeft { flex: 1 } 26 | .toolbarRight { 27 | font-size: 1.5em; 28 | margin-left: auto; 29 | } 30 | 31 | @keyframes ckw { 32 | 0% { transform: rotate(0deg) } 33 | 100% { transform: rotate(360deg) } 34 | } 35 | 36 | .spin { animation: ckw 4s infinite linear } 37 | ` 38 | 39 | class Header extends Component { 40 | constructor (opts) { 41 | super(opts) 42 | 43 | this.emit = null 44 | this.search = '' 45 | this.dialogOpen = false 46 | 47 | this.handleSearch = this.handleSearch.bind(this) 48 | this.handleAddButton = this.handleAddButton.bind(this) 49 | this.handlePaths = this.handlePaths.bind(this) 50 | this.handleNav = this.handleNav.bind(this) 51 | this.handleDrop = this.handleDrop.bind(this) 52 | 53 | this.searchComp = new Search() 54 | } 55 | 56 | handleSearch (val) { 57 | this.search = val 58 | this.emit('library:search', val) 59 | } 60 | 61 | handleAddButton () { 62 | if (!this.dialogOpen) { 63 | this.dialogOpen = true 64 | const paths = config.get('paths') 65 | const defaultPath = paths ? paths[paths.length - 1] : app.getPath('music') 66 | dialog.showOpenDialog({ 67 | defaultPath, 68 | properties: ['openFile', 'openDirectory', 'multiSelections'] 69 | }) 70 | .then(this.handlePaths) 71 | .catch(err => { 72 | this.dialogOpen = false 73 | console.error(err) 74 | }) 75 | } 76 | } 77 | 78 | handlePaths ({ filePaths }) { 79 | this.dialogOpen = false 80 | if (Array.isArray(filePaths) && filePaths.length > 0) { 81 | this.emit('config:set', { filePaths }) 82 | this.emit('library:update-library', filePaths) 83 | } 84 | } 85 | 86 | handleNav () { 87 | this.emit('pushState', '#preferences') 88 | } 89 | 90 | handleDrop (event) { 91 | event.preventDefault() 92 | const { files } = event.dataTransfer 93 | 94 | const paths = Array(files.length).fill(0).map((_, i) => webUtils.getPathForFile(files.item(i))) 95 | this.handlePaths({ filePaths: paths }) 96 | } 97 | 98 | createElement (state, emit) { 99 | this.emit = emit 100 | this.search = state.library.search 101 | this.loading = state.library.loading 102 | 103 | // `this._emit` is undefined if this is assigned in the constructor 104 | document.body.ondrop = this.handleDrop 105 | document.ondragover = event => event.preventDefault() 106 | 107 | return html` 108 |
109 |
110 | ${this.searchComp.render({ /* eslint-disable indent */ 111 | onchange: this.handleSearch, 112 | value: this.search 113 | })/* eslint-enable indent */} 114 |
115 |
116 | ${button({ /* eslint-disable indent */ 117 | className: this.loading ? styles.spin : null, 118 | onclick: this.handleAddButton, 119 | iconName: this.loading ? 'entypo-cog' : 'entypo-folder-music' 120 | })/* eslint-enable indent */} 121 |
122 |
123 | ` 124 | } 125 | 126 | update (state, emit) { 127 | if (this.search !== state.library.search) return true 128 | if (this.loading !== state.library.loading) return true 129 | return false 130 | } 131 | } 132 | 133 | module.exports = Header 134 | -------------------------------------------------------------------------------- /renderer/player/elements/header/search.js: -------------------------------------------------------------------------------- 1 | const html = require('choo/html') 2 | const formStyles = require('../form/styles') 3 | const assert = require('assert') 4 | const Component = require('nanocomponent') 5 | const css = require('csjs-inject') 6 | 7 | const styles = css` 8 | .searchInput { 9 | -webkit-app-region: no-drag; 10 | width: 100%; 11 | padding: 1px 5px; 12 | vertical-align: middle; 13 | min-height: auto; 14 | margin-right: 1em; 15 | height: 24px; 16 | } 17 | ` 18 | 19 | class Search extends Component { 20 | constructor (opts) { 21 | if (!opts) opts = {} 22 | super(opts) 23 | 24 | this.opts = Object.assign({ id: '' }, opts) 25 | this.value = '' 26 | this.onchange = null 27 | this.className = `${formStyles.formControl} ${styles.searchInput}` 28 | this.handleInput = this.handleInput.bind(this) 29 | } 30 | 31 | handleInput (ev) { 32 | if (this.onchange) this.onchange(this.element.value) 33 | } 34 | 35 | createElement ({ onchange, value, className }) { 36 | assert.strict.equal(typeof onchange, 'function', 'Search: onchange should be a function') 37 | 38 | this.onchange = onchange 39 | this.value = value 40 | if (className !== undefined) this.className = className 41 | 42 | return html` 43 | 48 | ` 49 | } 50 | 51 | // Lets mutate! 52 | update ({ value, onchange, className }) { 53 | assert.strict.equal(typeof onchange, 'function', 'Range: onchange should be a function') 54 | if (this.onchange !== onchange) { 55 | this.onchange = onchange 56 | } 57 | if (this.className !== className) { 58 | this.className = className 59 | this.element.class = className 60 | } 61 | if (this.element.value !== value) { 62 | // Mutate value changes 63 | 64 | this.value = value 65 | this.element.value = this.value 66 | } 67 | return false 68 | } 69 | } 70 | 71 | module.exports = Search 72 | -------------------------------------------------------------------------------- /renderer/player/elements/icon.js: -------------------------------------------------------------------------------- 1 | const html = require('choo/html') 2 | const assert = require('assert') 3 | 4 | assert.strict.equal(document.body.firstChild.tagName, 'svg', 'svg sprite sheet must be mounted before icons work') 5 | 6 | function icon (opts) { 7 | const name = opts.name 8 | const height = opts.size || opts.height || '1em' 9 | const width = opts.size || opts.width || '1em' 10 | return html`` 11 | } 12 | 13 | module.exports = icon 14 | -------------------------------------------------------------------------------- /renderer/player/elements/loader.js: -------------------------------------------------------------------------------- 1 | const html = require('choo/html') 2 | const css = require('csjs-inject') 3 | 4 | const styles = css` 5 | .loading { 6 | height: 100%; 7 | width: 100%; 8 | display: flex; 9 | justify-content: center; 10 | align-items: center; 11 | } 12 | 13 | .loader, 14 | .loader:before, 15 | .loader:after { 16 | background: var(--dark); 17 | -webkit-animation: load1 1s infinite ease-in-out; 18 | animation: load1 1s infinite ease-in-out; 19 | width: 1em; 20 | height: 4em; 21 | } 22 | .loader:before, 23 | .loader:after { 24 | position: absolute; 25 | top: 0; 26 | content: ''; 27 | } 28 | .loader:before { 29 | left: -1.5em; 30 | -webkit-animation-delay: -0.32s; 31 | animation-delay: -0.32s; 32 | } 33 | .loader { 34 | color: var(--dark); 35 | text-indent: -9999em; 36 | margin: 88px auto; 37 | position: relative; 38 | font-size: 11px; 39 | -webkit-transform: translateZ(0); 40 | -ms-transform: translateZ(0); 41 | transform: translateZ(0); 42 | -webkit-animation-delay: -0.16s; 43 | animation-delay: -0.16s; 44 | } 45 | .loader:after { 46 | left: 1.5em; 47 | } 48 | @-webkit-keyframes load1 { 49 | 0%, 50 | 80%, 51 | 100% { 52 | box-shadow: 0 0; 53 | height: 4em; 54 | } 55 | 40% { 56 | box-shadow: 0 -2em; 57 | height: 5em; 58 | } 59 | } 60 | @keyframes load1 { 61 | 0%, 62 | 80%, 63 | 100% { 64 | box-shadow: 0 0; 65 | height: 4em; 66 | } 67 | 40% { 68 | box-shadow: 0 -2em; 69 | height: 5em; 70 | } 71 | } 72 | ` 73 | 74 | module.exports = function loader () { 75 | return html` 76 |
77 |
78 |
79 | ` 80 | } 81 | -------------------------------------------------------------------------------- /renderer/player/elements/player/artwork.js: -------------------------------------------------------------------------------- 1 | const html = require('choo/html') 2 | const Component = require('nanocomponent') 3 | const fileUrlFromPath = require('../../../shared/file-url') 4 | const path = require('path') 5 | const defaultBG = path.resolve(window.__dirname, 'default-artwork.png') 6 | const compare = require('nanocomponent/compare') 7 | const css = require('csjs-inject') 8 | 9 | const styles = css` 10 | .albumCover { 11 | position: relative; 12 | width: 76px; 13 | height: 76px; 14 | overflow: hidden; 15 | float: left; 16 | flex-shrink: 0; 17 | } 18 | .albumCover:before { 19 | content: ''; 20 | display: block; 21 | padding-top: 100%; /* initial ratio of 1:1*/ 22 | } 23 | .albumArt { 24 | position: absolute; 25 | top: 0; 26 | left: 0; 27 | bottom: 0; 28 | right: 0; 29 | 30 | background: var(--bg); 31 | background-size: cover; 32 | background-position: center; 33 | } 34 | ` 35 | 36 | class Artwork extends Component { 37 | constructor () { 38 | super() 39 | this.arguments = [] 40 | } 41 | 42 | createElement (artworkPath) { 43 | this.arguments = arguments 44 | 45 | const fileUrl = fileUrlFromPath(artworkPath || defaultBG) 46 | const style = fileUrl 47 | ? `background-image: url(${fileUrl})` 48 | : '' 49 | 50 | return html` 51 |
52 |
53 |
54 | ` 55 | } 56 | 57 | update () { 58 | return compare(arguments, this.arguments) 59 | } 60 | } 61 | 62 | module.exports = Artwork 63 | -------------------------------------------------------------------------------- /renderer/player/elements/player/controls.js: -------------------------------------------------------------------------------- 1 | const Component = require('nanocomponent') 2 | const button = require('../button') 3 | const buttonGroup = require('../button/button-group') 4 | const buttonStyles = require('../button/styles') 5 | const css = require('csjs-inject') 6 | 7 | const styles = css` 8 | .controls { 9 | font-size: 1.5em; 10 | flex-direction: column; 11 | align-items: center; 12 | justify-content: center; 13 | align-self: center; 14 | display: flex; 15 | flex-direction: row; 16 | } 17 | ` 18 | 19 | class PlayerControls extends Component { 20 | constructor (opts) { 21 | super(opts) 22 | 23 | // State 24 | this.key = null 25 | this.emit = null 26 | this.playing = false 27 | 28 | // Bound Methods 29 | this.handlePrev = this.handlePrev.bind(this) 30 | this.handleNext = this.handleNext.bind(this) 31 | this.handlePlayPause = this.handlePlayPause.bind(this) 32 | this.shuffleToggle = this.shuffleToggle.bind(this) 33 | } 34 | 35 | handlePrev () { this.emit('player:prev') } 36 | 37 | handleNext () { this.emit('player:next') } 38 | 39 | handlePlayPause () { 40 | if (this.playing) this.emit('player:pause') 41 | else this.emit('player:play') 42 | } 43 | 44 | shuffleToggle () { 45 | if (this.shuffling) this.emit('player:unshuffle') 46 | else this.emit('player:shuffle') 47 | } 48 | 49 | createElement (state, emit) { 50 | const { playing, shuffling, currentTrack = {} } = state.player 51 | 52 | this.emit = emit 53 | this.key = currentTrack.key 54 | this.playing = playing 55 | this.shuffling = shuffling 56 | 57 | return buttonGroup({ className: styles.controls }, 58 | [ 59 | button({ 60 | onclick: this.handlePrev, 61 | iconName: 'entypo-controller-fast-backward' 62 | }), 63 | button({ 64 | onclick: this.handlePlayPause, 65 | iconName: `entypo-controller-${this.playing ? 'paus' : 'play'}` 66 | }), 67 | button({ 68 | onclick: this.handleNext, 69 | iconName: 'entypo-controller-fast-forward' 70 | }), 71 | button({ 72 | onclick: this.shuffleToggle, 73 | iconName: 'entypo-shuffle', 74 | className: shuffling ? buttonStyles.active : null 75 | }) 76 | ] 77 | ) 78 | } 79 | 80 | update (state, emit) { 81 | const { currentTrack = {}, playing, shuffling } = state.player 82 | this.emit = emit 83 | if (this.key !== currentTrack.key) return true 84 | if (this.playing !== playing) return true 85 | if (this.shuffling !== shuffling) return true 86 | return false 87 | } 88 | } 89 | 90 | module.exports = PlayerControls 91 | -------------------------------------------------------------------------------- /renderer/player/elements/player/index.js: -------------------------------------------------------------------------------- 1 | const html = require('choo/html') 2 | const Component = require('nanocomponent') 3 | const Controls = require('./controls') 4 | const Progress = require('./progress') 5 | const Volume = require('./volume') 6 | const Meta = require('./meta') 7 | const css = require('csjs-inject') 8 | 9 | const styles = css` 10 | .player { 11 | -webkit-app-region: drag; 12 | border-top: var(--border); 13 | align-items: center; 14 | text-align: center; 15 | position: fixed; 16 | left: 0; 17 | right: 0; 18 | bottom: 0; 19 | height: 77px; 20 | justify-content: space-between; 21 | will-change: transform; 22 | contain: layout; 23 | display: flex; 24 | padding: 0 2% 0 0; 25 | background: var(--bg); 26 | } 27 | ` 28 | 29 | class Player extends Component { 30 | constructor (opts) { 31 | if (!opts) opts = {} 32 | super(opts) 33 | this.opts = Object.assign({}, opts) 34 | 35 | // state 36 | this.emit = null 37 | this.key = null 38 | this.pictureHash = null 39 | 40 | // owned children 41 | this.controls = new Controls() 42 | this.progress = new Progress() 43 | this.volume = new Volume() 44 | this.meta = new Meta() 45 | } 46 | 47 | createElement (state, emit) { 48 | const { currentTrack = {} } = state.player 49 | 50 | this.emit = emit 51 | this.key = currentTrack.key 52 | 53 | return html` 54 |
55 | ${this.meta.render(currentTrack, emit)} 56 | ${this.controls.render(state, emit)} 57 | ${this.progress.render(state, emit)} 58 | ${this.volume.render(state, emit)} 59 |
60 | ` 61 | } 62 | 63 | update (state, emit) { 64 | this.emit = emit 65 | 66 | const { currentTrack = {} } = state.player 67 | 68 | if (this.key !== currentTrack.key) return true 69 | 70 | this.controls.render(state, emit) 71 | this.progress.render(state, emit) 72 | this.volume.render(state, emit) 73 | this.meta.render(currentTrack, emit) 74 | 75 | return false 76 | } 77 | } 78 | 79 | module.exports = Player 80 | -------------------------------------------------------------------------------- /renderer/player/elements/player/meta.js: -------------------------------------------------------------------------------- 1 | const Component = require('nanocomponent') 2 | const compare = require('nanocomponent/compare') 3 | const Artwork = require('./artwork') 4 | const html = require('choo/html') 5 | const css = require('csjs-inject') 6 | 7 | const styles = css` 8 | .nowPlaying { 9 | position: relative; 10 | min-width: 220px; 11 | max-width: 300px; 12 | flex: 1 0 30%; 13 | display: flex; 14 | align-items: center; 15 | padding-right: 2%; 16 | overflow: hidden; 17 | border-right: var(--border); 18 | margin-right: 2%; 19 | height: 100%; 20 | } 21 | 22 | .meta { 23 | font-size: 12px; 24 | text-align: left; 25 | padding-left: 10px; 26 | overflow: hidden; 27 | -webkit-app-region: no-drag; 28 | } 29 | .title, .artist { 30 | margin: 0; 31 | white-space: nowrap; 32 | overflow: hidden; 33 | text-overflow: ellipsis; 34 | } 35 | .title { font-weight: 600 } 36 | ` 37 | 38 | class Meta extends Component { 39 | constructor () { 40 | super() 41 | 42 | // state 43 | this.arguments = [] 44 | 45 | // owned children 46 | this.artwork = new Artwork() 47 | 48 | this.handleClick = this.handleClick.bind(this) 49 | } 50 | 51 | handleClick () { 52 | this.emit('library:recall') 53 | } 54 | 55 | createElement (track = {}, emit) { 56 | this.arguments = arguments 57 | this.emit = emit 58 | 59 | const { title, artist } = track 60 | 61 | return html` 62 |
63 | ${this.artwork.render(track.artwork)} 64 | 65 |
66 | ${artist != null && artist !== '' && artist.length > 0 /* eslint-disable indent */ 67 | ? html`
${Array.isArray(artist) ? artist.join(', ') : artist}
` 68 | : ''/* eslint-enable indent */} 69 | ${title != null/* eslint-disable indent */ 70 | ? html`
${title}
` 71 | : html`
No Track Selected
`/* eslint-enable indent */} 72 |
73 |
74 | ` 75 | } 76 | 77 | update (_, emit) { 78 | this.emit = emit 79 | return compare(arguments, this.arguments) 80 | } 81 | } 82 | 83 | module.exports = Meta 84 | -------------------------------------------------------------------------------- /renderer/player/elements/player/progress.js: -------------------------------------------------------------------------------- 1 | const Component = require('nanocomponent') 2 | const html = require('choo/html') 3 | const truthy = require('@bret/truthy') 4 | const button = require('../button') 5 | const Range = require('../range') 6 | const fd = require('format-duration') 7 | const css = require('csjs-inject') 8 | const get = require('lodash.get') 9 | 10 | const styles = css` 11 | .progress { 12 | display: flex; 13 | width: 100%; 14 | padding: 0 2%; 15 | justify-content: center; 16 | } 17 | .time { 18 | font-size: 11px; 19 | display: inline-flex; 20 | align-items: center; 21 | min-width: 3em; 22 | font-variant-numeric: tabular-nums; 23 | line-height: 1; 24 | } 25 | .time:first-child { justify-content: flex-end } 26 | .time:last-child { justify-content: flex-start } 27 | .range { width: 100% } 28 | .scrubber { 29 | cursor: default; 30 | position: relative; 31 | vertical-align: middle; 32 | -webkit-app-region: no-drag; 33 | width: 100%; 34 | } 35 | @media (max-width: 640px) { 36 | .range { 37 | width: 0; 38 | padding: 0 .5em 0 0; 39 | pointer-events: none; 40 | } 41 | .range::after { 42 | content: '/'; 43 | margin-left: -.25em; 44 | } 45 | } 46 | ` 47 | 48 | class Progress extends Component { 49 | constructor (opts) { 50 | if (!opts) opts = {} 51 | super(opts) 52 | this.opts = Object.assign({ 53 | min: 0, 54 | max: 100, 55 | step: 0.1, 56 | default: 0, 57 | id: 'position' 58 | }, opts) 59 | 60 | // State 61 | this.position = 0 62 | this.currentIndex = null 63 | this.emit = null 64 | this.disabled = false 65 | this.duration = 1 66 | 67 | // Bound Methods 68 | this.scalePosition = this.scalePosition.bind(this) 69 | this.handleSeek = this.handleSeek.bind(this) 70 | 71 | // Owned Children 72 | this.positionSlider = new Range(this.opts) 73 | } 74 | 75 | scalePosition (position, duration) { 76 | return (position / duration) * this.opts.max || 0 77 | } 78 | 79 | handleSeek (val) { 80 | const newTime = (val / this.opts.max) * this.duration 81 | this.emit('player:seek', newTime) 82 | this.position = newTime 83 | } 84 | 85 | createElement (state, emit) { 86 | const { currentTrack, currentTime } = state.player 87 | 88 | this.emit = emit 89 | this.key = get(currentTrack, 'key') 90 | this.position = currentTime 91 | this.disabled = !truthy(currentTrack) 92 | 93 | if (currentTrack) this.duration = currentTrack.duration 94 | 95 | return html` 96 |
97 |
${fd(this.position * 1000)}
98 | ${button({ className: styles.range }, /* eslint-disable indent */ 99 | this.positionSlider.render({ 100 | onchange: this.handleSeek, 101 | value: currentTrack ? this.scalePosition(this.position, currentTrack.duration) : 0, 102 | className: styles.scrubber, 103 | disabled: this.disabled 104 | }) 105 | )/* eslint-enable indent */} 106 |
${fd(this.duration * 1000)}
107 |
108 | ` 109 | } 110 | 111 | update (state, emit) { 112 | this.emit = emit 113 | if (this.disabled !== !truthy(state.player.currentTrack)) return true 114 | if (this.key !== get(state, 'player.currentTrack.key')) return true 115 | if (this.position !== state.player.currentTime) return true 116 | if (this.duration !== get(state, 'player.currentTrack.duration')) return true 117 | return false 118 | } 119 | } 120 | 121 | module.exports = Progress 122 | -------------------------------------------------------------------------------- /renderer/player/elements/player/volume.js: -------------------------------------------------------------------------------- 1 | const html = require('choo/html') 2 | const button = require('../button') 3 | const buttonStyles = require('../button/styles') 4 | const Component = require('nanocomponent') 5 | const Range = require('../range') 6 | const css = require('csjs-inject') 7 | 8 | const styles = css` 9 | .volumeGroup { 10 | flex: 1 1 30%; 11 | max-width: 110px; 12 | min-width: 80px; 13 | } 14 | .volumeButton { padding-right: 0 } 15 | .range { 16 | width: 100%; 17 | padding: 0 3px; 18 | } 19 | .volumeSlider { 20 | position: relative; 21 | cursor: default; 22 | display: inline-block; 23 | vertical-align: middle; 24 | -webkit-app-region: no-drag; 25 | margin: 0 5px; 26 | width: 100%; 27 | } 28 | ` 29 | 30 | class Volume extends Component { 31 | constructor (opts) { 32 | if (!opts) opts = {} 33 | super(opts) 34 | this.opts = Object.assign({ 35 | min: 0, 36 | max: 1, 37 | default: 0.5, 38 | step: 0.01 39 | }, opts) 40 | 41 | // State 42 | this.emit = null 43 | this.volume = 0 44 | this.muted = false 45 | 46 | // Bound Methods 47 | this.changeVolume = this.changeVolume.bind(this) 48 | this.toggleMute = this.toggleMute.bind(this) 49 | 50 | // Owned Children 51 | this.volumeSlider = new Range(this.opts) 52 | } 53 | 54 | changeVolume (volume) { 55 | this.volume = volume 56 | if (this.emit) this.emit('player:changeVolume', volume) 57 | } 58 | 59 | toggleMute () { 60 | if (this.muted) this.emit('player:unmute') 61 | else this.emit('player:mute') 62 | } 63 | 64 | createElement (state, emit) { 65 | const { muted, volume } = state.player 66 | this.muted = muted 67 | this.volume = volume 68 | this.emit = emit 69 | return html` 70 |
71 | ${button({ /* eslint-disable indent */ 72 | onclick: this.toggleMute, 73 | iconName: muted ? 'entypo-sound-mute' : 'entypo-sound', 74 | className: styles.volumeButton 75 | })} 76 | ${button({ className: styles.range }, 77 | this.volumeSlider.render({ 78 | onchange: this.changeVolume, 79 | value: volume, 80 | className: styles.volumeSlider 81 | }) 82 | )/* eslint-enable indent */} 83 |
84 | ` 85 | } 86 | 87 | update (state) { 88 | const { muted, volume } = state.player 89 | if (this.muted !== muted || this.volume !== volume) { 90 | return true 91 | } 92 | return false 93 | } 94 | } 95 | 96 | module.exports = Volume 97 | -------------------------------------------------------------------------------- /renderer/player/elements/playlist/index.js: -------------------------------------------------------------------------------- 1 | const html = require('choo/html') 2 | const Component = require('nanocomponent') 3 | const Header = require('../../elements/header') 4 | const styles = require('./styles') 5 | const TrackView = require('./track-view') 6 | const loader = require('../loader') 7 | 8 | class Playlist extends Component { 9 | constructor (opts) { 10 | if (!opts) opts = {} 11 | super(opts) 12 | this.opts = Object.assign({}, opts) 13 | 14 | // Owned Children 15 | this.header = new Header() 16 | this.trackView = new TrackView() 17 | } 18 | 19 | createElement (state, emit) { 20 | this.loading = state.library.loading 21 | 22 | return html` 23 |
24 | ${this.header.render(state, emit)} 25 | ${this.loading /* eslint-disable indent */ 26 | ? loader() 27 | : this.trackView.render(state, emit)/* eslint-enable indent */} 28 |
29 | ` 30 | } 31 | 32 | update (state, emit) { 33 | if (this.loading !== state.library.loading) return true 34 | this.trackView.render(state, emit) 35 | this.header.render(state, emit) 36 | return false 37 | } 38 | } 39 | 40 | module.exports = Playlist 41 | -------------------------------------------------------------------------------- /renderer/player/elements/playlist/lib.js: -------------------------------------------------------------------------------- 1 | exports.formatCount = formatCount 2 | 3 | function formatCount (countObj) { 4 | if (!countObj.no && !countObj.of) return '' 5 | if (!countObj.of) return countObj.no.toString() 6 | return `${countObj.no} of ${countObj.of}` 7 | } 8 | -------------------------------------------------------------------------------- /renderer/player/elements/playlist/styles.js: -------------------------------------------------------------------------------- 1 | const css = require('csjs-inject') 2 | 3 | module.exports = css` 4 | .playlist { 5 | position: absolute; 6 | left: 0; 7 | top: 0; 8 | right: 0; 9 | bottom: 77px; 10 | } 11 | 12 | .tableScrollWindow { 13 | position: absolute; 14 | top: 40px; 15 | right: 0; 16 | left: 0; 17 | bottom: 0; 18 | overflow: auto; 19 | } 20 | 21 | .tableContainer { position: relative } 22 | 23 | .mediaList { 24 | table-layout: fixed; 25 | width: 100%; 26 | min-width: 1000px; 27 | border-spacing: 0; 28 | border: 0; 29 | border-collapse: separate; 30 | text-align: left; 31 | position: absolute; 32 | contain: layout; 33 | } 34 | 35 | .mediaList td { 36 | white-space: nowrap; 37 | overflow: hidden; 38 | text-overflow: ellipsis; 39 | } 40 | 41 | /* .mediaList tr:nth-child(even), 42 | thead { background: var(--darken) } */ 43 | 44 | .mediaList th { 45 | font-weight: var(--font-weight-default); 46 | /* border-right: var(--border); 47 | border-bottom: var(--border); */ 48 | } 49 | /* .mediaList td { border-right: var(--border) } 50 | .mediaList th:last-child { border-right: none } */ 51 | 52 | .stickyHead th { 53 | position: sticky; 54 | top: 0px; 55 | background-color: var(--bg); 56 | font-weight: 500; 57 | border-bottom: var(--border); 58 | } 59 | 60 | .mediaList td, th { 61 | height: 3em; 62 | padding: 2px 15px; 63 | } 64 | 65 | .mediaList tr:nth-child(even) { background: var(--darken) } 66 | .mediaList tbody tr.selected { background: rgba(255,102,51,.1) } 67 | 68 | /* use colgroup to sanely apply width properties */ 69 | /* https://docs.webplatform.org/wiki/html/elements/colgroup */ 70 | .mediaList .title { width: 12em } 71 | .mediaList .time { width: 4em } 72 | .mediaList .artist { width: 10em } 73 | .mediaList .album { width: 8em } 74 | .mediaList .track { width: 4em } 75 | .mediaList .disk { width: 4em } 76 | .mediaList .year { width: 4em } 77 | .mediaList .genre { width: 4em } 78 | .playing { font-weight: 500 } 79 | ` 80 | -------------------------------------------------------------------------------- /renderer/player/elements/playlist/test.js: -------------------------------------------------------------------------------- 1 | const test = require('tape') 2 | const { formatCount } = require('./lib') 3 | 4 | test('format disk and track objects correctly', function (t) { 5 | const tests = [ 6 | { 7 | in: { no: 14, of: 17 }, 8 | expect: '14 of 17' 9 | }, 10 | { 11 | in: { no: 0, of: 0 }, 12 | expect: '' 13 | }, 14 | { 15 | in: { no: 5, of: 0 }, 16 | expect: '5' 17 | } 18 | ] 19 | 20 | tests.forEach(function (testCase) { 21 | t.equal(formatCount(testCase.in), testCase.expect, `${JSON.stringify(testCase.in)} formats to ${testCase.expect}`) 22 | }) 23 | 24 | t.end() 25 | }) 26 | -------------------------------------------------------------------------------- /renderer/player/elements/playlist/track-view.js: -------------------------------------------------------------------------------- 1 | const html = require('choo/html') 2 | const fd = require('format-duration') 3 | const cn = require('classnames') 4 | const Component = require('nanocomponent') 5 | const document = require('global/document') 6 | const { formatCount } = require('./lib') 7 | const { COLUMNS } = require('../../lib/constants') 8 | const styles = require('./styles') 9 | const remote = require('@electron/remote') 10 | const { Menu, MenuItem, getCurrentWindow, shell } = remote 11 | 12 | const OFFSET_BUFFER = 50 13 | 14 | class TrackView extends Component { 15 | constructor (opts) { 16 | if (!opts) opts = {} 17 | super(opts) 18 | this.opts = Object.assign({}, opts) 19 | 20 | // State 21 | this.emit = null 22 | this.trackOrder = [] 23 | this.trackDict = {} 24 | this.currentIndex = null 25 | this.selectedIndex = null 26 | this.sliceLength = 200 27 | this.sliceStartIndex = 0 28 | this.rowHeight = 39 29 | this.scrollWindowHeight = 1024 30 | this.ticking = false // https://developer.mozilla.org/en-US/docs/Web/Events/scroll#Example 31 | this.columns = {} 32 | 33 | // Bound methods 34 | // NOTE: not sure most of these are needed 35 | this.selectTrack = this.selectTrack.bind(this) 36 | this.deselect = this.deselect.bind(this) 37 | this.playTrack = this.playTrack.bind(this) 38 | this.rowMap = this.rowMap.bind(this) 39 | this.renderSlice = this.renderSlice.bind(this) 40 | this.mutateCurrentIndex = this.mutateCurrentIndex.bind(this) 41 | this.mutateSelectedIndex = this.mutateSelectedIndex.bind(this) 42 | this.handleOnScroll = this.handleOnScroll.bind(this) 43 | this.metaMenu = this.metaMenu.bind(this) 44 | this.scrollTo = this.scrollTo.bind(this) 45 | this.scrollCurrent = this.scrollCurrent.bind(this) 46 | } 47 | 48 | get topVisibleRowIndex () { 49 | return Math.floor(this.element.scrollTop / this.rowHeight) 50 | } 51 | 52 | get bottomVisibleRowIndex () { 53 | const { clientHeight } = this.element 54 | return Math.floor(clientHeight / this.rowHeight) + this.topVisibleRowIndex 55 | } 56 | 57 | get midIndexOffset () { 58 | return Math.floor((this.bottomVisibleRowIndex - this.topVisibleRowIndex - 1) / 2) 59 | } 60 | 61 | get topOffset () { 62 | return this.topVisibleRowIndex - this.sliceStartIndex 63 | } 64 | 65 | get bottomOffset () { 66 | const lastRenderedIndex = this.sliceStartIndex + this.sliceLength 67 | return lastRenderedIndex - this.bottomVisibleRowIndex 68 | } 69 | 70 | get maxScrollTop () { 71 | return this.element.scrollHeight - this.element.clientHeight 72 | } 73 | 74 | scrollTo (index) { 75 | window.requestAnimationFrame(() => { 76 | let middleScrollTop = ((index - this.midIndexOffset) * this.rowHeight) 77 | if (middleScrollTop < 0) middleScrollTop = 0 78 | if (middleScrollTop > this.maxScrollTop) middleScrollTop = this.maxScrollTop 79 | if (index < this.topVisibleRowIndex + 1 || index > this.bottomVisibleRowIndex - 1) { 80 | this.element.scrollTop = middleScrollTop 81 | } 82 | }) 83 | } 84 | 85 | scrollCurrent () { 86 | this.scrollTo(this.currentIndex) 87 | } 88 | 89 | selectTrack (ev) { 90 | let t = ev.target 91 | while (t && !t.id) t = t.parentNode // Bubble up 92 | if (t && t.tagName === 'TR') { 93 | ev.stopPropagation() 94 | const index = Number(t.id.replace('track-', '')) 95 | this.emit('library:select', index) 96 | } 97 | } 98 | 99 | playTrack (ev) { 100 | let t = ev.target 101 | while (t && !t.id) t = t.parentNode // Bubble up 102 | if (t && t.tagName === 'TR') { 103 | const index = Number(t.id.replace('track-', '')) 104 | this.emit('library:queue', index) 105 | this.emit('player:play') 106 | } 107 | } 108 | 109 | mutateCurrentIndex (newIndex) { 110 | const oldIndex = this.currentIndex 111 | const oldEl = document.getElementById(`track-${oldIndex}`) 112 | const newEl = document.getElementById(`track-${newIndex}`) 113 | 114 | if (oldEl) oldEl.classList.toggle(styles.playing, false) 115 | if (newEl) newEl.classList.toggle(styles.playing, true) 116 | 117 | this.currentIndex = newIndex 118 | } 119 | 120 | mutateSelectedIndex (newIndex) { 121 | const oldIndex = this.selectedIndex 122 | const oldEl = document.getElementById(`track-${oldIndex}`) 123 | const newEl = document.getElementById(`track-${newIndex}`) 124 | 125 | if (oldEl) oldEl.classList.toggle(styles.selected, false) 126 | if (newEl) newEl.classList.toggle(styles.selected, true) 127 | 128 | if (this.selectedIndex != null) { 129 | const selected = document.querySelector(styles.selected.selector) 130 | if (selected != null) selected.scrollIntoViewIfNeeded(false) 131 | } 132 | 133 | this.selectedIndex = newIndex 134 | } 135 | 136 | // TODO: figure out Y offset for top element when scrolling up 137 | rowMap (key, idx) { 138 | // Look up track info 139 | const track = this.trackDict[key] 140 | const columns = Object.keys(this.columns).filter(col => this.columns[col]) 141 | 142 | // create meta display values 143 | const meta = Object.assign({}, track, { 144 | time: track.duration ? fd(track.duration * 1000) : '', 145 | track: track.track ? formatCount(track.track) : '', 146 | disk: track.disk ? formatCount(track.disk) : '' 147 | }) 148 | 149 | // Generate state based styles 150 | const classes = cn({ 151 | [styles.playing]: this.currentIndex === idx + this.sliceStartIndex && !this.isNewQuery, 152 | [styles.selected]: this.selectedIndex === idx + this.sliceStartIndex 153 | }) 154 | 155 | return html` 156 | 160 | ${columns.map(col => html` 161 | ${arrToStr(meta[col])} 162 | `)} 163 | 164 | ` 165 | } 166 | 167 | metaMenu (event) { 168 | event.preventDefault() 169 | 170 | const menu = new Menu() 171 | 172 | Array.from(COLUMNS).map(col => ({ 173 | label: capitalize(col), 174 | type: 'checkbox', 175 | checked: this.columns[col], 176 | click: () => this.emit('library:columns', col) 177 | })).forEach(item => menu.append(new MenuItem(item))) 178 | 179 | menu.popup(getCurrentWindow()) 180 | } 181 | 182 | renderSlice () { 183 | const sliceOffset = `top: ${this.sliceStartIndex * this.rowHeight}px;` 184 | const tableContainerHeight = `height: ${this.trackOrder.length * this.rowHeight}px;` 185 | const sliceEnd = this.sliceStartIndex + this.sliceLength < this.trackOrder.length 186 | ? this.sliceStartIndex + this.sliceLength 187 | : this.trackOrder.length 188 | const tracks = this.trackOrder.slice(this.sliceStartIndex, sliceEnd).map(this.rowMap) 189 | const columns = Object.keys(this.columns).filter(col => this.columns[col]) 190 | 191 | return html` 192 |
193 |
194 | 195 | 196 | 197 | ${columns.map(col => html` 198 | 199 | `)} 200 | 201 | 202 | 203 | ${tracks} 204 | 205 |
${capitalize(col)}
206 |
207 |
208 | ` 209 | } 210 | 211 | deselect () { 212 | this.emit('library:select', null) 213 | } 214 | 215 | handleOnScroll (ev) { 216 | const self = this 217 | 218 | const maxStart = this.trackOrder.length - this.sliceLength > 0 ? this.trackOrder.length - this.sliceLength : 0 219 | const closeToBottom = this.bottomOffset < OFFSET_BUFFER && this.sliceStartIndex !== maxStart 220 | const closeToTop = this.topOffset < OFFSET_BUFFER && this.sliceStartIndex !== 0 221 | 222 | if (closeToBottom) { 223 | const frontSlice = this.topVisibleRowIndex - OFFSET_BUFFER 224 | this.sliceStartIndex = frontSlice > maxStart ? maxStart : frontSlice 225 | } 226 | 227 | if (closeToTop) { 228 | const backSlice = this.bottomVisibleRowIndex + OFFSET_BUFFER - this.sliceLength 229 | this.sliceStartIndex = backSlice > 0 ? backSlice : 0 230 | } 231 | 232 | if (!this.ticking && (closeToTop || closeToBottom)) { 233 | window.requestAnimationFrame(function () { 234 | self.render(null, null, true) 235 | self.ticking = false 236 | }) 237 | this.ticking = true 238 | } 239 | } 240 | 241 | createElement (state, emit) { 242 | if (emit) this.emit = emit 243 | if (state) { 244 | // Save references to state track order and dicts 245 | this.trackOrder = state.library.trackOrder 246 | this.trackDict = state.library.trackDict 247 | // Save state 248 | // Current index is the index of a queued track 249 | this.currentIndex = state.library.currentIndex 250 | this.isNewQuery = state.library.isNewQuery 251 | // Selected index is the index of the highlighted track 252 | this.selectedIndex = state.library.selectedIndex 253 | // set of currently displayed columns 254 | this.columns = Object.assign({}, state.library.columns) // must be cloned for comparison 255 | } 256 | 257 | return this.renderSlice() 258 | } 259 | 260 | update (state, emit, scroll) { 261 | // Re-render 262 | // Note, these are only shallow compares. You must slice or reobject your state 263 | if (scroll) return true 264 | if (this.trackOrder !== state.library.trackOrder) return true 265 | if (this.trackDict !== state.library.trackDict) return true 266 | if (this.isNewQuery !== state.library.isNewQuery) return true 267 | if (shouldColumnsUpdate(this.columns, state.library.columns)) return true 268 | // Mutate 269 | if (this.currentIndex !== state.library.currentIndex && !this.isNewQuery) { 270 | this.mutateCurrentIndex(state.library.currentIndex) 271 | } 272 | if (this.selectedIndex !== state.library.selectedIndex) { 273 | this.mutateSelectedIndex(state.library.selectedIndex) 274 | } 275 | // Cache! 276 | return false 277 | } 278 | 279 | beforerender (el) { 280 | const self = this 281 | window.requestAnimationFrame(function () { 282 | el.scrollTop = self.sliceStartIndex * self.rowHeight 283 | }) 284 | } 285 | } 286 | 287 | function shouldColumnsUpdate (cols, newCols) { 288 | return Object.keys(cols).filter(k => cols[k] !== newCols[k]).length !== 0 289 | } 290 | 291 | function capitalize (string) { 292 | return string.charAt(0).toUpperCase() + string.slice(1) 293 | } 294 | 295 | function trackMenu (filepath) { 296 | return function onTrackContextMenu (event) { 297 | event.preventDefault() 298 | const menu = new Menu() 299 | menu.append(new MenuItem({ 300 | // TODO: show appropriate labels for windows & linux 301 | label: 'Reveal in Finder', 302 | click: () => shell.showItemInFolder(filepath) 303 | })) 304 | menu.popup(getCurrentWindow()) 305 | } 306 | } 307 | 308 | function arrToStr (arr) { 309 | if (Array.isArray(arr)) return arr.join(', ') 310 | return arr 311 | } 312 | 313 | module.exports = TrackView 314 | -------------------------------------------------------------------------------- /renderer/player/elements/range.js: -------------------------------------------------------------------------------- 1 | const Component = require('nanocomponent') 2 | const html = require('choo/html') 3 | const assert = require('assert') 4 | const css = require('csjs-inject') 5 | 6 | const styles = css` 7 | .range { 8 | cursor: default; 9 | position: relative; 10 | vertical-align: middle; 11 | -webkit-app-region: no-drag; 12 | width: 100%; 13 | } 14 | ` 15 | 16 | class Range extends Component { 17 | constructor (opts) { 18 | if (!opts) opts = {} 19 | super(opts) 20 | this._opts = Object.assign({ 21 | min: 0, 22 | max: 1, 23 | default: 0.5, 24 | step: 0.01, 25 | id: '' 26 | }, opts) 27 | this._value = this._opts.default 28 | this._onchange = null 29 | this._disabled = false 30 | this._className = styles.range 31 | this._handleInput = this._handleInput.bind(this) 32 | } 33 | 34 | _handleInput (e) { 35 | if (this._onchange) this._onchange(this.element.value) 36 | } 37 | 38 | createElement ({ value, onchange, className, disabled }) { 39 | assert.strict.equal(typeof onchange, 'function', 'Range: onchange should be a function') 40 | 41 | this._onchange = onchange 42 | this._value = value 43 | if (className !== undefined) this._className = className 44 | this._disabled = disabled 45 | 46 | return html` 47 | 56 | ` 57 | } 58 | 59 | // Lets mutate! 60 | update ({ value, onchange, className, disabled }) { 61 | assert.strict.equal(typeof onchange, 'function', 'Range: onchange should be a function') 62 | 63 | if (this._onchange !== onchange) { 64 | this._onchange = onchange 65 | } 66 | if (this._className !== className) { 67 | this._className = className 68 | this.element.class = className 69 | } 70 | if (this._value !== value) { 71 | // Mutate value changes 72 | this._value = value 73 | this.element.value = this._value 74 | } 75 | if (this._disabled !== disabled) { 76 | this._disabled = disabled 77 | if (this._disabled) { 78 | this.element.setAttribute('disabled', '') 79 | } else { 80 | this.element.removeAttribute('disabled') 81 | } 82 | } 83 | return false 84 | } 85 | } 86 | 87 | module.exports = Range 88 | -------------------------------------------------------------------------------- /renderer/player/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | HyperAmp 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /renderer/player/index.js: -------------------------------------------------------------------------------- 1 | const log = require('electron-log/renderer') 2 | log.info('Log from the player process') 3 | const choo = require('choo') 4 | const { ipcRenderer } = require('electron') 5 | const app = window.hyperamp = choo() 6 | 7 | ipcRenderer.on('log', (ev, data) => console.log(data)) 8 | 9 | const entypoSprite = require('entypo').getNode() 10 | document.body.insertAdjacentElement('afterbegin', entypoSprite) 11 | 12 | app.use(require('choo-devtools')()) 13 | 14 | app.use(require('./stores/config')) 15 | app.use(require('./stores/player')) 16 | app.use(require('./stores/library')) 17 | 18 | app.route('#', require('./pages/main')) 19 | app.route('#preferences', require('./pages/preferences')) 20 | app.mount('#app') 21 | 22 | ipcRenderer.send('sync-state') 23 | -------------------------------------------------------------------------------- /renderer/player/lib/constants.js: -------------------------------------------------------------------------------- 1 | /** 2 | * a place for constants that need to be used in more than one file 3 | */ 4 | 5 | // column names master list 6 | const COLUMNS = new Set([ 7 | 'title', 8 | 'time', 9 | 'artist', 10 | 'album', 11 | 'track', 12 | 'disk', 13 | 'year', 14 | 'genre' 15 | ]) 16 | 17 | module.exports = { 18 | COLUMNS 19 | } 20 | -------------------------------------------------------------------------------- /renderer/player/loader.js: -------------------------------------------------------------------------------- 1 | const remote = require('@electron/remote') 2 | const isPackaged = remote.app.isPackaged 3 | const isDev = !isPackaged 4 | 5 | if (isDev || process.env.DEV_SERVER) { 6 | const bundle = document.createElement('script') 7 | bundle.src = 'http://localhost:9966/bundle.js' 8 | document.body.appendChild(bundle) 9 | } else { 10 | window.localStorage.DISABLE_NANOTIMING = true 11 | require('./bundle.js') 12 | } 13 | -------------------------------------------------------------------------------- /renderer/player/pages/main.js: -------------------------------------------------------------------------------- 1 | const html = require('choo/html') 2 | const Playlist = require('../elements/playlist') 3 | const Player = require('../elements/player') 4 | const css = require('csjs-inject') 5 | 6 | const styles = css` 7 | .window { 8 | position: absolute; 9 | top: 0; 10 | right: 0; 11 | bottom: 0; 12 | left: 0; 13 | } 14 | ` 15 | 16 | const playlist = new Playlist() 17 | const player = new Player() 18 | 19 | function main (state, emit) { 20 | return html` 21 |
22 | ${playlist.render(state, emit)} 23 | ${player.render(state, emit)} 24 |
25 | ` 26 | } 27 | 28 | module.exports = main 29 | module.exports.playlist = playlist 30 | -------------------------------------------------------------------------------- /renderer/player/pages/preferences.js: -------------------------------------------------------------------------------- 1 | // NOTE: this page is not currently in use 2 | 3 | const html = require('choo/html') 4 | const Header = require('../elements/header') 5 | const button = require('../elements/button') 6 | const Player = require('../elements/player') 7 | const player = new Player() 8 | const formStyles = require('../elements/form/styles') 9 | const remote = require('@electron/remote') 10 | const { app, dialog } = remote 11 | const styles = require('./styles') 12 | 13 | const header = new Header() 14 | 15 | function preferences (state, emit) { 16 | function showDialog () { 17 | dialog.showOpenDialog({ 18 | defaultPath: app.getPath('home'), 19 | properties: ['openDirectory'] 20 | }, (paths) => { 21 | // paths is undefined if user presses cancel 22 | if (paths) { 23 | emit('config:set', { music: paths[0] }) 24 | emit('library:loadSongs') 25 | } 26 | }) 27 | } 28 | return html` 29 |
30 |
31 | ${header.render(state, emit)} 32 |
33 |
34 |
35 |
36 | 37 | 42 |
43 |
44 | ${button({ /* eslint-disable indent */ 45 | onclick: () => emit('pushState', '#'), 46 | iconName: 'entypo-chevron-left' 47 | }, 'Back')/* eslint-disable indent */} 48 |
49 |
50 |
51 | ${player.render(state, emit)} 52 |
53 | ` 54 | } 55 | 56 | module.exports = preferences 57 | -------------------------------------------------------------------------------- /renderer/player/pages/styles.js: -------------------------------------------------------------------------------- 1 | const css = require('csjs-inject') 2 | 3 | module.exports = css` 4 | .window { 5 | display: flex; 6 | position: absolute; 7 | top: 0; 8 | right: 0; 9 | bottom: 0; 10 | left: 0; 11 | } 12 | 13 | .pane { 14 | padding: 1rem; 15 | } 16 | 17 | .grow { 18 | flex: 1 0; 19 | overflow-y: hidden; 20 | display: flex; 21 | flex-direction: column; 22 | } 23 | 24 | @media (max-width: 460px) { 25 | .grow { display: none } 26 | } 27 | ` 28 | -------------------------------------------------------------------------------- /renderer/player/stores/config.js: -------------------------------------------------------------------------------- 1 | const remote = require('@electron/remote') 2 | const { ipcRenderer } = require('electron') 3 | 4 | const config = remote.require('./config.js') 5 | const mutate = require('xtend/mutable') 6 | 7 | function configStore (state, emitter) { 8 | let localState = state.config 9 | 10 | if (!localState) { 11 | localState = state.config = {} 12 | localState = config.store // wtf 13 | } 14 | 15 | emitter.on('config:set', set) 16 | 17 | function set (data) { 18 | mutate(localState, data) 19 | ipcRenderer.send('config', data) 20 | config.set(data) 21 | emitter.emit('render') 22 | } 23 | } 24 | 25 | module.exports = configStore 26 | -------------------------------------------------------------------------------- /renderer/player/stores/library.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron') 2 | const mousetrap = require('mousetrap') 3 | const { COLUMNS } = require('../lib/constants') 4 | const { trackView } = require('../pages/main').playlist 5 | const remote = require('@electron/remote') 6 | 7 | window.trackView = trackView 8 | 9 | module.exports = libraryStore 10 | 11 | function getInitialState () { 12 | const mainState = remote.require('./index.js') 13 | return { 14 | paths: mainState.paths, 15 | trackDict: {}, 16 | trackOrder: [], 17 | currentIndex: mainState.al.index, 18 | search: mainState.al.searchTerm, 19 | selectedIndex: null, 20 | isNewQuery: mainState.al.isNewQuery, 21 | loading: mainState.loading, 22 | columns: Array.from(COLUMNS).reduce((obj, col) => { 23 | obj[col] = true 24 | return obj 25 | }, {}) 26 | } 27 | } 28 | 29 | function libraryStore (state, emitter) { 30 | let localState = state.library 31 | if (!localState) localState = state.library = getInitialState() 32 | 33 | mousetrap.bind('up', e => { 34 | e.preventDefault() 35 | const idx = localState.selectedIndex 36 | const newIdx = idx == null || idx === 0 37 | ? 0 38 | : idx - 1 39 | emitter.emit('library:select', newIdx) 40 | trackView.scrollTo(newIdx) 41 | }) 42 | mousetrap.bind('down', e => { 43 | e.preventDefault() 44 | const idx = localState.selectedIndex 45 | const newIdx = idx == null 46 | ? 0 47 | : idx === localState.trackOrder.length - 1 48 | ? localState.trackOrder.length - 1 49 | : idx + 1 50 | emitter.emit('library:select', newIdx) 51 | trackView.scrollTo(newIdx) 52 | }) 53 | mousetrap.bind('enter', e => { 54 | e.preventDefault() 55 | const idx = localState.selectedIndex 56 | if (idx != null) { 57 | emitter.emit('library:queue', idx) 58 | emitter.emit('player:play') 59 | } 60 | }) 61 | mousetrap.bind('esc', e => { 62 | e.preventDefault() 63 | emitter.emit('library:select') 64 | }) 65 | 66 | emitter.on('library:search', search) 67 | emitter.on('library:update-library', updateLibrary) 68 | emitter.on('library:track-dict', updateTrackDict) 69 | emitter.on('library:track-order', updateTrackOrder) 70 | emitter.on('library:paths', updatePaths) 71 | emitter.on('library:select', select) 72 | emitter.on('library:columns', updateColumns) 73 | emitter.on('library:current-index', updateIndex) 74 | emitter.on('library:queue', queue) 75 | emitter.on('library:new-query', updateQueryState) 76 | emitter.on('library:recall', recall) 77 | 78 | function recall () { 79 | if (!localState.isNewQuery) return trackView.scrollCurrent() 80 | ipcRenderer.send('recall') 81 | } 82 | 83 | function queue (newIndex) { 84 | ipcRenderer.send('queue', newIndex) 85 | } 86 | 87 | function updateColumns (col) { 88 | localState.columns[col] = !localState.columns[col] 89 | emitter.emit('render') 90 | } 91 | 92 | function updateQueryState (state) { 93 | localState.isNewQuery = state 94 | } 95 | 96 | function updateTrackDict (newTrackDict) { 97 | localState.trackDict = newTrackDict 98 | } 99 | 100 | function updateTrackOrder (newTrackOrder) { 101 | localState.trackOrder = newTrackOrder 102 | } 103 | 104 | function updatePaths (newPaths) { 105 | localState.paths = newPaths 106 | } 107 | 108 | function updateIndex (newIndex) { 109 | localState.currentIndex = newIndex 110 | } 111 | 112 | function loading (bool) { 113 | localState.loading = bool 114 | emitter.emit('render') 115 | } 116 | 117 | function updateLibrary (paths) { 118 | window.requestAnimationFrame(() => { 119 | ipcRenderer.send('update-library', paths) 120 | }) 121 | } 122 | 123 | function search (string) { 124 | ipcRenderer.send('search', string) 125 | localState.search = string 126 | trackView.scrollTo(0) 127 | } 128 | 129 | function select (selectedIndex) { 130 | localState.selectedIndex = selectedIndex 131 | emitter.emit('render') 132 | } 133 | 134 | ipcRenderer.on('loading', (ev, isLoading) => loading(isLoading)) 135 | ipcRenderer.on('track-dict', (ev, newTrackDict, newTrackOrder, newPaths) => { 136 | window.requestAnimationFrame(() => { 137 | emitter.emit('library:track-dict', newTrackDict) 138 | emitter.emit('library:track-order', newTrackOrder) 139 | emitter.emit('library:paths', newPaths) 140 | emitter.emit('render') 141 | }) 142 | }) 143 | ipcRenderer.on('track-order', (ev, newTrackOrder) => { 144 | window.requestAnimationFrame(() => { 145 | emitter.emit('library:track-order', newTrackOrder) 146 | emitter.emit('render') 147 | }) 148 | }) 149 | ipcRenderer.on('new-index', (ev, newIndex) => { 150 | emitter.emit('library:current-index', newIndex) 151 | emitter.emit('render') 152 | }) 153 | ipcRenderer.on('is-new-query', (ev, queryState) => { 154 | emitter.emit('library:new-query', queryState) 155 | emitter.emit('render') 156 | }) 157 | ipcRenderer.on('recall', (ev, order, searchTerm) => { 158 | localState.trackOrder = order 159 | localState.search = searchTerm 160 | localState.isNewQuery = false 161 | emitter.emit('render') 162 | trackView.scrollCurrent() 163 | }) 164 | ipcRenderer.on('sync-state', (ev, data) => { 165 | const { trackDict, order, paths } = data 166 | window.requestAnimationFrame(() => { 167 | emitter.emit('library:track-dict', trackDict) 168 | emitter.emit('library:track-order', order) 169 | emitter.emit('library:paths', paths) 170 | emitter.emit('render') 171 | trackView.scrollCurrent() 172 | }) 173 | }) 174 | } 175 | -------------------------------------------------------------------------------- /renderer/player/stores/player.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron') 2 | const mousetrap = require('mousetrap') 3 | const { trackView } = require('../pages/main').playlist 4 | const remote = require('@electron/remote') 5 | 6 | module.exports = playerStore 7 | 8 | function getInitialState () { 9 | const mainState = remote.require('./index.js') 10 | return { 11 | playing: mainState.playing, 12 | currentTime: 0.0, 13 | currentTrack: mainState.al.currentTrack, 14 | volume: mainState.volume, 15 | muted: mainState.muted, 16 | shuffling: mainState.al.shuffling 17 | } 18 | } 19 | 20 | function playerStore (state, emitter) { 21 | let localState = state.player 22 | if (!localState) localState = state.player = getInitialState() 23 | 24 | function render () { 25 | emitter.emit('render') 26 | } 27 | 28 | function muted (bool) { 29 | localState.muted = bool 30 | render() 31 | } 32 | 33 | function playing (bool) { 34 | localState.playing = bool 35 | render() 36 | } 37 | 38 | function shuffling (bool) { 39 | localState.shuffling = bool 40 | } 41 | 42 | function currentTime (time, shouldRender) { 43 | localState.currentTime = time 44 | } 45 | 46 | function volume (lev) { 47 | localState.volume = lev 48 | } 49 | 50 | function current (newTrack) { 51 | localState.currentTrack = newTrack 52 | render() 53 | if (!state.library.isNewQuery) { 54 | window.requestAnimationFrame(() => { 55 | trackView.scrollCurrent() 56 | }) 57 | } 58 | } 59 | 60 | mousetrap.bind('left', e => { 61 | e.preventDefault() 62 | emitter.emit('player:prev') 63 | }) 64 | mousetrap.bind('right', e => { 65 | e.preventDefault() 66 | emitter.emit('player:next') 67 | }) 68 | mousetrap.bind('space', e => { 69 | e.preventDefault() 70 | if (localState.playing) emitter.emit('player:pause') 71 | else emitter.emit('player:play') 72 | }) 73 | 74 | emitter.on('player:play', play) 75 | emitter.on('player:pause', pause) 76 | emitter.on('player:prev', prev) 77 | emitter.on('player:next', next) 78 | emitter.on('player:mute', mute) 79 | emitter.on('player:unmute', unmute) 80 | emitter.on('player:shuffle', shuffle) 81 | emitter.on('player:unshuffle', unshuffle) 82 | emitter.on('player:seek', seek) 83 | emitter.on('player:changeVolume', changeVolume) 84 | emitter.on('player:time-update', currentTime) 85 | 86 | function play () { 87 | ipcRenderer.send('play') 88 | playing(true) 89 | } 90 | 91 | function pause () { 92 | ipcRenderer.send('pause') 93 | playing(false) 94 | } 95 | 96 | function next () { 97 | ipcRenderer.send('next') 98 | currentTime(0) 99 | render() 100 | } 101 | 102 | function prev () { 103 | ipcRenderer.send('prev') 104 | currentTime(0) 105 | render() 106 | } 107 | 108 | function mute () { 109 | ipcRenderer.send('mute') 110 | muted(true) 111 | } 112 | 113 | function unmute () { 114 | ipcRenderer.send('unmute') 115 | muted(false) 116 | } 117 | 118 | function shuffle () { 119 | ipcRenderer.send('shuffle') 120 | shuffling(true) 121 | render() 122 | } 123 | 124 | function unshuffle () { 125 | ipcRenderer.send('unshuffle') 126 | shuffling(false) 127 | render() 128 | } 129 | 130 | function seek (time) { 131 | window.requestAnimationFrame(() => { 132 | ipcRenderer.send('seek', time) 133 | currentTime(time) 134 | render() 135 | }) 136 | } 137 | 138 | function changeVolume (lev) { 139 | ipcRenderer.send('volume', lev) 140 | volume(lev) 141 | } 142 | 143 | ipcRenderer.on('play', () => playing(true)) 144 | ipcRenderer.on('playing', () => playing(true)) 145 | ipcRenderer.on('pause', () => playing(false)) 146 | ipcRenderer.on('paused', () => playing(false)) 147 | ipcRenderer.on('new-track', (ev, newTrack) => current(newTrack)) 148 | ipcRenderer.on('mute', () => muted(true)) 149 | ipcRenderer.on('unmute', () => muted(false)) 150 | ipcRenderer.on('shuffle', () => shuffling(true)) 151 | ipcRenderer.on('unshuffle', () => shuffling(false)) 152 | ipcRenderer.on('volume', (ev, lev) => volume(lev)) 153 | ipcRenderer.on('timeupdate', (ev, time) => { 154 | currentTime(time) 155 | render() 156 | }) 157 | } 158 | -------------------------------------------------------------------------------- /renderer/shared/README.md: -------------------------------------------------------------------------------- 1 | # Shared Assets 2 | 3 | This directory is for assets (css, images, audio, etc) shared between processes that should be included in the build. 4 | 5 | Any files that should be excluded from the build can be placed in `docs`. 6 | -------------------------------------------------------------------------------- /renderer/shared/css/base.css: -------------------------------------------------------------------------------- 1 | html { 2 | background: var(--bg); 3 | box-sizing: border-box; 4 | cursor: default !important; /* always be defaultin */ 5 | font-size: var(--font-size-default); 6 | overflow: hidden; 7 | width: 100%; 8 | -webkit-user-select: none; 9 | } 10 | 11 | *, *:before, *:after { 12 | box-sizing: inherit; 13 | } 14 | 15 | html, body { 16 | height: 100%; 17 | } 18 | 19 | body { 20 | color: var(--copy); 21 | font-family: var(--font-family-default); 22 | font-size: var(--font-size-default); 23 | font-weight: var(--font-weight-default); 24 | line-height: var(--line-height-default); 25 | margin: 0; 26 | overflow: hidden; 27 | padding: 0; 28 | animation: fadeIn 0.5s ease-in; 29 | } 30 | 31 | @-webkit-keyframes fadeIn { 32 | 0% { opacity: 0 } 33 | 100% { opacity: 1 } 34 | } 35 | 36 | hr { 37 | margin: 15px 0; 38 | overflow: hidden; 39 | background: transparent; 40 | border: 0; 41 | border-bottom: var(--border); 42 | } 43 | 44 | /* Typography */ 45 | h1, h2, h3, h4, h5, h6 { 46 | margin-top: 20px; 47 | margin-bottom: 10px; 48 | font-weight: 500; 49 | white-space: nowrap; 50 | overflow: hidden; 51 | text-overflow: ellipsis; 52 | } 53 | 54 | h1 { font-size: 36px; } 55 | h2 { font-size: 30px; } 56 | h3 { font-size: 24px; } 57 | h4 { font-size: 18px; } 58 | h5 { font-size: 14px; } 59 | h6 { font-size: 12px; } 60 | 61 | a { 62 | color: var(--link); 63 | text-decoration: none; 64 | display: inline-block; 65 | } 66 | -------------------------------------------------------------------------------- /renderer/shared/css/index.css: -------------------------------------------------------------------------------- 1 | /* ----------------------------------*/ 2 | /* HYPERAMP GLOBAL CSS */ 3 | /* ----------------------------------*/ 4 | 5 | @import './variables.css'; 6 | @import './base.css'; 7 | /*@import './scrollbar.css';*/ 8 | @import './range.css'; 9 | -------------------------------------------------------------------------------- /renderer/shared/css/range.css: -------------------------------------------------------------------------------- 1 | input[type=range] { 2 | -webkit-app-region: no-drag; 3 | -webkit-appearance: none; /* Hides the slider so that custom slider can be made */ 4 | background: transparent; /* Otherwise white in Chrome */ 5 | 6 | position: relative; 7 | overflow: hidden; 8 | border-radius: 3px; 9 | } 10 | 11 | input[type=range]:focus { 12 | outline: none; 13 | } 14 | 15 | input[type=range]::-webkit-slider-thumb { 16 | -webkit-app-region: no-drag; 17 | -webkit-appearance: none; 18 | border: none; 19 | height: 0; 20 | width: 0; 21 | background: transparent; 22 | box-shadow: -100vw 0 0 100vw var(--link); 23 | } 24 | 25 | input[type=range]:disabled::-webkit-slider-thumb { 26 | background: var(--bg-light); 27 | } 28 | 29 | input[type=range]::-webkit-slider-runnable-track { 30 | width: 100%; 31 | height: 6px; 32 | cursor: default; 33 | background: var(--dark); 34 | border-radius: 3px; 35 | } 36 | 37 | input[type=range]:focus::-webkit-slider-runnable-track { 38 | background: var(--dark); 39 | } 40 | -------------------------------------------------------------------------------- /renderer/shared/css/scrollbar.css: -------------------------------------------------------------------------------- 1 | ::-webkit-scrollbar, 2 | ::-webkit-scrollbar-corner, 3 | ::-webkit-scrollbar-track { 4 | background-color: var(--darken); 5 | } 6 | 7 | ::-webkit-scrollbar, 8 | ::-webkit-scrollbar-track { background-color: transparent } 9 | 10 | ::-webkit-scrollbar-track:hover { 11 | background-color: var(--darken); 12 | } 13 | 14 | ::-webkit-scrollbar { 15 | width: .6rem; 16 | height: .6rem; 17 | } 18 | 19 | ::-webkit-scrollbar-thumb { 20 | /*border: 1px solid var(--scrollbar-bg);*/ 21 | /*border-radius: 10px;*/ 22 | background: var(--dark); 23 | } 24 | -------------------------------------------------------------------------------- /renderer/shared/css/variables.css: -------------------------------------------------------------------------------- 1 | :root { 2 | /* scrollbar */ 3 | 4 | --scrollbar-bg: var(--dark); 5 | --scrollbar-thumb-bg: var(--bg-light); 6 | 7 | /* type */ 8 | 9 | /* use system fonts */ 10 | --font-family-default: -apple-system, BlinkMacSystemFont, /* MacOS and iOS */ 11 | 'avenir next', avenir, /* MacOS and iOS */ 12 | 'Segoe UI', /* Windows */ 13 | 'lucida grande', /* Older MacOS */ 14 | 'helvetica neue', helvetica, /* Older MacOS */ 15 | 'Fira Sans', /* Firefox OS */ 16 | roboto, noto, /* Google stuff */ 17 | 'Droid Sans', /* Old Google stuff */ 18 | cantarell, oxygen, ubuntu, /* Linux stuff */ 19 | 'franklin gothic medium', 'century gothic', /* Windows stuff */ 20 | 'Liberation Sans', /* Linux */ 21 | sans-serif; /* Everything else */ 22 | 23 | --font-size-default: 13px; 24 | --font-weight-default: 300; 25 | --font-weight-bold: 500; 26 | --font-weight-light: 100; 27 | --line-height-default: 1.6; 28 | 29 | /* colors */ 30 | 31 | /* begin experiment */ 32 | /* colors */ 33 | --bg: #fff; 34 | --copy: #222; 35 | --link: #f63; 36 | --highlight: #E75CE0; 37 | 38 | /* tints */ 39 | --bg-light: rgb(47,59,71); 40 | 41 | /* alphas */ 42 | --lighter: rgba(255,255,255,.25); 43 | --light: rgba(255,255,255,.08); 44 | --lighten: rgba(255,255,255,.025); 45 | --dark: rgba(0,0,0,.1); 46 | --darker: rgba(0,0,0,.25); 47 | --darken: rgba(0,0,0,.025); 48 | 49 | /* states */ 50 | --active-bg: #eee; 51 | --active-border: 1px solid var(--lighter); 52 | /* end experiment */ 53 | 54 | --primary-color: #3b99fc; 55 | --chrome-color: #fff; 56 | 57 | /* Copy */ 58 | --gray-color: #333; 59 | 60 | /* Borders */ 61 | --border-color: #D89C90; 62 | --dark-border-color: #c2c0c2; 63 | --darker-bottom-border-color: #a19fa1; 64 | --toolbar-border-color: #939293; 65 | --default-border-radius: 4px; 66 | 67 | --border: 1px solid var(--dark); 68 | 69 | /* Action colors */ 70 | --default-color: #fff; 71 | --positive-color: #34c84a; 72 | --negative-color: #fc605b; 73 | --warning-color: #fdbc40; 74 | 75 | /* Shades */ 76 | --dark-color: #57acf5; 77 | 78 | /* Focus and active colors */ 79 | --active-color: #116cd6; 80 | --focus-input-color: #6db3fd; 81 | 82 | /* Padding */ 83 | --padding: 10px; 84 | --padding-mini: 3px; 85 | --padding-less: 5px; 86 | --padding-more: 20px; 87 | } 88 | -------------------------------------------------------------------------------- /renderer/shared/file-url.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | // Vendored from https://github.com/sindresorhus/file-url/blob/982123e9af861ce26167de7ef40be3ff9cad2be7/index.js#L2 4 | // because inconvient ESM upgrade 5 | 6 | function fileUrl (filePath, options = {}) { 7 | if (typeof filePath !== 'string') { 8 | throw new TypeError(`Expected a string, got ${typeof filePath}`) 9 | } 10 | 11 | const { resolve = true } = options 12 | 13 | let pathName = filePath 14 | if (resolve) { 15 | pathName = path.resolve(filePath) 16 | } 17 | 18 | pathName = pathName.replace(/\\/g, '/') 19 | 20 | // Windows drive letter must be prefixed with a slash. 21 | if (pathName[0] !== '/') { 22 | pathName = `/${pathName}` 23 | } 24 | 25 | // Escape required characters for path components. 26 | // See: https://tools.ietf.org/html/rfc3986#section-3.3 27 | return encodeURI(`file://${pathName}`).replace(/[?#]/g, encodeURIComponent) 28 | } 29 | 30 | module.exports = fileUrl 31 | -------------------------------------------------------------------------------- /scripts/README.md: -------------------------------------------------------------------------------- 1 | # Scripts 2 | 3 | This directory is for miscellaneous scripts for running development tasks. 4 | -------------------------------------------------------------------------------- /scripts/clear.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env electron 2 | 3 | const Store = require('electron-store') 4 | 5 | const config = new Store({ name: 'hyperamp-config' }) 6 | const persist = new Store({ name: 'hyperamp-persist' }) 7 | const library = new Store({ name: 'hyperamp-library' }) 8 | 9 | console.log('clearing %s', config.path) 10 | config.clear() 11 | 12 | console.log('clearing %s', persist.path) 13 | persist.clear() 14 | 15 | console.log('clearing %s', library.path) 16 | library.clear() 17 | 18 | process.exit(0) 19 | -------------------------------------------------------------------------------- /test/README.md: -------------------------------------------------------------------------------- 1 | # Test 2 | 3 | This directory is for test files. 4 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | const Application = require('spectron').Application 2 | const test = require('tape') 3 | const path = require('path') 4 | 5 | test('does the thing turn on?', t => { 6 | const app = new Application({ 7 | path: require('electron'), 8 | args: [path.join(__dirname, '..', 'main', 'index.js')] 9 | }) 10 | 11 | app.start().catch(err => { 12 | t.error(err, 'an error occured. uh oh') 13 | }) 14 | .then(() => { 15 | t.pass('the app started up') 16 | return app.client.waitUntilWindowLoaded().getWindowCount() 17 | }) 18 | // .then(count => { 19 | // t.is(count, 4, 'there are 4 browser windows for some reason') 20 | // }) 21 | .catch(err => { 22 | t.error(err, 'an error occured. uh oh') 23 | }) 24 | .then(() => { 25 | app.stop() 26 | }) 27 | .then(() => { 28 | t.end() 29 | }) 30 | }) 31 | 32 | test('pass', t => { 33 | t.end() 34 | }) 35 | --------------------------------------------------------------------------------