oneplus fix
This commit is contained in:
		
							parent
							
								
									a45c11b216
								
							
						
					
					
						commit
						1a716f9b94
					
				@ -6,7 +6,6 @@ import sys
 | 
				
			|||||||
from datetime import datetime
 | 
					from datetime import datetime
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import click
 | 
					import click
 | 
				
			||||||
from send2trash import send2trash
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
from ordigi import config
 | 
					from ordigi import config
 | 
				
			||||||
from ordigi import constants
 | 
					from ordigi import constants
 | 
				
			||||||
@ -112,14 +111,15 @@ def _sort(debug, dry_run, destination, clean, copy, exclude_regex, filter_by_ext
 | 
				
			|||||||
    # Initialize Db
 | 
					    # Initialize Db
 | 
				
			||||||
    db = Db(destination)
 | 
					    db = Db(destination)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if 'Directory' in conf and 'day_begins' in conf['Directory']:
 | 
					    if 'Path' in conf and 'day_begins' in conf['Path']:
 | 
				
			||||||
        config_directory = conf['Directory']
 | 
					        config_directory = conf['Path']
 | 
				
			||||||
        day_begins = config_directory['day_begins']
 | 
					        day_begins = int(config_directory['day_begins'])
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        day_begins = 0
 | 
					        day_begins = 0
 | 
				
			||||||
    filesystem = FileSystem(cache, day_begins, dry_run, exclude_regex_list,
 | 
					    filesystem = FileSystem(cache, day_begins, dry_run, exclude_regex_list,
 | 
				
			||||||
            filter_by_ext, logger, max_deep, mode, path_format)
 | 
					            filter_by_ext, logger, max_deep, mode, path_format)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    import ipdb; ipdb.set_trace()
 | 
				
			||||||
    summary, has_errors = filesystem.sort_files(paths, destination, db,
 | 
					    summary, has_errors = filesystem.sort_files(paths, destination, db,
 | 
				
			||||||
            remove_duplicates, ignore_tags)
 | 
					            remove_duplicates, ignore_tags)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -26,7 +26,9 @@ def coordinates_by_name(name, db):
 | 
				
			|||||||
    # If the name is not cached then we go ahead with an API lookup
 | 
					    # If the name is not cached then we go ahead with an API lookup
 | 
				
			||||||
    geocoder = get_geocoder()
 | 
					    geocoder = get_geocoder()
 | 
				
			||||||
    if geocoder == 'Nominatim':
 | 
					    if geocoder == 'Nominatim':
 | 
				
			||||||
        locator = Nominatim(user_agent='myGeocoder')
 | 
					        # timeout = DEFAULT_SENTINEL
 | 
				
			||||||
 | 
					        timeout = 10
 | 
				
			||||||
 | 
					        locator = Nominatim(user_agent='myGeocoder', timeout=timeout)
 | 
				
			||||||
        geolocation_info = locator.geocode(name)
 | 
					        geolocation_info = locator.geocode(name)
 | 
				
			||||||
        if geolocation_info is not None:
 | 
					        if geolocation_info is not None:
 | 
				
			||||||
            return {
 | 
					            return {
 | 
				
			||||||
@ -135,14 +137,19 @@ def lookup_osm(lat, lon, logger=logging.getLogger()):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    prefer_english_names = get_prefer_english_names()
 | 
					    prefer_english_names = get_prefer_english_names()
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        locator = Nominatim(user_agent='myGeocoder')
 | 
					        timeout = 10
 | 
				
			||||||
 | 
					        locator = Nominatim(user_agent='myGeocoder', timeout=timeout)
 | 
				
			||||||
        coords = (lat, lon)
 | 
					        coords = (lat, lon)
 | 
				
			||||||
        if(prefer_english_names):
 | 
					        if(prefer_english_names):
 | 
				
			||||||
            lang='en'
 | 
					            lang='en'
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            lang='local'
 | 
					            lang='local'
 | 
				
			||||||
        return locator.reverse(coords, language=lang).raw
 | 
					        locator_reverse = locator.reverse(coords, language=lang)
 | 
				
			||||||
    except geopy.exc.GeocoderUnavailable as e:
 | 
					        if locator_reverse is not None:
 | 
				
			||||||
 | 
					            return locator_reverse.raw
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            return None
 | 
				
			||||||
 | 
					    except geopy.exc.GeocoderUnavailable or geopy.exc.GeocoderServiceError as e:
 | 
				
			||||||
        logger.error(e)
 | 
					        logger.error(e)
 | 
				
			||||||
        return None
 | 
					        return None
 | 
				
			||||||
    # Fix *** TypeError: `address` must not be None
 | 
					    # Fix *** TypeError: `address` must not be None
 | 
				
			||||||
 | 
				
			|||||||
@ -5,6 +5,7 @@ Media :class:`Media` class to get file metadata
 | 
				
			|||||||
import logging
 | 
					import logging
 | 
				
			||||||
import mimetypes
 | 
					import mimetypes
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					import six
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# load modules
 | 
					# load modules
 | 
				
			||||||
from dateutil.parser import parse
 | 
					from dateutil.parser import parse
 | 
				
			||||||
@ -147,7 +148,8 @@ class Media():
 | 
				
			|||||||
                value = re.sub(regex , r'\g<1>-\g<2>-\g<3>', value)
 | 
					                value = re.sub(regex , r'\g<1>-\g<2>-\g<3>', value)
 | 
				
			||||||
            return parse(value)
 | 
					            return parse(value)
 | 
				
			||||||
        except BaseException  or dateutil.parser._parser.ParserError as e:
 | 
					        except BaseException  or dateutil.parser._parser.ParserError as e:
 | 
				
			||||||
            self.logger.error(e)
 | 
					            self.logger.error(e, value)
 | 
				
			||||||
 | 
					            import ipdb; ipdb.set_trace()
 | 
				
			||||||
            return None
 | 
					            return None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_coordinates(self, key, value):
 | 
					    def get_coordinates(self, key, value):
 | 
				
			||||||
 | 
				
			|||||||
@ -153,6 +153,7 @@ class TestFilesystem:
 | 
				
			|||||||
        for mode in 'copy', 'move':
 | 
					        for mode in 'copy', 'move':
 | 
				
			||||||
            filesystem = FileSystem(path_format=self.path_format, mode=mode)
 | 
					            filesystem = FileSystem(path_format=self.path_format, mode=mode)
 | 
				
			||||||
            # copy mode
 | 
					            # copy mode
 | 
				
			||||||
 | 
					            import ipdb; ipdb.set_trace()
 | 
				
			||||||
            src_path = Path(self.src_paths, 'photo.png')
 | 
					            src_path = Path(self.src_paths, 'photo.png')
 | 
				
			||||||
            dest_path = Path(tmp_path,'photo_copy.png')
 | 
					            dest_path = Path(tmp_path,'photo_copy.png')
 | 
				
			||||||
            src_checksum = filesystem.checksum(src_path)
 | 
					            src_checksum = filesystem.checksum(src_path)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user