Allow clients to determine whether data is intentionally unavailable
For instance, bandcamp users will always see
when viewing streams and
when viewing comments. The same applies to the "subscriber count", which is by design not provided by Bandcamp.
The reason is that the client (the NewPipe app) cannot differentiate between data that has failed to extract and data that is generally not available for the service.
There's an infinite amount of possible solutions to this:
- return
-1if extraction fails,-2if not available by design - return
nullif extraction fails,-1if intentional - return
-1if extraction fails,nullif intentional - return
Optional.of(-1)if extraction fails, return an emptyOptionalif intentional - add extra method call that determines which fields are filled by the provider (similar to
MediaCapabiliy) - …
If data is not available intentionally, NewPipe should hide the affected views. This makes the services that don't provide the corresponding data fields look less broken in the app.
Please comment what you think would be the best solution to this.
Let's create two constants and return them:
-
COUNT_UNAVAILABLE = -1 -
COUNT_EXTRACTION_FAILED = -2