Skip to content

Commit

Permalink
Version 350
Browse files Browse the repository at this point in the history
  • Loading branch information
hydrusnetwork committed May 1, 2019
1 parent 4577a5f commit 058559e
Show file tree
Hide file tree
Showing 26 changed files with 1,223 additions and 864 deletions.
18 changes: 18 additions & 0 deletions help/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@
<div class="content">
<h3>changelog</h3>
<ul>
<li><h3>version 350</h3></li>
<ul>
<li>the duplicate filter no longer applies the implicit system limit (which defaults to 10,000 files) on its search domains, which solves the undercounting issue on large search domains. duplicate operations will be appropriately slower, so narrow your duplicate file queries (adding a creator: tag works great) if they take too long</li>
<li>fixed the duplicate pairs filter's 'ghost pair' issue. it was failing, when 'both files' was unchecked, to remove pairs that included one file that was non-local. this accidental inclusion resulted in incorrect non-zero count and filter/random pairs that could not display correctly</li>
<li>insulated against potential future iterations of this problem (likely that one of the pair was deleted by another process while a filter is ongoing), with a notification and graceful exiting of the duplicate filter while saving progress</li>
<li>the 'show random duplicates' button now puts the 'base' of the group (to which all the others are potentially matched) as the first thumbnail</li>
<li>added a new 'advanced file deletion' section to 'files and trash' options page to turn on a new advanced dialog and set custom file deletion reasons</li>
<li>if this new dialog is turned on, a delete event from thumbnail grid, regular media viewer, or the duplicate filter's manual delete will launch it. it permits you to delete physically (skipping trash) in one step or delete physically without leaving a deletion record (for easier later re-import) and choose one of the deletion reasons in the new options panel or set a one-time custom reason</li>
<li>export folders now have more run-controls: 'run regularly', 'paused', and 'run now'</li>
<li>the file menu now has a 'run export folder now' submenu just like for import folders-- it is simple now to set up an export folder that only runs when you tell it to</li>
<li>updated the on-boot missing file folder recovery process to automatically 'heal' file location mappings when a missing folder is actually in a location that is known (essentially, you can now manually move a bunch of folders from one known location to another while the client is off and it will recover automatically now). error dialogs will appear in this case summarising the problem and proposed fixes with a chance to bail out if you do not want it to happen</li>
<li>added a new frame type to 'gui' options page called 'regular_center_dialog' for yes/no style dialogs that are better in the center of the parent window</li>
<li>the custom web browser launch path and file type 'open externally' paths are moved from 'files and trash' to a new 'external programs' options page</li>
<li>as the superior '--temp_path' program launch parameter now exists for both client and server, I have removed the limited 'BUGFIX: temp folder override' option from the client's 'files and trash' page and use in the actual code. if this option was important to you, please migrate to the --temp_path launch parameter, which covers temp usage more comprehensively</li>
<li>as the artstation downloader is now non-functional, apparently by a cloudflare issue, the default gug for new users (and anyone with artstation set atm) is now safebooru</li>
<li>added dolphin file manager add-on link to the client api help</li>
<li>some misc file metadata fetching cleanup</li>
</ul>
<li><h3>version 349</h3></li>
<ul>
<li>duplicate filter:</li>
Expand Down
1 change: 1 addition & 0 deletions help/client_api.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ <h3>client api</h3>
<h3>Support created by hydrus users:</h3>
<ul>
<li><a href="https://gitgud.io/prkc/hydrus-companion">https://gitgud.io/prkc/hydrus-companion</a> - Hydrus Companion, a browser extension for hydrus.</li>
<li><a href="https://gitgud.io/prkc/dolphin-hydrus-actions">https://gitgud.io/prkc/dolphin-hydrus-actions</a> - Adds Hydrus right-click context menu actions to Dolphin file manager.</li>
<li><a href="https://gitlab.com/cryzed/hydrus-api">https://gitlab.com/cryzed/hydrus-api</a> - A python module that talks to the API.</li>
</ul>
<h3>API</h3>
Expand Down
136 changes: 116 additions & 20 deletions include/ClientCaches.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,88 @@ def _AddThumbnailFromBytes( self, hash, thumbnail_bytes ):
self._controller.pub( 'new_thumbnails', { hash } )


def _AttemptToHealMissingLocations( self ):

# if a missing prefix folder seems to be in another location, lets update to that other location

correct_rows = []
some_are_unhealable = False

fixes_counter = collections.Counter()

known_locations = set()

known_locations.update( self._prefixes_to_locations.values() )

( locations_to_ideal_weights, thumbnail_override ) = self._controller.Read( 'ideal_client_files_locations' )

known_locations.update( locations_to_ideal_weights.keys() )

if thumbnail_override is not None:

