commit 9004b2105a5f3c16a91033b8eb2a9c71c88fab63
Author: Arkadiusz Miƛkiewicz <[email protected]>
Date:   Sun Nov 8 23:30:56 2015 +0100

    - rel 6; skip utf8 bom

 subconv.py   | 10 ++++++++--
 subconv.spec |  2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/subconv.spec b/subconv.spec
index f06ad8e..a85c42e 100644
--- a/subconv.spec
+++ b/subconv.spec
@@ -1,7 +1,7 @@
 Summary:       Subtitle formats converter
 Name:          subconv
 Version:       0.4
-Release:       5
+Release:       6
 License:       GPL
 Group:         Applications/System
 Source0:       %{name}.py
diff --git a/subconv.py b/subconv.py
index 8cfd8e5..4b23902 100644
--- a/subconv.py
+++ b/subconv.py
@@ -4,11 +4,12 @@
 # divx subtitles converter by Pawel Stolowski, Julien Lerouge
 # mpl2 by Grzegorz Zyla
 #
-# Maintained at http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/subconv/
+# Maintained at http://git.pld-linux.org/packages/subconv/
 #
 # Released under terms of GNU GPL
 #
 
+import codecs
 import re
 import sys
 import getopt
@@ -431,6 +432,11 @@ def read_subs(file,fmt,fps):
     src = open(file,'r')
     subs = src.readlines()
     src.close()
+
+    # skip utf8 BOM
+    if len(subs) and len(subs[0]) > 3 and subs[0][0:3] == codecs.BOM_UTF8:
+        subs[0] = subs[0][3:]
+
     if fmt == "tmp":
         return read_tmp(subs)
     elif fmt == "srt":
@@ -442,7 +448,7 @@ def read_subs(file,fmt,fps):
                 fps = detect_fps(subs)
         return read_mdvd(subs, fps)
     elif fmt == "auto":
-       fmt = detect_format(subs)
+        fmt = detect_format(subs)
         sys.stderr.write("Guessing subs format .. %s\n" % fmt )
         return read_subs(file,fmt,fps)
     elif fmt == "sub2":
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/subconv.git/commitdiff/9004b2105a5f3c16a91033b8eb2a9c71c88fab63

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to