Set filenames properly
This commit is contained in:
@@ -29,15 +29,15 @@ func MainApp(configPath string) {
|
||||
log := logutil.NewLogger(logPath)
|
||||
zurglog := log.Named("zurg")
|
||||
|
||||
if log.Level() == zapcore.DebugLevel {
|
||||
zurglog.Infof("debug logging is enabled; if you are not debugging please set LOG_LEVEL=info in your environment")
|
||||
}
|
||||
|
||||
zurglog.Debugf("PID: %d", os.Getpid())
|
||||
zurglog.Infof("Version: %s", version.GetVersion())
|
||||
zurglog.Infof("GitCommit: %s", version.GetGitCommit())
|
||||
zurglog.Infof("BuiltAt: %s", version.GetBuiltAt())
|
||||
|
||||
if log.Level() == zapcore.DebugLevel {
|
||||
zurglog.Infof("Debug logging is enabled; if you are not debugging please set LOG_LEVEL=info in your environment")
|
||||
}
|
||||
|
||||
config, configErr := config.LoadZurgConfig(configPath, log.Named("config"))
|
||||
if configErr != nil {
|
||||
zurglog.Errorf("Config failed to load: %v", configErr)
|
||||
|
||||
@@ -110,9 +110,11 @@ func (t *TorrentManager) GetKey(torrent *Torrent) string {
|
||||
func (t *TorrentManager) GetPath(file *File) string {
|
||||
if t.Config.ShouldExposeFullPath() {
|
||||
filename := strings.TrimPrefix(file.Path, "/")
|
||||
return strings.ReplaceAll(filename, "/", " - ")
|
||||
filename = strings.ReplaceAll(filename, "/", " - ")
|
||||
return filename
|
||||
}
|
||||
return filepath.Base(file.Path)
|
||||
filename := filepath.Base(file.Path)
|
||||
return filename
|
||||
}
|
||||
|
||||
func (t *TorrentManager) writeTorrentToFile(instanceID string, torrent *Torrent) {
|
||||
|
||||
@@ -147,7 +147,6 @@ func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent {
|
||||
if torrentFromCache, exists := infoCache.Get(rdTorrent.ID); exists &&
|
||||
!torrentFromCache.AnyInProgress() &&
|
||||
torrentFromCache.SelectedFiles.Count() == len(rdTorrent.Links) {
|
||||
t.ResetSelectedFiles(torrentFromCache)
|
||||
return torrentFromCache
|
||||
}
|
||||
|
||||
@@ -165,6 +164,7 @@ func (t *TorrentManager) getMoreInfo(rdTorrent realdebrid.Torrent) *Torrent {
|
||||
|
||||
if !hasBrokenFiles {
|
||||
infoCache.Set(rdTorrent.ID, torrentFromFile)
|
||||
t.ResetSelectedFiles(torrentFromFile)
|
||||
return torrentFromFile
|
||||
} else {
|
||||
t.log.Warnf("Torrent %s has broken files, will not save on info cache", rdTorrent.ID)
|
||||
|
||||
Reference in New Issue
Block a user