Skip to content

Commit

Permalink
Version 149
Browse files Browse the repository at this point in the history
  • Loading branch information
hydrusnetwork committed Mar 4, 2015
1 parent d8d67a4 commit 9997b85
Show file tree
Hide file tree
Showing 24 changed files with 3,064 additions and 3,103 deletions.
19 changes: 19 additions & 0 deletions help/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@
<div class="content">
<h3>changelog</h3>
<ul>
<li><h3>version 149</h3></li>
<ul>
<li>all listctrls with an attendant delete button will now support the same action with the delete key</li>
<li>several normal tag boxes will support the delete key as well</li>
<li>added a temporary service cache to the client db to speed up service fetching until I can figure out a yaml replacement</li>
<li>cleared out inefficient tag and hash database fetching and generation code</li>
<li>tag parent dialog will now ask for an action/reason for every ( children, parent ) pair rather than every ( child, parent ) pair</li>
<li>fixed an error with collecting by rating</li>
<li>fixed the 'fix' to the gui_colours db update problem</li>
<li>the autocomplete dropdowns in the paths-to-tags dialog will no longer produce errors when tags are submitted</li>
<li>improved accuracy of taglist scroll-to-selected scrolldown calculation</li>
<li>collapsed some of the helter-skelter db code in prep for future improvements</li>
<li>moved daemon code to separate files</li>
<li>silenced server upnp errors</li>
<li>all except: continue lines are banished!</li>
<li>cleaned up some miscellaneous exception code</li>
<li>cleaned some ugly behind the scenes a/c dropdown button code</li>
<li>did some general code cleanup</li>
</ul>
<li><h3>version 148</h3></li>
<ul>
<li>rewrote thumbnail canvas and scrolling code from a crashtastic monolithic bmp to a lighter, faster, and more flexible page buffer</li>
Expand Down
2 changes: 1 addition & 1 deletion help/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<a class="screenshot" href="screenshot_booru.png" title="you can run your own (simple!) booru"><img src="screenshot_booru_thumb.png" /></a>
<a class="screenshot" href="screenshot_advanced_autocomplete.png" title="the tag autocomplete is a powerful tool that can get complicated if you want it to. this screenshot shows a tag sibling, where one tag is immediately swapped with another, and a non-local search, where results that are known but not on the computer are shown"><img src="screenshot_advanced_autocomplete_thumb.png" /></a>
<h3>hydrus help</h3>
<p>Although I've tried to make hydrus's interface simple, its underlying concepts are not. Please read the introduction and skim the getting started guide at the least, and if you want to get started with my server, you'll probably want to check out the access keys section.</p>
<p>Although I try to make hydrus's interface simple, some of the things it does are quite complicated. Please read the introduction and skim the getting started guide at the least, and if you want to get started with my server, you'll probably want to check out the access keys section.</p>
<ul>
<li><a href="introduction.html">introduction and statement of principles</a></li>
<li><a href="getting_started_installing.html">installing and updating</a></li>
Expand Down
93 changes: 25 additions & 68 deletions include/ClientConstants.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,61 +403,6 @@ def FilterPredicates( search_entry, predicates, service_key = None, expand_paren

return matches

def GenerateCollectByChoices( sort_by_choices ):

already_added = set()

collect_choices = []

for ( sort_by_type, namespaces ) in sort_by_choices:

for i in range( 1, len( namespaces ) ):

combinations = itertools.combinations( namespaces, i )

for combination in combinations:

combination_set = frozenset( combination )

if combination_set not in already_added:

already_added.add( combination_set )

collect_choices.append( ( 'collect by ' + '-'.join( combination ), combination ) )



'''
namespaces_set = frozenset( namespaces )
if namespaces_set not in already_added:
collect_choices.append( ( 'collect by ' + '-'.join( namespaces ), namespaces ) )
already_added.add( namespaces_set )
for i in range( 1, len( namespaces ) ):
sub_namespaces = namespaces[:-i]
sub_namespaces_set = frozenset( sub_namespaces )
if sub_namespaces_set not in already_added:
collect_choices.append( ( 'collect by ' + '-'.join( sub_namespaces ), sub_namespaces ) )
already_added.add( sub_namespaces_set )
'''

collect_choices.sort()

collect_choices.insert( 0, ( 'no collections', None ) )

return collect_choices

def GenerateDumpMultipartFormDataCTAndBody( fields ):

m = multipart.Multipart()
Expand Down Expand Up @@ -551,13 +496,16 @@ def GetAllFileHashes():

( base, filename ) = os.path.split( path )

try:

( hash_encoded, ext ) = filename.split( '.', 1 )

file_hashes.add( hash_encoded.decode( 'hex' ) )

except: continue
result = filename.split( '.', 1 )

if len( result ) != 2: continue

( hash_encoded, ext ) = result

try: hash = hash_encoded.decode( 'hex' )
except TypeError: continue

file_hashes.add( hash )


return file_hashes
Expand Down Expand Up @@ -610,8 +558,10 @@ def GetAllThumbnailHashes():

if not filename.endswith( '_resized' ):

try: thumbnail_hashes.add( filename.decode( 'hex' ) )
except: continue
try: hash = filename.decode( 'hex' )
except TypeError: continue

thumbnail_hashes.add( hash )



Expand Down Expand Up @@ -1211,7 +1161,7 @@ def GetRatingSlice( self, service_keys ):

# this doesn't work yet. it should probably use self.GetScore( service_key ) like I think Sort by remote rating does

return frozenset( { self._service_keys_to_ratings[ service_key ] for service_key in service_keys if service_key in self._service_keys_to_ratings } )
return frozenset( { self._service_keys_to_cp[ service_key ] for service_key in service_keys if service_key in self._service_keys_to_cp } )


def GetServiceKeysToRatingsCP( self ): return self._service_keys_to_cp
Expand Down Expand Up @@ -2604,7 +2554,11 @@ def __init__( self ):

def GetService( self, service_key ):

with self._lock: return self._keys_to_services[ service_key ]
with self._lock:

try: return self._keys_to_services[ service_key ]
except KeyError: raise HydrusExceptions.NotFoundException( 'That service was not found!' )



def GetServices( self, types = HC.ALL_SERVICES ):
Expand Down Expand Up @@ -2707,7 +2661,7 @@ def DAEMONWaterfall( self ):
while not HC.shutdown:

try: ( page_key, medias ) = self._queue.get( timeout = 1 )
except: continue
except Queue.Empty: continue

try:

Expand All @@ -2727,7 +2681,10 @@ def DAEMONWaterfall( self ):



except Exception as e: HC.ShowException( e )
except Exception as e:

HC.ShowException( e )




Expand Down
71 changes: 33 additions & 38 deletions include/ClientController.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import os
import random
import shutil
import sqlite3
import stat
import subprocess
import sys
Expand Down Expand Up @@ -568,51 +567,47 @@ def StartFileQuery( self, query_key, search_context ): HydrusThreading.CallToThr

def THREADDoFileQuery( self, query_key, search_context ):

try:

query_hash_ids = self.Read( 'file_query_ids', search_context )

query_hash_ids = list( query_hash_ids )

random.shuffle( query_hash_ids )

limit = search_context.GetSystemPredicates().GetLimit()

if limit is not None: query_hash_ids = query_hash_ids[ : limit ]

service_key = search_context.GetFileServiceKey()
query_hash_ids = self.Read( 'file_query_ids', search_context )

query_hash_ids = list( query_hash_ids )

random.shuffle( query_hash_ids )

limit = search_context.GetSystemPredicates().GetLimit()

if limit is not None: query_hash_ids = query_hash_ids[ : limit ]

service_key = search_context.GetFileServiceKey()

include_current_tags = search_context.IncludeCurrentTags()

media_results = []

include_pending_tags = search_context.IncludePendingTags()

i = 0

base = 256

while i < len( query_hash_ids ):

include_current_tags = search_context.IncludeCurrentTags()
if query_key.IsCancelled(): return

media_results = []
if i == 0: ( last_i, i ) = ( 0, base )
else: ( last_i, i ) = ( i, i + base )

include_pending_tags = search_context.IncludePendingTags()
sub_query_hash_ids = query_hash_ids[ last_i : i ]

i = 0
more_media_results = self.Read( 'media_results_from_ids', service_key, sub_query_hash_ids )

base = 256
media_results.extend( more_media_results )

while i < len( query_hash_ids ):

if query_key.IsCancelled(): return

if i == 0: ( last_i, i ) = ( 0, base )
else: ( last_i, i ) = ( i, i + base )

sub_query_hash_ids = query_hash_ids[ last_i : i ]

more_media_results = self.Read( 'media_results_from_ids', service_key, sub_query_hash_ids )

media_results.extend( more_media_results )

HC.pubsub.pub( 'set_num_query_results', len( media_results ), len( query_hash_ids ) )

self.WaitUntilGoodTimeToUseGUIThread()

HC.pubsub.pub( 'set_num_query_results', len( media_results ), len( query_hash_ids ) )

HC.pubsub.pub( 'file_query_done', query_key, media_results )
self.WaitUntilGoodTimeToUseGUIThread()

except Exception as e: HC.ShowException( e )

HC.pubsub.pub( 'file_query_done', query_key, media_results )


def TIMEREventMaintenance( self, event ):
Expand Down
Loading

0 comments on commit 9997b85

Please sign in to comment.