Skip to content

Commit

Permalink
logging to FFMpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanslack committed Jan 31, 2023
1 parent 55f3ee8 commit 134c70a
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 18 deletions.
7 changes: 3 additions & 4 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
+--------------------------------+
January 28 2023 Version 1.0.20
January 31 2023 Version 1.0.20
+--------------------------------+

- Added logging module to event logging system.
- Uses logging to tracking events to console.
- Refactoring of classes, methods and functions.
- Improved API using Python programs.
- The use of the API has been redefined (see the docs for more info)
- Improved CLI.
- Update man page.
- Update all documentation.
- Update all documentation and wiki pages.

+--------------------------------+
January 24 2023 Version 1.0.19 Beta
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ffcuesplitter -i FILENAMES DIRNAMES [FILENAMES DIRNAMES ...]
[-p {tqdm,standard}]
[--ffprobe-cmd URL]
[--dry]
[--prg-loglevel]
[--prg-loglevel {error,warning,info,debug}]
[-h]
[--version]
```
Expand Down
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- test on MSWindows




5 changes: 3 additions & 2 deletions ffcuesplitter/cuesplitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ def __init__(self,
with `True`, perform the dry run with no changes
done to filesystem.
prg_loglevel:
Set the program loglevel, one of
("debug", "info", "warning", "error"), default is `info`
Set the logging level of tracking events to console,
one of ("error", "warning", "info", "debug"),
default is `info`.
"""
numeric_level = getattr(logging, prg_loglevel.upper(), None)
if not isinstance(numeric_level, int):
Expand Down
10 changes: 6 additions & 4 deletions ffcuesplitter/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"""
import subprocess
import os
import logging
import platform
from tqdm import tqdm
from ffcuesplitter.exceptions import FFMpegError
Expand Down Expand Up @@ -166,7 +167,7 @@ def run_ffmpeg_command_with_progress(self, cmd, seconds):
Returns:
None
"""
makeoutputdirs(self.kwargs['outputdir']) # Make dirs for output files
makeoutputdirs(self.kwargs['outputdir']) # Make dirs for files dest.
progbar = tqdm(total=100,
unit="s",
dynamic_ncols=True
Expand All @@ -192,10 +193,11 @@ def run_ffmpeg_command_with_progress(self, cmd, seconds):
progbar.update(round(percent) - progbar.n)

if proc.wait(): # error
logging.error("Popen proc.wait() Exit status %s",
proc.wait())
progbar.close()
raise FFMpegError(f"ffmpeg FAILED: See log details: "
f"'{self.kwargs['logtofile']}'"
f"\nExit status: {proc.wait()}")
raise FFMpegError(f"ffmpeg FAILED, See log details: "
f"'{self.kwargs['logtofile']}'")

except (OSError, FileNotFoundError) as excepterr:
progbar.close()
Expand Down
2 changes: 1 addition & 1 deletion ffcuesplitter/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
__maintainer_contact__ = "[email protected]"
__copyleft__ = '2023'
__version__ = '1.0.20'
__release__ = 'January 29 2023'
__release__ = 'January 31 2023'
__appname__ = "FFcuesplitter"
__packagename__ = "ffcuesplitter"
__license__ = "GPL3 (Gnu Public License)"
Expand Down
5 changes: 3 additions & 2 deletions ffcuesplitter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ def main():
required=False,
)
parser.add_argument('--prg-loglevel',
help='Set the program loglevel, default is `info`',
choices=["debug", "info", "warning", "error"],
help=("Set the program logging level of tracking "
"events to console, default is `info`"),
choices=["error", "warning", "info", "debug"],
required=False,
default='info'
)
Expand Down
2 changes: 1 addition & 1 deletion ffcuesplitter/user_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __init__(self,
):
"""
For a full meaning of the arguments to pass
to the instance, see the super class docs.
to the instance, see the super class doc strings.
"""

super().__init__(filename, outputdir, collection,
Expand Down
Binary file modified man/ffcuesplitter.1.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
'Natural Language :: English',
'Operating System :: Microsoft :: Windows',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX :: Linux :: BSD',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
Expand Down
2 changes: 1 addition & 1 deletion tests/test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: UTF-8 -*-

"""
Porpose: Contains test cases for the splitcue object.
Porpose: Contains test cases for the FFCueSplitter object.
Rev: Jan.29.2023
"""
import os
Expand Down

0 comments on commit 134c70a

Please sign in to comment.