Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -617,58 +617,3 @@ reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

END OF TERMS AND CONDITIONS

How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
6 changes: 3 additions & 3 deletions subtle_gui/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

logger = logging.getLogger(__name__)

T_Subs = Literal["SRT"] | Literal["SSA"]
T_Subs = Literal["SRT", "SSA", "IDX"]


def simplified(text: str) -> str:
Expand Down Expand Up @@ -155,8 +155,8 @@ def formatTS(value: int) -> str:
def decodeTS(value: str | None, default: int = 0, fmt: T_Subs = "SRT") -> int:
"""Decode a SRT time stamp to milliseconds."""
if isinstance(value, str):
if fmt == "SRT" and len(value) >= 12:
if value[2] == ":" and value[5] == ":" and value[8] in ".,":
if fmt in ("SRT", "IDX") and len(value) >= 12:
if value[2] == ":" and value[5] == ":" and value[8] in ":.,":
try:
return 3600000 * int(value[0:2]) + 60000 * int(value[3:5]) + int(value[6:8] + value[9:12])
except Exception:
Expand Down
5 changes: 4 additions & 1 deletion subtle_gui/core/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from subtle_gui.formats.pgssubs import PGSSubs
from subtle_gui.formats.srtsubs import SRTSubs
from subtle_gui.formats.ssasubs import SSASubs
from subtle_gui.formats.vobsub import VobSubs

if TYPE_CHECKING:
from collections.abc import Iterable
Expand Down Expand Up @@ -141,8 +142,10 @@ def __init__(self, media: MediaData, info: dict) -> None:
self._wrapper = SRTSubs()
elif codec_id == "S_TEXT/ASS" or codec_nm == "SubStationAlpha":
self._wrapper = SSASubs()
elif codec_id == "S_VOBSUB" or codec_nm == "VobSub":
self._wrapper = VobSubs()
else:
logger.info("Unsupported subtitle format: %s", codec_id or codec_nm)
logger.info("Unsupported subtitle format: %s (%s)", codec_nm, codec_id)

##
# Properties
Expand Down
3 changes: 2 additions & 1 deletion subtle_gui/core/mediafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class ContainerType(IntEnum):
ContainerType.SRT,
ContainerType.SSA_ASS,
ContainerType.PGSSUP,
ContainerType.VOBSUB,
)


Expand Down Expand Up @@ -104,7 +105,7 @@ def container(self) -> ContainerType:
def supported(self) -> bool:
"""True if the format is supported."""
try:
return self._info["container"]["supported"]
return bool(self._info["container"]["supported"])
except Exception:
pass
return False
Expand Down
2 changes: 1 addition & 1 deletion subtle_gui/formats/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Subtle Subtitles Base
Subtle - Subtitles Base
=======================

This file is a part of Subtle
Expand Down
6 changes: 4 additions & 2 deletions subtle_gui/formats/pgssubs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Subtle – Core PGS Reader
========================
Subtle - PGS Reader
===================

This file is a part of Subtle
Copyright (C) Veronica Berglyd Olsen
Expand Down Expand Up @@ -146,6 +146,8 @@ def _readData(self, path: Path) -> None:
class PGSFrame(FrameBase):
"""PGS Subtitle Frame Class."""

__slots__ = ("_ds",)

def __init__(self, index: int, ds: DisplaySet) -> None:
super().__init__(index=index)
self._ds = ds
Expand Down
4 changes: 2 additions & 2 deletions subtle_gui/formats/srtsubs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Subtle SRT File Object
========================
Subtle - SRT File Reader/Writer
===============================

This file is a part of Subtle
Copyright (C) Veronica Berglyd Olsen
Expand Down
2 changes: 1 addition & 1 deletion subtle_gui/formats/ssasubs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Subtle SSA File Object
Subtle - SSA File Reader
========================

This file is a part of Subtle
Expand Down
Loading