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

Extend local webserver to provide files from internal/external storage via directory structure #70

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

Conversation

stephanritscher
Copy link

Hi there,

I extended the local webserver included in DroidUPnP to show a new folder "Directories" which includes all storage volumes (internal and external) and their directory trees recursively. The feature may be disabled in the settings.

Only media files and folders will be shown. File type detection will be based on content (default) or file extension (faster) which can be configured in the settings.

Another speed optimization would be to not count the number of directory entries (not implemented).

Currently only reduced meta data is provided (no length of audio/videos, resolution of pictures/videos).

Unfortunately I had to increase the API level to 24 which works for my devices, but might not be suitable for others. This was mostly due to recent extensions of the StorageManager API. I'm also not happy to use an inofficial API here (getPath). Alternatives could be

  • using heuristical approaches (known paths)
  • parsing vold or mount output
  • using Environment parameters for internal / external storage (missing some edge cases with more volumes)
  • disabling the directory feature for API < 24
  • using one of the above as fallback for API < 24.

I tested with Kodi media center only.

Is anyone interested in merging this feature into the main branch?

Best regards,
Stephan Ritscher

- Persist/restore last selected renderer device in ServiceController
- Persist/restore last selected content directory device in ServiceController
- Persist/restore last path per content directory device in
  ContentDirectoryFragment
- Handle ACTION_SEND intents and play URI on last selected device in
  Main
- Implement playOnNextSelectedRendererUri in UPnPServiceController
- Implement launchUri in RendererCommand
- Sort files alphabetically before servicing in DirectoryContainer
@stephanritscher
Copy link
Author

I just added another feature.

DroidUPnP now stores the selected renderer and content directory (device and path) in the shared preferences so it can restore them after restarting the whole application.

This was actually a preparation for the "Play with DroidUPnP" intent I added. It is meant to be a method to share a video URI to be played on the currently selected renderer.

I implemented and tested this intent in combination with Firefox for Android. Whenever you have a native HTML5 player in Firefox, you can long click the player widget and use the share button from there. Select "Play with DroidUPnP" and DroidUPnP will start. Internally, theUPnP service is started and as soon as a renderer is selected (which by default will be the latest selected renderer), the playback of the renderer will be set to the shared video URI.

Notes:

  • Only mime type video/* will be handled by the intent now
  • Using the share button next to the firefox address bar does not work (other intent action type/mime type; I think it is not possible to know the proper mime type here before since it is meant for arbitrary URI sharing)
  • Most likely there are other combinations of apps and share methods which won't work, but it might be easy to extend it in some cases (as long as you can easily figure out the proper video URI).

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.

1 participant