11using MonoTorrent ;
22using System ;
33using System . Collections . Generic ;
4- using System . Linq ;
54using System . Threading . Tasks ;
6- using System . Web ;
75
86namespace 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