Skip to content
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

Added better library browsing for Android Auto #1322

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

ISO-B
Copy link
Contributor

@ISO-B ISO-B commented Sep 13, 2024

This should resolve issue. Fixes #1204

Each library now has three browsing options: Library, Series, Collections. Library browsing tree is following:

  • Library
    • Shows authors, but if there is 1000 or more authors only show first letters until there is under 100 authors.
      • Series and single books for author
        • Author books from selected series
  • Series
    • Show list of series, but if there 1000 or more series only show first letters until there is under 500 series to show.
      • Books in series
  • Collections
    • Show collections
      • Books in collection

Fetched data is cached using variables.

Each library has 3 options: Library, Series and Collection. Library is grouped by authors
@kuldan5853
Copy link

Could you maybe make the thresholds customizable in the future? 1000 / 500 are quite a bit to browse through on a car display, one might prefer to always force it to the Alphabetical drawdown and / or change those numbers.

Not needed for a first step (looking forward to testing this!) but just as an idea for future refinement.

@ISO-B
Copy link
Contributor Author

ISO-B commented Sep 16, 2024

That was good idea. I added settings for those.

@kuldan5853
Copy link

@ISO-B I have tried setting up my own build environment after talking with nicholas a while back, but I just have not enough clue what I'm doing to get a successful build going - would you be willing to build me an APK of your repo (including your three pull requests) so I can test this for a bit on my car?

@ISO-B
Copy link
Contributor Author

ISO-B commented Oct 10, 2024

Sure. If you are on ABS discord server send message to me and I will provide apk for testing

@kuldan5853
Copy link

kuldan5853 commented Oct 11, 2024

Hey, thanks to the awesome @ISO-B I was able to give this a test on real hardware, and what I have been seeing has been very promising.

First, the great stuff (Library 1 has ~1.000 Books, Library 2 has ~5.000 Books):

  • Library browsing works as expected, and performance was pretty great (I tested on a parking lot away from home on an LTE connection for "real world" testing), and I'd say that the responsiveness of the library browsing etc. was great, even better than using the web version for my big library on my PC - Android Auto seems to do a lot of caching and prefetching, and it works great.

  • I initially enabled the new paginated results and they work fine, but since performance was so good I ended up disabling it and just used the Android Auto pagination instead

And here's my findings for improvement:

  • Podcasts currently do not work / are not supported

  • Libraries with "Books/Comics" are listed but have no entries

  • The Series view currently does not use the Sequence Numbers of Books for sorting, it's A-Z only

I had a quick chat with ISO-B about this, and it seems all three of these issues should be pretty easy to fix.
There was also the idea of adding asc/desc sort orders to the views to make navigating big libraries easier (desc = newest in a series on top).

Oh, and something I just thought of - I'd be very thankful for a "recently added books" view per library as well.

Overall, very happy with what I've seen and I really hope after a few tweaks this will make it into main.

@kuldan5853
Copy link

Found a bug (I think) - when you open the app / connect to Android Auto while the phone has limited connectivity / the app can't reach the server, you get stuck on a "Downloads" page without any way to get anywhere else.

While in this state, the app is still responsive (on the phone), so I could for example start playback via the phone and also got the "now playing" to display on AA - but there was no way to get back to the navigation bar.

PXL_20241013_174037021 MP

@ISO-B
Copy link
Contributor Author

ISO-B commented Oct 13, 2024

Podcasts currently do not work / are not supported

I accidentally removed podcast browsing. Probably managed to get it back, but can't say before I find time to test.

Libraries with "Books/Comics" are listed but have no entries

Made fix to this using data from library stats endpoint.

I will first test these and after that I will commit to git and provide new test build for Kuldan

- Hide libraries without audiobooks
- Sort books in series by sequence value
- Added option for selecting ASC or DESC sorting for series
- Order authors alphabetically
@ISO-B
Copy link
Contributor Author

ISO-B commented Oct 27, 2024

We have been doing quite lot of testing with @kuldan5853. Libraries without audiobooks are now hidden from Android Auto. Series are sorted using sequence values. There is also setting which allows using ascending or descending order for books in series. Authors weren't always on alphabetical order, but are now sorted. Podcasts are now working again. All bugs should be now fixed.

@kuldan5853 confirmed that getting stuck on downloads tab also happens on production version of app. I can take a look for that problem, but it is not related to this PR so it should be fixed with different PR.

@advplyr
Copy link
Owner

advplyr commented Nov 2, 2024

I think we should remove the settings for alphabetical drawdown and force a reasonable standard.

Requesting 10,000 series is too much. Have you tested with a library that large? I think this would be a very large payload that could cause memory issues. Even 1,000 is too much I think. We need some form of pagination for the queries or just show the first 100 and try to get the search working. We could also set up an endpoint on the server to send back data we need to build the directory structure including the alphabetized directories. Building that client side means we have to load the entire library.

When I was first trying to build with android auto a few years ago I could never get the search working. I just tested now and it sort of worked for the first time but showed a bunch of empty directories that I had to look into to see if a playable item was in there.

@advplyr
Copy link
Owner

advplyr commented Nov 2, 2024

I don't understand why there are 2 different number inputs for the alphabetical drawdown settings. Why would we want 2 different settings there?

@kuldan5853
Copy link

kuldan5853 commented Nov 2, 2024

I think we should remove the settings for alphabetical drawdown and force a reasonable standard.

Requesting 10,000 series is too much. Have you tested with a library that large?

My collection is ~1.000 Books and ~5.000 Books in 2 different libraries, and I turned off the drawdown by setting the limit to 10.000 myself (to let the Android Auto A...Z do it's magic). I only have 200 series on each library though,

Performance for that was very fast and usable, I think with up to 1.000 series it should sitll be ok (this is all tested on 5G and on my phone).

However, I do agree that I didn't really understand the two values in the setup and personally didn't use the alphabetical drawdown besides to test it.

Browsing by Author / Series utilizing the built-in A...Z menus was performant eough for my use case (it honestly felt faster than using the app on the phone), so I didn't miss a search, but yeah having one might be useful.

FWIW, I can also say that I have not noticed any discernable differences between testing this in the emulator and on my actual phone in my real car, the emulator is pretty good by now. The main case where the physical phone was useful for testing was changing/bad connectivity etc.

@ISO-B
Copy link
Contributor Author

ISO-B commented Nov 2, 2024

I don't understand why there are 2 different number inputs for the alphabetical drawdown settings. Why would we want 2 different settings there?

Now that I think about it one would be enough.

I think we should remove the settings for alphabetical drawdown and force a reasonable standard.

Requesting 10,000 series is too much. Have you tested with a library that large? I think this would be a very large payload that could cause memory issues. Even 1,000 is too much I think. We need some form of pagination for the queries or just show the first 100 and try to get the search working. We could also set up an endpoint on the server to send back data we need to build the directory structure including the alphabetized directories. Building that client side means we have to load the entire library.

My test library has ~4,000 books with 800 series from 2,500 authors. With that amount it seemed fast enough. Didn't notice any memory issues on server nor app.
There is two reasons why I think alphabetical drawdown is needed:

  1. It is much faster and safer to use while driving.
    • It can be used with physical buttons unlike search. My car has scroll wheel that can be used to scroll through list. I can use built in A...Z option with scroll wheel, but it is pain to get to it and requires more scrolling.
    • With search I need to try to hit right letter. You can probably use voice input for search, but it seems to be hit or miss when I have books with multiple different language
    • Android Auto voice commands could also help with searching and safety, but at least for me problem is that Finnish is not supported and while using English for voice commands Finnish words are not recognized correctly.
  2. Android Auto has 1000 item limit for lists. In case that library has more than 1000 authors/series/anything you can't use built-in A..Z thing as it cant jump to section that is not available in that list. We could put paging links to be first items in lists but switching between pages just to use that A..Z thingy feels bit odd vs picking first letter from list and selecting correct item from next page.

Even though search is not useful for me, it will need to be working. I can take a look for that too at some point.

Reason for doing fetching data as it is now made was just to see if I can make browsing work for android auto. Didn't want to commit making API changes and then notice that I can't get android auto side to work. Having endpoint that does tree structure would make things easier, but it would still make same amount of data as for now code fetches all/most browsable content when started.

Couple things that I would like to add at some point; newest episodes for podcasts and recently added books and discovery for book libraries.

@kuldan5853
Copy link

Ah, right...I forgot about the 1000 items limit, as none of my libraries gets over that one. In that case, I think the functionality as is is pretty decent and advantageous vs. a 1/2/3 style paginated list..

@ISO-B
Copy link
Contributor Author

ISO-B commented Nov 3, 2024

Also for long run having library fully cached to app(Offline library) would be helpful for Android Auto too. If you have lot of downloaded books you can't easily browse those on AA when you don't have internet connection.

@kuldan5853
Copy link

@ISO-B one more thing you might want to integrate before the code gets merged is the "recently added" section as you mentioned a while ago - that would make ist mostly feature complete I think.

@ISO-B ISO-B marked this pull request as draft November 8, 2024 10:05
Search now queries data from server. Results are grouped by books, series and authors.
General:
 - New top menu item Recent is added
 - Library caches are cleared when switching server

Search:
 - Is done using server API
 - Latest search is cache to prevent need to make new request when returning from browsable item.
 - Results are grouped by book, series, author and split by library
 - Only searches libraries with audio content

Library personalized shelves:
 - Recent books, series, authors, podcasts and episodes shelves are listed under Recent top menu
 - Discovery shelves can be found under library many from corresponding library
Icons:
- Static browsable list items everywhere have hardcoded icons
- Libraries use icons that are defined on server

Start up / Initial loading:
- Initial loading first loads libraries from server. After that personalized shelves and items in progress are fetched simultaneously. Top menu items are update after every stage.
- If network connection is not available when android auto starts app tries to do initial loading again when network connection becomes available again
@ISO-B
Copy link
Contributor Author

ISO-B commented Nov 17, 2024

Status update:

General:

  • New tab Recent is added
  • Library caches are cleared when switching server
  • Streamlined browsing settings to single setting
  • Podcast episodes show publish date in subtitle

Search:

  • Is done using server API
  • Latest search is cache to prevent need to make new request when returning from browsable item.
  • Results are grouped by book, series, author and split by library
  • Only searches libraries with audio content

Library personalized shelves:

Icons:

  • Static browsable list items everywhere have hard-coded icons
  • Libraries use icons that are defined on server

Start up / Initial loading:

  • Initial loading first loads libraries from server. After that personalized shelves and items in progress are fetched simultaneously. Top menu items are update after every stage.
  • If network connection is not available when android auto starts app tries to do initial loading again when network connection becomes available again

I will add fix for #1083 before changing PR from draft.

@ISO-B ISO-B marked this pull request as ready for review November 18, 2024 18:21
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.

[Enhancement]: Allow browsing books by author / series (and a full list) on Android Auto
3 participants