Commit Graph

212 Commits (94de0491840a1b616854ca793476122cf2ebd2e3)

Author SHA1 Message Date
Christopher Snowhill ec91f61403 [Metadata] Commit first seen date for whole batch
Commit only once the entire batch is loaded and processed. Also commit
using the correct function.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-24 17:09:06 -07:00
Christopher Snowhill ba33218ddf [Path Suggester] Automatically pop where required
The Path Suggester will now automatically open when new files are added
to the playlist and a given path is not in the sandbox settings. It will
also pop for both the File Tree and MIDI SoundFont path configuration
settings being changed.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-24 00:52:03 -07:00
Christopher Snowhill 2c2a058126 Cog now requires macOS 10.13 as a minimum version
All optional fallback code for older versions has also been removed, and
everything now assumes 10.13.0 or newer. Some cases are still included
for point releases, such as 10.13.2.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-23 23:23:07 -07:00
Christopher Snowhill 5cb08291bf [Sandbox / Core Data] Refine global variable usage
Refine the global variable usage, eliminating double underscore prefixes
and trusting that static global variables will exist in the object where
the class was created. Got rid of that nasty NSApplication extension
hack that was previously in use.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-21 00:01:07 -07:00
Christopher Snowhill 4330226776 [Core Data Store] Fix empty URL filtering
Empty URL filtering was implemented incorrectly. Fix that.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-20 23:18:37 -07:00
Christopher Snowhill c89837c0f8 [Play Count] Remember added count across sessions
Remember if play count was already tracked for the current file across
restarts, if resume playback after restart is enabled.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-20 19:13:33 -07:00
Christopher Snowhill c23bece62c Reintroducing App Sandbox, and more
- Implemented App Sandboxing in a more friendly manner.
- All sandboxed paths will need to be set in Preferences. Set as loose
  a path as you want. The shortest path will be preferred.
- Removed Last.fm client support, as it was non-functional by now,
  unfortunately. Maybe something better can come in the future.
- Added support for insecure SSL to the HTTP/S reader, in case anyone
  needs streams which are "protected" by self-signed or expired
  certificates, without having to futz around by adding certificates to
  the system settings, especially for expired certificates that can't
  otherwise be dodged this way.

If you want to import your old playlists to the new version, copy the
contents of `~/Library/Application Support/Cog` to the alternate sandbox
path: `~/Library/Containers/org.cogx.cog/Data/Library/Application `...
...continued...`Support/Cog`. The preferences file will migrate to the
new version automatically.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-20 03:35:29 -07:00
Christopher Snowhill 385335b37c [Core Data Storage] Refine deleted/empty items
Remove empty items also with empty URL fields.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-19 20:04:30 -07:00
Christopher Snowhill 163ae5c864 [Core Data] Optimize queue and shuffle loading
Optimize queue loading code, and add shuffle list reading code.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-19 02:05:26 -07:00
Christopher Snowhill 7fcfdb373b [Playback Status] Remember last play position
Remember last play position in the playlist, rather than using an index
variable to store its position and play time. Still store whether the
player was last playing in a configuration variable, though.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-19 01:42:27 -07:00
Christopher Snowhill 84d0cbee3c [Playlist Controller] Remove unused function
Remove a leftover function from previous code.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-18 23:01:11 -07:00
Christopher Snowhill a2d8e0ec42 [Track Info] Add play count tabulation and display
Add play count data collection, including first seen times for every
file first added to the playlist. Data is indexed by album, artist, and
title, or by filename, whichever matches first. Add interfaces to
AppleScript automation definition as well.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-18 23:00:08 -07:00
Christopher Snowhill ecb30dd734 [Translation Support] Update strings a bit.
Update the strings, and remove the comments where they won't be used.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-18 16:10:18 -07:00
Christopher Snowhill 54b102f09e [Playlist] Fix refresh handling range
Apparently, somehow, indexes in obscene ranges hit this code, and cause
exceptions. Strange.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-18 15:50:25 -07:00
Christopher Snowhill 4b4776fbc0 [Shuffle Function] Make album predicate exact
Make the album match predicate an exact match, rather than using the
"like" operator, in case there's a speed up from doing so.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-17 17:25:42 -07:00
Christopher Snowhill e9b02d54f4 [Core Storage] Apply index sort to fetch request
Apply the index sort to the fetch request itself, rather than applying
it to the resulting array afterward.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-17 17:20:45 -07:00
Christopher Snowhill cad6ddac02 [Shuffle Function] Greatly optimize list generator
The list generator now selects only a list of unique album names, which
may include empty string as well as NSNull, so filter those as well.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-17 17:03:50 -07:00
Christopher Snowhill 9820571a94 [Shuffle Function] Rewrite query for Core Data
Rewrite the album filter function to apply the filter predicate against
Core Data directly, which also requires filtering out deLeted entries so
they don't end up in the results, and also requires sorting the results.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-17 17:02:24 -07:00
Christopher Snowhill d972a6eaf5 [Playlist] Correctly handle deleted items
The member that I set myself to indicate deletion has one capital letter
to differentiate it from the built-in "delete" property of managed
objects, which doesn't do what I want, so I had to dodge it with that
capitalization thing.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-17 04:34:17 -07:00
Christopher Snowhill 789e8e432e [Playlist Storage] Add another compatibility hook
Add a compatibility getter/setter for URL, which was renamed to url, due
to Core Storage having a requirement of all attributes starting with a
lower case letter.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-16 17:43:48 -07:00
Christopher Snowhill 4c95c943ef [Playlist Storage] Rewrite to use Core Data
Completely rewrite the playlist storage once again, this time with a
much faster Core Data implementation. It still uses a little magic for
Album Artwork consolidation, but string consolidation doesn't seem to be
needed to reduce the disk storage size. Works much faster than my silly
implementation, too.

Old implementations are still kept for backwards compatibility with
existing playlists.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-16 07:14:33 -07:00
Christopher Snowhill 5bca70d141 [Job Queue] Prevent multiple jobs from stacking
Jobs are meant to be serialized, so prevent multiple jobs from queueing
simultaneously, as they are not designed to interact with each other.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-15 01:10:53 -07:00
Christopher Snowhill 92573ec088 [Job Queue] Overhauled long action handling
Long actions, such as file opening, playlist loading, metadata loading
and refreshing, etc, are now handled through NSProgress. Additionally,
a new status bar change displays the progress of the task instead of
the total duration of the playlist. Finally, app quit is blocked by a
running task, and if the app is quit while a task is running, it will
be delayed until the task completes, at which time the app will
terminate cleanly.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-15 01:01:45 -07:00
Christopher Snowhill 9d558a89ab [Playlist] Guard Open in Finder against empty set
Guard Open in Finder against being called on a playlist with no
selection, which may happen if the action is triggered on an empty
playlist, which would cause an array out of bounds access error.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-13 16:28:29 -07:00
Christopher Snowhill 686cf95795 [Playlist] Guard entry selection against empty set
Guard the playlist entry retrieval function against being called on an
empty playlist, because an empty playlist would result in a division by
zero error to occur here.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-13 16:27:32 -07:00
Christopher Snowhill 90b83f8f51 [Various] Clean up various warnings
Various warnings related to uninitialized variables, or setting values
to variables that would not be used later or would be overwritten by per
loop initializers.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-11 13:42:42 -07:00
Christopher Snowhill f22a74ab3a [Translation Support] Fix several string constants
Several string constants were not fetching from the translation strings
table. Fixed this.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-11 13:34:57 -07:00
Christopher Snowhill f11ef2d887 [Playlist Controller] Fix ambiguity with Xcode 14
This NSArray member call is ambiguous, but Xcode <14 allowed it.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-07 18:57:19 -07:00
Christopher Snowhill 0ba766023e Playlist/Time: Simplify font initialization
Apparently this simpler API already existed on a minimum of 10.11 for
creating a system font with monospaced digits.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-03 16:46:37 -07:00
Christopher Snowhill 05f17ea950 [Menu] Add Stop after Selection to context menu
Since the existing code already supports setting any arbitrary track as
a stopping point, add a menu interface to toggle Stop After for any
track in the playlist. Stop After will be removed from the given track
after it has been played. Stop After will not be remembered on disk.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-05-30 22:23:02 -07:00
Christopher Snowhill 1b48459eaa Track number column should also sort by disc
Apparently, the sort descriptors are going by data members of the array,
not by the column identifiers, or their textual contents.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-18 02:23:15 -08:00
Christopher Snowhill 60a4266840 Fix sorting of playlist
Unfortunately, the track number column will always bug out and pop the
indicator back over to the Album Artist column. No way around it. The
control is just buggy like that.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-18 01:57:19 -08:00
Christopher Snowhill 0902703ee1 Playlist: Fix sorting by the track number column
Should now properly sort by album artist, album, then disc/track number.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-17 17:07:47 -08:00
Christopher Snowhill 2e52066293 Skip to next on trash, else stop playback
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-10 21:48:30 -08:00
Christopher Snowhill 2e1460f72d Only trash regular files
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-10 21:48:08 -08:00
Christopher Snowhill 5411a60ea1 Added option to remove tracks to the trash
Fixes #23

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-10 21:35:13 -08:00
Christopher Snowhill a4387dc6d1 Playlist now supports dragging tracks out of app
Playlist now supports dragging copies of URL references to other apps,
including Finder, and possibly other audio players. The chosen drag
operation is to copy files.

Fixes #75

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-10 01:32:09 -08:00
Christopher Snowhill 5330295a97 Fix array bounds issues with album shuffle builder
The shuffle list builder was encountering errors when some album tags or
empty album tags led to empty lists.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-10 01:14:42 -08:00
Christopher Snowhill 64c4aa2e25 Handle deleting the current track gracefully
Now it should flow playback correctly to the next remaining track after
the block of deleted tracks. And if the user deletes the next queued
track, it will still be queued to flow past the deleted block. If the
user undoes their deletes and restores the tracks, playback will resume
after the originally deleted track.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-09 21:04:17 -08:00
Christopher Snowhill 85c7073649 Reformat my own source code with clang-format
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-06 21:49:27 -08:00
Christopher Snowhill 6d9f1be7ea Playlist Controller: Stop when deleting current
When deleting the currently playing track, stop playback, because the
player engine doesn't like dealing with the current playing track not
actually having a playlist reference to go with it. Better stop playback
instead, as a safety check.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-02-04 19:54:43 -08:00
Christopher Snowhill d8b16e44c7 SQLite Store / Drag and Drop: Now correctly store changes made by dragging playlist entries around to the database 2022-01-24 06:07:13 -08:00
Christopher Snowhill b54b10861b Playlist View: Enable column text tightening before truncation 2022-01-22 15:03:30 -08:00
Christopher Snowhill 2165d37144 Metadata: Now supports disc number field where possible 2022-01-21 21:49:17 -08:00
Christopher Snowhill 297b7b2909 Playlist View: Fix default sorting and playlist refreshing, which fixes playlist search bugging out 2022-01-21 00:16:29 -08:00
Christopher Snowhill 0f90dd3b3e Playlist View: Support undoing and redoing Drag and Drop operations within the playlist 2022-01-20 21:48:23 -08:00
Christopher Snowhill c07b268288 Playlist View: Adjust threshold for expansion tooltip assignment 2022-01-20 18:18:05 -08:00
Christopher Snowhill 4e918fc868 Playlist View: Refresh playlist entries when queue is emptied 2022-01-20 17:58:24 -08:00
Christopher Snowhill 973664f3b3 Playlist View: Correctly refresh playlist tooltips when queue is manipulated 2022-01-20 17:54:02 -08:00
Christopher Snowhill 7cc4ee22f7 Playlist View: Fix centering and sizing of status icons 2022-01-20 17:37:56 -08:00