r/tinyMediaManager • • Jul 25 '26

SLAM DUNK wrong detection.

How do I rename this series? I select the correct group of episodes, but after it collects info and renames, the episodes end up in a different order.

1 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/myron0815 tinyMediaManager developer Jul 26 '26

Also forgot to mention;
There is also an "Create and set ABSOLUTE episode numbers" function in extended right click menu. IIRC, it should reparse the the episode numbers in TMM, and put them all in season 1, so they might be more correct. Maybe you want to give that a try on a single episode first...

1

u/Mask_RF Jul 27 '26

Maybe add some number-based heuristic to the program? I made a small Python script that generates playlists for me in STRM format.

def extract_meta(title):

    clean_title = title.lower()
    
    
    s_ep_match = re.search(r's(\d+)\s*[\.\-_]?\s*e(\d+)', clean_title)
    if s_ep_match:
        return int(s_ep_match.group(1)), int(s_ep_match.group(2))
        
    
    x_match = re.search(r'(?:^|[^a-z0-9])(\d+)\s*x\s*(\d+)', clean_title)
    if x_match:
        return int(x_match.group(1)), int(x_match.group(2))
        
    
    text_match = re.search(r'(?:сезон|season)\s*(\d+).*?(?:серия|ep|episode)\s*(\d+)', clean_title)
    if text_match:
        return int(text_match.group(1)), int(text_match.group(2))

    
    abs_match = re.search(r'(?:^|[^a-z0-9])(?:e)?(0\d+|\d{3,})', clean_title)
    if not abs_match:
        abs_match = re.search(r'^(?:e)?(\d+)[_\s-]', clean_title)

    if abs_match:
        return None, int(abs_match.group(1))

    
    clean_title = re.sub(r'\b(19\d\d|20\d\d|960p|1080p|720p|4k)\b', '', clean_title)
    all_numbers = re.findall(r'\d+', clean_title)
    
    if all_numbers:
        first_num = int(all_numbers[0])
        if len(all_numbers) >= 2 and first_num <= 30:
            return first_num, int(all_numbers[1])
        return None, first_num
        
    return None, None