Skip to content

Commit

Permalink
updates for 4.0.3 (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
aw-was-here authored Mar 26, 2023
1 parent da03e12 commit 8d530aa
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 10 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@

# Changelog

## Version 4.0.3 - Unreleased

* Force binaries to build with Python 3.10 as 3.11 causes problems.
* Verify the image cache at startup and every hour
* Fixed some bugs around base64 encoding in the webserver
that would trigger a 500 HTTP error
* missed an await in trackrequest that cause it to go awol
* Quiet down the logging of Virtual DJ playlist import
* Try to make the artistextras artwork handling consistent when
artist names are in disagreement. (Part 1)
* Change TCP timeouts in artistextras to be based on track delay times
if possible
* Fix some edge-case crashes with artistextras
* Push the discord more :D
* Enhanced the automated testing of some parts of the code base
* More dependency updates
* Add some debug messages for some rare issues
* JSON test source now supports random tracks

## Version 4.0.2 - 2023-03-12

* Some dependency updates which should improve a few edge-case problems.
Expand Down
2 changes: 1 addition & 1 deletion nowplaying/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def read_last_meta(self):
'''SELECT * FROM currentmeta ORDER BY id DESC LIMIT 1''')
except sqlite3.OperationalError:
for line in traceback.format_exc().splitlines():
logging.debug(line)
logging.error(line)
return None

row = cursor.fetchone()
Expand Down
24 changes: 15 additions & 9 deletions nowplaying/imagecache.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def image_dl(self, imagedict):
}
dlimage = session.get(imagedict['url'], timeout=5, headers=headers)
except Exception as error: # pylint: disable=broad-except
logging.debug('image_dl: %s %s', imagedict['url'], error)
logging.error('image_dl: %s %s', imagedict['url'], error)
self.erase_url(imagedict['url'])
return
if dlimage.status_code == 200:
Expand All @@ -422,7 +422,7 @@ def image_dl(self, imagedict):
imagetype=imagedict['imagetype'],
cachekey=cachekey)
else:
logging.debug('image_dl: status_code %s', dlimage.status_code)
logging.error('image_dl: status_code %s', dlimage.status_code)
self.erase_url(imagedict['url'])
return

Expand All @@ -444,7 +444,7 @@ async def verify_cache(self):
if not self.databasefile.exists():
return

cachekeys = []
cachekeys = {}

try:
logging.debug('Starting image cache verification')
Expand All @@ -457,21 +457,27 @@ async def verify_cache(self):
url = row['url']
if url == 'STOPWNP':
continue
cachekeys.append(row['cachekey'])
cachekeys[row['cachekey']] = url
except: # pylint: disable=bare-except
for line in traceback.format_exc().splitlines():
logging.debug(line)
logging.error(line)

startsize = len(cachekeys)
if not startsize:
logging.debug('Finished image cache verification: no cache!')
return

count = startsize
# making this two separate operations unlocks the DB
for key in cachekeys:
for key, url in cachekeys.items():
try:
image = self.cache[key] # pylint: disable=unused-variable
except KeyError:
count -= 1
logging.debug('%s/%s expired', key, url)
self.erase_cachekey(key)
logging.debug('Finished image cache verification: %s images',
len(cachekeys))
self.erase_url(url)
logging.debug('Finished image cache verification: %s/%s images', count,
startsize)

def queue_process(self, logpath, maxworkers=5):
''' Process to download stuff in the background to avoid the GIL '''
Expand Down

0 comments on commit 8d530aa

Please sign in to comment.