| @@ 280-292 (lines=13) @@ | ||
| 277 | return collections_to_pin, remaining_slots |
|
| 278 | ||
| 279 | ||
| 280 | def fill_with_random_collections(random_collections_pool, remaining_slots): |
|
| 281 | """Fills remaining slots with random choices (version from user script).""" |
|
| 282 | # Assumes random_collections_pool is already filtered |
|
| 283 | collections_to_pin = [] |
|
| 284 | available = random_collections_pool[:] |
|
| 285 | if not available: logging.info("No items left for random."); return collections_to_pin |
|
| 286 | random.shuffle(available) |
|
| 287 | num = min(remaining_slots, len(available)) |
|
| 288 | logging.info(f"Selecting up to {num} random collections from {len(available)}.") |
|
| 289 | selected = available[:num] |
|
| 290 | collections_to_pin.extend(selected) |
|
| 291 | for c in selected: logging.info(f"Added random collection '{getattr(c, 'title', 'Untitled')}'") |
|
| 292 | return collections_to_pin |
|
| 293 | ||
| 294 | ||
| 295 | def filter_collections(config, all_collections, active_special_collections, collection_limit, library_name, selected_collections): |
|
| @@ 280-292 (lines=13) @@ | ||
| 277 | return collections_to_pin, remaining_slots |
|
| 278 | ||
| 279 | ||
| 280 | def fill_with_random_collections(random_collections_pool, remaining_slots): |
|
| 281 | """Fills remaining slots with random choices (version from user script).""" |
|
| 282 | # Assumes random_collections_pool is already filtered |
|
| 283 | collections_to_pin = [] |
|
| 284 | available = random_collections_pool[:] |
|
| 285 | if not available: logging.info("No items left for random."); return collections_to_pin |
|
| 286 | random.shuffle(available) |
|
| 287 | num = min(remaining_slots, len(available)) |
|
| 288 | logging.info(f"Selecting up to {num} random collections from {len(available)}.") |
|
| 289 | selected = available[:num] |
|
| 290 | collections_to_pin.extend(selected) |
|
| 291 | for c in selected: logging.info(f"Added random collection '{getattr(c, 'title', 'Untitled')}'") |
|
| 292 | return collections_to_pin |
|
| 293 | ||
| 294 | ||
| 295 | def filter_collections(config, all_collections, active_special_collections, collection_limit, library_name, selected_collections): |
|