示例#1
0
 def recount_videos_and_invalidate_parents(node, force=False, stamp_urls=False):
     """
     Call stamp_video_availability (if necessary); if a change has been detected,
     then check parents to see if their counts should be invalidated.
     """
     do_it = force
     do_it = do_it or "nvideos_local" not in node
     do_it = do_it or any(["nvideos_local" not in child for child in node.get("children", [])])
     if do_it:
         logging.debug("Adding video counts %s%sto topic (and all descendants) %s" % (
             "(and urls) " if stamp_urls else "",
             "(forced) " if force else "",
             node["path"],
         ))
         (_a, _b, _c, _d, changed) = stamp_availability_on_topic(topic=node, force=force, stamp_urls=stamp_urls)
         if changed:
             strip_counts_from_ancestors(node)
     return node
示例#2
0
 def preload_global_data():
     if not settings.CENTRAL_SERVER:
         logging.info("Preloading topic data.")
         from main.topic_tools import get_topic_tree
         from updates import stamp_availability_on_topic
         stamp_availability_on_topic(get_topic_tree(), force=True, stamp_urls=True)