├── .gitignore ├── LICENSE ├── Plyr.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ ├── IDEWorkspaceChecks.plist │ └── WorkspaceSettings.xcsettings ├── Plyr ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── mac_appicon-128@1x.png │ │ ├── mac_appicon-128@2x.png │ │ ├── mac_appicon-16@1x.png │ │ ├── mac_appicon-16@2x.png │ │ ├── mac_appicon-256@1x.png │ │ ├── mac_appicon-256@2x.png │ │ ├── mac_appicon-32@1x.png │ │ ├── mac_appicon-32@2x.png │ │ ├── mac_appicon-512@1x.png │ │ └── mac_appicon-512@2x.png │ ├── Contents.json │ └── Missing.imageset │ │ ├── Contents.json │ │ ├── image@1x.png │ │ └── image@2x.png ├── Base.lproj │ └── Main.storyboard ├── Extensions.swift ├── Info.plist ├── KeyCode.swift ├── OpenQuicklyDelegate.swift ├── OpenQuicklyOptions.swift ├── OpenQuicklyTableRowView.swift ├── OpenQuicklyViewController.swift ├── OpenQuicklyWindow.swift ├── OpenQuicklyWindowController.swift ├── Player.swift ├── PlayerViewController.swift ├── PlyrWindowController.swift ├── Preferences.swift └── Song.swift └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | plyr.xcodeproj/xcuserdata 2 | plyr.xcodeproj/project.xcworkspace/xcuserdata -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /Plyr.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A12C35C922A3441500DE7886 /* OpenQuicklyDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A12C35C322A3441500DE7886 /* OpenQuicklyDelegate.swift */; }; 11 | A12C35CA22A3441500DE7886 /* OpenQuicklyTableRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A12C35C422A3441500DE7886 /* OpenQuicklyTableRowView.swift */; }; 12 | A12C35CB22A3441500DE7886 /* OpenQuicklyOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A12C35C522A3441500DE7886 /* OpenQuicklyOptions.swift */; }; 13 | A12C35CC22A3441500DE7886 /* OpenQuicklyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A12C35C622A3441500DE7886 /* OpenQuicklyViewController.swift */; }; 14 | A12C35CD22A3441500DE7886 /* OpenQuicklyWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A12C35C722A3441500DE7886 /* OpenQuicklyWindowController.swift */; }; 15 | A12C35CE22A3441500DE7886 /* OpenQuicklyWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = A12C35C822A3441500DE7886 /* OpenQuicklyWindow.swift */; }; 16 | A12C35D022A3496F00DE7886 /* KeyCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = A12C35CF22A3496F00DE7886 /* KeyCode.swift */; }; 17 | A131454122224FC500E86383 /* Song.swift in Sources */ = {isa = PBXBuildFile; fileRef = A131454022224FC500E86383 /* Song.swift */; }; 18 | A142AA892222183A0018C7BC /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = A142AA882222183A0018C7BC /* Preferences.swift */; }; 19 | A19C347D1F76182E00BA7FC3 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A19C347C1F76182E00BA7FC3 /* AppDelegate.swift */; }; 20 | A19C34841F76182E00BA7FC3 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A19C34821F76182E00BA7FC3 /* Main.storyboard */; }; 21 | A1A133AD1F830FBD0072CB58 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A1A133AC1F830FBD0072CB58 /* Assets.xcassets */; }; 22 | A1B787301F77AA2700F6C5DF /* PlyrWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1B7872F1F77AA2700F6C5DF /* PlyrWindowController.swift */; }; 23 | A1C24559204779D300B519F8 /* Player.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1C24558204779D300B519F8 /* Player.swift */; }; 24 | A1D6A1BD2046AD9F0071155C /* PlayerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1D6A1BC2046AD9F0071155C /* PlayerViewController.swift */; }; 25 | A1FFBBC12047A4FB004C16BA /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1FFBBC02047A4FB004C16BA /* Extensions.swift */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | A12C35C322A3441500DE7886 /* OpenQuicklyDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenQuicklyDelegate.swift; sourceTree = ""; }; 30 | A12C35C422A3441500DE7886 /* OpenQuicklyTableRowView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenQuicklyTableRowView.swift; sourceTree = ""; }; 31 | A12C35C522A3441500DE7886 /* OpenQuicklyOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenQuicklyOptions.swift; sourceTree = ""; }; 32 | A12C35C622A3441500DE7886 /* OpenQuicklyViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenQuicklyViewController.swift; sourceTree = ""; }; 33 | A12C35C722A3441500DE7886 /* OpenQuicklyWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenQuicklyWindowController.swift; sourceTree = ""; }; 34 | A12C35C822A3441500DE7886 /* OpenQuicklyWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpenQuicklyWindow.swift; sourceTree = ""; }; 35 | A12C35CF22A3496F00DE7886 /* KeyCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyCode.swift; sourceTree = ""; }; 36 | A131454022224FC500E86383 /* Song.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Song.swift; sourceTree = ""; }; 37 | A142AA882222183A0018C7BC /* Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = ""; }; 38 | A19C34791F76182E00BA7FC3 /* Plyr.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Plyr.app; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | A19C347C1F76182E00BA7FC3 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 40 | A19C34831F76182E00BA7FC3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | A19C34851F76182E00BA7FC3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 42 | A1A133AC1F830FBD0072CB58 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | A1B7872F1F77AA2700F6C5DF /* PlyrWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlyrWindowController.swift; sourceTree = ""; }; 44 | A1C24558204779D300B519F8 /* Player.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Player.swift; sourceTree = ""; }; 45 | A1D6A1BC2046AD9F0071155C /* PlayerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerViewController.swift; sourceTree = ""; }; 46 | A1FFBBC02047A4FB004C16BA /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | A19C34761F76182E00BA7FC3 /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | /* End PBXFrameworksBuildPhase section */ 58 | 59 | /* Begin PBXGroup section */ 60 | A19C34701F76182E00BA7FC3 = { 61 | isa = PBXGroup; 62 | children = ( 63 | A19C347B1F76182E00BA7FC3 /* Plyr */, 64 | A19C347A1F76182E00BA7FC3 /* Products */, 65 | ); 66 | sourceTree = ""; 67 | }; 68 | A19C347A1F76182E00BA7FC3 /* Products */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | A19C34791F76182E00BA7FC3 /* Plyr.app */, 72 | ); 73 | name = Products; 74 | sourceTree = ""; 75 | }; 76 | A19C347B1F76182E00BA7FC3 /* Plyr */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | A19C347C1F76182E00BA7FC3 /* AppDelegate.swift */, 80 | A1A133AC1F830FBD0072CB58 /* Assets.xcassets */, 81 | A1FFBBC02047A4FB004C16BA /* Extensions.swift */, 82 | A19C34851F76182E00BA7FC3 /* Info.plist */, 83 | A12C35CF22A3496F00DE7886 /* KeyCode.swift */, 84 | A19C34821F76182E00BA7FC3 /* Main.storyboard */, 85 | A12C35C322A3441500DE7886 /* OpenQuicklyDelegate.swift */, 86 | A12C35C522A3441500DE7886 /* OpenQuicklyOptions.swift */, 87 | A12C35C422A3441500DE7886 /* OpenQuicklyTableRowView.swift */, 88 | A12C35C622A3441500DE7886 /* OpenQuicklyViewController.swift */, 89 | A12C35C822A3441500DE7886 /* OpenQuicklyWindow.swift */, 90 | A12C35C722A3441500DE7886 /* OpenQuicklyWindowController.swift */, 91 | A1C24558204779D300B519F8 /* Player.swift */, 92 | A1D6A1BC2046AD9F0071155C /* PlayerViewController.swift */, 93 | A1B7872F1F77AA2700F6C5DF /* PlyrWindowController.swift */, 94 | A142AA882222183A0018C7BC /* Preferences.swift */, 95 | A131454022224FC500E86383 /* Song.swift */, 96 | ); 97 | path = Plyr; 98 | sourceTree = ""; 99 | }; 100 | /* End PBXGroup section */ 101 | 102 | /* Begin PBXNativeTarget section */ 103 | A19C34781F76182E00BA7FC3 /* Plyr */ = { 104 | isa = PBXNativeTarget; 105 | buildConfigurationList = A19C34891F76182E00BA7FC3 /* Build configuration list for PBXNativeTarget "Plyr" */; 106 | buildPhases = ( 107 | A19C34751F76182E00BA7FC3 /* Sources */, 108 | A19C34761F76182E00BA7FC3 /* Frameworks */, 109 | A19C34771F76182E00BA7FC3 /* Resources */, 110 | ); 111 | buildRules = ( 112 | ); 113 | dependencies = ( 114 | ); 115 | name = Plyr; 116 | productName = Minimal; 117 | productReference = A19C34791F76182E00BA7FC3 /* Plyr.app */; 118 | productType = "com.apple.product-type.application"; 119 | }; 120 | /* End PBXNativeTarget section */ 121 | 122 | /* Begin PBXProject section */ 123 | A19C34711F76182E00BA7FC3 /* Project object */ = { 124 | isa = PBXProject; 125 | attributes = { 126 | LastSwiftUpdateCheck = 0900; 127 | LastUpgradeCheck = 0930; 128 | ORGANIZATIONNAME = "Luka Kerr"; 129 | TargetAttributes = { 130 | A19C34781F76182E00BA7FC3 = { 131 | CreatedOnToolsVersion = 9.0; 132 | LastSwiftMigration = 1020; 133 | ProvisioningStyle = Manual; 134 | }; 135 | }; 136 | }; 137 | buildConfigurationList = A19C34741F76182E00BA7FC3 /* Build configuration list for PBXProject "Plyr" */; 138 | compatibilityVersion = "Xcode 8.0"; 139 | developmentRegion = en; 140 | hasScannedForEncodings = 0; 141 | knownRegions = ( 142 | en, 143 | Base, 144 | ); 145 | mainGroup = A19C34701F76182E00BA7FC3; 146 | productRefGroup = A19C347A1F76182E00BA7FC3 /* Products */; 147 | projectDirPath = ""; 148 | projectRoot = ""; 149 | targets = ( 150 | A19C34781F76182E00BA7FC3 /* Plyr */, 151 | ); 152 | }; 153 | /* End PBXProject section */ 154 | 155 | /* Begin PBXResourcesBuildPhase section */ 156 | A19C34771F76182E00BA7FC3 /* Resources */ = { 157 | isa = PBXResourcesBuildPhase; 158 | buildActionMask = 2147483647; 159 | files = ( 160 | A1A133AD1F830FBD0072CB58 /* Assets.xcassets in Resources */, 161 | A19C34841F76182E00BA7FC3 /* Main.storyboard in Resources */, 162 | ); 163 | runOnlyForDeploymentPostprocessing = 0; 164 | }; 165 | /* End PBXResourcesBuildPhase section */ 166 | 167 | /* Begin PBXSourcesBuildPhase section */ 168 | A19C34751F76182E00BA7FC3 /* Sources */ = { 169 | isa = PBXSourcesBuildPhase; 170 | buildActionMask = 2147483647; 171 | files = ( 172 | A12C35CE22A3441500DE7886 /* OpenQuicklyWindow.swift in Sources */, 173 | A1FFBBC12047A4FB004C16BA /* Extensions.swift in Sources */, 174 | A1C24559204779D300B519F8 /* Player.swift in Sources */, 175 | A131454122224FC500E86383 /* Song.swift in Sources */, 176 | A12C35D022A3496F00DE7886 /* KeyCode.swift in Sources */, 177 | A12C35CC22A3441500DE7886 /* OpenQuicklyViewController.swift in Sources */, 178 | A12C35CD22A3441500DE7886 /* OpenQuicklyWindowController.swift in Sources */, 179 | A12C35C922A3441500DE7886 /* OpenQuicklyDelegate.swift in Sources */, 180 | A142AA892222183A0018C7BC /* Preferences.swift in Sources */, 181 | A1D6A1BD2046AD9F0071155C /* PlayerViewController.swift in Sources */, 182 | A1B787301F77AA2700F6C5DF /* PlyrWindowController.swift in Sources */, 183 | A12C35CB22A3441500DE7886 /* OpenQuicklyOptions.swift in Sources */, 184 | A19C347D1F76182E00BA7FC3 /* AppDelegate.swift in Sources */, 185 | A12C35CA22A3441500DE7886 /* OpenQuicklyTableRowView.swift in Sources */, 186 | ); 187 | runOnlyForDeploymentPostprocessing = 0; 188 | }; 189 | /* End PBXSourcesBuildPhase section */ 190 | 191 | /* Begin PBXVariantGroup section */ 192 | A19C34821F76182E00BA7FC3 /* Main.storyboard */ = { 193 | isa = PBXVariantGroup; 194 | children = ( 195 | A19C34831F76182E00BA7FC3 /* Base */, 196 | ); 197 | name = Main.storyboard; 198 | sourceTree = ""; 199 | }; 200 | /* End PBXVariantGroup section */ 201 | 202 | /* Begin XCBuildConfiguration section */ 203 | A19C34871F76182E00BA7FC3 /* Debug */ = { 204 | isa = XCBuildConfiguration; 205 | buildSettings = { 206 | ALWAYS_SEARCH_USER_PATHS = NO; 207 | CLANG_ANALYZER_NONNULL = YES; 208 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 209 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 210 | CLANG_CXX_LIBRARY = "libc++"; 211 | CLANG_ENABLE_MODULES = YES; 212 | CLANG_ENABLE_OBJC_ARC = YES; 213 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 214 | CLANG_WARN_BOOL_CONVERSION = YES; 215 | CLANG_WARN_COMMA = YES; 216 | CLANG_WARN_CONSTANT_CONVERSION = YES; 217 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 218 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 219 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 220 | CLANG_WARN_EMPTY_BODY = YES; 221 | CLANG_WARN_ENUM_CONVERSION = YES; 222 | CLANG_WARN_INFINITE_RECURSION = YES; 223 | CLANG_WARN_INT_CONVERSION = YES; 224 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 225 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 226 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 227 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 228 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 229 | CLANG_WARN_STRICT_PROTOTYPES = YES; 230 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 231 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 232 | CLANG_WARN_UNREACHABLE_CODE = YES; 233 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 234 | CODE_SIGN_IDENTITY = "Mac Developer"; 235 | COPY_PHASE_STRIP = NO; 236 | DEBUG_INFORMATION_FORMAT = dwarf; 237 | ENABLE_STRICT_OBJC_MSGSEND = YES; 238 | ENABLE_TESTABILITY = YES; 239 | GCC_C_LANGUAGE_STANDARD = gnu11; 240 | GCC_DYNAMIC_NO_PIC = NO; 241 | GCC_NO_COMMON_BLOCKS = YES; 242 | GCC_OPTIMIZATION_LEVEL = 0; 243 | GCC_PREPROCESSOR_DEFINITIONS = ( 244 | "DEBUG=1", 245 | "$(inherited)", 246 | ); 247 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 248 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 249 | GCC_WARN_UNDECLARED_SELECTOR = YES; 250 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 251 | GCC_WARN_UNUSED_FUNCTION = YES; 252 | GCC_WARN_UNUSED_VARIABLE = YES; 253 | MACOSX_DEPLOYMENT_TARGET = 10.12; 254 | MTL_ENABLE_DEBUG_INFO = YES; 255 | ONLY_ACTIVE_ARCH = YES; 256 | SDKROOT = macosx; 257 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 258 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 259 | }; 260 | name = Debug; 261 | }; 262 | A19C34881F76182E00BA7FC3 /* Release */ = { 263 | isa = XCBuildConfiguration; 264 | buildSettings = { 265 | ALWAYS_SEARCH_USER_PATHS = NO; 266 | CLANG_ANALYZER_NONNULL = YES; 267 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 268 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 269 | CLANG_CXX_LIBRARY = "libc++"; 270 | CLANG_ENABLE_MODULES = YES; 271 | CLANG_ENABLE_OBJC_ARC = YES; 272 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 273 | CLANG_WARN_BOOL_CONVERSION = YES; 274 | CLANG_WARN_COMMA = YES; 275 | CLANG_WARN_CONSTANT_CONVERSION = YES; 276 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 277 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 278 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 279 | CLANG_WARN_EMPTY_BODY = YES; 280 | CLANG_WARN_ENUM_CONVERSION = YES; 281 | CLANG_WARN_INFINITE_RECURSION = YES; 282 | CLANG_WARN_INT_CONVERSION = YES; 283 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 284 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 285 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 286 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 287 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 288 | CLANG_WARN_STRICT_PROTOTYPES = YES; 289 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 290 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 291 | CLANG_WARN_UNREACHABLE_CODE = YES; 292 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 293 | CODE_SIGN_IDENTITY = "Mac Developer"; 294 | COPY_PHASE_STRIP = NO; 295 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 296 | ENABLE_NS_ASSERTIONS = NO; 297 | ENABLE_STRICT_OBJC_MSGSEND = YES; 298 | GCC_C_LANGUAGE_STANDARD = gnu11; 299 | GCC_NO_COMMON_BLOCKS = YES; 300 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 301 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 302 | GCC_WARN_UNDECLARED_SELECTOR = YES; 303 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 304 | GCC_WARN_UNUSED_FUNCTION = YES; 305 | GCC_WARN_UNUSED_VARIABLE = YES; 306 | MACOSX_DEPLOYMENT_TARGET = 10.12; 307 | MTL_ENABLE_DEBUG_INFO = NO; 308 | SDKROOT = macosx; 309 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 310 | }; 311 | name = Release; 312 | }; 313 | A19C348A1F76182E00BA7FC3 /* Debug */ = { 314 | isa = XCBuildConfiguration; 315 | buildSettings = { 316 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 317 | CODE_SIGN_IDENTITY = "Mac Developer: lukakerr1@gmail.com (WP67RK7EQG)"; 318 | CODE_SIGN_STYLE = Manual; 319 | COMBINE_HIDPI_IMAGES = YES; 320 | DEVELOPMENT_TEAM = QY544RDL2W; 321 | FRAMEWORK_SEARCH_PATHS = ( 322 | "$(inherited)", 323 | "$(PROJECT_DIR)/plyr", 324 | ); 325 | INFOPLIST_FILE = Plyr/Info.plist; 326 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 327 | MACOSX_DEPLOYMENT_TARGET = 10.12.2; 328 | PRODUCT_BUNDLE_IDENTIFIER = com.lukakerr.Plyr; 329 | PRODUCT_NAME = "$(TARGET_NAME)"; 330 | PROVISIONING_PROFILE_SPECIFIER = ""; 331 | SWIFT_PRECOMPILE_BRIDGING_HEADER = YES; 332 | SWIFT_VERSION = 5.0; 333 | }; 334 | name = Debug; 335 | }; 336 | A19C348B1F76182E00BA7FC3 /* Release */ = { 337 | isa = XCBuildConfiguration; 338 | buildSettings = { 339 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 340 | CODE_SIGN_IDENTITY = "Mac Developer: lukakerr1@gmail.com (WP67RK7EQG)"; 341 | CODE_SIGN_STYLE = Manual; 342 | COMBINE_HIDPI_IMAGES = YES; 343 | DEVELOPMENT_TEAM = QY544RDL2W; 344 | FRAMEWORK_SEARCH_PATHS = ( 345 | "$(inherited)", 346 | "$(PROJECT_DIR)/plyr", 347 | ); 348 | INFOPLIST_FILE = Plyr/Info.plist; 349 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 350 | MACOSX_DEPLOYMENT_TARGET = 10.12.2; 351 | PRODUCT_BUNDLE_IDENTIFIER = com.lukakerr.Plyr; 352 | PRODUCT_NAME = "$(TARGET_NAME)"; 353 | PROVISIONING_PROFILE_SPECIFIER = ""; 354 | SWIFT_PRECOMPILE_BRIDGING_HEADER = YES; 355 | SWIFT_VERSION = 5.0; 356 | }; 357 | name = Release; 358 | }; 359 | /* End XCBuildConfiguration section */ 360 | 361 | /* Begin XCConfigurationList section */ 362 | A19C34741F76182E00BA7FC3 /* Build configuration list for PBXProject "Plyr" */ = { 363 | isa = XCConfigurationList; 364 | buildConfigurations = ( 365 | A19C34871F76182E00BA7FC3 /* Debug */, 366 | A19C34881F76182E00BA7FC3 /* Release */, 367 | ); 368 | defaultConfigurationIsVisible = 0; 369 | defaultConfigurationName = Release; 370 | }; 371 | A19C34891F76182E00BA7FC3 /* Build configuration list for PBXNativeTarget "Plyr" */ = { 372 | isa = XCConfigurationList; 373 | buildConfigurations = ( 374 | A19C348A1F76182E00BA7FC3 /* Debug */, 375 | A19C348B1F76182E00BA7FC3 /* Release */, 376 | ); 377 | defaultConfigurationIsVisible = 0; 378 | defaultConfigurationName = Release; 379 | }; 380 | /* End XCConfigurationList section */ 381 | }; 382 | rootObject = A19C34711F76182E00BA7FC3 /* Project object */; 383 | } 384 | -------------------------------------------------------------------------------- /Plyr.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Plyr.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Plyr.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Latest 7 | 8 | 9 | -------------------------------------------------------------------------------- /Plyr/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Plyr 4 | // 5 | // Created by Luka Kerr on 28/2/18. 6 | // Copyright © 2018 Luka Kerr. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | let defaults = UserDefaults.standard 12 | 13 | @NSApplicationMain 14 | class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate { 15 | 16 | func applicationDidFinishLaunching(_ aNotification: Notification) { 17 | } 18 | 19 | func applicationWillTerminate(_ aNotification: Notification) { 20 | } 21 | 22 | func userNotificationCenter(_ center: NSUserNotificationCenter, shouldPresent notification: NSUserNotification) -> Bool { 23 | return true 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Plyr/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "mac_appicon-16@1x.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "mac_appicon-16@2x.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "mac_appicon-32@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "mac_appicon-32@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "mac_appicon-128@1x.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "mac_appicon-128@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "mac_appicon-256@1x.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "mac_appicon-256@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "mac_appicon-512@1x.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "mac_appicon-512@2x.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-128@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukakerr/plyr/b5fb665a3c4232cc3c00c91800315d050722c8d5/Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-128@1x.png -------------------------------------------------------------------------------- /Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukakerr/plyr/b5fb665a3c4232cc3c00c91800315d050722c8d5/Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-128@2x.png -------------------------------------------------------------------------------- /Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-16@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukakerr/plyr/b5fb665a3c4232cc3c00c91800315d050722c8d5/Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-16@1x.png -------------------------------------------------------------------------------- /Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukakerr/plyr/b5fb665a3c4232cc3c00c91800315d050722c8d5/Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-16@2x.png -------------------------------------------------------------------------------- /Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-256@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukakerr/plyr/b5fb665a3c4232cc3c00c91800315d050722c8d5/Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-256@1x.png -------------------------------------------------------------------------------- /Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukakerr/plyr/b5fb665a3c4232cc3c00c91800315d050722c8d5/Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-256@2x.png -------------------------------------------------------------------------------- /Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-32@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukakerr/plyr/b5fb665a3c4232cc3c00c91800315d050722c8d5/Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-32@1x.png -------------------------------------------------------------------------------- /Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukakerr/plyr/b5fb665a3c4232cc3c00c91800315d050722c8d5/Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-32@2x.png -------------------------------------------------------------------------------- /Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-512@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukakerr/plyr/b5fb665a3c4232cc3c00c91800315d050722c8d5/Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-512@1x.png -------------------------------------------------------------------------------- /Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukakerr/plyr/b5fb665a3c4232cc3c00c91800315d050722c8d5/Plyr/Assets.xcassets/AppIcon.appiconset/mac_appicon-512@2x.png -------------------------------------------------------------------------------- /Plyr/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Plyr/Assets.xcassets/Missing.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "filename" : "image@1x.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "filename" : "image@2x.png", 11 | "scale" : "2x" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /Plyr/Assets.xcassets/Missing.imageset/image@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukakerr/plyr/b5fb665a3c4232cc3c00c91800315d050722c8d5/Plyr/Assets.xcassets/Missing.imageset/image@1x.png -------------------------------------------------------------------------------- /Plyr/Assets.xcassets/Missing.imageset/image@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lukakerr/plyr/b5fb665a3c4232cc3c00c91800315d050722c8d5/Plyr/Assets.xcassets/Missing.imageset/image@2x.png -------------------------------------------------------------------------------- /Plyr/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 119 | 132 | 145 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | -------------------------------------------------------------------------------- /Plyr/Extensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Extensions.swift 3 | // Plyr 4 | // 5 | // Created by Luka Kerr on 1/3/18. 6 | // Copyright © 2018 Luka Kerr. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | import Foundation 11 | 12 | extension FileManager { 13 | internal func filteredMusicFileURLs(inDirectory directory: String) -> [Song] { 14 | guard let enumerator = enumerator( 15 | at: URL(fileURLWithPath: directory), 16 | includingPropertiesForKeys: nil, 17 | options: [], 18 | errorHandler: nil 19 | ) else { 20 | return [] 21 | } 22 | 23 | var songs = [Song]() 24 | 25 | let enumeration: () -> Bool = { 26 | guard let fileURL = enumerator.nextObject() as? URL else { 27 | return false 28 | } 29 | 30 | if fileURL.isMusicFile { 31 | let song = Song(url: fileURL) 32 | songs.append(song) 33 | } 34 | 35 | return true 36 | } 37 | while enumeration() {} 38 | 39 | return songs 40 | } 41 | } 42 | 43 | extension URL { 44 | private enum MusicFileExtension: String { 45 | case mp3 46 | case m4a 47 | case m4p 48 | case aiff 49 | } 50 | 51 | internal var isMusicFile: Bool { 52 | return MusicFileExtension(rawValue: pathExtension) != nil 53 | } 54 | } 55 | 56 | extension NSImage { 57 | 58 | public func setSize() { 59 | self.size = NSSize(width: 36, height: 36) 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /Plyr/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 0.0.1 19 | CFBundleVersion 20 | 1 21 | LSApplicationCategoryType 22 | public.app-category.developer-tools 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | Copyright © 2019 Luka Kerr. All rights reserved. 27 | NSMainStoryboardFile 28 | Main 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /Plyr/KeyCode.swift: -------------------------------------------------------------------------------- 1 | // 2 | // KeyCode.swift 3 | // plyr 4 | // 5 | // Created by Luka Kerr on 2/6/19. 6 | // Copyright © 2019 Luka Kerr. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum KeyCode { 12 | static let n: UInt16 = 45 13 | static let p: UInt16 = 35 14 | static let s: UInt16 = 1 15 | static let r: UInt16 = 15 16 | static let o: UInt16 = 31 17 | static let esc: UInt16 = 53 18 | static let space: UInt16 = 49 19 | static let enter: UInt16 = 36 20 | static let upArrow: UInt16 = 126 21 | static let downArrow: UInt16 = 125 22 | } 23 | -------------------------------------------------------------------------------- /Plyr/OpenQuicklyDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OpenQuicklyDelegate.swift 3 | // OpenQuickly 4 | // 5 | // Created by Luka Kerr on 25/2/19. 6 | // Copyright © 2019 Luka Kerr. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Cocoa 11 | 12 | public protocol OpenQuicklyDelegate { 13 | 14 | /// Called when an item in the matches list was selected 15 | /// 16 | /// - Parameters: 17 | /// - item: The selected item 18 | func itemWasSelected(selected item: Any) 19 | 20 | /// Called when a value was typed in the search bar 21 | /// 22 | /// - Parameters: 23 | /// - value: The value entered in to the search field 24 | /// 25 | /// - Returns: Any matches based off the value typed 26 | func valueWasEntered(_ value: String) -> [Any] 27 | 28 | /// Given an item return a view to be used for that item in the matches list 29 | /// 30 | /// - Parameters: 31 | /// - item: An item from the matches list 32 | /// 33 | /// - Returns: A view to display the given item in the matches list 34 | func openQuickly(item: Any) -> NSView? 35 | 36 | /// Called when the open quickly window is closed 37 | func windowDidClose() 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Plyr/OpenQuicklyOptions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OpenQuicklyOptions.swift 3 | // OpenQuickly 4 | // 5 | // Created by Luka Kerr on 25/2/19. 6 | // Copyright © 2019 Luka Kerr. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | import Foundation 11 | 12 | public class OpenQuicklyOptions { 13 | 14 | /// Setup sensible defaults 15 | public init() { 16 | self.radius = 7 17 | self.width = 400 18 | self.height = 44 19 | self.rowHeight = 20 20 | self.matchesShown = 6 21 | self.material = .popover 22 | self.placeholder = "Search" 23 | self.persistMatches = false 24 | self.persistPosition = true 25 | self.font = NSFont.systemFont(ofSize: 20, weight: .light) 26 | self.edgeInsets = NSEdgeInsets(top: 10.0, left: 10.0, bottom: 10.0, right: 10.0) 27 | } 28 | 29 | // MARK: - UI options 30 | 31 | /// The font to be used for the search field 32 | public var font: NSFont 33 | 34 | /// The radius of the open quickly window 35 | public var radius: CGFloat 36 | 37 | /// The width of the open quickly window 38 | public var width: CGFloat 39 | 40 | /// The height of the open quickly window 41 | public var height: CGFloat 42 | 43 | /// The maximum number of matches shown 44 | public var matchesShown: Int 45 | 46 | /// The height of each row in the matches list 47 | public var rowHeight: CGFloat 48 | 49 | /// The placeholder text to be used for the search field 50 | public var placeholder: String 51 | 52 | /// Whether to persist the matches list when the 53 | /// open quickly window is closed and re-opened 54 | public var persistMatches: Bool 55 | 56 | /// Whether to persist the position of the open quickly 57 | /// window when it is closed and re-opened 58 | public var persistPosition: Bool 59 | 60 | /// The insets for the search field and matches list 61 | public var edgeInsets: NSEdgeInsets 62 | 63 | /// The material effect to be used for the open quickly window 64 | public var material: NSVisualEffectView.Material 65 | 66 | // MARK: - Delegate options 67 | 68 | /// An instance that conforms to the OpenQuicklyDelegate 69 | public var delegate: OpenQuicklyDelegate? 70 | 71 | } 72 | -------------------------------------------------------------------------------- /Plyr/OpenQuicklyTableRowView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OpenQuicklyTableRowView.swift 3 | // OpenQuickly 4 | // 5 | // Created by Luka Kerr on 26/2/19. 6 | // Copyright © 2019 Luka Kerr. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class OpenQuicklyTableRowView: NSTableRowView { 12 | 13 | override var isEmphasized: Bool { 14 | get { 15 | return true 16 | } 17 | 18 | set {} 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Plyr/OpenQuicklyViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OpenQuicklyViewController.swift 3 | // OpenQuickly 4 | // 5 | // Created by Luka Kerr on 25/2/19. 6 | // Copyright © 2019 Luka Kerr. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class OpenQuicklyViewController: NSViewController, NSTextFieldDelegate { 12 | 13 | /// KeyCodes that shouldn't update the searchField 14 | let IGNORED_KEYCODES = [ 15 | KeyCode.esc, KeyCode.enter, 16 | KeyCode.upArrow, KeyCode.downArrow 17 | ] 18 | 19 | /// The data used to display the matches 20 | private var matches: [Any]! 21 | 22 | /// Configuration options 23 | private var options: OpenQuicklyOptions! 24 | 25 | /// The currently selected match 26 | private var selected: Int? 27 | 28 | /// Various views 29 | private var clipView: NSClipView! 30 | private var stackView: NSStackView! 31 | private var scrollView: NSScrollView! 32 | private var searchField: NSTextField! 33 | private var matchesList: NSOutlineView! 34 | private var transparentView: NSVisualEffectView! 35 | 36 | /// The Open Quickly window controller instance for this view 37 | private var openQuicklyWindowController: OpenQuicklyWindowController? { 38 | return view.window?.windowController as? OpenQuicklyWindowController 39 | } 40 | 41 | init(options: OpenQuicklyOptions) { 42 | super.init(nibName: nil, bundle: nil) 43 | 44 | self.options = options 45 | self.matches = [] 46 | } 47 | 48 | required init?(coder: NSCoder) { 49 | super.init(coder: coder) 50 | } 51 | 52 | override func loadView() { 53 | let frame = NSRect( 54 | x: 0, 55 | y: 0, 56 | width: options.width, 57 | height: options.height 58 | ) 59 | 60 | view = NSView() 61 | view.frame = frame 62 | view.wantsLayer = true 63 | view.layer?.cornerRadius = options.radius + 1 64 | } 65 | 66 | override func viewDidLoad() { 67 | super.viewDidLoad() 68 | 69 | setupSearchField() 70 | setupTransparentView() 71 | setupMatchesListView() 72 | setupScrollView() 73 | setupStackView() 74 | 75 | stackView.addArrangedSubview(searchField) 76 | stackView.addArrangedSubview(scrollView) 77 | transparentView.addSubview(stackView) 78 | view.addSubview(transparentView) 79 | 80 | setupConstraints() 81 | 82 | matchesList.doubleAction = #selector(itemSelected) 83 | 84 | NSEvent.addLocalMonitorForEvents(matching: .keyDown, handler: keyDown) 85 | } 86 | 87 | override func viewWillAppear() { 88 | searchField.stringValue = "" 89 | 90 | if !options.persistMatches { 91 | clearMatches() 92 | } 93 | 94 | view.window?.makeFirstResponder(searchField) 95 | } 96 | 97 | override var acceptsFirstResponder: Bool { 98 | return true 99 | } 100 | 101 | func keyDown(with event: NSEvent) -> NSEvent? { 102 | let keyCode = event.keyCode 103 | 104 | // When esc pressed, close the window 105 | if keyCode == KeyCode.esc { 106 | openQuicklyWindowController?.toggle() 107 | return nil 108 | } 109 | 110 | // When enter pressed, indicate that an item was selected 111 | if keyCode == KeyCode.enter { 112 | itemSelected() 113 | return nil 114 | } 115 | 116 | // When down arrow pressed, if there is a selection move it down 117 | if keyCode == KeyCode.downArrow { 118 | if let currentSelection = selected { 119 | setSelected(at: currentSelection + 1) 120 | } 121 | 122 | return nil 123 | } 124 | 125 | // When uo arrow pressed, if there is a selection move it up 126 | if keyCode == KeyCode.upArrow { 127 | if let currentSelection = selected { 128 | setSelected(at: currentSelection - 1) 129 | } 130 | 131 | return nil 132 | } 133 | 134 | return event 135 | } 136 | 137 | override func keyUp(with event: NSEvent) { 138 | if IGNORED_KEYCODES.contains(event.keyCode) { 139 | return 140 | } 141 | 142 | let value = searchField.stringValue 143 | 144 | matches = options.delegate?.valueWasEntered(value) 145 | 146 | reloadMatches() 147 | } 148 | 149 | @objc func itemSelected() { 150 | let selected = matchesList.item(atRow: matchesList.selectedRow) as Any 151 | 152 | if let delegate = options.delegate { 153 | delegate.itemWasSelected(selected: selected) 154 | } 155 | 156 | openQuicklyWindowController?.toggle() 157 | } 158 | 159 | // MARK: - UI management 160 | 161 | private func clearMatches() { 162 | matches = [] 163 | reloadMatches() 164 | } 165 | 166 | private func reloadMatches() { 167 | matchesList.reloadData() 168 | updateViewSize() 169 | 170 | if matches.count > 0 { 171 | setSelected(at: 0) 172 | } 173 | } 174 | 175 | private func setSelected(at index: Int) { 176 | if index < 0 || index >= matches.count { 177 | return 178 | } 179 | 180 | selected = index 181 | let selectedIndex = IndexSet(integer: index) 182 | matchesList.scrollRowToVisible(index) 183 | matchesList.selectRowIndexes(selectedIndex, byExtendingSelection: false) 184 | } 185 | 186 | private func updateViewSize() { 187 | let numMatches = matches.count > options.matchesShown 188 | ? options.matchesShown : matches.count 189 | 190 | let rowHeight = CGFloat(numMatches) * options.rowHeight 191 | let newHeight = options.height + rowHeight 192 | 193 | let newSize = NSSize(width: options.width, height: newHeight) 194 | 195 | guard var frame = view.window?.frame else { return } 196 | 197 | frame.origin.y += frame.size.height; 198 | frame.origin.y -= newSize.height; 199 | frame.size = newSize 200 | 201 | view.setFrameSize(newSize) 202 | transparentView.setFrameSize(newSize) 203 | view.window?.setFrame(frame, display: true) 204 | stackView.spacing = matches.count > 0 ? 5.0 : 0.0 205 | } 206 | 207 | // MARK: - UI setup 208 | 209 | private func setupSearchField() { 210 | searchField = NSTextField() 211 | searchField.delegate = self 212 | searchField.alignment = .left 213 | searchField.isEditable = true 214 | searchField.isBezeled = false 215 | searchField.isSelectable = true 216 | searchField.font = options.font 217 | searchField.focusRingType = .none 218 | searchField.drawsBackground = false 219 | searchField.placeholderString = options.placeholder 220 | } 221 | 222 | private func setupTransparentView() { 223 | let frame = NSRect( 224 | x: 0, 225 | y: 0, 226 | width: options.width, 227 | height: options.height 228 | ) 229 | 230 | transparentView = NSVisualEffectView() 231 | transparentView.frame = frame 232 | transparentView.state = .active 233 | transparentView.wantsLayer = true 234 | transparentView.blendingMode = .behindWindow 235 | transparentView.layer?.cornerRadius = options.radius 236 | transparentView.material = options.material 237 | } 238 | 239 | private func setupMatchesListView() { 240 | matchesList = NSOutlineView() 241 | matchesList.delegate = self 242 | matchesList.headerView = nil 243 | matchesList.wantsLayer = true 244 | matchesList.dataSource = self 245 | matchesList.selectionHighlightStyle = .sourceList 246 | 247 | let column = NSTableColumn() 248 | matchesList.addTableColumn(column) 249 | } 250 | 251 | private func setupScrollView() { 252 | scrollView = NSScrollView() 253 | scrollView.borderType = .noBorder 254 | scrollView.drawsBackground = false 255 | scrollView.autohidesScrollers = true 256 | scrollView.hasVerticalScroller = true 257 | scrollView.documentView = matchesList 258 | scrollView.translatesAutoresizingMaskIntoConstraints = true 259 | } 260 | 261 | private func setupStackView() { 262 | stackView = NSStackView() 263 | stackView.spacing = 0.0 264 | stackView.orientation = .vertical 265 | stackView.distribution = .fillEqually 266 | stackView.edgeInsets = options.edgeInsets 267 | stackView.translatesAutoresizingMaskIntoConstraints = false 268 | } 269 | 270 | private func setupConstraints() { 271 | let stackViewConstraints = [ 272 | stackView.topAnchor.constraint(equalTo: transparentView.topAnchor), 273 | stackView.bottomAnchor.constraint(equalTo: transparentView.bottomAnchor), 274 | stackView.leadingAnchor.constraint(equalTo: transparentView.leadingAnchor), 275 | stackView.trailingAnchor.constraint(equalTo: transparentView.trailingAnchor) 276 | ] 277 | 278 | NSLayoutConstraint.activate(stackViewConstraints) 279 | } 280 | 281 | } 282 | 283 | extension OpenQuicklyViewController: NSOutlineViewDataSource { 284 | 285 | /// Number of items in the matches list 286 | func outlineView(_ outlineView: NSOutlineView, numberOfChildrenOfItem item: Any?) -> Int { 287 | return matches.count 288 | } 289 | 290 | /// Items to be added to the matches list 291 | func outlineView(_ outlineView: NSOutlineView, child index: Int, ofItem item: Any?) -> Any { 292 | return matches[index] 293 | } 294 | 295 | /// Whether items in the matches list are expandable by an arrow 296 | func outlineView(_ outlineView: NSOutlineView, isItemExpandable item: Any) -> Bool { 297 | return false 298 | } 299 | 300 | /// Height of each item in the matches list 301 | func outlineView(_ outlineView: NSOutlineView, heightOfRowByItem item: Any) -> CGFloat { 302 | return options.rowHeight 303 | } 304 | 305 | /// When an item in the matches list is clicked on should it be selected 306 | func outlineView(_ outlineView: NSOutlineView, shouldSelectItem item: Any) -> Bool { 307 | return true 308 | } 309 | 310 | /// The NSTableRowView instance to be used 311 | func outlineView(_ outlineView: NSOutlineView, rowViewForItem item: Any) -> NSTableRowView? { 312 | return OpenQuicklyTableRowView(frame: NSZeroRect) 313 | } 314 | 315 | /// When an item is selected 316 | func outlineViewSelectionDidChange(_ notification: Notification) { 317 | selected = matchesList.selectedRow 318 | } 319 | 320 | } 321 | 322 | extension OpenQuicklyViewController: NSOutlineViewDelegate { 323 | 324 | /// The view for each item in the matches array 325 | func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? { 326 | return options.delegate?.openQuickly(item: item) 327 | } 328 | 329 | } 330 | -------------------------------------------------------------------------------- /Plyr/OpenQuicklyWindow.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OpenQuicklyWindow.swift 3 | // OpenQuickly 4 | // 5 | // Created by Luka Kerr on 25/2/19. 6 | // Copyright © 2019 Luka Kerr. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class OpenQuicklyWindow: NSWindow, NSWindowDelegate { 12 | 13 | override init( 14 | contentRect: NSRect, 15 | styleMask style: NSWindow.StyleMask, 16 | backing backingStoreType: NSWindow.BackingStoreType, 17 | defer flag: Bool 18 | ) { 19 | super.init(contentRect: contentRect, styleMask: style, backing: backingStoreType, defer: flag) 20 | 21 | self.titleVisibility = .hidden 22 | self.styleMask = .borderless 23 | self.backgroundColor = .clear 24 | self.isOpaque = false 25 | self.isMovableByWindowBackground = true 26 | self.delegate = self 27 | } 28 | 29 | func windowDidResignKey(_ notification: Notification) { 30 | windowController?.close() 31 | } 32 | 33 | override var canBecomeKey: Bool { 34 | return true 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /Plyr/OpenQuicklyWindowController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // OpenQuicklyWindowController.swift 3 | // OpenQuickly 4 | // 5 | // Created by Luka Kerr on 25/2/19. 6 | // Copyright © 2019 Luka Kerr. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | open class OpenQuicklyWindowController: NSWindowController { 12 | 13 | let AUTOSAVE_NAME = "OpenQuicklyWindow" 14 | 15 | var options: OpenQuicklyOptions! 16 | 17 | private var windowIsVisible: Bool { 18 | return window?.isVisible ?? false 19 | } 20 | 21 | public convenience init(options: OpenQuicklyOptions) { 22 | let oqvc = OpenQuicklyViewController(options: options) 23 | let window = OpenQuicklyWindow(contentViewController: oqvc) 24 | 25 | self.init(window: window) 26 | 27 | self.options = options 28 | 29 | if options.persistPosition { 30 | window.setFrameAutosaveName(AUTOSAVE_NAME) 31 | } 32 | } 33 | 34 | override open func close() { 35 | if windowIsVisible { 36 | options.delegate?.windowDidClose() 37 | super.close() 38 | } 39 | } 40 | 41 | public func toggle() { 42 | guard let visible = window?.isVisible else { return } 43 | 44 | if visible { 45 | close() 46 | } else { 47 | window?.makeKeyAndOrderFront(self) 48 | showWindow(self) 49 | } 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /Plyr/Player.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Player.swift 3 | // Plyr 4 | // 5 | // Created by Luka Kerr on 1/3/18. 6 | // Copyright © 2018 Luka Kerr. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import AVFoundation 11 | 12 | final class Player: NSObject, AVAudioPlayerDelegate, NSUserNotificationCenterDelegate { 13 | 14 | /// All songs 15 | private var songs: [Song]! 16 | 17 | /// Main audio player 18 | private var audioPlayer: AVAudioPlayer! 19 | 20 | /// Currently playing song 21 | private var currentSong: Song! 22 | 23 | /// Currently playing song index 24 | private var currentSongIndex: Int! 25 | 26 | /// Whether the player is currently playing or paused 27 | public var playing: Bool { 28 | return audioPlayer.isPlaying 29 | } 30 | 31 | override init() { 32 | super.init() 33 | 34 | self.currentSongIndex = preferences.currentSongIndex 35 | NSUserNotificationCenter.default.delegate = self 36 | } 37 | 38 | public func initialize() { 39 | self.songs = self.getAllSongs() 40 | } 41 | 42 | /// Plays all songs one by one 43 | public func playAll() { 44 | if songs.count > currentSongIndex { 45 | currentSong = songs[currentSongIndex] 46 | play(currentSong.url) 47 | } else { 48 | let notification = NSUserNotification() 49 | notification.title = "No music found" 50 | notification.informativeText = "No music could be found. Exiting" 51 | notification.soundName = NSUserNotificationDefaultSoundName 52 | NSUserNotificationCenter.default.deliver(notification) 53 | exit(0) 54 | } 55 | } 56 | 57 | // MARK: - Public methods to control the player 58 | 59 | public func pause() { 60 | audioPlayer.pause() 61 | } 62 | 63 | public func resume() { 64 | audioPlayer.prepareToPlay() 65 | audioPlayer.play() 66 | } 67 | 68 | public func skip() { 69 | audioPlayer.currentTime += 10.0 70 | } 71 | 72 | public func rewind() { 73 | audioPlayer.currentTime -= 10.0 74 | } 75 | 76 | public func next() { 77 | let newIndex = (currentSongIndex + 1) % songs.count 78 | 79 | currentSongIndex = newIndex 80 | preferences.currentSongIndex = newIndex 81 | 82 | playAll() 83 | } 84 | 85 | public func previous() { 86 | let newIndex = currentSongIndex <= 0 ? 0 : currentSongIndex - 1 87 | 88 | currentSongIndex = newIndex 89 | preferences.currentSongIndex = newIndex 90 | 91 | playAll() 92 | } 93 | 94 | public func play(_ song: Song) { 95 | if let index = songs.firstIndex(where: { $0.url == song.url }) { 96 | currentSongIndex = index 97 | preferences.currentSongIndex = index 98 | playAll() 99 | } 100 | } 101 | 102 | public func play(_ song: URL) { 103 | audioPlayer = try? AVAudioPlayer(contentsOf: song) 104 | audioPlayer.numberOfLoops = 0 105 | audioPlayer.delegate = self 106 | audioPlayer.prepareToPlay() 107 | audioPlayer.play() 108 | 109 | DispatchQueue.global(qos: .userInitiated).async { 110 | self.currentSong.setMetadata() 111 | 112 | DispatchQueue.main.async { 113 | NotificationCenter.default.post( 114 | name: NSNotification.Name(rawValue: "setSongDetails"), 115 | object: self.currentSong 116 | ) 117 | } 118 | } 119 | } 120 | 121 | public func clearSongArtwork() { 122 | self.songs.forEach { 123 | if $0 != currentSong { 124 | $0.clearArtwork() 125 | } 126 | } 127 | } 128 | 129 | public func song(for term: String) -> [Song] { 130 | if term.count < 2 { 131 | return [] 132 | } 133 | 134 | return songs.filter { 135 | if let path = $0.url.lastPathComponent.removingPercentEncoding { 136 | return path.lowercased().contains(term.lowercased()) 137 | } 138 | 139 | return false 140 | } 141 | } 142 | 143 | // MARK: - Private methods 144 | 145 | // Returns an array of URLs found under ~/Music 146 | private func getAllSongs() -> [Song] { 147 | let path = "\(FileManager.default.homeDirectoryForCurrentUser.path)/Music" 148 | let songs = FileManager.default.filteredMusicFileURLs(inDirectory: path) 149 | return songs 150 | } 151 | 152 | // MARK: - AVAudioPlayerDelegate methods 153 | 154 | // Called when a song playing the player ends 155 | func audioPlayerDidFinishPlaying(_ player: AVAudioPlayer, successfully flag: Bool) { 156 | next() 157 | } 158 | 159 | } 160 | -------------------------------------------------------------------------------- /Plyr/PlayerViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PlayerViewController.swift 3 | // Plyr 4 | // 5 | // Created by Luka Kerr on 28/2/18. 6 | // Copyright © 2018 Luka Kerr. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class PlayerViewController: NSViewController { 12 | 13 | private var player = Player() 14 | private var searching: Bool = false 15 | private var searchWindowController: OpenQuicklyWindowController! 16 | 17 | @IBOutlet weak var backgroundView: NSView! 18 | @IBOutlet weak var transparentView: NSVisualEffectView! 19 | @IBOutlet weak var mainControlButton: NSButton! 20 | @IBOutlet weak var artistName: NSTextField! 21 | @IBOutlet weak var songName: NSTextField! 22 | 23 | override func viewWillAppear() { 24 | super.viewWillAppear() 25 | 26 | view.wantsLayer = true 27 | view.layer?.cornerRadius = 10.0 28 | 29 | // NSVisualEffectView properties 30 | transparentView.blendingMode = .withinWindow 31 | transparentView.wantsLayer = true 32 | transparentView.layer?.cornerRadius = 7.0 33 | transparentView.state = .active 34 | transparentView.material = .light 35 | 36 | NSEvent.addLocalMonitorForEvents(matching: .keyDown) { (event) -> NSEvent? in 37 | if self.keyDown(with: event) { 38 | return nil 39 | } 40 | 41 | return event 42 | } 43 | 44 | DispatchQueue.global(qos: .userInitiated).async { 45 | self.player.initialize() 46 | 47 | DispatchQueue.main.async { 48 | self.player.playAll() 49 | } 50 | } 51 | } 52 | 53 | override func viewDidLoad() { 54 | let openQuicklyOptions = OpenQuicklyOptions() 55 | openQuicklyOptions.width = 400 56 | openQuicklyOptions.rowHeight = 50 57 | openQuicklyOptions.delegate = self 58 | openQuicklyOptions.persistPosition = true 59 | openQuicklyOptions.placeholder = "Search for a song" 60 | 61 | self.searchWindowController = OpenQuicklyWindowController(options: openQuicklyOptions) 62 | 63 | NotificationCenter.default.addObserver( 64 | self, 65 | selector: #selector(self.setSongDetails), 66 | name: NSNotification.Name(rawValue: "setSongDetails"), 67 | object: nil 68 | ) 69 | } 70 | 71 | func keyDown(with event: NSEvent) -> Bool { 72 | let modifierFlags = event.modifierFlags.intersection(.deviceIndependentFlagsMask) 73 | 74 | // Command + 'o' 75 | if modifierFlags == [.command] && event.keyCode == KeyCode.o { 76 | searching.toggle() 77 | searchWindowController.toggle() 78 | return true 79 | } 80 | 81 | // If searching, don't listen to any other keys 82 | if searching { 83 | return false 84 | } 85 | 86 | switch event.keyCode { 87 | case KeyCode.space: 88 | onMainControlClick(nil) 89 | return true 90 | 91 | case KeyCode.n: 92 | nextButtonClicked(nil) 93 | return true 94 | 95 | case KeyCode.p: 96 | previousButtonClicked(nil) 97 | return true 98 | 99 | case KeyCode.s: 100 | skipButtonClicked(nil) 101 | return true 102 | 103 | case KeyCode.r: 104 | rewindButtonClicked(nil) 105 | return true 106 | 107 | default: 108 | return false 109 | } 110 | } 111 | 112 | // Set song details from given audio path 113 | @objc func setSongDetails(notification: Notification?) { 114 | guard 115 | let song = notification?.object as? Song, 116 | let artist = song.artist, 117 | let name = song.name 118 | else { return } 119 | 120 | if let artwork = song.artwork ?? MISSING_ARTWORK { 121 | artwork.setSize() 122 | view.layer?.contents = artwork 123 | } 124 | 125 | artistName.stringValue = artist 126 | songName.stringValue = name 127 | } 128 | 129 | func setButtons() { 130 | if player.playing { 131 | mainControlButton.image = NSImage(named: "NSTouchBarPauseTemplate") 132 | } else { 133 | mainControlButton.image = NSImage(named: "NSTouchBarPlayTemplate") 134 | } 135 | } 136 | 137 | // MARK: - Methods responding to button clicks 138 | 139 | @IBAction func onMainControlClick(_ sender: Any?) { 140 | player.playing ? player.pause() : player.resume() 141 | setButtons() 142 | } 143 | 144 | @IBAction func skipButtonClicked(_ sender: Any?) { 145 | player.skip() 146 | setButtons() 147 | } 148 | 149 | @IBAction func rewindButtonClicked(_ sender: Any?) { 150 | player.rewind() 151 | setButtons() 152 | } 153 | 154 | @IBAction func nextButtonClicked(_ sender: Any?) { 155 | player.next() 156 | setButtons() 157 | } 158 | 159 | @IBAction func previousButtonClicked(_ sender: Any?) { 160 | player.previous() 161 | setButtons() 162 | } 163 | 164 | } 165 | 166 | extension PlayerViewController: OpenQuicklyDelegate { 167 | 168 | func openQuickly(item: Any) -> NSView? { 169 | guard 170 | let song = item as? Song 171 | else { return nil } 172 | 173 | song.setMetadata() 174 | 175 | guard 176 | let artist = song.artist, 177 | let name = song.name 178 | else { return nil } 179 | 180 | let view = NSStackView() 181 | view.edgeInsets = NSEdgeInsets(top: 4, left: 4, bottom: 4, right: 4) 182 | 183 | let title = NSTextField() 184 | 185 | title.isEditable = false 186 | title.isBezeled = false 187 | title.isSelectable = false 188 | title.focusRingType = .none 189 | title.drawsBackground = false 190 | title.font = NSFont.systemFont(ofSize: 14) 191 | title.stringValue = name 192 | 193 | let subtitle = NSTextField() 194 | 195 | subtitle.isEditable = false 196 | subtitle.isBezeled = false 197 | subtitle.isSelectable = false 198 | subtitle.focusRingType = .none 199 | subtitle.drawsBackground = false 200 | subtitle.stringValue = artist 201 | subtitle.font = NSFont.systemFont(ofSize: 12) 202 | 203 | let text = NSStackView() 204 | text.orientation = .vertical 205 | text.spacing = 2.0 206 | text.alignment = .left 207 | 208 | text.addArrangedSubview(title) 209 | text.addArrangedSubview(subtitle) 210 | 211 | if let artwork = song.artwork ?? MISSING_ARTWORK { 212 | artwork.setSize() 213 | view.addArrangedSubview(NSImageView(image: artwork)) 214 | } 215 | 216 | view.addArrangedSubview(text) 217 | 218 | return view 219 | } 220 | 221 | func valueWasEntered(_ value: String) -> [Any] { 222 | return player.song(for: value) 223 | } 224 | 225 | func itemWasSelected(selected item: Any) { 226 | searching = false 227 | 228 | guard let song = item as? Song else { return } 229 | 230 | player.play(song) 231 | } 232 | 233 | func windowDidClose() { 234 | searching = false 235 | player.clearSongArtwork() 236 | } 237 | 238 | } 239 | -------------------------------------------------------------------------------- /Plyr/PlyrWindowController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WindowController.swift 3 | // Plyr 4 | // 5 | // Created by Luka Kerr on 28/2/18. 6 | // Copyright © 2018 Luka Kerr. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | let PLYR_AUTOSAVE_NAME = "PlyrWindow" 12 | 13 | class PlyrWindowController: NSWindowController { 14 | 15 | override func windowDidLoad() { 16 | super.windowDidLoad() 17 | 18 | window?.isOpaque = false 19 | window?.styleMask = .borderless 20 | window?.backgroundColor = .clear 21 | window?.titleVisibility = .hidden 22 | window?.isMovableByWindowBackground = true 23 | window?.setFrameAutosaveName(PLYR_AUTOSAVE_NAME) 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Plyr/Preferences.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Preferences.swift 3 | // Plyr 4 | // 5 | // Created by Luka Kerr on 24/2/19. 6 | // Copyright © 2019 Luka Kerr. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | enum PreferencesKeys { 12 | static let currentSongIndex = "currentSongIndex" 13 | } 14 | 15 | class Preferences { 16 | static let shared = Preferences() 17 | 18 | private init() {} 19 | 20 | public var currentSongIndex: Int { 21 | get { 22 | if exists(PreferencesKeys.currentSongIndex) { 23 | return defaults.integer(forKey: PreferencesKeys.currentSongIndex) 24 | } 25 | 26 | return 0 27 | } 28 | 29 | set { 30 | setDefaults(key: PreferencesKeys.currentSongIndex, newValue) 31 | } 32 | } 33 | 34 | fileprivate func setDefaults(key: String, _ val: Any) { 35 | defaults.setValue(val, forKey: key) 36 | } 37 | 38 | fileprivate func exists(_ key: String) -> Bool { 39 | return UserDefaults.standard.object(forKey: key) != nil 40 | } 41 | 42 | } 43 | 44 | let preferences = Preferences.shared 45 | -------------------------------------------------------------------------------- /Plyr/Song.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Song.swift 3 | // plyr 4 | // 5 | // Created by Luka Kerr on 24/2/19. 6 | // Copyright © 2019 Luka Kerr. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import Cocoa 11 | import AVFoundation 12 | 13 | func ==(lhs: Song, rhs: Song) -> Bool { 14 | return lhs.url == rhs.url 15 | } 16 | 17 | func !=(lhs: Song, rhs: Song) -> Bool { 18 | return !(lhs == rhs) 19 | } 20 | 21 | let MISSING_ARTWORK = NSImage(named: "Missing") 22 | 23 | class Song { 24 | 25 | public var url: URL 26 | public var name: String? 27 | public var artist: String? 28 | public var artwork: NSImage? 29 | 30 | init(url: URL) { 31 | self.url = url 32 | self.name = nil 33 | self.artist = nil 34 | self.artwork = nil 35 | 36 | self.artwork?.setSize() 37 | } 38 | 39 | public func clearArtwork() { 40 | self.artwork = nil 41 | } 42 | 43 | public func setMetadata() { 44 | let asset = AVURLAsset(url: url) 45 | 46 | for format in asset.availableMetadataFormats { 47 | if name != nil && artist != nil && artwork != nil { 48 | return 49 | } 50 | 51 | for item in asset.metadata(forFormat: format) { 52 | guard let key = item.commonKey else { continue } 53 | 54 | switch key { 55 | case .commonKeyTitle: 56 | name = item.value as? String 57 | 58 | case .commonKeyArtist: 59 | artist = item.value as? String 60 | 61 | case .commonKeyArtwork: 62 | guard let imageData = item.value as? Data else { continue } 63 | 64 | artwork = NSImage(data: imageData) 65 | artwork?.setSize() 66 | 67 | default: 68 | continue 69 | } 70 | } 71 | } 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Plyr 2 | 3 | [![Swift 5](https://img.shields.io/badge/swift-5-orange.svg?style=flat)](https://github.com/apple/swift) 4 | [![Platform](http://img.shields.io/badge/platform-macOS-red.svg?style=flat)](https://developer.apple.com/macos/) 5 | [![Github](http://img.shields.io/badge/github-lukakerr-green.svg?style=flat)](https://github.com/lukakerr) 6 | ![Github All Releases](https://img.shields.io/github/downloads/lukakerr/plyr/total.svg) 7 | 8 |

