Giter VIP home page Giter VIP logo

downloader's Introduction

Downloader


Useful library for downloading file, mp3, mp4, ..... any file

Options

  • pause, resume, cancel, queue
  • multi download
  • add header request
  • set download directory
  • set time out connection
  • show progress download (percent, downloaded size, total size)
  • event every action (onStart, onPause, onResume, onProgress, onComplete, onFailure, onCancel)

Issue

Usage

add to root build.gradle

    maven { url "https://jitpack.io" }

add to module build.gradle

    implementation 'com.github.alirezat775:downloader:{latest-version}'

contribution guidelines

please commit in development branch and send a pull request to merge development branch. explain better in a commit message, don't remove class author and add your data in a header of class

downloader's People

Contributors

alirezat775 avatar mithrandir21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

downloader's Issues

DownloadedSize not work when pause and resume in File .ZIP.

when i startdownload after that pause and resume appear to DownloadedSize is Increase.
downloadsize and percent will increase when i press pause resume
onProgressUpdate: percent --> 241 downloadedSize --> 26767949 totalSize --> 11106893
img_20200717

java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/user/0/packagename/databases/downloader_db

hello, when using the library, I encountered a problem:

sometimes lib calls onFailure with such reason message:

java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/user/0/packagename/databases/downloader_db
  1. maybe better to pass exception as parameter, for its future custom handing in client code? F.ex, if it is network exception, it can be handled in one way, if this is IOException -- another way to handle it.
  2. actually I can't understand, why it throws exception like in title of this issue.

If this info will help with understanding:
I'm using this lib for loading images in recyclerview as context I'm using applicationContext.
Can it be cuz, fast scrolling of recyclerview and, in this reason, several instances of Downloader, creating?

Download Fails because of file name length

Noted that some of my downloads were failing because the autogenerated file name was too long.

I was able to trace the source of the issue to the 'DownloadTask.kt' file. After some tries I updated the code on my end to

/**

  • Added the name string checker to make sure the 'file is too long' exception doesn't happen again
    */
    fileName = when {
    fileName == null -> System.currentTimeMillis().toString()
    fileName.toString().length > 20 -> cleanName()
    else -> fileName
    }

private fun cleanName(): String{
return DatabaseApp().getDownloadsDao(context.get()!!.applicationContext).getDownloadByUrl(url).name
.replace("[VIDEO ONLY]", "").replace("[AUDIO ONLY]", "").substring(0, 25)
}

This checks the filename size and the cleanName creates a 25 character name to append to the file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.