浏览代码

remove useless comments and fix a help statement

Breandan Dezendorf 2 年之前
父节点
当前提交
3b53ca1e80
共有 1 个文件被更改,包括 1 次插入13 次删除
  1. 1 13
      dezendorf/applications/offset-fixer/offset-fixer.py

+ 1 - 13
dezendorf/applications/offset-fixer/offset-fixer.py

@@ -53,7 +53,7 @@ def main():
   parser.add_argument("--seconds", help="Decimal formatted seconds to adjust offsets by", type=float, required=True)
   parser.add_argument("--file", help="Subtitle file to shift", type=str, required=True)
   parser.add_argument("--inplace", required=False, help="Shift file in place, creating a backup", action='store_true')
-  parser.add_argument("--outfile", required=False, help="Subtitle file to shift", type=str)
+  parser.add_argument("--outfile", required=False, help="New subtitle filename", type=str)
 
   args = parser.parse_args()
 
@@ -75,26 +75,17 @@ def main():
     for line in file:
       m1 = re.match(r"^([0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}) --> ([0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3})", line)
       if line == "\n":
-        #print("blank line")
         if (entryNumber > 0) and (timestamp is not None):
-          #print("new entry")
           s = SubtitleEntry(entryNumber, text, timestamp.groups()[0], timestamp.groups()[1])
           Subtitles.append(s)
-          #print(s.entryNumber, s.startTime, s.endTime, s.text)
           text = ""
           timestamp = ""
           entryNumber = 0
       elif re.match(r"^[0-9]+$", line):
-        #print("Added entryNumber")
         entryNumber = int(line.rstrip())
-        #print(entryNumber)
       elif m1:
-        #print("Added timestamp")
         timestamp = m1
-        #print(m1.groups()[0])
-        #print(m1.groups()[1])
       else:
-        #print("Added text:" + line)
         text += line
 
   if args.inplace == True:
@@ -109,10 +100,7 @@ def main():
   with open(args.outfile, 'w') as o:
     print("Shifting all entries by {} seconds".format(args.seconds))
     for entry in Subtitles:
-      #print("\n\n\n\n")
-      #print(entry.entryNumber)
       entry.shift(args.seconds)
-      #print(entry.formatEntry())
       print(entry.formatEntry(), file=o)
 
 if __name__ == "__main__":