Skip to content

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Remember folder #1

wants to merge 7 commits into from

Conversation

raff
Copy link

@raff raff commented Aug 10, 2023

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.

<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.app-sandbox</key>
Copy link
Author

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)
Copy link
Author

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()
Copy link
Author

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",
Copy link
Author

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")

Copy link
Author

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" ]
Copy link
Author

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 = ""
Copy link
Author

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 != "" {
Copy link
Author

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 {
Copy link
Author

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 {
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant