Allow accessing same filename differently
This commit is contained in:
@@ -88,7 +88,7 @@ func GetTorrents(accessToken string) ([]Torrent, error) {
|
||||
baseURL := "https://api.real-debrid.com/rest/1.0/torrents"
|
||||
var allTorrents []Torrent
|
||||
page := 1
|
||||
limit := 10
|
||||
limit := 2500
|
||||
|
||||
for {
|
||||
params := url.Values{}
|
||||
@@ -124,7 +124,7 @@ func GetTorrents(accessToken string) ([]Torrent, error) {
|
||||
|
||||
allTorrents = append(allTorrents, torrents...)
|
||||
|
||||
totalCountHeader := "10" // resp.Header.Get("x-total-count")
|
||||
totalCountHeader := resp.Header.Get("x-total-count")
|
||||
totalCount, err := strconv.Atoi(totalCountHeader)
|
||||
if err != nil {
|
||||
break
|
||||
@@ -152,9 +152,9 @@ func deduplicateTorrents(torrents []Torrent) []Torrent {
|
||||
} else {
|
||||
// If hash is different, delete old entry and create two new entries
|
||||
delete(mappedTorrents, t.Filename)
|
||||
newKey1 := t.Filename + " - " + t.Hash[:4]
|
||||
newKey2 := existing.Filename + " - " + existing.Hash[:4]
|
||||
newKey1 := fmt.Sprintf("%s - %s", t.Filename, t.Hash[:4])
|
||||
mappedTorrents[newKey1] = t
|
||||
newKey2 := fmt.Sprintf("%s - %s", existing.Filename, existing.Hash[:4])
|
||||
mappedTorrents[newKey2] = existing
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -6,12 +6,11 @@ type FileJSON struct {
|
||||
}
|
||||
|
||||
type UnrestrictResponse struct {
|
||||
Filename string `json:"filename"`
|
||||
Filesize int64 `json:"filesize"`
|
||||
Link string `json:"link"`
|
||||
Host string `json:"host"`
|
||||
Download string `json:"download,omitempty"`
|
||||
Streamable int `json:"streamable,omitempty"`
|
||||
Filename string `json:"filename"`
|
||||
Filesize int64 `json:"filesize"`
|
||||
Link string `json:"link"`
|
||||
Host string `json:"host"`
|
||||
Download string `json:"download,omitempty"`
|
||||
}
|
||||
|
||||
type Torrent struct {
|
||||
|
||||
Reference in New Issue
Block a user