Skip to content

πŸ› Refactor Screenshot Logic β€” Auto-create directories and improve file namingΒ #835

@mrfoggg

Description

@mrfoggg

Description

Overview

The screenshot functionality is currently unreliable and lacks descriptive file naming. After analyzing the source code in lib/providers/video_player_provider.dart, I identified that the feature fails because the app expects a pre-existing directory structure and a configured syncPath, but doesn't handle their absence gracefully.

Identified Issues:

1. Missing Directory Creation (mkdir)

The app checks for the existence of the Screenshots sub-directory but returns false if it's missing instead of attempting to create it.
Location: lib/providers/video_player_provider.dart

Current logic in takeScreenshot:
if (!await savePathDirectory.exists()) { return false; }

2. Unclear Error Messaging

If syncPath is not set (null) in Client Settings, the method returns false immediately. The UI error "There was an error taking the screenshot" is too generic and doesn't explain that the user needs to configure a path first.

3. Poor File Naming

Screenshots are named using a simple incrementing counter (001.png, 002.png), which makes organization difficult.

Proposed Solutions:

  1. Auto-create Folders: Use savePathDirectory.create(recursive: true) if the directory is missing.
  2. Contextual Errors: If syncPath is null, show a specific message: "Please set a Sync Path in Client Settings to save screenshots".
  3. Improved Naming: Include the Media Title and Timestamp in the filename (e.g., MovieTitle_01_24_15.png).

Reproduction steps

### Environment:
* OS: Fedora 43 (Wayland)
* App Version: 0.10.2 (AppImage) / Flatpak

### Steps to Reproduce:
1. Install Fladder on a fresh system (or clear existing config).
2. Play any video without manually setting a "Sync Path" in the Client Settings.
3. Attempt to take a screenshot using the in-app button or hotkey.
4. Observe the result: A generic error toast appears ("There was an error taking the screenshot"), and no file is saved.
5. Even if a Sync Path is set, the feature fails unless the user manually creates a sub-folder named "Screenshots" inside that path via terminal/file manager.

### Expected Behavior:
The app should automatically create the necessary folders (mkdir -p) and save the screenshot with a descriptive name, or provide a clear instruction if the Sync Path is missing.

Screenshots

No response

Logs

Platform

Linux (Fedora Workstation GNOME 49)

App Version

v0.10.2

Jellyfin server

Jellyfin.Server 10.11.6.0 Raspberry Pi OS

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions