Commit Graph

25 Commits

Author SHA1 Message Date
Stypox a9e21a35ea
Delete pending missions with invalid storage 2021-07-21 10:52:04 +02:00
Stypox 21b8df0375
Check if file really exists before asking user to overwrite it 2021-06-08 10:40:45 +02:00
wb9688 1164ea52f9
Move Stored(File|Directory)Helper into NewPipe 2021-06-08 10:40:44 +02:00
TacoTheDank 0274cd6beb Lint: Inner class may be static 2020-11-18 18:02:33 -05:00
Isira Seneviratne b0b0a75c87 Use Collection.removeIf() instead of using Iterator.remove() to remove elements conditionally. 2020-11-01 14:44:07 +05:30
Isira Seneviratne abcacf8c74 Use Comparator's comparing(), nullsLast() and reversed() methods. 2020-11-01 14:44:04 +05:30
kapodamy 00eddcb237 android 5 (lollipop) fixup
this commit attempts to fix the pickAvailableTemporalDir() method in ROMS that not are CTS compliant.
2020-01-14 00:05:34 -03:00
kapodamy e6d9d8e26d code cleanup
* migrate few annotations to androidx
* mission recovery: better error handling (except StreamExtractor.getErrorMessage() method always returns an error)
* post-processing: more detailed progress

[file specific changes]

DownloadMission.java
* remove redundant/boilerplate code (again)
* make few variables volatile
* better file "length" approximation
* use "done" variable to count the amount of bytes downloaded (simplify percent calc in UI code)

Postprocessing.java
* if case of error use "ERROR_POSTPROCESSING" instead of "ERROR_UNKNOWN_EXCEPTION"
* simplify source stream init

DownloadManager.java
* move all "service message sending" code to DownloadMission
* remove not implemented method "notifyUserPendingDownloads()" also his unused strings

DownloadManagerService.java
* use START_STICKY instead of START_NOT_STICKY
* simplify addMissionEventListener()/removeMissionEventListener() methods (always are called from the main thread)

Deleter.java
* better method definition

MissionAdapter.java
* better method definition
* code cleanup
* the UI is now refreshed every 750ms
* simplify download progress calculation
* indicates if the download is actually recovering
* smooth download speed measure
* show estimated remain time

MainFragment.java:
* check if viewPager is null (issued by "Apply changes" feature of Android Studio)
2019-11-26 10:46:31 -03:00
kapodamy da052df106 update DownloadManager.java
* check if the directory pending_downloads was created
2019-11-26 10:46:29 -03:00
kapodamy 60d4c8a55d fallback for pending downloads directory 2019-11-26 10:46:29 -03:00
kapodamy 86dafdd92b long-term downloads resume
* recovery infrastructure
* bump serialVersionUID of DownloadMission
* misc cleanup in DownloadMission.java
* remove unused/redundant from strings.xml
2019-11-26 10:46:26 -03:00
Robin bf2a3ca043 Migrate to AndroidX 2019-10-04 14:59:08 +02:00
kapodamy 1a643126de Changes for Android 9 (Pie)
* validate the stored file before start the mission
* add warning on StoredFileHelper.java
* simplify the communication between MissionAdapter and DownloadManagerService.java since shares the same looper
* simplify setVisible() "start/pause all downloads" buttons logic
2019-09-01 18:37:06 -03:00
kapodamy 10dfcbf0b9 add manual switch in download setting fragment
switch for:
* Java I/O Api
* Storage Access Framework
2019-08-17 13:38:33 -03:00
kapodamy 0375194e7d fix start/pause buttons disappear when screen goes off
* fix start/pause buttons disappear, issued by RecyclerView re-draw
* show start/pause buttons in pair to avoid confusions
2019-08-03 12:28:58 -03:00
kapodamy 7b948f83c3 Space reserving tweaks for huge video resolutions
* improve space reserving, allows write better 4K/8K video data
* do not use cache dirs in the muxers, Android can force close NewPipe if the device is running out of storage. Is a aggressive cache cleaning >:/
* (for devs) webm & mkv are the same thing
* calculate the final file size inside of the mission, instead getting from the UI
* simplify ps algorithms constructors
* [missing old commit message] simplify the loading of pending downloads
2019-06-03 18:26:26 -03:00
kapodamy d00dc798f4 more SAF implementation
* full support for Directory API (Android Lollipop or later)
* best effort to handle any kind errors (missing file, revoked permissions, etc) and recover the download
* implemented directory choosing
* fix download database version upgrading
* misc. cleanup
* do not release permission on the old save path (if the user change the download directory) under SAF api
2019-06-03 18:18:20 -03:00
kapodamy f6b32823ba Implement Storage Access Framework
* re-work finished mission database
* re-work DownloadMission and bump it Serializable version
* keep the classic Java IO API
* SAF Tree API support on Android Lollipop or higher
* add wrapper for SAF stream opening
* implement Closeable in SharpStream to replace the dispose() method

* do required changes for this API:
** remove any file creation logic from DownloadInitializer
** make PostProcessing Serializable and reduce the number of iterations
** update all strings.xml files
** storage helpers: StoredDirectoryHelper & StoredFileHelper
** best effort to handle any kind of SAF errors/exceptions
2019-06-03 18:16:41 -03:00
kapodamy 9e34fee58c New MP4 muxer + Queue changes + Storage fixes
Main changes:
* correctly check the available space (CircularFile.java)
* misc cleanup (CircularFile.java)
* use the "Error Reporter" for non-http errors
* rewrite network state checking and add better support for API 21 (Lollipop) or higher
* implement "metered networks"
* add buttons in "Downloads" activity to start/pause all pending downloads, ignoring the queue flag or if the network is "metered"
* add workaround for VPN connections and/or network switching. Example: switching WiFi to 3G
* rewrite DataReader ¡Webm muxer is now 57% more faster!
* rewrite CircularFile, use file buffers instead of memory buffers. Less troubles in low-end devices
* fix missing offset for KaxCluster (WebMWriter.java), manifested as no thumbnails on file explorers

Download queue:
* remember queue status, unless the user pause the download (un-queue)
* semi-automatic downloads, between networks. Effective if the user create a new download or the downloads activity is starts
* allow enqueue failed downloads
* new option, queue limit, enabled by default. Used to allow one or multiple downloads at same time

Miscellaneous:
* fix crash while selecting details/error menu (mistake on MissionFragment.java)
* misc serialize changes (DownloadMission.java)
* minor UI tweaks
* allow overwrite paused downloads
* fix wrong icons for grid/list button in downloads
* add share option
* implement #2006
* correct misspelled word in strings.xml (es) (cmn)
* fix MissionAdapter crash during device shutdown

New Mp4Muxer + required changes:
* new mp4 muxer (from dash only) with this, muxing on Android 7 is possible now!!!
* re-work in SharpStream
* drop mp4 dash muxer
* misc changes: add warning in SecondaryStreamHelper.java,
* strip m4a DASH files to normal m4a format (youtube only)

Fix storage issues:
* warn to the user if is choosing a "read only" download directory (for external SD Cards), useless is rooted :)
* "write proof" allow post-processing resuming only if the device ran out of space
* implement "insufficient storage" error for downloads
2019-06-03 18:09:43 -03:00
kapodamy f2285c0b19 MP4 muxer +misc modifications
* allow retry downloads with "post-processing failed" error in the new muxer
* MPEG-4 muxer  ¡¡ no DASH output!!
* keep the progress if download fails
* remove TODO in SecondaryStreamHelper.java
* misc clean-up
* delete TestAlgo.java
* delete ExtSDDownloadFailedActivity.java and remove it from AndroidManifest.xml
* use hardcored version for changing icon colors
2019-01-22 18:53:31 -03:00
kapodamy 9f4a7e664f more of the same
* misc code clean-up
* fix weird download speed, before switching the list view
* fix CircularFile.java getting stuck on post-processing huge files >2GiB
* keep crashed post-processing downloads visible to the user
2018-12-01 22:14:56 -03:00
kapodamy eba3b32708 misc improvements
* don't show notifications while download activity
* proper icon in failed download notifications
* re-write list auto-refresh (MissionAdapter.java)
* improve I/O performance (CircularFile.java)
* fix implementation of "save thread position" on multi-thread downloads
2018-11-28 22:24:52 -03:00
kapodamy f3d4d4747a and more fixes
* fix content length reading
* use float overflow. Expensive, double is used instead
* fix invalid cast after click the mission body
* use a list for maximum attemps (downloads)
* minor clean up (DownloadManager.java)
* dont pass SharedPreferences instace to DownloadManager
* use a switch instead of checkbox for cross_network_downloads
* notify media scanner after deleting a finished download
2018-11-24 20:13:18 -03:00
kapodamy d647555e3a more fixes
* use bold style in status (mission_item_linear.xml)
* fix download attemps not begin updated
* dont stop the queue if a download fails
* implement partial wake-lock & wifi-lock
* show notifications for failed downloads
* ¿proper bitmap dispose? (DownloadManagerService.java)
* improve buffer filling (CircularFile.java)
* [Mp4Dash] increment reserved space from 2MiB to 15MiB. This is expensive but useful for devices with low ram
* [WebM] use 2MiB of reserved space
* fix debug warning if one thread is used
* fix wrong download speed when the activity is suspended
* Fix "Queue" menu item that appears in post-processing errors
* fix mission length dont being updated (missing commit)
2018-11-22 23:33:34 -03:00
kapodamy 5825843f68 main commit
Post-processing infrastructure
* remove interfaces with one implementation
* fix download resources with unknow length
* marquee style for ProgressDrawable
* "view details" option in mission context menu
* notification for finished downloads
* postprocessing infrastructure: sub-missions, circular file, layers for layers of abstractions for Java IO streams
* Mp4 muxing (only DASH brand)
* WebM muxing
* Captions downloading
* alert dialog for overwrite existing downloads finished or not.

Misc changes
* delete SQLiteDownloadDataSource.java
* delete DownloadMissionSQLiteHelper.java
* implement Localization from #114

Misc fixes (this branch)
* restore old mission listeners variables. Prevents registered listeners get de-referenced on low-end devices
* DownloadManagerService.checkForRunningMission() now return false if the mission has a error.
* use Intent.FLAG_ACTIVITY_NEW_TASK when launching an activity from gigaget threads (apparently it is required in old versions of android)

More changes
* proper error handling "infrastructure"
* queue instead of multiple downloads
* move serialized pending downloads (.giga files) to app data
* stop downloads when swicthing to mobile network (never works, see 2nd point)
* save the thread count for next downloads
* a lot of incoherences fixed
* delete DownloadManagerTest.java (too many changes to keep this file updated)
2018-11-08 19:00:44 -03:00