9 | 10 |

11 | 12 | Plyr is a hyperminimal, lightweight macOS music playback desktop application. 13 | 14 | Audio files are looked for in the `~/Music` directory. If none are found, the app will notify you and terminate. 15 | 16 | ### Installing 17 | 18 | #### Install via Homebrew Cask 19 | 20 | ```bash 21 | $ brew tap lukakerr/things 22 | $ brew cask install plyr 23 | ``` 24 | 25 | #### Manual Download 26 | 27 | Visit the [releases page](https://github.com/lukakerr/plyr/releases) to download manually. 28 | 29 | ### Uninstalling 30 | 31 | #### Download via Homebrew Cask 32 | 33 | ```bash 34 | $ brew cask remove plyr 35 | ``` 36 | 37 | #### Downloaded Manually 38 | 39 | ```bash 40 | $ rm -r /Applications/Plyr.app ~/Library/Caches/io.github.lukakerr.plyr 41 | ``` 42 | 43 | ### Features 44 | 45 | - Pause or play 46 | - Skip or rewind 10 seconds 47 | - Skip to next or previous song 48 | - Minimal UI 49 | 50 | ### Todo 51 | 52 | - Add UI preferences 53 | - [ ] Window border radius 54 | - [ ] Show or hide traffic lights 55 | - [ ] Light or dark overlay 56 | 57 | - Add functionality preferences 58 | - [ ] Duration to skip or rewind 59 | 60 | - Add functionality 61 | - [x] Show quick open panel to search for and play songs 62 | - [x] Add keybindings for play, pause, skip, rewind, next and previous buttons 63 | 64 | ### Screenshots 65 | 66 |

67 | 68 | 69 | 70 |

71 | --------------------------------------------------------------------------------