Add bin other torrent when torrent is completed

This commit is contained in:
Ben Sarmiento
2024-05-25 15:49:57 +02:00
parent 264d62d0dc
commit b8c67a83cf
4 changed files with 146 additions and 114 deletions

View File

@@ -209,7 +209,7 @@ func (t *TorrentManager) deleteTorrentFile(hash string) {
/// info functions
func (t *TorrentManager) getInfoFiles() mapset.Set[string] {
files, err := filepath.Glob("data/*.info_zurg")
files, err := filepath.Glob("data/*.zurginfo")
if err != nil {
t.log.Warnf("Cannot get files in data directory: %v", err)
return nil
@@ -218,7 +218,7 @@ func (t *TorrentManager) getInfoFiles() mapset.Set[string] {
}
func (t *TorrentManager) writeInfoToFile(info *realdebrid.TorrentInfo) {
filePath := "data/" + info.ID + ".info_zurg"
filePath := "data/" + info.ID + ".zurginfo"
file, err := os.Create(filePath)
if err != nil {
t.log.Warnf("Cannot create info file %s: %v", filePath, err)
@@ -241,7 +241,7 @@ func (t *TorrentManager) writeInfoToFile(info *realdebrid.TorrentInfo) {
}
func (t *TorrentManager) readInfoFromFile(torrentID string) *realdebrid.TorrentInfo {
filePath := "data/" + torrentID + ".info_zurg"
filePath := "data/" + torrentID + ".zurginfo"
file, err := os.Open(filePath)
if err != nil {
if os.IsNotExist(err) {
@@ -262,7 +262,7 @@ func (t *TorrentManager) readInfoFromFile(torrentID string) *realdebrid.TorrentI
}
func (t *TorrentManager) deleteInfoFile(torrentID string) {
filePath := "data/" + torrentID + ".info_zurg"
filePath := "data/" + torrentID + ".zurginfo"
_ = os.Remove(filePath)
}