diff --git a/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py b/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py index 8f4d92f..efc1f97 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular_nonfollowers.py @@ -144,9 +144,8 @@ class DicoverContentCurrentlyPopularNonFollowers(DVMTaskInterface): database = await NostrDatabase.sqlite(self.db_name) cli = ClientBuilder().database(database).signer(signer).opts(opts).build() - await cli.add_relay("wss://relay.damus.io") - await cli.add_relay("wss://nostr.oxtr.dev") - await cli.add_relay("wss://nostr.mom") + for relay in self.dvm_config.RECONCILE_DB_RELAY_LIST: + await cli.add_relay(relay) # ropts = RelayOptions().ping(False) # cli.add_relay_with_opts("wss://nostr.band", ropts) @@ -173,8 +172,7 @@ class DicoverContentCurrentlyPopularNonFollowers(DVMTaskInterface): print("Couldn't find follower List") return [] - - + print(len(followings)) timestamp_since = Timestamp.now().as_secs() - self.db_since since = Timestamp.from_secs(timestamp_since) @@ -182,8 +180,8 @@ class DicoverContentCurrentlyPopularNonFollowers(DVMTaskInterface): filter1 = Filter().kind(definitions.EventDefinitions.KIND_NOTE).since(since) events = await database.query([filter1]) - if self.dvm_config.LOGLEVEL.value >= LogLevel.DEBUG.value: - print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events)) + " Events") + + print("[" + self.dvm_config.NIP89.NAME + "] Considering " + str(len(events)) + " Events") ns.finallist = {} for event in events: @@ -198,6 +196,7 @@ class DicoverContentCurrentlyPopularNonFollowers(DVMTaskInterface): if len(reactions) >= self.min_reactions: ns.finallist[event.id().to_hex()] = len(reactions) + print(len(ns.finallist)) result_list = [] finallist_sorted = sorted(ns.finallist.items(), key=lambda x: x[1], reverse=True)[:int(options["max_results"])] for entry in finallist_sorted: @@ -255,6 +254,7 @@ class DicoverContentCurrentlyPopularNonFollowers(DVMTaskInterface): except Exception as e: print(e) + # We build an example here that we can call by either calling this file directly from the main directory, # or by adding it to our playground. You can call the example and adjust it to your needs or redefine it in the # playground or elsewhere diff --git a/tests/discovery.py b/tests/discovery.py index bf8d21c..a7007e1 100644 --- a/tests/discovery.py +++ b/tests/discovery.py @@ -758,7 +758,8 @@ def playground(): "db_since": 60 * 60 * 6, # 8h since gmt, } cost = 0 - image = "https://image.nostr.build/c6879f458252641d04d0aa65fd7f1e005a4f7362fd407467306edc2f4acdb113.jpg" + #image = "https://image.nostr.build/c6879f458252641d04d0aa65fd7f1e005a4f7362fd407467306edc2f4acdb113.jpg" + image = "https://i.nostr.build/U5AO3vUMy47NWSQG.png" discovery_topzaps = build_example_top_zapped("Top Zapped notes", "discovery_content_top_zaps", admin_config=admin_config_top_zaps, @@ -943,8 +944,8 @@ def playground(): "db_since": 2 * 60 * 60, # 2h since gmt, } cost = 0 - image = "https://image.nostr.build/d92652a6a07677e051d647dcf9f0f59e265299b3335a939d008183a911513f4a.jpg" - + #image = "https://image.nostr.build/d92652a6a07677e051d647dcf9f0f59e265299b3335a939d008183a911513f4a.jpg" + image = "https://i.nostr.build/ZJqko0W9ApEVZAPt.png" discovery_followers = build_example_popular_followers( "Popular from npubs you follow", "discovery_content_followers", @@ -972,7 +973,7 @@ def playground(): update_db = False options_nonfollowers_popular = { "db_name": "db/nostr_recent_notes.db", - "db_since": 3 * 60 * 60, # 2h since gmt, + "db_since": 2 * 60 * 60, # 2h since gmt, } cost = 0 image = "https://i.nostr.build/l11EczDmpZBaxlRm.jpg" @@ -1005,7 +1006,8 @@ def playground(): "db_since": 60 * 60 * 2, # 1h since gmt, } cost = 0 - image = "https://i.nostr.build/H6SMmCl7eRDvkbAn.jpg" + #image = "https://i.nostr.build/H6SMmCl7eRDvkbAn.jpg" + image = "https://i.nostr.build/fsGWicUhyRrfy85d.jpg" discovery_one_per_follow = build_example_oneperfollow("One per follow", "discovery_latest_per_follow", admin_config=admin_config_opf, @@ -1035,7 +1037,8 @@ def playground(): "db_since": 60 * 60, # 1h since gmt, } cost = 0 - image = "https://image.nostr.build/b29b6ec4bf9b6184f69d33cb44862db0d90a2dd9a506532e7ba5698af7d36210.jpg" + #image = "https://image.nostr.build/b29b6ec4bf9b6184f69d33cb44862db0d90a2dd9a506532e7ba5698af7d36210.jpg" + image = "https://i.nostr.build/AnBKrfAIRMhWm0h3.jpg" discovery_global = build_example_popular("Currently Popular Notes DVM", "discovery_content_test", admin_config=admin_config_global_popular,