Beispiel #1
0
    def GetOptions(self):

        automatic_archive = self._auto_archive.GetValue()
        exclude_deleted = self._exclude_deleted.GetValue()
        min_size = self._min_size.GetValue()
        min_resolution = self._min_resolution.GetValue()

        return ClientData.ImportFileOptions(
            automatic_archive=automatic_archive,
            exclude_deleted=exclude_deleted,
            min_size=min_size,
            min_resolution=min_resolution)
Beispiel #2
0
def GetDefaultImportFileOptions():
    
    options = HydrusGlobals.client_controller.GetOptions()
    
    automatic_archive = False
    exclude_deleted = options[ 'exclude_deleted_files' ]
    min_size = None
    min_resolution = None
    
    import_file_options = ClientData.ImportFileOptions( automatic_archive = automatic_archive, exclude_deleted = exclude_deleted, min_size = min_size, min_resolution = min_resolution )
    
    return import_file_options
 def test_SERIALISABLE_TYPE_SUBSCRIPTION( self ):
     
     def test( obj, dupe_obj ):
         
         self.assertEqual( obj.GetName(), dupe_obj.GetName() )
         
         self.assertEqual( obj._gallery_identifier, dupe_obj._gallery_identifier )
         self.assertEqual( obj._gallery_stream_identifiers, dupe_obj._gallery_stream_identifiers )
         self.assertEqual( obj._query, dupe_obj._query )
         self.assertEqual( obj._period, dupe_obj._period )
         self.assertEqual( obj._get_tags_if_url_known_and_file_redundant, dupe_obj._get_tags_if_url_known_and_file_redundant )
         self.assertEqual( obj._initial_file_limit, dupe_obj._initial_file_limit )
         self.assertEqual( obj._periodic_file_limit, dupe_obj._periodic_file_limit )
         self.assertEqual( obj._paused, dupe_obj._paused )
         
         self.assertEqual( obj._import_file_options.GetSerialisableTuple(), dupe_obj._import_file_options.GetSerialisableTuple() )
         self.assertEqual( obj._import_tag_options.GetSerialisableTuple(), dupe_obj._import_tag_options.GetSerialisableTuple() )
         
         self.assertEqual( obj._last_checked, dupe_obj._last_checked )
         self.assertEqual( obj._last_error, dupe_obj._last_error )
         self.assertEqual( obj._check_now, dupe_obj._check_now )
         
         self.assertEqual( obj._seed_cache.GetSerialisableTuple(), dupe_obj._seed_cache.GetSerialisableTuple() )
         
     
     sub = ClientImporting.Subscription( 'test sub' )
     
     self._dump_and_load_and_test( sub, test )
     
     gallery_identifier = ClientDownloading.GalleryIdentifier( HC.SITE_TYPE_BOORU, 'gelbooru' )
     gallery_stream_identifiers = ClientDownloading.GetGalleryStreamIdentifiers( gallery_identifier )
     query = 'test query'
     period = 86400 * 7
     get_tags_if_url_known_and_file_redundant = True
     initial_file_limit = 100
     periodic_file_limit = 50
     paused = False
     
     import_file_options = ClientData.ImportFileOptions( automatic_archive = False, exclude_deleted = True, min_size = 8 * 1024, min_resolution = [ 25, 25 ] )
     import_tag_options = ClientData.ImportTagOptions( service_keys_to_namespaces = { HydrusData.GenerateKey() : { 'series', '' } }, service_keys_to_explicit_tags = { HydrusData.GenerateKey() : { 'test explicit tag', 'and another' } } )
     
     last_checked = HydrusData.GetNow() - 3600
     last_error = HydrusData.GetNow() - 86400 * 20
     check_now = False
     seed_cache = ClientImporting.SeedCache()
     
     seed_cache.AddSeed( 'http://exampleurl.com/image/123456' )
     
     sub.SetTuple( gallery_identifier, gallery_stream_identifiers, query, period, get_tags_if_url_known_and_file_redundant, initial_file_limit, periodic_file_limit, paused, import_file_options, import_tag_options, last_checked, last_error, check_now, seed_cache )
     
     self.assertEqual( sub.GetGalleryIdentifier(), gallery_identifier )
     self.assertEqual( sub.GetImportTagOptions(), import_tag_options )
     self.assertEqual( sub.GetQuery(), query )
     self.assertEqual( sub.GetSeedCache(), seed_cache )
     
     self.assertEqual( sub._paused, False )
     sub.PauseResume()
     self.assertEqual( sub._paused, True )
     sub.PauseResume()
     self.assertEqual( sub._paused, False )
     
     self._dump_and_load_and_test( sub, test )