known_locations.add( thumbnail_override )


for ( missing_location, prefix ) in self._missing_locations:

potential_correct_locations = []

for known_location in known_locations:

if known_location == missing_location:

continue


dir_path = os.path.join( known_location, prefix )

if os.path.exists( dir_path ) and os.path.isdir( dir_path ):

potential_correct_locations.append( known_location )



if len( potential_correct_locations ) == 1:

correct_location = potential_correct_locations[0]

correct_rows.append( ( missing_location, prefix, correct_location ) )

fixes_counter[ ( missing_location, correct_location ) ] += 1

else:

some_are_unhealable = True



if len( correct_rows ) > 0 and some_are_unhealable:

message = 'Hydrus found multiple missing locations in your file storage. Some of these locations seemed to be fixable, others did not. The client will now inform you about both problems.'

wx.SafeShowMessage( 'Multiple file location problems.', message )


if len( correct_rows ) > 0:

summaries = [ '{} moved from {} to {}'.format( HydrusData.ToHumanInt( count ), missing_location, correct_location ) for ( ( missing_location, correct_location ), count ) in fixes_counter.items() ]

summaries.sort()

summary_message = 'Some client file folders were missing, but they seem to be in other known locations! The folders are:'
summary_message += os.linesep * 2
summary_message += os.linesep.join( summaries )
summary_message += os.linesep * 2
summary_message += 'Assuming you did this on purpose, Hydrus is ready to update its internal knowledge to reflect these new mappings as soon as this dialog closes. If you know these proposed fixes are incorrect, terminate the program now.'

HydrusData.Print( summary_message )

wx.SafeShowMessage( 'About to auto-heal client file folders.', summary_message )

HG.client_controller.WriteSynchronous( 'repair_client_files', correct_rows )



def _GenerateExpectedFilePath( self, hash, mime ):

self._WaitOnWakeup()
Expand Down Expand Up @@ -720,7 +802,7 @@ def _Reinit( self ):

try:

for ( prefix, location ) in list(self._prefixes_to_locations.items()):
for ( prefix, location ) in list( self._prefixes_to_locations.items() ):

HydrusPaths.MakeSureDirectoryExists( location )

Expand All @@ -731,7 +813,7 @@ def _Reinit( self ):

except:

text = 'Attempting to create the database\'s client_files folder structure failed!'
text = 'Attempting to create the database\'s client_files folder structure in {} failed!'.format( location )

wx.SafeShowMessage( 'unable to create file structure', text )

Expand All @@ -740,23 +822,15 @@ def _Reinit( self ):

else:

self._missing_locations = set()
self._ReinitMissingLocations()

for ( prefix, location ) in list(self._prefixes_to_locations.items()):
if len( self._missing_locations ) > 0:

if os.path.exists( location ):

subdir = os.path.join( location, prefix )

if not os.path.exists( subdir ):

self._missing_locations.add( ( location, prefix ) )


else:

self._missing_locations.add( ( location, prefix ) )

self._AttemptToHealMissingLocations()

self._prefixes_to_locations = self._controller.Read( 'client_files_locations' )

self._ReinitMissingLocations()


if len( self._missing_locations ) > 0:
Expand All @@ -773,16 +847,16 @@ def _Reinit( self ):

missing_string = ''

for l in missing_locations:
for missing_location in missing_locations:

missing_prefixes = list( missing_dict[ l ] )
missing_prefixes = list( missing_dict[ missing_location ] )

missing_prefixes.sort()

missing_prefixes_string = ' ' + os.linesep.join( ( ', '.join( block ) for block in HydrusData.SplitListIntoChunks( missing_prefixes, 32 ) ) )

missing_string += os.linesep
missing_string += l
missing_string += missing_location
missing_string += os.linesep
missing_string += missing_prefixes_string

Expand Down Expand Up @@ -816,6 +890,28 @@ def _Reinit( self ):



def _ReinitMissingLocations( self ):

self._missing_locations = set()

for ( prefix, location ) in list(self._prefixes_to_locations.items()):

if os.path.exists( location ):

subdir = os.path.join( location, prefix )

if not os.path.exists( subdir ):

self._missing_locations.add( ( location, prefix ) )


else:

self._missing_locations.add( ( location, prefix ) )




def _WaitOnWakeup( self ):

if HG.client_controller.new_options.GetBoolean( 'file_system_waits_on_wakeup' ):
Expand Down
2 changes: 1 addition & 1 deletion include/ClientController.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _InitDB( self ):

def _InitTempDir( self ):

self.temp_dir = ClientPaths.GetTempDir()
self.temp_dir = HydrusPaths.GetTempDir()


def _DestroySplash( self ):
Expand Down

0 comments on commit 058559e

Please sign in to comment.