Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Add setting for custom filename on save image #187

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

rekkoha
Copy link

@rekkoha rekkoha commented Aug 2, 2017

This adds an option in advanced settings to allow users to customize the default filename used for snapshots when using File > Save Image (or pressing F5). Currently snapshot filenames are hardcoded like video.mkv_snapshot_01.12_[2017.08.01_16.59.08]. This option lets users choose their own filename format string, defaulted to %f_snapshot_%t_[%Y.%m.%d_%H.%M.%S] to copy current behavior.

Trac: https://trac.mpc-hc.org/ticket/4241

@XhmikosR XhmikosR requested a review from kasper93 August 3, 2017 07:03
} else if (GetPlaybackMode() == PM_DVD) {
prefix.Format(_T("dvd_snapshot_%s"), GetVidPos());
snapshotName = MakeSnapshotFileName(GetFileName(), GetVidPos());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that GetFileName() is valid for DVDs.

@@ -4880,15 +4954,15 @@ void CMainFrame::OnFileSaveImage()

CPath psrc(s.strSnapshotPath);

CStringW prefix = _T("snapshot");
CString snapshotName = _T("snapshot");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assignment can be move to end of if/else for unhandled GetPlaybackMode() values.

@@ -4948,17 +5022,17 @@ void CMainFrame::OnFileSaveImageAuto()
return;
}

CStringW prefix = _T("snapshot");
CString snapshotName = _T("snapshot");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code block is similar as the other one. Could be refactored or moved into MakeSnapshotFileName().

"Use legacy toolbar instead of new vectorized one."
IDS_SUBMENU_COPYURL "Copy URL"
IDS_PPAGEADVANCED_SNAPSHOT_NAME_FORMAT
"Filename format used for snapshots on ""Save Image"". %f is the video filename, %t is the current video position, %Y, %m, %d is the current year, month, day, etc."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Filename template that is used for"

For example: "%f_snapshot_%t_[%Y.%m.%d_%H.%M.%S]", where %f equals video file name, %t current video timestamp, %Y current year, etc.

clsid2 referenced this pull request Aug 9, 2017
…his allows excluding timestamp and position.

ToDo: translations
@kasper93
Copy link
Contributor

Thanks for patch, but I don't think this is best approach. 95% of people will not understand what to type there and how this work. And it is not good to give user full control over format string. I would prefer few preset that every user can understand and select best one. Similar to what @clsid2 done in his patch. But I'm open for discussion here.

@rekkoha
Copy link
Author

rekkoha commented Aug 18, 2017

Is the main concern the possibility of a security vulnerability? I believe it is better to give users the option of having a custom format string, since power users will most likely be the ones using this feature. FWIW, VLC is doing the same thing: https://wiki.videolan.org/Documentation:Play_HowTo/Format_String/

@clsid2
Copy link
Contributor

clsid2 commented Aug 19, 2017

This feature should also be useful for less experienced PC users. So perhaps my simpler approach would indeed be better. Which custom string would you personally use if your patch would be used?

@rekkoha
Copy link
Author

rekkoha commented Aug 23, 2017

I don't think less experienced users would use this feature. The users who want to change the filename prefer full control over it, like the person who created the original Trac ticket for this feature: https://trac.mpc-hc.org/ticket/4241

If less experienced users that are interested in this feature do exist, I think they will be ok as long as we provide sufficient documentation. It seems to be working for VLC.

Personally I prefer the video time at the beginning, so I would use %t_%f_%Y%m%d_%H%M%S

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
3 participants