Skip to content

handlr fails to correctly identify *.m3u playlists #121

@zoqaeski

Description

@zoqaeski

When opening *.m3u playlists with handlr, it incorrectly identifies them as plain text files and opens them with my text editor instead of the application I use for music and media.

$ handlr --verbose open /tmp/beets/beetsplug_play/6y91bmas.m3u
2025-10-31T03:01:21.443971Z  INFO handlr::config::main_config: Started opening paths: ["/tmp/beets/beetsplug_play/6y91bmas.m3u"]
2025-10-31T03:01:21.443982Z  INFO handlr::config::main_config: No matching regex handlers found for `/tmp/beets/beetsplug_play/6y91bmas.m3u`
2025-10-31T03:01:21.447389Z  INFO handlr::apps::user: Not running selector, choosing first handler
2025-10-31T03:01:21.447394Z  INFO handlr::config::main_config: Match found for `text/plain` in mimeapps.list Default Associations
2025-10-31T03:01:21.447741Z  INFO handlr::config::main_config: Finished opening paths

$ handlr mime /tmp/beets/beetsplug_play/6y91bmas.m3u
┌────────────────────────────────────────┬────────────┐
│ path                                   │ mime       │
├────────────────────────────────────────┼────────────┤
│ /tmp/beets/beetsplug_play/6y91bmas.m3u │ text/plain │
└────────────────────────────────────────┴────────────┘

$ mimetype /tmp/beets/beetsplug_play/6y91bmas.m3u
/tmp/beets/beetsplug_play/6y91bmas.m3u: audio/x-mpegurl

$ handlr get .m3u
mpv.desktop

$  handlr get audio/x-mpegurl
mpv.desktop

$ cat /tmp/beets/beetsplug_play/6y91bmas.m3u
/mnt/library/Music/Artist/Album/Song 1.flac
/mnt/library/Music/Artist/Album/Song 2.flac
/mnt/library/Music/Artist/Album/Song 3.flac
/mnt/library/Music/Artist/Album/Song 4.flac
...

While technically *.m3u files are plain text files, they should be handled differently because they're a list of files or URLs to play. Perhaps handlr should check the file extension first?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions