This commit is contained in:
		
							parent
							
								
									31db4e661a
								
							
						
					
					
						commit
						f7be8f323f
					
				@ -111,6 +111,12 @@ class FileSystem(object):
 | 
				
			|||||||
        if(metadata is None):
 | 
					        if(metadata is None):
 | 
				
			||||||
            return None
 | 
					            return None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # First we check if we have metadata['original_name'].
 | 
				
			||||||
 | 
					        # We have to do this for backwards compatibility because
 | 
				
			||||||
 | 
					        #   we original did not store this back into EXIF.
 | 
				
			||||||
 | 
					        if(metadata['original_name'] is not None):
 | 
				
			||||||
 | 
					            base_name = os.path.splitext(metadata['original_name'])[0]
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
            # If the file has EXIF title we use that in the file name
 | 
					            # If the file has EXIF title we use that in the file name
 | 
				
			||||||
            #   (i.e. my-favorite-photo-img_1234.jpg)
 | 
					            #   (i.e. my-favorite-photo-img_1234.jpg)
 | 
				
			||||||
            # We want to remove the date prefix we add to the name.
 | 
					            # We want to remove the date prefix we add to the name.
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								elodie/tests/files/with-filename-and-title-in-exif.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								elodie/tests/files/with-filename-and-title-in-exif.jpg
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 18 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								elodie/tests/files/with-filename-in-exif.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								elodie/tests/files/with-filename-in-exif.jpg
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 18 KiB  | 
@ -191,6 +191,20 @@ def test_get_file_name_with_title():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    assert file_name == helper.path_tz_fix('2015-12-05_00-59-26-with-title-some-title.jpg'), file_name
 | 
					    assert file_name == helper.path_tz_fix('2015-12-05_00-59-26-with-title-some-title.jpg'), file_name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_get_file_name_with_original_name_exif():
 | 
				
			||||||
 | 
					    filesystem = FileSystem()
 | 
				
			||||||
 | 
					    media = Photo(helper.get_file('with-filename-in-exif.jpg'))
 | 
				
			||||||
 | 
					    file_name = filesystem.get_file_name(media)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    assert file_name == helper.path_tz_fix('2015-12-05_00-59-26-foobar.jpg'), file_name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_get_file_name_with_original_name_title_exif():
 | 
				
			||||||
 | 
					    filesystem = FileSystem()
 | 
				
			||||||
 | 
					    media = Photo(helper.get_file('with-filename-and-title-in-exif.jpg'))
 | 
				
			||||||
 | 
					    file_name = filesystem.get_file_name(media)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    assert file_name == helper.path_tz_fix('2015-12-05_00-59-26-foobar-foobar-title.jpg'), file_name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_get_folder_path_plain():
 | 
					def test_get_folder_path_plain():
 | 
				
			||||||
    filesystem = FileSystem()
 | 
					    filesystem = FileSystem()
 | 
				
			||||||
    media = Photo(helper.get_file('plain.jpg'))
 | 
					    media = Photo(helper.get_file('plain.jpg'))
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user