Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AppInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static AppInit conf
}
#endregion

public string torrentsStatFile = "Data/temp/stats.json";

public string listenip = "any";

Expand Down
5 changes: 4 additions & 1 deletion Controllers/StatsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ public ActionResult Torrents(string trackerName)

if (string.IsNullOrWhiteSpace(trackerName))
{
return Content(System.IO.File.ReadAllText("Data/temp/stats.json"));
if (System.IO.File.Exists(AppInit.conf.torrentsStatFile))
return Content(System.IO.File.ReadAllText(AppInit.conf.torrentsStatFile));
else
return Content(string.Empty);
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion Engine/StatsCron.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ async public static Task Run()
}
}

File.WriteAllText("Data/temp/stats.json", JsonConvert.SerializeObject(stats.OrderByDescending(i => i.Value.alltorrents).Select(i => new
Directory.CreateDirectory(Path.GetDirectoryName(AppInit.conf.torrentsStatFile)); // Creates all directories and subdirectories in the specified path unless they already exist.
File.WriteAllText(AppInit.conf.torrentsStatFile, JsonConvert.SerializeObject(stats.OrderByDescending(i => i.Value.alltorrents).Select(i => new
{
trackerName = i.Key,
lastnewtor = i.Value.lastnewtor.ToString("dd.MM.yyyy"),
Expand Down