@@ -46,7 +46,7 @@ public ActionResult Jackett(string apikey, string query, string title, string ti
4646 if ( string . IsNullOrWhiteSpace ( title ) && string . IsNullOrWhiteSpace ( title_original ) &&
4747 mNum . Success )
4848 {
49- if ( Regex . IsMatch ( mNum . Groups [ 2 ] . Value , "[a-zA-Z]{4 }" ) )
49+ if ( Regex . IsMatch ( mNum . Groups [ 2 ] . Value , "[a-zA-Z0-9]{2 }" ) )
5050 {
5151 rqnum = true ;
5252 var g = mNum . Groups ;
@@ -109,7 +109,11 @@ void AddTorrents(TorrentDetails t)
109109 string _o = StringConvert . SearchName ( title_original ) ;
110110
111111 // Быстрая выборка по совпадению ключа в имени
112- foreach ( var val in FileDB . masterDb . Where ( i => ( _n != null && i . Key . StartsWith ( $ "{ _n } :") ) || ( _o != null && i . Key . EndsWith ( $ ":{ _o } ") ) ) . Take ( AppInit . conf . maxreadfile ) )
112+ var mdb = FileDB . masterDb . Where ( i => ( _n != null && i . Key . StartsWith ( $ "{ _n } :") ) || ( _o != null && i . Key . EndsWith ( $ ":{ _o } ") ) ) ;
113+ if ( ! AppInit . conf . evercache )
114+ mdb = mdb . Take ( AppInit . conf . maxreadfile ) ;
115+
116+ foreach ( var val in mdb )
113117 {
114118 foreach ( var t in FileDB . OpenRead ( val . Key ) . Values )
115119 {
@@ -238,15 +242,19 @@ void AddTorrents(TorrentDetails t)
238242 }
239243 #endregion
240244 }
241- else if ( ! string . IsNullOrWhiteSpace ( query ) && query . Length > 3 )
245+ else if ( ! string . IsNullOrWhiteSpace ( query ) && query . Length > 1 )
242246 {
243247 #region Обычный поиск
244248 string _s = StringConvert . SearchName ( query ) ;
245249
246250 #region torrentsSearch
247251 void torrentsSearch ( bool exact )
248252 {
249- foreach ( var val in FileDB . masterDb . OrderByDescending ( i => i . Value ) . Where ( i => i . Key . Contains ( _s ) ) . Take ( AppInit . conf . maxreadfile ) )
253+ var mdb = FileDB . masterDb . OrderByDescending ( i => i . Value ) . Where ( i => i . Key . Contains ( _s ) ) ;
254+ if ( ! AppInit . conf . evercache )
255+ mdb = mdb . Take ( AppInit . conf . maxreadfile ) ;
256+
257+ foreach ( var val in mdb )
250258 {
251259 foreach ( var t in FileDB . OpenRead ( val . Key ) . Values )
252260 {
@@ -346,11 +354,7 @@ HashSet<int> getCategoryIds(TorrentDetails t, out string categoryDesc)
346354 #region Объединить дубликаты
347355 var tsort = new List < TorrentDetails > ( ) ;
348356
349- if ( ! AppInit . conf . mergeduplicates || rqnum )
350- {
351- tsort = torrents . Values . ToList ( ) ;
352- }
353- else
357+ if ( AppInit . conf . mergeduplicates || ( rqnum && AppInit . conf . mergenumduplicates ) )
354358 {
355359 Dictionary < string , ( TorrentDetails torrent , string title , string Name , List < string > AnnounceUrls ) > temp = new Dictionary < string , ( TorrentDetails , string , string , List < string > ) > ( ) ;
356360
@@ -478,6 +482,10 @@ void UpdateTitle()
478482 foreach ( var item in temp . Select ( i => i . Value . torrent ) )
479483 tsort . Add ( item ) ;
480484 }
485+ else
486+ {
487+ tsort = torrents . Values . ToList ( ) ;
488+ }
481489 #endregion
482490
483491 #region FFprobe
@@ -592,7 +600,7 @@ void AddTorrents(TorrentDetails t)
592600 }
593601 #endregion
594602
595- if ( string . IsNullOrWhiteSpace ( search ) || 3 >= search . Length )
603+ if ( string . IsNullOrWhiteSpace ( search ) || search . Length == 1 )
596604 return Json ( torrents ) ;
597605
598606 string _s = StringConvert . SearchName ( search ) ;
@@ -624,9 +632,13 @@ void AddTorrents(TorrentDetails t)
624632 else
625633 {
626634 #region Поиск по совпадению ключа в имени
627- foreach ( var mdb in FileDB . masterDb . OrderByDescending ( i => i . Value ) . Where ( i => i . Key . Contains ( _s ) || ( _altsearch != null && i . Key . Contains ( _altsearch ) ) ) . Take ( AppInit . conf . maxreadfile ) )
635+ var mdb = FileDB . masterDb . OrderByDescending ( i => i . Value ) . Where ( i => i . Key . Contains ( _s ) || ( _altsearch != null && i . Key . Contains ( _altsearch ) ) ) ;
636+ if ( ! AppInit . conf . evercache )
637+ mdb = mdb . Take ( AppInit . conf . maxreadfile ) ;
638+
639+ foreach ( var val in mdb )
628640 {
629- foreach ( var t in FileDB . OpenRead ( mdb . Key ) . Values )
641+ foreach ( var t in FileDB . OpenRead ( val . Key ) . Values )
630642 {
631643 if ( t . types == null )
632644 continue ;
0 commit comments