Bugfixes for all programs
This commit is contained in:
		
							parent
							
								
									52e58ba505
								
							
						
					
					
						commit
						df3e79b9e6
					
				@ -40,7 +40,7 @@ def cli():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    pattern = re.compile(args.pattern)
 | 
					    pattern = re.compile(args.pattern)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for filename in sys.argv[3:]:
 | 
					    for filename in args.files:
 | 
				
			||||||
        base = os.path.basename(filename)
 | 
					        base = os.path.basename(filename)
 | 
				
			||||||
        dirn = os.path.dirname(filename)
 | 
					        dirn = os.path.dirname(filename)
 | 
				
			||||||
        new_base = pattern.sub(args.replacement, base)
 | 
					        new_base = pattern.sub(args.replacement, base)
 | 
				
			||||||
 | 
				
			|||||||
@ -20,9 +20,13 @@ def get_new_name(filename, date_matches):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    while True:
 | 
					    while True:
 | 
				
			||||||
        if suffix == 0:
 | 
					        if suffix == 0:
 | 
				
			||||||
            target = f"{dirn}/{year}-{month}-{date}_{hour}:{second}:{minute}{extension}"
 | 
					            target_base = f"{year}-{month}-{date}_{hour}:{second}:{minute}{extension}"
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            target = f"{dirn}/{year}-{month}-{date}_{hour}:{second}:{minute}_{suffix}{extension}"
 | 
					            target_base = (
 | 
				
			||||||
 | 
					                f"{year}-{month}-{date}_{hour}:{second}:{minute}_{suffix}{extension}"
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        target = os.path.join(dirn, target_base)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if not os.path.exists(target):
 | 
					        if not os.path.exists(target):
 | 
				
			||||||
            return target
 | 
					            return target
 | 
				
			||||||
@ -74,7 +78,9 @@ def cli():
 | 
				
			|||||||
            found_raw = unextended + ".CR2"
 | 
					            found_raw = unextended + ".CR2"
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            unextended_basename = os.path.basename(unextended)
 | 
					            unextended_basename = os.path.basename(unextended)
 | 
				
			||||||
            try_next = os.path.dirname(filename) + "/CR2/" + unextended_basename
 | 
					            try_next = os.path.join(
 | 
				
			||||||
 | 
					                os.path.dirname(filename), "CR2", unextended_basename + ".CR2"
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
            if os.path.exists(try_next):
 | 
					            if os.path.exists(try_next):
 | 
				
			||||||
                found_raw = try_next
 | 
					                found_raw = try_next
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -28,7 +28,7 @@ def prepare_processable(search_in: str):
 | 
				
			|||||||
                found_raw = unextended + ".CR2"
 | 
					                found_raw = unextended + ".CR2"
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                unextended_basename = os.path.basename(unextended)
 | 
					                unextended_basename = os.path.basename(unextended)
 | 
				
			||||||
                try_next = os.path.dirname(file) + "/CR2/" + unextended_basename
 | 
					                try_next = os.path.join(os.path.dirname(file), "CR2", unextended_basename + ".CR2")
 | 
				
			||||||
                if os.path.exists(try_next):
 | 
					                if os.path.exists(try_next):
 | 
				
			||||||
                    found_raw = try_next
 | 
					                    found_raw = try_next
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -86,6 +86,9 @@ def cli():
 | 
				
			|||||||
    print("<phototrie.py> [file extension to process e.g. CR2 or jpg.")
 | 
					    print("<phototrie.py> [file extension to process e.g. CR2 or jpg.")
 | 
				
			||||||
    print("keybinds: B 'bad', 'G' good, 'P' pristine")
 | 
					    print("keybinds: B 'bad', 'G' good, 'P' pristine")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if len(sys.argv) < 2:
 | 
				
			||||||
 | 
					        sys.exit(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    to_process, tmp_dir = prepare_processable(".")
 | 
					    to_process, tmp_dir = prepare_processable(".")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dirs = "./bad", "./good", "./pristine"
 | 
					    dirs = "./bad", "./good", "./pristine"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user