use a shared db for content dvms

This commit is contained in:
Believethehype
2024-05-17 10:34:27 +02:00
parent 817170670b
commit f5548c6fac
6 changed files with 146 additions and 88 deletions

View File

@@ -16,11 +16,14 @@ from nostr_dvm.utils.zap_utils import check_and_set_ln_bits_keys
def playground():
# Generate an optional Admin Config, in this case, whenever we give our DVMs this config, they will (re)broadcast
# their NIP89 announcement
# You can create individual admins configs and hand them over when initializing the dvm,
# for example to whilelist users or add to their balance.
# If you use this global config, options will be set for all dvms that use it.
# Popular NOSTR.band
admin_config_trending_nostr_band = AdminConfig()
custom_processing_msg = "Looking for trending notes on nostr.band.."
trending_nb = discovery_trending_notes_nostrband.build_example("Trending Notes on nostr.band",
"trending_notes_nostrband",
admin_config_trending_nostr_band,
custom_processing_msg)
trending_nb.run()
# Popular Garden&Plants
admin_config_plants = AdminConfig()
@@ -33,9 +36,9 @@ def playground():
options_plants = {
"search_list": ["garden", "gardening", "nature", " plants ", " plant ", " herb ", " herbs " " pine ",
"homesteading", "rosemary", "chicken", "🪻", "🌿", "☘️", "🌲", "flower", "forest", "watering",
"permies", "planting", "farm", "vegetable", "fruit", " grass ", "sunshine",
"#flowerstr", "#bloomscrolling", "#treestr", "#plantstr", "touchgrass",],
"avoid_list": ["porn", "smoke", "nsfw", "bitcoin", "bolt12", "bolt11", "github", "currency", "utxo",
"permies", "planting", "farm", "vegetable", "fruit", " grass ", "sunshine",
"#flowerstr", "#bloomscrolling", "#treestr", "#plantstr", "touchgrass", ],
"avoid_list": ["porn", "smoke", "nsfw", "bitcoin", "bolt12", "bolt11", "github", "currency", "utxo",
"encryption", "government", "airpod", "ipad", "iphone", "android", "warren",
"moderna", "pfizer",
"murder", "tax", "engagement", "hodlers", "hodl", "gdp", "global markets", "crypto", "wherostr",
@@ -43,19 +46,24 @@ def playground():
"white house", "blocks", "streaming", "summary", "wealth", "beef", "cunt", "nigger", "business",
"retail", "bakery", "synth", "slaughterhouse", "hamas", "dog days", "ww3", "socialmedia",
"nintendo", "signature", "deepfake", "congressman", "cypherpunk", "minister", "dissentwatch",
"inkblot", "covid", "robot", "pandemic", "bethesda", "zap farming", " defi ", " minister ",
"nostr-hotter-site", " ai ", "palestine", "https://boards.4chan", "https://techcrunch.com", "https://screenrant.com"],
"db_name": "db/nostr_recent_notes_plants.db",
"db_since": 10 * 60 * 60, # 10h
"inkblot", "covid", "robot", "pandemic", "bethesda", "zap farming", " defi ", " minister ",
"nostr-hotter-site", " ai ", "palestine", "https://boards.4chan", "https://techcrunch.com",
"https://screenrant.com"],
"db_name": "db/nostr_recent_notes.db",
"db_since": 10 * 60 * 60, # 10h since gmt
"personalized": False}
image = "https://image.nostr.build/a816f3f5e98e91e8a47d50f4cd7a2c17545f556d9bb0a6086a659b9abdf7ab68.jpg"
description = "I show recent notes about plants and gardening"
custom_processing_msg = ["Finding the best notes for you.. #blooming", "Looking for some positivity.. #touchgrass", "Looking for #goodvibes.."]
custom_processing_msg = ["Finding the best notes for you.. #blooming", "Looking for some positivity.. #touchgrass",
"Looking for #goodvibes.."]
update_db = False
discovery_test_sub = content_discovery_currently_popular_topic.build_example("Garden & Growth",
"discovery_content_garden",
admin_config_plants, options_plants, image,
description, custom_processing_msg)
admin_config_plants, options_plants,
image,
description, custom_processing_msg,
update_db)
discovery_test_sub.run()
# Popular Animals (Fluffy frens)
@@ -63,8 +71,10 @@ def playground():
admin_config_animals.REBROADCAST_NIP89 = False
admin_config_animals.UPDATE_PROFILE = False
options_animal = {
"search_list": ["catstr", "pawstr", "dogstr", " cat ", " cats ", "🐾", "🐈", "🐕" , " dog ", " dogs ", " fluffy ", "animal",
" duck", " lion ", " lions ", " fox ", " foxes ", " koala ", " koalas ", "capybara", "squirrel", "monkey", "panda", "alpaca", " otter"],
"search_list": ["catstr", "pawstr", "dogstr", " cat ", " cats ", "🐾", "🐈", "🐕", " dog ", " dogs ", " fluffy ",
"animal",
" duck", " lion ", " lions ", " fox ", " foxes ", " koala ", " koalas ", "capybara", "squirrel",
"monkey", "panda", "alpaca", " otter"],
"avoid_list": ["porn", "smoke", "nsfw", "bitcoin", "bolt12", "bolt11", "github", "currency", "utxo",
"encryption", "government", "airpod", "ipad", "iphone", "android", "warren",
"moderna", "pfizer",
@@ -74,63 +84,73 @@ def playground():
"retail", "bakery", "synth", "slaughterhouse", "hamas", "dog days", "ww3", "socialmedia",
"nintendo", "signature", "deepfake", "congressman", "fried chicken", "cypherpunk",
"chef", "cooked", "foodstr", "minister", "dissentwatch", "inkblot", "covid", "robot", "pandemic",
" dies ", "bethesda", " defi ", " minister ", "nostr-hotter-site", " ai ", "palestine", " hit by a", "https://boards.4chan", "https://techcrunch.com", "https://screenrant.com"],
" dies ", "bethesda", " defi ", " minister ", "nostr-hotter-site", " ai ", "palestine", "animalistic",
" hit by a", "https://boards.4chan", "https://techcrunch.com", "https://screenrant.com"],
"must_list": ["http"],
"db_name": "db/nostr_recent_notes_animals.db",
"db_since": 48 * 60 * 60, # 48h,
"personalized": False}
"must_list": ["http"],
"db_name": "db/nostr_recent_notes.db",
"db_since": 48 * 60 * 60, # 48h since gmt,
"personalized": False}
image = "https://image.nostr.build/f609311532c470f663e129510a76c9a1912ae9bc4aaaf058e5ba21cfb512c88e.jpg"
description = "I show recent notes about animals"
custom_processing_msg = ["Looking for fluffy frens...", "Let's see if we find some animals for you..", "Looking for the goodest bois and girls.."]
custom_processing_msg = ["Looking for fluffy frens...", "Let's see if we find some animals for you..",
"Looking for the goodest bois and girls.."]
update_db = True #As this is our largerst DB we update it here, and the other dvms use it. TODO make an own scheduler that only updates the db
discovery_animals = content_discovery_currently_popular_topic.build_example("Fluffy Frens",
"discovery_content_fluffy",
admin_config_animals, options_animal, image,
description, custom_processing_msg)
"discovery_content_fluffy",
admin_config_animals, options_animal,
image,
description, custom_processing_msg,
update_db)
discovery_animals.run()
# Popular Followers
admin_config_followers = AdminConfig()
admin_config_followers.REBROADCAST_NIP89 = False
admin_config_followers.UPDATE_PROFILE = False
custom_processing_msg = ["Looking for popular notes from npubs you follow..", "Let's see what npubs you follow have been up to..", "Processing a personalized feed, just for you.."]
custom_processing_msg = ["Looking for popular notes from npubs you follow..",
"Let's see what npubs you follow have been up to..",
"Processing a personalized feed, just for you.."]
update_db = False
options_followers_popular = {
"db_name": "db/nostr_recent_notes.db",
"db_since": 2 * 60 * 60, # 2h since gmt,
}
discovery_followers = content_discovery_currently_popular_followers.build_example("Currently Popular Notes from npubs you follow",
"discovery_content_followers",
admin_config_followers,
custom_processing_msg)
discovery_followers = content_discovery_currently_popular_followers.build_example(
"Currently Popular Notes from npubs you follow",
"discovery_content_followers",
admin_config=admin_config_followers,
options=options_followers_popular,
processing_msg=custom_processing_msg,
update_db=update_db)
discovery_followers.run()
#Popular Global
# Popular Global
admin_config_global_popular = AdminConfig()
admin_config_global_popular.REBROADCAST_NIP89 = False
admin_config_global_popular.UPDATE_PROFILE = False
custom_processing_msg = ["Looking for popular notes on the Nostr..", "Let's see what's trending on Nostr..", "Finding the best notes for you.."]
custom_processing_msg = ["Looking for popular notes on the Nostr..", "Let's see what's trending on Nostr..",
"Finding the best notes for you.."]
update_db = False
options_global_popular = {
"db_name": "db/nostr_recent_notes.db",
"db_since": 60 * 60, # 1h since gmt,
}
discovery_global = content_discovery_currently_popular.build_example("Currently Popular Notes DVM",
"discovery_content_test",
admin_config_global_popular,
custom_processing_msg)
"discovery_content_test",
admin_config=admin_config_global_popular,
options=options_global_popular,
processing_msg=custom_processing_msg,
update_db=update_db)
discovery_global.run()
# 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()
#Popular NOSTR.band
admin_config_trending_nostr_band = AdminConfig()
custom_processing_msg = "Looking for trending notes on nostr.band.."
trending_nb = discovery_trending_notes_nostrband.build_example("Trending Notes on nostr.band",
"trending_notes_nostrband", admin_config_trending_nostr_band, custom_processing_msg)
trending_nb.run()
# Subscription Manager DVM
subscription_config = DVMConfig()
subscription_config.PRIVATE_KEY = check_and_set_private_key("dvm_subscription")