8000 subtitles: drop gaupol module support · translate/translate@965c7a6 · GitHub 8000
[go: up one dir, main page]

Skip to content

Commit 965c7a6

Browse files
committed
subtitles: drop gaupol module support
Aiedon is available for years and gaupol uses it to parse subtitles, so there is no reason to import from gaupol anymore.
1 parent e23b59b commit 965c7a6

File tree

5 files changed

+8
-32
lines changed

5 files changed

+8
-32
lines changed

README.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,9 @@ simply appear in English. It is therefore recommended you install the
139139

140140
The package vobject is needed for ical2po and po2ical.
141141

142-
The aeidon package (or gaupol if aeidon is not available) is needed for sub2po
142+
The aeidon package is needed for sub2po
143143
and po2sub. Some Unicode encoded files (including most files from
144144
<http://dotsub.com/>) require version 0.14 or later.
145-
<http://home.gna.org/gaupol/>
146-
Gaupol might need the 'Universal Encoding Detector'
147-
<http://pypi.python.org/pypi/chardet>
148145

149146
Trados TXT TM support requires the BeautifulSoup parser
150147
<http://www.crummy.com/software/BeautifulSoup/>

docs/commands/sub2po.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,5 @@ Bugs
102102
----
103103
There might be some issues with encodings, since the srt files don't specify
104104
them. We assume files to be encoded in UTF-8, so a conversion should solve this
105-
easily. Note that most of the handling of the srt files come from gaupol.
105+
easily. Note that most of the handling of the srt files come from aeidon.
106106

docs/formats/subtitles.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ YouTube supports `a number of formats
2828
Implementation details
2929
======================
3030

31-
Format support is provided by `Gaupol <https://otsaloma.io/gaupol/>`_ a
32-
subtitling tool. Further enhancement of format support in Gaupol will directly
31+
Format support is provided by `aeidon <https://pypi.org/project/aeidon/>`_ library.
32+
Further enhancement of format support in aeidon will directly
3333
benefit our conversion ability.
3434

3535
.. _subtitles#usage:
10000

tests/translate/convert/test_po2sub.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from . import test_convert
99

10-
# Technically subtitles can also use an older gaupol
1110
importorskip("aeidon")
1211

1312

translate/storage/subtitles.py

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919
"""
2020
Class that manages subtitle files for translation.
2121
22-
This class makes use of the subtitle functionality of ``gaupol``.
23-
24-
.. seealso:: gaupol/agents/open.py::open_main
25-
26-
A patch to gaupol is required to open utf-8 files successfully.
22+
This class makes use of the subtitle functionality of ``aeidon``.
2723
"""
2824

2925
import os
@@ -36,25 +32,9 @@
3632
from aeidon import Subtitle, documents, newlines
3733
from aeidon.encodings import detect
3834
from aeidon.files import AdvSubStationAlpha, MicroDVD, SubRip, SubStationAlpha, new
39-
from aeidon.util import detect_format as determine
35+
from aeidon.util import detect_format
4036
except ImportError:
41-
try:
42-
from gaupol import FormatDeterminer, documents
43-
from gaupol.encodings import detect
44-
from gaupol.files import (
45-
AdvSubStationAlpha,
46-
MicroDVD,
47-
SubRip,
48-
SubStationAlpha,
49-
new,
50-
)
51-
from gaupol.newlines import newlines
52-
from gaupol.subtitle import Subtitle
53-
54-
_determiner = FormatDeterminer()
55-
determine = _determiner.determine
56-
except ImportError:
57-
raise ImportError("\naeidon or gaupol package required for Subtitle support")
37+
raise ImportError("\naeidon package required for Subtitle support")
5838

5939

6040
class SubtitleUnit(base.TranslationUnit):
@@ -119,7 +99,7 @@ def serialize(self, out):
11999
def _parse(self):
120100
try:
121101
self.encoding = detect(self.filename)
122-
self._format = determine(self.filename, self.encoding)
102+
self._format = detect_format(self.filename, self.encoding)
123103
self._subtitlefile = new(self._format, self.filename, self.encoding)
124104
for subtitle in self._subtitlefile.read():
125105
newunit = self.addsourceunit(subtitle.main_text)

0 commit comments

Comments
 (0)
0