fix
This commit is contained in:
parent
b18550918d
commit
2008f73e14
|
|
@ -151,6 +151,28 @@ async def s_api_v1_storage_get(request, file_hash=None):
|
||||||
cover_tempfile_path = None
|
cover_tempfile_path = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
file_ext = content.filename.split('.')[-1]
|
||||||
|
if file_ext == 'mp3':
|
||||||
|
audio = AudioSegment.from_mp3(file_path)
|
||||||
|
elif file_ext == 'wav':
|
||||||
|
audio = AudioSegment.from_wav(file_path)
|
||||||
|
elif file_ext == 'ogg':
|
||||||
|
audio = AudioSegment.from_ogg(file_path)
|
||||||
|
elif file_ext == 'flv':
|
||||||
|
audio = AudioSegment.from_flv(file_path)
|
||||||
|
|
||||||
|
if not audio:
|
||||||
|
try:
|
||||||
|
audio = AudioSegment.from_file(file_path)
|
||||||
|
except BaseException as e:
|
||||||
|
make_log("Storage", f"Error loading audio from file: {e}", level="debug")
|
||||||
|
|
||||||
|
if not audio:
|
||||||
|
try:
|
||||||
|
audio = AudioSegment(content_file_bin)
|
||||||
|
except BaseException as e:
|
||||||
|
make_log("Storage", f"Error loading audio from binary: {e}", level="debug")
|
||||||
|
|
||||||
audio = AudioSegment(content_file_bin)
|
audio = AudioSegment(content_file_bin)
|
||||||
audio = audio[:seconds_limit * 1000] if seconds_limit else audio
|
audio = audio[:seconds_limit * 1000] if seconds_limit else audio
|
||||||
audio.export(tempfile_path, format="mp3", cover=cover_tempfile_path)
|
audio.export(tempfile_path, format="mp3", cover=cover_tempfile_path)
|
||||||
|
|
|
||||||
|
|
@ -41,19 +41,21 @@ async def license_index_loop(memory, platform_found: bool, seqno: int) -> [bool,
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
make_log("LicenseIndex", f"Error: {e}" + '\n' + traceback.format_exc(), level="error")
|
make_log("LicenseIndex", f"Error: {e}" + '\n' + traceback.format_exc(), level="error")
|
||||||
|
|
||||||
for content in session.query(UserContent).filter(
|
process_content = session.query(UserContent).filter(
|
||||||
and_(
|
and_(
|
||||||
UserContent.type.startswith('nft/'),
|
UserContent.type.startswith('nft/'),
|
||||||
UserContent.updated < (datetime.now() - timedelta(minutes=15)),
|
UserContent.updated < (datetime.now() - timedelta(minutes=5)),
|
||||||
)
|
)
|
||||||
):
|
).first()
|
||||||
|
if process_content:
|
||||||
make_log("LicenseIndex", f"Syncing content with blockchain: {content.id}", level="info")
|
make_log("LicenseIndex", f"Syncing content with blockchain: {content.id}", level="info")
|
||||||
try:
|
try:
|
||||||
await content.sync_with_chain(session)
|
await process_content.sync_with_chain(session)
|
||||||
content.updated = datetime.now()
|
|
||||||
session.commit()
|
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
make_log("LicenseIndex", f"Error: {e}" + '\n' + traceback.format_exc(), level="error")
|
make_log("LicenseIndex", f"Error: {e}" + '\n' + traceback.format_exc(), level="error")
|
||||||
|
finally:
|
||||||
|
process_content.updated = datetime.now()
|
||||||
|
session.commit()
|
||||||
|
|
||||||
for action in session.query(UserAction).filter(
|
for action in session.query(UserAction).filter(
|
||||||
and_(
|
and_(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue