Skip to content

Commit

Permalink
Version 253
Browse files Browse the repository at this point in the history
  • Loading branch information
hydrusnetwork committed Apr 26, 2017
1 parent d29afc7 commit f700ad6
Show file tree
Hide file tree
Showing 24 changed files with 1,291 additions and 269 deletions.
27 changes: 27 additions & 0 deletions help/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,33 @@
<div class="content">
<h3>changelog</h3>
<ul>
<li><h3>version 253</h3></li>
<ul>
<li>created a new object to hold tag and rating merging and 'worse file' deletion options</li>
<li>wrote a dialog to edit this new object</li>
<li>established some simple defaults for this object for different duplicate status actions</li>
<li>the cog icon on the duplicates filter now lets you edit these defaults</li>
<li>the 'custom' duplicate filter action now works--first by asking you what status you want to set, and then by throwing up the new merge options dialog to tune it to whatever you like</li>
<li>wrote comprehensive unit tests for the new object</li>
<li>fixed the super slow dupe filter launch time problem</li>
<li>added a 'known urls' submenu to thumbnail and browser canvas right-click menu that lists all known urls for a file with an option to launch or copy the url</li>
<li>added known urls' hosts to the top-right canvas details background, just below where known file repos are listed</li>
<li>added the same known urls' hosts as clickable hyperlinks to the ratings hover window that pops over that top-right area</li>
<li>added 'delete from deleted files' action to the local tags's service-wide update panel. it will limit the deletion to mappings that are currently on files that have been previously completely physically deleted from the program</li>
<li>fixed namespace filtering on service-wide update panel</li>
<li>the hentai foundry downloader broke, so the update code will pause all hf subs. the solution is not trivial (it is part of the downloader overhaul), but I will try to fix it soon</li>
<li>debuted a new question-mark help button to better explain .txt tag importing on the manual import tagging dialog and the manage import folders dialog</li>
<li>fixed a small potential error due to bad parsing in the 'page of images' downloader</li>
<li>fixed a typo bug that stopped the 'delete shortcuts set' action working in the manage shortcuts dialog</li>
<li>I may have fixed an issue where the server was sometimes not shutting cleanly with a keyboardinterrupt</li>
<li>fixed the media embed button not reliably updating its thumbnail</li>
<li>fixed an issue where a dummy animation bar was displaying on embed buttons that showed static images that included transparency</li>
<li>the serious db missing tag and hash states will now not throw an error but will inform/spam the user (and hence not prohibit a boot)</li>
<li>attempting to open a second manage tags frame from the media viewer will now instead put the focus on the first (previously, multiple manage tags frames could be made)</li>
<li>misc db code cleanup that should result in faster result building in certain situations</li>
<li>misc improvements</li>
<li>misc layout fixes</li>
</ul>
<li><h3>version 252</h3></li>
<ul>
<li>the duplicate filter now processes pairs in batches and hence supports 'back' actions to revisit decisions. you will be prompted every fifty or so pairs to commit and checkpoint your progress</li>
Expand Down
5 changes: 5 additions & 0 deletions include/ClientConstants.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@
SHORTCUT_MOUSE_MIDDLE = 2
SHORTCUT_MOUSE_SCROLL_UP = 3
SHORTCUT_MOUSE_SCROLL_DOWN = 4
SHORTCUT_MOUSE_SCROLL_LEFT = 5
SHORTCUT_MOUSE_SCROLL_RIGHT = 6

shortcut_mouse_string_lookup = {}

Expand All @@ -253,6 +255,8 @@
shortcut_mouse_string_lookup[ SHORTCUT_MOUSE_MIDDLE ] = 'middle-click'
shortcut_mouse_string_lookup[ SHORTCUT_MOUSE_SCROLL_UP ] = 'scroll up'
shortcut_mouse_string_lookup[ SHORTCUT_MOUSE_SCROLL_DOWN ] = 'scroll down'
shortcut_mouse_string_lookup[ SHORTCUT_MOUSE_SCROLL_LEFT ] = 'scroll left'
shortcut_mouse_string_lookup[ SHORTCUT_MOUSE_SCROLL_RIGHT ] = 'scroll right'

SHORTCUT_TYPE_KEYBOARD = 0
SHORTCUT_TYPE_MOUSE = 1
Expand Down Expand Up @@ -499,6 +503,7 @@ def STATICInitialise():

GlobalBMPs.cog = wx.Bitmap( os.path.join( HC.STATIC_DIR, 'cog.png' ) )
GlobalBMPs.keyboard = wx.Bitmap( os.path.join( HC.STATIC_DIR, 'keyboard.png' ) )
GlobalBMPs.help = wx.Bitmap( os.path.join( HC.STATIC_DIR, 'help.png' ) )

GlobalBMPs.check = wx.Bitmap( os.path.join( HC.STATIC_DIR, 'check.png' ) )
GlobalBMPs.pause = wx.Bitmap( os.path.join( HC.STATIC_DIR, 'pause.png' ) )
Expand Down
178 changes: 115 additions & 63 deletions include/ClientDB.py

Large diffs are not rendered by default.

