File size: 2,037 Bytes
2e205f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import os
import json

ROOT_DIR = r"C:\ComfyUI\Articles"
PENDING_FILE = os.path.join(ROOT_DIR, "pending.json")

def main():
    if not os.path.exists(PENDING_FILE):
        print("No pending articles queue found.")
        return
        
    try:
        with open(PENDING_FILE, 'r', encoding='utf-8') as f:
            pending = json.load(f)
    except Exception as e:
        print(f"Failed to read pending queue: {e}")
        return
        
    if not pending:
        print("No pending articles in queue.")
        return
        
    # Group by category
    by_category = {}
    for item in pending:
        cat = item["category"]
        if cat not in by_category:
            by_category[cat] = []
        by_category[cat].append(item)
        
    print(f"=== PENDING ARTICLES FOR SYNTHESIS (Total: {len(pending)}) ===")
    for category, items in by_category.items():
        print(f"\nCategory: {category}")
        for idx, item in enumerate(items, 1):
            print(f"  {idx}. Title: {item['title']}")
            print(f"     Link: {item['link']}")
            print(f"     Source File: {item['source_file']}")
            
            src_path = item["source_file"]
            content = ""
            if src_path and os.path.exists(src_path):
                try:
                    with open(src_path, 'r', encoding='utf-8') as sf:
                        content = sf.read().strip()
                except Exception as e:
                    content = f"Error reading source file: {e}"
            else:
                content = "Source file does not exist."
                
            truncated = content
            if len(content) > 1500:
                truncated = content[:1500] + "... [truncated]"
                
            print("     Content:")
            # Indent content lines for cleaner logs
            for line in truncated.splitlines():
                if line.strip():
                    print(f"       {line}")
            print("\n" + "-" * 40)

if __name__ == "__main__":
    main()