-
Notifications
You must be signed in to change notification settings - Fork 52
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
Some improvements and #8 #52
base: master
Are you sure you want to change the base?
Conversation
Feature/song dict
This is great, really appreciate the contribution.
For a quick testing I installed the app to try it. So, I downloaded couple of songs and tested some functionalities andI here is my feedback so far:
I was also thinking that we can remove support to the old song Dict style and instead just save and load a Song struct directly instead of having the cache presentable layer in between. I have not decided on this part yet so feel free to share any ideas |
Yea, SongTest is a mistake, forgot I added it. The bugs you mentioned - I'll look into them today or tomorrow, it was just hard to test because I was running out of my free time. Another problem which affects most of the bugs I guess is that metadata/cache parsing stuff. I misunderstood how it works in the first place. Song dict style can be removed easily, since Song inherits from Codable which can be stored as JSON data via JSONEncoder/JSONDecoder, but my problem was that I wanted to keep your old cache system and dont break it with my PR. But I guess I can try to implement some migrations. By the way, when I was doing some kind of player, I've used Realm as cache provider. Its really fast, allows to listen for objects updates and much more, but the only thing that bugged me was thread safety. Just telling that you can look into Realm. |
I was afraid that separating the extensions into multiple files for each type is going to overwhelm the project with just too many file so it felt right to just have them in a single file but separate them by Feel free to do those fixes anytime and I'll be happy to review and merge. Regarding saving the Song as JSON, this was my initial intention when I started the project but as this is my first Swift project and I wanted to actually see the output rather than getting stuck with the syntax and protocols, I just wrote it the easiest way and thought that I can refactor later. Unfortunately, I got stuck while working with Tbh I've never worked or looked into Realm but sure I'll read about it. Also, I saw you raised some points regarding |
Any update on this pull? |
Hey! I found your post on reddit and decided that I could help a little.
Regarding issue #8 I did change songDict to be a struct and did some Library / Player improvements (at least, I think those are improvements :)).
If you're okay with the code you can clone my repo and test if all the logic works as intended.
Because it was quite hard for me to decide how cache/metadata works with dictionaries. I'm open to fix the bugs that I introduced, especially, editing song's artists, tags, etc.
Some tips:
Get rid of NSMutabbleArrays and NSArrays since there is not point to use those in swift. I tried to remove some, but my main point was changing dictionary to struct.
LibraryManager's
getLibraryArray
(in my code and in yours) is pretty heavy and could lead to bottlenecks when there are too many songs.Same goes for
applyTagFilter
IMO.I found that you often doing the force unwraps, which are not good tactics.
edit: fork -> clone