235 changes: 235 additions & 0 deletions include/ClientData.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,15 @@ def _InitialiseDefaults( self, db_dir ):

#

self._dictionary[ 'duplicate_action_options' ] = HydrusSerialisable.SerialisableDictionary()

self._dictionary[ 'duplicate_action_options' ][ HC.DUPLICATE_BETTER ] = DuplicateActionOptions( [ ( CC.LOCAL_TAG_SERVICE_KEY, HC.CONTENT_MERGE_ACTION_MOVE ) ], True )
self._dictionary[ 'duplicate_action_options' ][ HC.DUPLICATE_SAME_FILE ] = DuplicateActionOptions( [ ( CC.LOCAL_TAG_SERVICE_KEY, HC.CONTENT_MERGE_ACTION_TWO_WAY_MERGE ) ], False )
self._dictionary[ 'duplicate_action_options' ][ HC.DUPLICATE_ALTERNATE ] = DuplicateActionOptions( [], False )
self._dictionary[ 'duplicate_action_options' ][ HC.DUPLICATE_NOT_DUPLICATE ] = DuplicateActionOptions( [], False )

#

self._dictionary[ 'integers' ] = {}

self._dictionary[ 'integers' ][ 'video_buffer_size_mb' ] = 96
Expand Down Expand Up @@ -1068,6 +1077,14 @@ def GetDefaultImportTagOptions( self, gallery_identifier = None ):



def GetDuplicateActionOptions( self, duplicate_status ):

with self._lock:

return self._dictionary[ 'duplicate_action_options' ][ duplicate_status ]



def GetFrameLocation( self, frame_key ):

with self._lock:
Expand Down Expand Up @@ -1249,6 +1266,14 @@ def SetDefaultImportTagOptions( self, gallery_identifier, import_tag_options ):



def SetDuplicateActionOptions( self, duplicate_status, duplicate_action_options ):

with self._lock:

self._dictionary[ 'duplicate_action_options' ][ duplicate_status ] = duplicate_action_options



def SetFrameLocation( self, frame_key, remember_size, remember_position, last_size, last_position, default_gravity, default_position, maximised, fullscreen ):

with self._lock:
Expand Down Expand Up @@ -1378,6 +1403,216 @@ def HasAccessKey( self ): return self._access_key is not None and self._access_k

def SetAccessKey( self, access_key ): self._access_key = access_key

class DuplicateActionOptions( HydrusSerialisable.SerialisableBase ):

SERIALISABLE_TYPE = HydrusSerialisable.SERIALISABLE_TYPE_DUPLICATE_ACTION_OPTIONS
SERIALISABLE_VERSION = 1

def __init__( self, service_actions = None, delete_second_file = None ):

if service_actions is None:

service_actions = []


if delete_second_file is None:

delete_second_file = False


HydrusSerialisable.SerialisableBase.__init__( self )

self._service_actions = service_actions
self._delete_second_file = delete_second_file


def _GetSerialisableInfo( self ):

serialisable_service_actions = [ ( service_key.encode( 'hex' ), action ) for ( service_key, action ) in self._service_actions ]

return ( serialisable_service_actions, self._delete_second_file )


def _InitialiseFromSerialisableInfo( self, serialisable_info ):

( serialisable_service_actions, self._delete_second_file ) = serialisable_info

self._service_actions = [ ( serialisable_service_key.decode( 'hex' ), action ) for ( serialisable_service_key, action ) in serialisable_service_actions ]


def SetTuple( self, service_actions, delete_second_file ):

self._service_actions = service_actions
self._delete_second_file = delete_second_file


def ToTuple( self ):

return ( self._service_actions, self._delete_second_file )


def ProcessPairIntoContentUpdates( self, first_media, second_media ):

content_service_keys_to_content_updates = {}
file_service_keys_to_content_updates = {}

first_hashes = first_media.GetHashes()
second_hashes = second_media.GetHashes()

services_manager = HydrusGlobals.client_controller.GetServicesManager()

for ( service_key, action ) in self._service_actions:

content_updates = []

try:

service = services_manager.GetService( service_key )

except HydrusExceptions.DataMissing:

continue


service_type = service.GetServiceType()

if service_type in ( HC.LOCAL_RATING_LIKE, HC.LOCAL_RATING_NUMERICAL ):

first_current_value = first_media.GetRatingsManager().GetRating( service_key )
second_current_value = second_media.GetRatingsManager().GetRating( service_key )

if action == HC.CONTENT_MERGE_ACTION_TWO_WAY_MERGE:

if first_current_value == second_current_value:

continue


if first_current_value is None and second_current_value is not None:

content_updates.append( HydrusData.ContentUpdate( HC.CONTENT_TYPE_RATINGS, HC.CONTENT_UPDATE_ADD, ( second_current_value, first_hashes ) ) )

elif first_current_value is not None and second_current_value is None:

content_updates.append( HydrusData.ContentUpdate( HC.CONTENT_TYPE_RATINGS, HC.CONTENT_UPDATE_ADD, ( first_current_value, second_hashes ) ) )


