G-Ray / pikatorrent

BitTorrent client ⚡. For mobile, desktop & server.
https://www.pikatorrent.com
GNU General Public License v3.0
309 stars 14 forks source link

Unable to edit download path in Android #94

Closed Jagadishwar49 closed 3 months ago

Jagadishwar49 commented 9 months ago

The download path is in root folder and most of the video player are not able to recognise this video Pls add edit download path

Android 13

Jagadishwar49 commented 9 months ago

![Uploading Screenshot_20230917-001558_pikatorrent.png…]()

G-Ray commented 9 months ago

Thank you @Jagadishwar49 , currently the downloaded files are stored into an app's private folder. I think it is not accessible by other apps like video players or files managers.

In the meantime, you should be able to open the "files" screen, and click on the "Open" button to open your file with another app.

We might prefer to set the download folder at the start of the app, with a default path as the /sdcard/Download directory on android. This might trigger a permission request though.

G-Ray commented 9 months ago

So I just explored solutions for this:

By default, we can write to /sdcard/download (I hope it exists on all android implementations, though?). Read access is not allowed. So after reinstalling the app, PikaTorrent will not be able to reuse existing downloaded folders.

Intent ACTION_OPEN_DOCUMENT_TREE allows to select a folder while giving permission, but it does return a content (SAF URI), which cannot be translated to an absolute path as far as I know. (selected folder could be a remote one, not on the local device).

The MANAGE_EXTERNAL_STORAGE permission could allow access to all files, but play store seems to limit the access to Download or Documents folders except if the app has specific use case like file browsers. See https://developer.android.com/training/data-storage/manage-all-files With this permission, IIUC we should build our own UI to select a folder. Additionally, I guess a permission prompt will be required to grant MANAGE_EXTERNAL_STORAGE permission ? From a security point of view, this solution should be avoided, pikatorrent really does not need to access all the filesystem, in my opinion.

That's a pity Intent ACTION_OPEN_DOCUMENT_TREE offers a great UX for this but cannot be used due to the returned SAF URIs instead of absolute paths.

I'm working on improving files listing in the app. It is already possible to open a video file with vlc for instance, and stream the video with cast feature. Also, if one want to transfer file from Android to a computer, it's possible to share the torrent link (with local peers discovery, it should be very fast), or share the file directly (eg. with Nearby share). Are there any missing use cases? We might not even need to select a folder on mobile if there are not.

Note: If the files are in another folder, the patch https://github.com/expo/expo/pull/23739 needs to be included to PikaTorrent to allow opening files.

QuentinSc commented 8 months ago

Unable to play mkv with kodi or vlc on shield tv. Work on galaxy tab with samsung video player

G-Ray commented 7 months ago

So for the next release, it will be possible to edit location path to a folder inside /sdcard/Documents or /sdcard/Download directories. Default location for new downloads will now be /sdcard/Download. Android seems to restrict filesystem permissions more & more, feel free to open another issue if you have a specific use case.

G-Ray commented 3 months ago

Closing this as this should now be possible, feel free to reopen an issue