-
Notifications
You must be signed in to change notification settings - Fork 2
Remember folder #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…allow accessing Downloads, Documents and Music in order to "save" the selected music folder.
… in MacOS 12/13 and later.
<true/> | ||
<key>com.apple.security.files.user-selected.read-only</key> | ||
<true/> | ||
<key>com.apple.security.app-sandbox</key> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of this is needed in order to make the "remember folder" work (since there is no user action.
I think there is a way to make the application ask for access to Documents, Downloads and maybe Music folder instead of forcing them here, but I am not sure of how to do that.
@@ -20,7 +20,7 @@ class Album: Identifiable, Equatable { | |||
init (_ albumFullPath: String) { | |||
albumPath = albumFullPath | |||
let fileManager = FileManager.default | |||
let contents = try! fileManager.contentsOfDirectory(atPath: albumFullPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Order folders by path
@@ -94,7 +94,7 @@ class Album: Identifiable, Equatable { | |||
// Return an array of URLs, one for each music file in this album's folder. | |||
func getPlaylist () -> [URL] { | |||
let fileManager = FileManager.default | |||
let contents = try! fileManager.contentsOfDirectory(atPath: albumPath) | |||
let contents = try! fileManager.contentsOfDirectory(atPath: albumPath).sorted() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Order tracks by name (usually the track starts with a track number)
@@ -21,21 +21,25 @@ | |||
"size" : "32x32" | |||
}, | |||
{ | |||
"filename" : "AppIcon128x128.png", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some icons, so I know where the app is.
@@ -13,6 +17,11 @@ struct ColdwaveApp: App { | |||
CommandGroup(before: CommandGroupPlacement.newItem) { | |||
Button(action: { openFolder() }, label: { Label("Open directory...", systemImage: "doc") }) | |||
.keyboardShortcut("o") | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to add a "modal" dialog to ask for a remote location (audio stream or remote file)
|
||
final class AppDelegate: NSObject, NSApplicationDelegate { | ||
func applicationDidFinishLaunching(_ notification: Notification) { | ||
let unwantedMenus = ["Edit","View" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove a couple of menu entries that don't do much for a music player
|
||
class ColdwaveState: ObservableObject { | ||
|
||
|
||
@AppStorage("music.folder") var path = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
retrieve last folder path from application store
} | ||
} | ||
|
||
if path != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If app is starting up and there is a stored folder path, scan library
|
||
import SwiftUI | ||
|
||
struct LocationView: View { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Location "dialog"
}.padding(PADDING) | ||
// Text(String(state.amountPlayed)) | ||
}.padding(.horizontal) | ||
HStack { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add track play and remaining time
This PR add saving the music folder for successive runs.
Also add some icons and removes a couple of menu items that are not really useful in a music player.