elif action == HC.CONTENT_MERGE_ACTION_COPY:

if first_current_value == second_current_value:

continue


if first_current_value is None and second_current_value is not None:

content_updates.append( HydrusData.ContentUpdate( HC.CONTENT_TYPE_RATINGS, HC.CONTENT_UPDATE_ADD, ( second_current_value, first_hashes ) ) )


elif action == HC.CONTENT_MERGE_ACTION_MOVE:

if second_current_value is not None:

if first_current_value is None:

content_updates.append( HydrusData.ContentUpdate( HC.CONTENT_TYPE_RATINGS, HC.CONTENT_UPDATE_ADD, ( second_current_value, first_hashes ) ) )


content_updates.append( HydrusData.ContentUpdate( HC.CONTENT_TYPE_RATINGS, HC.CONTENT_UPDATE_ADD, ( None, second_hashes ) ) )



elif service_type in ( HC.LOCAL_TAG, HC.TAG_REPOSITORY ):

if service_type == HC.LOCAL_TAG:

add_content_action = HC.CONTENT_UPDATE_ADD

elif service_type == HC.TAG_REPOSITORY:

add_content_action = HC.CONTENT_UPDATE_PEND


first_current_tags = first_media.GetTagsManager().GetCurrent( service_key )
second_current_tags = second_media.GetTagsManager().GetCurrent( service_key )

if action == HC.CONTENT_MERGE_ACTION_TWO_WAY_MERGE:

first_needs = second_current_tags.difference( first_current_tags )
second_needs = first_current_tags.difference( second_current_tags )

content_updates.extend( ( HydrusData.ContentUpdate( HC.CONTENT_TYPE_MAPPINGS, add_content_action, ( tag, first_hashes ) ) for tag in first_needs ) )
content_updates.extend( ( HydrusData.ContentUpdate( HC.CONTENT_TYPE_MAPPINGS, add_content_action, ( tag, second_hashes ) ) for tag in second_needs ) )

elif action == HC.CONTENT_MERGE_ACTION_COPY:

first_needs = second_current_tags.difference( first_current_tags )

content_updates.extend( ( HydrusData.ContentUpdate( HC.CONTENT_TYPE_MAPPINGS, add_content_action, ( tag, first_hashes ) ) for tag in first_needs ) )

elif service_type == HC.LOCAL_TAG and action == HC.CONTENT_MERGE_ACTION_MOVE:

first_needs = second_current_tags.difference( first_current_tags )

content_updates.extend( ( HydrusData.ContentUpdate( HC.CONTENT_TYPE_MAPPINGS, add_content_action, ( tag, first_hashes ) ) for tag in first_needs ) )
content_updates.extend( ( HydrusData.ContentUpdate( HC.CONTENT_TYPE_MAPPINGS, HC.CONTENT_UPDATE_DELETE, ( tag, second_hashes ) ) for tag in second_current_tags ) )



if len( content_updates ) > 0:

content_service_keys_to_content_updates[ service_key ] = content_updates



if self._delete_second_file:

current_locations = second_media.GetLocationsManager().GetCurrent()

if CC.LOCAL_FILE_SERVICE_KEY in current_locations:

deletee_service_key = CC.LOCAL_FILE_SERVICE_KEY

elif CC.TRASH_SERVICE_KEY in current_locations:

deletee_service_key = CC.TRASH_SERVICE_KEY

else:

deletee_service_key = None


if deletee_service_key is not None:

if deletee_service_key not in file_service_keys_to_content_updates:

file_service_keys_to_content_updates[ deletee_service_key ] = []


content_update = HydrusData.ContentUpdate( HC.CONTENT_TYPE_FILES, HC.CONTENT_UPDATE_DELETE, second_hashes )

file_service_keys_to_content_updates[ deletee_service_key ].append( content_update )




list_of_service_keys_to_content_updates = []

if len( content_service_keys_to_content_updates ) > 0:

list_of_service_keys_to_content_updates.append( content_service_keys_to_content_updates )


if len( file_service_keys_to_content_updates ) > 0:

list_of_service_keys_to_content_updates.append( file_service_keys_to_content_updates )


return list_of_service_keys_to_content_updates


HydrusSerialisable.SERIALISABLE_TYPES_TO_OBJECT_TYPES[ HydrusSerialisable.SERIALISABLE_TYPE_DUPLICATE_ACTION_OPTIONS ] = DuplicateActionOptions

class Imageboard( HydrusData.HydrusYAMLBase ):

yaml_tag = u'!Imageboard'
Expand Down
2 changes: 1 addition & 1 deletion include/ClientDownloading.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ def _ParseImagePage( self, html, url_base ):

# can't parse this easily normally because HF is a pain with the preview->click to see full size business.
# find http://pictures.hentai-foundry.com//
# then extend it to http://pictures.hentai-foundry.com//k/KABOS/172144.jpg
# then extend it to http://pictures.hentai-foundry.com//k/KABOS/172144/image.jpg
# the .jpg bit is what we really need, but whatever
try:

Expand Down
Loading

0 comments on commit f700ad6

Please sign in to comment.