Skip to main content

## Module conversions

Source
Expand description

Unit conversion and formatting utilities

This module provides centralized conversion functions for:

- Jellyfin tick-to-seconds conversions
- Volume normalization (0-1 vs 0-100 ranges)
- Time formatting for UI display

These utilities eliminate magic numbers and duplicate conversion logic across the codebase.

## Constants§

TICKS_PER_SECOND
  Number of Jellyfin ticks per second (10 million)

## Functions§

calculate_progress
  Calculate progress percentage from position and duration
format_time
  Format time in seconds to MM:SS display string
format_time_long
  Format time in seconds to HH:MM:SS or MM:SS display string
percent_to_volume
  Convert percentage volume (0-100) to normalized (0.0-1.0)
seconds_to_ticks
  Convert seconds to Jellyfin ticks
ticks_to_seconds
  Convert Jellyfin ticks to seconds
volume_to_percent
  Convert normalized volume (0.0-1.0) to percentage (0-100)