Skip to content

Commit c01051a

Browse files
committed
fix ffprobe
1 parent 9f8a90e commit c01051a

File tree

5 files changed

+36
-19
lines changed

5 files changed

+36
-19
lines changed

AppInit.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ public static AppInit conf
4949

5050
public bool tracks = false;
5151

52+
/// <summary>
53+
/// 0 - все
54+
/// 1 - день, месяц
55+
/// </summary>
56+
public int tracksmod = 0;
57+
5258
public int tracksdelay = 5000;
5359

5460
public string[] tsuri = new string[] { "http://127.0.0.1:8090" };

Controllers/ApiController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ List<ffStream> FFprobe(TorrentDetails t, out HashSet<string> langs)
498498

499499
var result = tsort.OrderByDescending(i => i.createTime).Take(2_000);
500500
if (apikey == "rus")
501-
result = result.Where(i => i.languages != null && i.languages.Contains("rus"));
501+
result = result.Where(i => (i.languages != null && i.languages.Contains("rus")) || (i.types != null && (i.types.Contains("sport") || i.types.Contains("tvshow") || i.types.Contains("docuserial"))));
502502

503503
jval = JsonConvert.SerializeObject(new
504504
{

Engine/FileDB/FileDB.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ void upt(bool uptfull = false)
121121
upt();
122122
}
123123

124+
if (torrent.ffprobe != null && t.ffprobe == null)
125+
{
126+
t.ffprobe = torrent.ffprobe;
127+
upt();
128+
}
129+
124130
if (updateFull)
125131
updateFullDetails(t);
126132

@@ -149,7 +155,8 @@ void upt(bool uptfull = false)
149155
sid = torrent.sid,
150156
relased = torrent.relased,
151157
sizeName = torrent.sizeName,
152-
magnet = torrent.magnet
158+
magnet = torrent.magnet,
159+
ffprobe = torrent.ffprobe
153160
};
154161

155162
savechanges = true;

Engine/StatsCron.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,13 @@ async public static Task Run()
5050

5151
if (AppInit.conf.tracks && !TracksDB.theBad(t.types))
5252
{
53-
if (TracksDB.Get(t.magnet) != null)
54-
s.trkconfirm = s.trkconfirm + 1;
55-
else
56-
s.trkwait = s.trkwait + 1;
53+
if (!string.IsNullOrEmpty(t.magnet) && t.sid > 0 && t.updateTime > DateTime.Today.AddDays(-20))
54+
{
55+
if (TracksDB.Get(t.magnet) != null)
56+
s.trkconfirm = s.trkconfirm + 1;
57+
else
58+
s.trkwait = s.trkwait + 1;
59+
}
5760
}
5861

5962
stats[t.trackerName] = s;

Engine/Tracks/TracksCron.cs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
using MonoTorrent;
22
using System;
33
using System.Collections.Generic;
4-
using System.Linq;
54
using System.Threading.Tasks;
6-
using System.Web;
75

86
namespace JacRed.Engine
97
{
@@ -23,10 +21,13 @@ async public static Task Run(int typetask)
2321
if (AppInit.conf.tracks == false)
2422
continue;
2523

24+
if (AppInit.conf.tracksmod == 1 && (typetask == 3 || typetask == 4))
25+
continue;
26+
2627
try
2728
{
2829
var starttime = DateTime.Now;
29-
var torrents = new Dictionary<string, (int sid, string magnet)>();
30+
var torrents = new List<(string trackerName, string magnet)>();
3031

3132
foreach (var item in FileDB.masterDb.ToArray())
3233
{
@@ -77,31 +78,31 @@ async public static Task Run(int typetask)
7778
if (TracksDB.theBad(t.types))
7879
continue;
7980

80-
var magnetLink = MagnetLink.Parse(t.magnet);
81-
string hex = magnetLink.InfoHash.ToHex();
82-
if (hex == null)
83-
continue;
81+
//var magnetLink = MagnetLink.Parse(t.magnet);
82+
//string hex = magnetLink.InfoHash.ToHex();
83+
//if (hex == null)
84+
// continue;
8485

85-
torrents.TryAdd(hex, (t.sid, t.magnet));
86+
torrents.Add((t.trackerName, t.magnet));
8687
}
8788
catch { }
8889
}
8990
}
9091
}
9192

92-
foreach (var t in torrents.OrderByDescending(i => i.Value.sid))
93+
foreach (var t in torrents)
9394
{
9495
try
9596
{
96-
if (typetask == 2 && DateTime.Now > starttime.AddDays(3))
97+
if (typetask == 2 && DateTime.Now > starttime.AddDays(10))
9798
break;
9899

99-
if ((typetask == 3 || typetask == 4) && DateTime.Now > starttime.AddDays(10))
100+
if ((typetask == 3 || typetask == 4) && DateTime.Now > starttime.AddMonths(2))
100101
break;
101102

102-
if (TracksDB.Get(t.Value.magnet) == null)
103+
if (TracksDB.Get(t.magnet) == null)
103104
{
104-
_ = TracksDB.Add(t.Value.magnet);
105+
_ = TracksDB.Add(t.magnet);
105106
await Task.Delay(AppInit.conf.tracksdelay);
106107
}
107108
}

0 commit comments

Comments
 (0)