mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-10-11 10:13:29 +02:00
Update discovery.py
This commit is contained in:
@@ -7,20 +7,19 @@ from pathlib import Path
|
|||||||
import dotenv
|
import dotenv
|
||||||
from nostr_sdk import init_logger, LogLevel, Keys, NostrDatabase
|
from nostr_sdk import init_logger, LogLevel, Keys, NostrDatabase
|
||||||
|
|
||||||
from nostr_dvm.tasks.content_discovery_currently_latest_longform import DicoverContentLatestLongForm
|
|
||||||
from nostr_dvm.tasks.content_discovery_currently_latest_wiki import DicoverContentLatestWiki
|
|
||||||
from nostr_dvm.tasks.content_discovery_currently_popular_gallery import DicoverContentCurrentlyPopularGallery
|
|
||||||
from nostr_dvm.tasks.content_discovery_currently_popular_mostr import DicoverContentCurrentlyPopularMostr
|
|
||||||
from nostr_dvm.tasks.content_discovery_currently_popular_nonfollowers import DicoverContentCurrentlyPopularNonFollowers
|
|
||||||
from nostr_dvm.tasks.content_discovery_latest_one_per_follower import Discoverlatestperfollower
|
|
||||||
from nostr_dvm.tasks.content_discovery_update_db_only import DicoverContentDBUpdateScheduler
|
|
||||||
|
|
||||||
# os.environ["RUST_BACKTRACE"] = "full"
|
# os.environ["RUST_BACKTRACE"] = "full"
|
||||||
from nostr_dvm.subscription import Subscription
|
from nostr_dvm.subscription import Subscription
|
||||||
|
from nostr_dvm.tasks.content_discovery_currently_latest_longform import DicoverContentLatestLongForm
|
||||||
|
from nostr_dvm.tasks.content_discovery_currently_latest_wiki import DicoverContentLatestWiki
|
||||||
from nostr_dvm.tasks.content_discovery_currently_popular import DicoverContentCurrentlyPopular
|
from nostr_dvm.tasks.content_discovery_currently_popular import DicoverContentCurrentlyPopular
|
||||||
from nostr_dvm.tasks.content_discovery_currently_popular_by_top_zaps import DicoverContentCurrentlyPopularZaps
|
from nostr_dvm.tasks.content_discovery_currently_popular_by_top_zaps import DicoverContentCurrentlyPopularZaps
|
||||||
from nostr_dvm.tasks.content_discovery_currently_popular_followers import DicoverContentCurrentlyPopularFollowers
|
from nostr_dvm.tasks.content_discovery_currently_popular_followers import DicoverContentCurrentlyPopularFollowers
|
||||||
|
from nostr_dvm.tasks.content_discovery_currently_popular_gallery import DicoverContentCurrentlyPopularGallery
|
||||||
|
from nostr_dvm.tasks.content_discovery_currently_popular_mostr import DicoverContentCurrentlyPopularMostr
|
||||||
|
from nostr_dvm.tasks.content_discovery_currently_popular_nonfollowers import DicoverContentCurrentlyPopularNonFollowers
|
||||||
from nostr_dvm.tasks.content_discovery_currently_popular_topic import DicoverContentCurrentlyPopularbyTopic
|
from nostr_dvm.tasks.content_discovery_currently_popular_topic import DicoverContentCurrentlyPopularbyTopic
|
||||||
|
from nostr_dvm.tasks.content_discovery_latest_one_per_follower import Discoverlatestperfollower
|
||||||
|
from nostr_dvm.tasks.content_discovery_update_db_only import DicoverContentDBUpdateScheduler
|
||||||
from nostr_dvm.tasks.discovery_trending_notes_nostrband import TrendingNotesNostrBand
|
from nostr_dvm.tasks.discovery_trending_notes_nostrband import TrendingNotesNostrBand
|
||||||
from nostr_dvm.utils.admin_utils import AdminConfig
|
from nostr_dvm.utils.admin_utils import AdminConfig
|
||||||
from nostr_dvm.utils.dvmconfig import build_default_config, DVMConfig
|
from nostr_dvm.utils.dvmconfig import build_default_config, DVMConfig
|
||||||
@@ -30,7 +29,6 @@ from nostr_dvm.utils.nostr_utils import check_and_set_private_key
|
|||||||
from nostr_dvm.utils.outbox_utils import AVOID_OUTBOX_RELAY_LIST
|
from nostr_dvm.utils.outbox_utils import AVOID_OUTBOX_RELAY_LIST
|
||||||
from nostr_dvm.utils.zap_utils import check_and_set_ln_bits_keys
|
from nostr_dvm.utils.zap_utils import check_and_set_ln_bits_keys
|
||||||
|
|
||||||
|
|
||||||
rebroadcast_NIP89 = False # Announce NIP89 on startup Only do this if you know what you're doing.
|
rebroadcast_NIP89 = False # Announce NIP89 on startup Only do this if you know what you're doing.
|
||||||
rebroadcast_NIP65_Relay_List = True
|
rebroadcast_NIP65_Relay_List = True
|
||||||
update_profile = False
|
update_profile = False
|
||||||
@@ -40,13 +38,12 @@ use_logger = True
|
|||||||
log_level = LogLevel.ERROR
|
log_level = LogLevel.ERROR
|
||||||
max_sync_duration_in_h = 48
|
max_sync_duration_in_h = 48
|
||||||
|
|
||||||
|
|
||||||
SYNC_DB_RELAY_LIST = ["wss://relay.damus.io",
|
SYNC_DB_RELAY_LIST = ["wss://relay.damus.io",
|
||||||
"wss://relay.primal.net",
|
#"wss://relay.primal.net",
|
||||||
"wss://nostr.oxtr.dev"]
|
"wss://nostr.oxtr.dev"]
|
||||||
|
|
||||||
RELAY_LIST = ["wss://relay.primal.net",
|
RELAY_LIST = ["wss://nostr.mom",
|
||||||
"wss://nostr.mom",
|
#"wss://relay.primal.net",
|
||||||
"wss://nostr.oxtr.dev",
|
"wss://nostr.oxtr.dev",
|
||||||
"wss://relay.nostr.net"
|
"wss://relay.nostr.net"
|
||||||
]
|
]
|
||||||
@@ -144,7 +141,6 @@ def build_example_gallery(name, identifier, admin_config, options, image, cost=0
|
|||||||
admin_config=admin_config, options=options)
|
admin_config=admin_config, options=options)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def build_example_nostrband(name, identifier, admin_config, image, about, custom_processing_msg):
|
def build_example_nostrband(name, identifier, admin_config, image, about, custom_processing_msg):
|
||||||
dvm_config: DVMConfig = build_default_config(identifier)
|
dvm_config: DVMConfig = build_default_config(identifier)
|
||||||
dvm_config.USE_OWN_VENV = False
|
dvm_config.USE_OWN_VENV = False
|
||||||
@@ -406,10 +402,9 @@ def build_example_popular_followers(name, identifier, admin_config, options, ima
|
|||||||
options=options,
|
options=options,
|
||||||
admin_config=admin_config)
|
admin_config=admin_config)
|
||||||
|
|
||||||
|
|
||||||
def build_example_popular_non_followers(name, identifier, admin_config, options, image, cost=0, update_rate=300,
|
def build_example_popular_non_followers(name, identifier, admin_config, options, image, cost=0, update_rate=300,
|
||||||
processing_msg=None, update_db=True, database=None):
|
processing_msg=None, update_db=True, database=None):
|
||||||
|
|
||||||
|
|
||||||
dvm_config = build_default_config(identifier)
|
dvm_config = build_default_config(identifier)
|
||||||
dvm_config.USE_OWN_VENV = False
|
dvm_config.USE_OWN_VENV = False
|
||||||
dvm_config.SHOWLOG = True
|
dvm_config.SHOWLOG = True
|
||||||
@@ -527,7 +522,6 @@ def build_example_top_zapped(name, identifier, admin_config, options, image, cos
|
|||||||
|
|
||||||
def build_example_mostr(name, identifier, admin_config, options, image, cost=0, update_rate=180, processing_msg=None,
|
def build_example_mostr(name, identifier, admin_config, options, image, cost=0, update_rate=180, processing_msg=None,
|
||||||
update_db=True):
|
update_db=True):
|
||||||
|
|
||||||
dvm_config = build_default_config(identifier)
|
dvm_config = build_default_config(identifier)
|
||||||
dvm_config.USE_OWN_VENV = False
|
dvm_config.USE_OWN_VENV = False
|
||||||
dvm_config.LOGLEVEL = LogLevel.INFO
|
dvm_config.LOGLEVEL = LogLevel.INFO
|
||||||
@@ -570,7 +564,8 @@ def build_example_mostr(name, identifier, admin_config, options, image, cost=0,
|
|||||||
admin_config=admin_config, options=options)
|
admin_config=admin_config, options=options)
|
||||||
|
|
||||||
|
|
||||||
def build_example_oneperfollow(name, identifier, admin_config, options, image, cost=0, update_rate=180, processing_msg=None,
|
def build_example_oneperfollow(name, identifier, admin_config, options, image, cost=0, update_rate=180,
|
||||||
|
processing_msg=None,
|
||||||
update_db=True):
|
update_db=True):
|
||||||
dvm_config = build_default_config(identifier)
|
dvm_config = build_default_config(identifier)
|
||||||
dvm_config.USE_OWN_VENV = False
|
dvm_config.USE_OWN_VENV = False
|
||||||
@@ -615,8 +610,8 @@ def build_example_oneperfollow(name, identifier, admin_config, options, image, c
|
|||||||
async def init_db(database):
|
async def init_db(database):
|
||||||
return NostrDatabase.lmdb(database)
|
return NostrDatabase.lmdb(database)
|
||||||
|
|
||||||
def playground():
|
|
||||||
|
|
||||||
|
def playground():
|
||||||
main_db = "db/nostr_recent_notes.db"
|
main_db = "db/nostr_recent_notes.db"
|
||||||
DATABASE = asyncio.run(init_db(main_db))
|
DATABASE = asyncio.run(init_db(main_db))
|
||||||
# DB Scheduler, do not announce, just use it to update the DB for the other DVMs.
|
# DB Scheduler, do not announce, just use it to update the DB for the other DVMs.
|
||||||
@@ -639,8 +634,6 @@ def playground():
|
|||||||
database=DATABASE)
|
database=DATABASE)
|
||||||
db_scheduler.run()
|
db_scheduler.run()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
admin_config_gallery = AdminConfig()
|
admin_config_gallery = AdminConfig()
|
||||||
admin_config_gallery.REBROADCAST_NIP89 = rebroadcast_NIP89
|
admin_config_gallery.REBROADCAST_NIP89 = rebroadcast_NIP89
|
||||||
admin_config_gallery.REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List
|
admin_config_gallery.REBROADCAST_NIP65_RELAY_LIST = rebroadcast_NIP65_Relay_List
|
||||||
@@ -672,7 +665,6 @@ def playground():
|
|||||||
# discover_gallery.run()
|
# discover_gallery.run()
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
# Latest Longform
|
# Latest Longform
|
||||||
admin_config_longform = AdminConfig()
|
admin_config_longform = AdminConfig()
|
||||||
admin_config_longform.REBROADCAST_NIP89 = rebroadcast_NIP89
|
admin_config_longform.REBROADCAST_NIP89 = rebroadcast_NIP89
|
||||||
@@ -701,8 +693,6 @@ def playground():
|
|||||||
|
|
||||||
latest_longform.run()
|
latest_longform.run()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Latest Wiki
|
# Latest Wiki
|
||||||
admin_config_wiki = AdminConfig()
|
admin_config_wiki = AdminConfig()
|
||||||
admin_config_wiki.REBROADCAST_NIP89 = rebroadcast_NIP89
|
admin_config_wiki.REBROADCAST_NIP89 = rebroadcast_NIP89
|
||||||
@@ -731,8 +721,6 @@ def playground():
|
|||||||
|
|
||||||
latest_wiki.run()
|
latest_wiki.run()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Popular top zapped
|
# Popular top zapped
|
||||||
admin_config_top_zaps = AdminConfig()
|
admin_config_top_zaps = AdminConfig()
|
||||||
admin_config_top_zaps.REBROADCAST_NIP89 = rebroadcast_NIP89
|
admin_config_top_zaps.REBROADCAST_NIP89 = rebroadcast_NIP89
|
||||||
@@ -766,7 +754,6 @@ def playground():
|
|||||||
|
|
||||||
discovery_topzaps.run()
|
discovery_topzaps.run()
|
||||||
|
|
||||||
|
|
||||||
# Popular NOSTR.band
|
# Popular NOSTR.band
|
||||||
admin_config_trending_nostr_band = AdminConfig()
|
admin_config_trending_nostr_band = AdminConfig()
|
||||||
admin_config_trending_nostr_band.REBROADCAST_NIP89 = rebroadcast_NIP89
|
admin_config_trending_nostr_band.REBROADCAST_NIP89 = rebroadcast_NIP89
|
||||||
@@ -877,9 +864,6 @@ def playground():
|
|||||||
database=DATABASE)
|
database=DATABASE)
|
||||||
discovery_mining.run()
|
discovery_mining.run()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Popular Animals (Fluffy frens)
|
# Popular Animals (Fluffy frens)
|
||||||
admin_config_animals = AdminConfig()
|
admin_config_animals = AdminConfig()
|
||||||
admin_config_animals.REBROADCAST_NIP89 = rebroadcast_NIP89
|
admin_config_animals.REBROADCAST_NIP89 = rebroadcast_NIP89
|
||||||
@@ -890,7 +874,6 @@ def playground():
|
|||||||
# admin_config_animals.EVENTID = "79c613b5f0e71718628bd0c782a5b6b495dac491f36c326ccf416ada80fd8fdc"
|
# admin_config_animals.EVENTID = "79c613b5f0e71718628bd0c782a5b6b495dac491f36c326ccf416ada80fd8fdc"
|
||||||
# admin_config_animals.POW = True
|
# admin_config_animals.POW = True
|
||||||
|
|
||||||
|
|
||||||
options_animal = {
|
options_animal = {
|
||||||
"search_list": ["catstr", "pawstr", "dogstr", "pugstr", " cat ", " cats ", "doggo", " deer ", " dog ", " dogs ",
|
"search_list": ["catstr", "pawstr", "dogstr", "pugstr", " cat ", " cats ", "doggo", " deer ", " dog ", " dogs ",
|
||||||
" fluffy ",
|
" fluffy ",
|
||||||
@@ -1118,7 +1101,6 @@ def playground():
|
|||||||
# discovery_test_sub = content_discovery_currently_popular.build_example_subscription("Currently Popular Notes DVM (with Subscriptions)", "discovery_content_test", admin_config)
|
# discovery_test_sub = content_discovery_currently_popular.build_example_subscription("Currently Popular Notes DVM (with Subscriptions)", "discovery_content_test", admin_config)
|
||||||
# discovery_test_sub.run()
|
# discovery_test_sub.run()
|
||||||
|
|
||||||
|
|
||||||
admin_config_nostriga = AdminConfig()
|
admin_config_nostriga = AdminConfig()
|
||||||
admin_config_nostriga.REBROADCAST_NIP89 = False # rebroadcast_NIP89
|
admin_config_nostriga.REBROADCAST_NIP89 = False # rebroadcast_NIP89
|
||||||
admin_config_nostriga.REBROADCAST_NIP65_RELAY_LIST = False # rebroadcast_NIP65_Relay_List
|
admin_config_nostriga.REBROADCAST_NIP65_RELAY_LIST = False # rebroadcast_NIP65_Relay_List
|
||||||
@@ -1161,9 +1143,6 @@ def playground():
|
|||||||
# update_db=update_db)
|
# update_db=update_db)
|
||||||
# discovery_nostriga.run()
|
# discovery_nostriga.run()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Subscription Manager DVM
|
# Subscription Manager DVM
|
||||||
subscription_config = DVMConfig()
|
subscription_config = DVMConfig()
|
||||||
subscription_config.PRIVATE_KEY = check_and_set_private_key("dvm_subscription")
|
subscription_config.PRIVATE_KEY = check_and_set_private_key("dvm_subscription")
|
||||||
@@ -1185,7 +1164,6 @@ def playground():
|
|||||||
# keep_alive()
|
# keep_alive()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
env_path = Path('.env')
|
env_path = Path('.env')
|
||||||
if not env_path.is_file():
|
if not env_path.is_file():
|
||||||
|
Reference in New Issue
Block a user