LivingWithHippos/unchained-android

[FEATURE REQUEST] Batch url add

Invictaz opened this issue · 5 comments

If you add 5 episodes like

https://1fichier.com/?blablabla.S01E01.mkv

https://1fichier.com/?blablabla.S01E02.mkv

https://1fichier.com/?blablabla.S01E03.mkv

https://1fichier.com/?blablabla.S01E04.mkv

https://1fichier.com/?blablabla.S01E05.mkv

It adds either only the first or the last episode.

The only way to add these is via the real-debrid website.

From other apps I remember that multiple items would be separated by ; or , or others. This is not possible because the links are retrieved from a pastefile that shows them line by line.

I think you can add them if they are separated by a newline but I need to double check

Link 1
Link 2
Link 3

I tried but that didn't work (from Samsung notes)

Screenshot_20240123_211825_Samsung Notes

Confirmed, code for multiple links is already there, the problem is probably that the first line is recognized as a web link and then the whole list is sent as a single link.

Interesting. Is it fixable?

Interesting. Is it fixable?

yes of course the code just need to be moved and fixed a little

link.isWebUrl() || link.isSimpleWebUrl() -> {
viewModel.postMessage(getString(R.string.loading_host_link))
enableButtons(binding, false)
var password: String? = binding.tePassword.text.toString()
// we don't pass the password if it is blank.
// N.B. it won't work if your password is made up of spaces but then again
// you deserve
// it
if (password.isNullOrBlank()) password = null
val remote: Int? =
if (binding.switchRemote.isChecked) REMOTE_TRAFFIC_ON else null
viewModel.fetchUnrestrictedLink(link, password, remote)
}
link.isBlank() -> {
viewModel.postMessage(getString(R.string.please_insert_url))
}
link.isContainerWebLink() -> {
viewModel.unrestrictContainer(link)
}
link.split("\n").firstOrNull()?.trim()?.isWebUrl() == true -> {
// todo: support list of magnets/torrents
val splitLinks: List<String> =
link.split("\n").map { it.trim() }.filter { it.length > 10 }
viewModel.postMessage(getString(R.string.loading))
enableButtons(binding, false)
// new folder list, alert the list fragment that it needs updating
activityViewModel.setListState(ListState.UpdateDownload)
val action =
NewDownloadFragmentDirections.actionNewDownloadDestToFolderListFragment(
folder = null,
torrent = null,
linkList = splitLinks.toTypedArray()
)
findNavController().navigate(action)
}