-
-
Notifications
You must be signed in to change notification settings - Fork 18
DYNAMIC_DURATION_GUIDE
Chuck edited this page Aug 12, 2025
·
1 revision
The news manager now includes intelligent dynamic duration calculation that automatically determines the exact time needed to display all your selected headlines without cutting off mid-scroll.
The system calculates the perfect display duration by:
- Measuring Text Width: Calculates the exact pixel width of all headlines combined
- Computing Scroll Distance: Determines how far text needs to scroll (display width + text width)
- Calculating Time: Uses scroll speed and delay to compute exact timing
- Adding Buffer: Includes configurable buffer time for smooth transitions
- Applying Limits: Ensures duration stays within your min/max preferences
With current settings (4 feeds, 2 headlines each):
- Total Headlines: 8 headlines per cycle
- Estimated Duration: 57 seconds
- Cycles per Hour: ~63 cycles
- Result: Perfect timing, no cut-offs
{
"news_manager": {
"dynamic_duration": true, // Enable/disable feature
"min_duration": 30, // Minimum display time (seconds)
"max_duration": 300, // Maximum display time (seconds)
"duration_buffer": 0.1, // Buffer time (10% extra)
"headlines_per_feed": 2, // Headlines from each feed
"scroll_speed": 2, // Pixels per frame
"scroll_delay": 0.02 // Seconds per frame
}
}| Scenario | Headlines | Est. Duration | Cycles/Hour |
|---|---|---|---|
| Light | 4 headlines | 30s (min) | 120 |
| Medium | 6 headlines | 30s (min) | 120 |
| Current | 8 headlines | 57s | 63 |
| Heavy | 12 headlines | 85s | 42 |
| Maximum | 20+ headlines | 300s (max) | 12 |
- No Cut-offs: Headlines never cut off mid-sentence
- Complete Cycles: Always shows full rotation of all selected content
- Smooth Transitions: Buffer time prevents jarring switches
- Adapts to Content: More feeds = longer duration automatically
- User Control: Set your preferred min/max limits
- Flexible: Works with any combination of feeds and headlines
- Consistent Experience: Same content always takes same time
- Reliable Cycling: Know exactly when content will repeat
- Configurable: Adjust to your viewing preferences
# Test dynamic duration calculations
python3 test_dynamic_duration.py
# Check current status
python3 test_dynamic_duration.py status# Add more feeds (increases duration)
python3 add_custom_feed_example.py add "Tennis" "https://www.atptour.com/en/rss/news"
# Check new duration
python3 test_dynamic_duration.py status- Go to
http://display-ip:5001 - Click "News Manager" tab
- Adjust "Duration Settings":
- Min Duration: Shortest acceptable cycle time
- Max Duration: Longest acceptable cycle time
- Buffer: Extra time for smooth transitions
{
"min_duration": 45, // Increase for longer minimum cycles
"max_duration": 180, // Decrease for shorter maximum cycles
"duration_buffer": 0.15 // Increase buffer for more transition time
}{
"scroll_speed": 3, // Faster scroll = shorter duration
"scroll_delay": 0.015 // Less delay = shorter duration
}{
"headlines_per_feed": 3, // More headlines = longer duration
"enabled_feeds": [ // More feeds = longer duration
"NFL", "NBA", "MLB", "NHL", "BBC F1", "Tennis"
]
}-
Increase
min_duration - Add more feeds or headlines per feed
-
Decrease
scroll_speed
-
Decrease
max_duration - Remove some feeds
-
Reduce
headlines_per_feed -
Increase
scroll_speed
-
Increase
duration_buffer -
Adjust
scroll_delay
To use fixed timing instead:
{
"dynamic_duration": false,
"fixed_duration": 60 // Fixed 60-second cycles
}total_scroll_distance = display_width + text_width
frames_needed = total_scroll_distance / scroll_speed
base_time = frames_needed * scroll_delay
buffer_time = base_time * duration_buffer
final_duration = base_time + buffer_time (within min/max limits)
The display controller automatically:
- Calls
news_manager.get_dynamic_duration() - Uses returned value for display timing
- Switches to next mode after exact calculated time
- Logs duration decisions for debugging
- Start Conservative: Use default settings initially
- Test Changes: Use test script to preview duration changes
- Monitor Performance: Watch for smooth transitions
- Adjust Gradually: Make small changes to settings
- Consider Viewing: Match duration to your typical viewing patterns
The dynamic duration feature ensures your news ticker always displays complete, perfectly-timed content cycles regardless of how many feeds or headlines you configure!