Skip to content

MediaLibrary: Media Titles Optimizer

Sliem requested to merge Sliem/vlc-ios:MediaLibarayTitlesOptimizer into master

Objective

  • Optimizing media titles in Media Groups and Albums for easier readability.
  • Enhancing optimization performance by caching the optimization results, preventing redundant computations.

Problem

Currently, some media files have long titles, making it difficult to distinguish them within Media Groups or Albums . This can be frustrating for users seeking specific files.

Solution

  1. Media Title Optimizer:
    • The solution extracts common substrings from all media titles within a group.
    • It stores these substrings and their frequencies in a "Substring Dictionary."
    • Example: [TopCinema: 2, Loki: 2, 1080p: 2, DNSP: 2, WEB: 2, DL: 2]
    • it generates optimized titles for each media by removing frequent substrings (e.g., removing "TopCinema" and "1080p" from titles in the example).
    • Optimized titles and original titles are stored in separate dictionaries for easy retrieval.
  2. Caching:
    • To avoid repeated optimization and improve performance, the following data is cached in JSON files:
      • MediaGroupSubstringCache.json: Stores common substrings and their frequencies for each group.
        • The format [(MediaGroup/Album) Title : [Common Substring : Frequency]]
      • ItemOptimizedTitles.json: Stores optimized titles for each media within a group.
        • The Format [(MediaGroup/Album) Title: [Original Title: Optimized Title]]
    • Users can enable/disable title optimization from settings labeled Optimize Item Name for Display.

Results:

  • Improved user experience: Makes titles easier to read and identify within Media Groups and Albums.
  • User control: Users can choose to optimize titles or show back to original titles.

Further Considerations

  • Updates caches when adding, removing, or updating media items.
  • The titles that require re-optimization are those associated with groups/albums when they are added, removed, or renamed.

This Merge should solve #1782

Merge request reports