Add support for rar extraction
This commit is contained in:
@@ -328,20 +328,10 @@ func (r *HTTPClient) CanFetchFirstByte(url string) bool {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||
defer cancel()
|
||||
req = req.WithContext(ctx)
|
||||
|
||||
resp, err := r.Do(req)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
// If server supports partial content
|
||||
if resp.StatusCode/100 == 2 {
|
||||
buffer := make([]byte, 1)
|
||||
_, err = resp.Body.Read(buffer)
|
||||
if err == nil {
|
||||
return true
|
||||
}
|
||||
resp, _ := r.Do(req)
|
||||
if resp != nil {
|
||||
defer resp.Body.Close()
|
||||
return resp.StatusCode == 200 || resp.StatusCode == 206
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ func (rd *RealDebrid) GetTorrents(onlyOne bool) ([]Torrent, int, error) {
|
||||
page := 1
|
||||
// compute ceiling of totalCount / limit
|
||||
maxPages := (totalCount + rd.cfg.GetTorrentsCount() - 1) / rd.cfg.GetTorrentsCount()
|
||||
rd.log.Debugf("Torrents total count is %d, max pages is %d", totalCount, maxPages)
|
||||
rd.log.Debugf("Torrents total count is %d, total page count is %d", totalCount, maxPages)
|
||||
maxParallelThreads := 4
|
||||
if maxPages < maxParallelThreads {
|
||||
maxParallelThreads = maxPages
|
||||
@@ -370,7 +370,7 @@ func (rd *RealDebrid) GetDownloads() []Download {
|
||||
|
||||
// compute ceiling of totalCount / limit
|
||||
maxPages := (totalCount + limit - 1) / limit
|
||||
rd.log.Debugf("Total downloads count is %d, max pages is %d", totalCount, maxPages)
|
||||
rd.log.Debugf("Total downloads count is %d, total page count is %d", totalCount, maxPages)
|
||||
maxParallelThreads := 8
|
||||
if maxPages < maxParallelThreads {
|
||||
maxParallelThreads = maxPages
|
||||
|
||||
@@ -7,9 +7,10 @@ func IsPlayable(filePath string) bool {
|
||||
return strings.HasSuffix(filePath, ".avi") ||
|
||||
strings.HasSuffix(filePath, ".m2ts") ||
|
||||
strings.HasSuffix(filePath, ".m4v") ||
|
||||
strings.HasSuffix(filePath, ".mkv") ||
|
||||
strings.HasSuffix(filePath, ".mp4") ||
|
||||
strings.HasSuffix(filePath, ".mkv") || // confirmed working
|
||||
strings.HasSuffix(filePath, ".mp4") || // confirmed working
|
||||
strings.HasSuffix(filePath, ".mpg") ||
|
||||
strings.HasSuffix(filePath, ".ts") ||
|
||||
strings.HasSuffix(filePath, ".wmv")
|
||||
strings.HasSuffix(filePath, ".wmv") ||
|
||||
strings.HasSuffix(filePath, ".m4b") // confirmed working
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user