Spaces:
Running
Running
oceansweep
commited on
Commit
•
c76c323
1
Parent(s):
5616cfc
Upload DB_Manager.py
Browse files
App_Function_Libraries/DB/DB_Manager.py
CHANGED
@@ -50,7 +50,7 @@ from App_Function_Libraries.DB.SQLite_DB import (
|
|
50 |
check_media_and_whisper_model as sqlite_check_media_and_whisper_model, \
|
51 |
create_document_version as sqlite_create_document_version,
|
52 |
get_document_version as sqlite_get_document_version, sqlite_search_db, add_media_chunk as sqlite_add_media_chunk,
|
53 |
-
sqlite_update_fts_for_media, sqlite_get_unprocessed_media, fetch_item_details as sqlite_fetch_item_details, \
|
54 |
search_media_database as sqlite_search_media_database, mark_as_trash as sqlite_mark_as_trash, \
|
55 |
get_media_transcripts as sqlite_get_media_transcripts, get_specific_transcript as sqlite_get_specific_transcript, \
|
56 |
get_media_summaries as sqlite_get_media_summaries, get_specific_summary as sqlite_get_specific_summary, \
|
@@ -68,7 +68,7 @@ from App_Function_Libraries.DB.SQLite_DB import (
|
|
68 |
get_workflow_chat as sqlite_get_workflow_chat, update_media_content_with_version as sqlite_update_media_content_with_version, \
|
69 |
check_existing_media as sqlite_check_existing_media, get_all_document_versions as sqlite_get_all_document_versions, \
|
70 |
fetch_paginated_data as sqlite_fetch_paginated_data, get_latest_transcription as sqlite_get_latest_transcription, \
|
71 |
-
|
72 |
)
|
73 |
#
|
74 |
# Local Imports
|
@@ -417,7 +417,7 @@ def update_fts_for_media(media_id: int):
|
|
417 |
raise ValueError(f"Unsupported database type: {db_type}")
|
418 |
|
419 |
|
420 |
-
def get_unprocessed_media():
|
421 |
if db_type == 'sqlite':
|
422 |
return sqlite_get_unprocessed_media(db)
|
423 |
elif db_type == 'elasticsearch':
|
@@ -427,6 +427,16 @@ def get_unprocessed_media():
|
|
427 |
raise ValueError(f"Unsupported database type: {db_type}")
|
428 |
|
429 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
430 |
#
|
431 |
# End of DB-Ingestion functions
|
432 |
############################################################################################################
|
|
|
50 |
check_media_and_whisper_model as sqlite_check_media_and_whisper_model, \
|
51 |
create_document_version as sqlite_create_document_version,
|
52 |
get_document_version as sqlite_get_document_version, sqlite_search_db, add_media_chunk as sqlite_add_media_chunk,
|
53 |
+
sqlite_update_fts_for_media, get_unprocessed_media as sqlite_get_unprocessed_media, fetch_item_details as sqlite_fetch_item_details, \
|
54 |
search_media_database as sqlite_search_media_database, mark_as_trash as sqlite_mark_as_trash, \
|
55 |
get_media_transcripts as sqlite_get_media_transcripts, get_specific_transcript as sqlite_get_specific_transcript, \
|
56 |
get_media_summaries as sqlite_get_media_summaries, get_specific_summary as sqlite_get_specific_summary, \
|
|
|
68 |
get_workflow_chat as sqlite_get_workflow_chat, update_media_content_with_version as sqlite_update_media_content_with_version, \
|
69 |
check_existing_media as sqlite_check_existing_media, get_all_document_versions as sqlite_get_all_document_versions, \
|
70 |
fetch_paginated_data as sqlite_fetch_paginated_data, get_latest_transcription as sqlite_get_latest_transcription, \
|
71 |
+
mark_media_as_processed as sqlite_mark_media_as_processed,
|
72 |
)
|
73 |
#
|
74 |
# Local Imports
|
|
|
417 |
raise ValueError(f"Unsupported database type: {db_type}")
|
418 |
|
419 |
|
420 |
+
def get_unprocessed_media(*args, **kwargs):
|
421 |
if db_type == 'sqlite':
|
422 |
return sqlite_get_unprocessed_media(db)
|
423 |
elif db_type == 'elasticsearch':
|
|
|
427 |
raise ValueError(f"Unsupported database type: {db_type}")
|
428 |
|
429 |
|
430 |
+
def mark_media_as_processed(*args, **kwargs):
|
431 |
+
if db_type == 'sqlite':
|
432 |
+
return sqlite_mark_media_as_processed(*args, **kwargs)
|
433 |
+
elif db_type == 'elasticsearch':
|
434 |
+
# Implement Elasticsearch version
|
435 |
+
raise NotImplementedError("Elasticsearch version of mark_media_as_processed not yet implemented")
|
436 |
+
else:
|
437 |
+
raise ValueError(f"Unsupported database type: {db_type}")
|
438 |
+
|
439 |
+
|
440 |
#
|
441 |
# End of DB-Ingestion functions
|
442 |
############################################################################################################
|