TortugaPower / BookPlayer

Player for your DRM-free audiobooks
GNU General Public License v3.0
1.62k stars 195 forks source link

Library: Sort by recently played #459

Closed pichfl closed 4 years ago

pichfl commented 4 years ago

Extracted from #456 - https://github.com/TortugaPower/BookPlayer/issues/456#issuecomment-624282846

I think this is something much more doable: Currently I'm only seeing sort by Title or Original File name, so it would be great if there was a way to sort audio files played by most Recent (recently played).

iamLoi commented 4 years ago

I may be able to take a stab at this. Could you give me some direction - for instance, which class does the library gets loaded and where are the sorting options that I need to change? My hunch would be the PlayListSortOrder within BookSortService class, is this correct and is that the only place that changes need to be made?

GianniCarlo commented 4 years ago

Hi @iamLoi !, that would be great, since the Watch app was introduced (or maybe CarPlay 🤔 not sure right now), the LibraryItem abstract class has had the lastPlayDate property. That could be used to sort the books by recently played (actually for CarPlay we use getItemsOrderedByDate in the Library class)

But well, yes you're on the right track, within BookSortService in the enum PlayListSortOrder there should be a new case with the raw value being lastPlayDate, and you should add the new option in the action sheet as well (inside the file ItemListAlerts.swift)

For localization, use the content of the carplay_recent_title key, mmmm or maybe we could rename it from carplay_recent_title to just recent_title and use that everywhere

GianniCarlo commented 4 years ago

Let me know if you got any other question 👍

iamLoi commented 4 years ago

Any commands or anything I need to run to get all the dependencies ready to build/run the project? This project uses Carthage so I ran carthage update --platform macOS but it's showing Carthage as deprecated (?) and runs still fail due to different modules not available (SwiftReorder in particular). I haven't done much Swift or Xcode programming so this is new for me.

iamLoi commented 4 years ago

I made another branch and pushed my changes. Please verify and let me know if there's anything missing, otherwise feel free to merge it.

pichfl commented 4 years ago

@iamLoi ❤ thanks for joining the effort. To allow us to merge or review your work, you need to create a fork and create a pull request.

GianniCarlo commented 4 years ago

@iamLoi I'll leave my comments on the PR 👍

mmurali88 commented 4 years ago

@GianniCarlo If is this still pending, can i take a stab at it ?

GianniCarlo commented 4 years ago

sure!, there's a PR opened #460 but after some feedback about project building, there hasn't been any updates to it. So you're welcome to do it 👌

mmurali88 commented 4 years ago

@GianniCarlo Thanks a lot. That PR was confusing for me and had many unwanted changes. I have implemented here in this PR

https://github.com/TortugaPower/BookPlayer/pull/475

mmurali88 commented 4 years ago

@GianniCarlo can you close this issue ? The PR is merged

GianniCarlo commented 4 years ago

wops I forgot 😅, closing it now 👍

pichfl commented 4 years ago

@mmurali88 if you add Closes #number to the description of the PR, the reference and closing will happen automatically when the PR is merged 👍

mmurali88 commented 4 years ago

@mmurali88 if you add Closes #number to the description of the PR, the reference and closing will happen automatically when the PR is merged 👍

Thanks @pichfl . Will do that going forward