def main(nzb_files, options): if not nzb_files: parser.print_help() return settings = config.read_config(options.config_file) if not settings: print '%s has no settings!' % options.config_file return if options.debug: settings['debug'] = options.debug print settings if options.pattern: settings['skip_regex'] = options.pattern settings['invert'] = True elif options.par2: settings['skip_regex'] = ['\.par2'] settings['invert'] = True nzbs = [nzb for nzb in helper.get_nzb_file(nzb_files)] for nzb in nzbs: nzb_name = os.path.split(nzb)[1] new_dir = helper.get_download_path(settings.get('download_dir'), nzb_name) settings['download_path'] = new_dir if not os.path.exists(new_dir): if settings.get('debug'): print 'made new dir %s ' % new_dir os.mkdir(new_dir) if settings.get('debug'): print settings['download_path'] download.start(nzb, settings)
def start_download(): download_status.set('Processing download...') # get download path and download options from entry widgets [download_path, product_id, download_options ] = entries.get(None, None, None, None, None, None, None, None, textbox_download_path, textbox_product_id, variable_save_metadata, variable_plot_footprints, variable_download_test_image, variable_download_all) download.start(api, images, download_path, product_id, download_options, aoi, download_status)
def test_download2(self): """Test a download of a multiple segment file.""" download.start(self.nzb2, self.settings) self.assertTrue(os.path.exists(os.path.join(self.download_dir, 'gut96back.jpg'))) # Make sure it's being going where it's supposed to go. self.assertEqual(os.listdir(self.download_dir), ['gut96back.jpg']) # Make sure we're cleaning up after ourselves. self.assertEqual(os.listdir(self.temp_dir), []) with open(os.path.join(self.download_dir, 'gut96back.jpg')) as f: data = f.read() checksum = binascii.hexlify(struct.pack('!l', binascii.crc32(data))) self.assertEqual(checksum, '82fe6b72')
def test_incomplete_download(self): """Test a file that has a broken segment.""" # Expected behavior: moooooo. download.start(self.broken_nzb, self.settings) self.assertTrue(os.path.exists(os.path.join(self.download_dir, 'gut96back.jpg'))) # Make sure it's being going where it's supposed to go. self.assertEqual(os.listdir(self.download_dir), ['gut96back.jpg']) # Make sure we're cleaning up after ourselves. #self.assertEqual(os.listdir(self.temp_dir), []) with open(os.path.join(self.download_dir, 'gut96back.jpg')) as f: data = f.read() checksum = binascii.hexlify(struct.pack('!l', binascii.crc32(data))) self.assertEqual(checksum, '7516546f') # Incomplete file.
# Date: March 29, 2017 # ######################################################################################################################## import configuration import query import download import preprocessing # Get path of configuration file config_file_path = raw_input( "Please type the path of your .txt configuration file: ") config_file = open(config_file_path, "r") # Retrieve input parameters from configuration file [ username, password, start_date, end_date, area_of_interest, platform, max_cloud_cover, download_path, product_id, download_options, image_path, preprocessing_options ] = configuration.read_txt(config_file) # Query images [api, images] = query.query_images(username, password, start_date, end_date, area_of_interest, platform, max_cloud_cover) # Download images download.start(api, images, download_path, product_id, download_options, area_of_interest) # Preprocessing preprocessing.start(image_path, area_of_interest, preprocessing_options)