craigsapp / website-polish-scores

Front-end for digital transcriptions of the Polish Music Heritage in Open Access project
https://polishscores.org
3 stars 1 forks source link

Limit random choice of score to search paramters in URL #266

Closed craigsapp closed 4 months ago

craigsapp commented 4 months ago

The id random will display the work page of a random score:

https://polishscores.org/?id=random

Such as:

https://polishscores.org/?id=pl-kk--kk-i-336--002

Screenshot 2024-02-09 at 21 37 47

When search parameters are also given, then apply the search first, and then choose a random work from the search results.

For example

https://polishscores.org/?id=random&c=Gimeshoffer

Should return a random work from the list of three works by the composer Gimeshoffer:

Screenshot 2024-02-09 at 21 39 50
craigsapp commented 4 months ago

Implemented in commit https://github.com/craigsapp/website-polish-scores/commit/465037e2825a20f4cad4ca93ced7b9d98dda61b8

https://polishscores.org/?id=random&c=Kaspar

Goes to: https://polishscores.org/?id=pl-kk--kk-i-397--001-003

Screenshot 2024-02-10 at 16 53 34

Running again:

https://polishscores.org/?id=random&c=Kaspar

Goes to https://polishscores.org/?id=pl-kk--kk-i-397--001-002

Screenshot 2024-02-10 at 16 55 04

Going to the browse page, the Composer field is filled in:

Screenshot 2024-02-10 at 16 57 16
craigsapp commented 4 months ago

Sometimes the lyrics and pitch search indexes are not loaded from the server when loading a random work:

Screenshot 2024-02-10 at 14 14 20

Probably related to a limit in the number of active downloads from a single server in the web browser (they could be competing with the files downloaded when display the random work page). Try delaying download of these indexes (all the time, or when a random work is being loaded).

craigsapp commented 4 months ago

Random work from a library:

https://polishscores.org/?s=PL-Kc&id=random

goes in this case to https://polishscores.org/?id=pl-kc--40102-iii-1-saf--002-023

Screenshot 2024-02-10 at 17 25 44

Successive clicking on the random button in the navigator:

Screenshot 2024-02-10 at 17 27 12

will subsequently take you to other random works in the archive/library (since the PL-Kc library is selected on the browse page and a search has been done before choosing a random work in that library from the URL).