Skip to content

Commit

Permalink
CLI: automatically fetch FPS from movies whenever suitable
Browse files Browse the repository at this point in the history
This commit deprecates "-A, --auto-fps" switch. It added unnecessary complexity. FPS are now fetched
whenever it's suitable i.e. when movie is specified by user (via -v switch) or where there is
automatically found a movie for subtitle (practically when it has the same basename as subtitle
file, but with a different extension). FPS is not automatically detected whenever user gives it via
--fps switch. When Subconvert is unable to auto detect FPS, it uses some default value.

Note that it only changes CLI version behaviour. Users can still set in pfiles their preferences
about automatic FPS fetch and CLI will respect them.

-A switch is not removed yet. Instead Subconvert will print a message informing user about its
deprecation. It will be removed in the next major release.
  • Loading branch information
Michał Góral committed Jun 25, 2015
1 parent 02db870 commit c89fe1c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion subconvert/cli/MainApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def getFps(self, subFile):
fps = self._args.fps
if fps is None:
fps = self._args.pfile.fps # default value
if self._args.autoFps or (self._args.video is not None) or self._args.pfile.autoFps:
if self._args.pfile.autoFps:
movieFile = self._parsePathTemplate(self._args.video, subFile.path)
videoInfo = subFile.detectFps(movieFile, fps)
fps = videoInfo.fps
Expand Down Expand Up @@ -161,6 +161,10 @@ def run(self):
if len(self._args.files) == 0:
log.warning(_("No files selected."))

if self._args.autoFps is not None:
log.warning(_("-A, --auto-fps switches are deprecated."))
log.warning(_(" note: FPS is now automatically fetched whenever it's suitable."))

for filePath in self._args.files:
log.info(_("Starting a job for file: %s") % filePath)
try:
Expand Down
2 changes: 1 addition & 1 deletion subconvert/utils/PropertyFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, subFormats, filePath = None):
self._availableFormats = subFormats

self._autoInputEncoding = True
self._autoFps = False
self._autoFps = True
self._fps = 25.0
self._inputEncoding = None
self._outputEncoding = None
Expand Down

0 comments on commit c89fe1c

Please sign in to comment.