export filename can be numbered by arbitrary sort

This commit is contained in:
corposim 2022-09-20 09:30:12 -05:00
parent e939c11b7a
commit 5c5bd5b715
3 changed files with 9 additions and 3 deletions

View File

@ -22,7 +22,7 @@ from hydrus.client.metadata import ClientTagSorting
MAX_PATH_LENGTH = 240 # bit of padding from 255 for .txt neigbouring and other surprises
def GenerateExportFilename( destination_directory, media, terms, do_not_use_filenames = None ):
def GenerateExportFilename( destination_directory, media, terms, count, do_not_use_filenames = None ):
def clean_tag_text( t ):
@ -92,7 +92,10 @@ def GenerateExportFilename( destination_directory, media, terms, do_not_use_file
hash_id = media.GetHashId()
filename += str( hash_id )
elif term == '#':
filename += str( count )
elif term_type == 'tag':

View File

@ -955,8 +955,10 @@ class ReviewExportFilesPanel( ClientGUIScrolledPanels.ReviewPanel ):
pattern = self._pattern.text()
terms = ClientExportingFiles.ParseExportPhrase( pattern )
count = len(self._media_to_paths) + 1
filename = ClientExportingFiles.GenerateExportFilename( directory, media, terms, do_not_use_filenames = self._existing_filenames )
filename = ClientExportingFiles.GenerateExportFilename( directory, media, terms, count, do_not_use_filenames = self._existing_filenames )
path = os.path.join( directory, filename )

View File

@ -1009,6 +1009,7 @@ class ExportPatternButton( BetterButton ):
ClientGUIMenus.AppendMenuItem( menu, 'the file\'s hash - {hash}', 'copy "{hash}" to the clipboard', HG.client_controller.pub, 'clipboard', 'text', '{hash}' )
ClientGUIMenus.AppendMenuItem( menu, 'all the file\'s tags - {tags}', 'copy "{tags}" to the clipboard', HG.client_controller.pub, 'clipboard', 'text', '{tags}' )
ClientGUIMenus.AppendMenuItem( menu, 'all the file\'s non-namespaced tags - {nn tags}', 'copy "{nn tags}" to the clipboard', HG.client_controller.pub, 'clipboard', 'text', '{nn tags}' )
ClientGUIMenus.AppendMenuItem( menu, 'file order - {#}', 'copy "{#}" to the clipboard', HG.client_controller.pub, 'clipboard', 'text', '{#}' )
ClientGUIMenus.AppendSeparator( menu )