<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to sub2srt-python-command-line.py source</title><link>https://sourceforge.net/p/sub2srtpython/wiki/sub2srt-python-command-line.py%2520source/</link><description>Recent changes to sub2srt-python-command-line.py source</description><atom:link href="https://sourceforge.net/p/sub2srtpython/wiki/sub2srt-python-command-line.py%20source/feed" rel="self"/><language>en</language><lastBuildDate>Fri, 06 Jul 2012 10:52:50 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/sub2srtpython/wiki/sub2srt-python-command-line.py%20source/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage sub2srt-python-command-line.py source modified by Bojan</title><link>https://sourceforge.net/p/sub2srtpython/wiki/sub2srt-python-command-line.py%2520source/</link><description>&lt;pre&gt;--- v2
+++ v3
@@ -70,7 +70,7 @@
         #0 = prog, ...
 
         if len(sys.argv) &lt; 4:
-            print ('sub2srt-python input.sub output.srt fps')
+            print ('sub2srt-python-command-line input.sub output.srt fps')
             sys.exit()
 
         infile = sys.argv[1]
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bojan</dc:creator><pubDate>Fri, 06 Jul 2012 10:52:50 -0000</pubDate><guid>https://sourceforge.netfc65b7866ebfab20d5559b63110cca220c4187b3</guid></item><item><title>WikiPage sub2srt-python-command-line.py source modified by Bojan</title><link>https://sourceforge.net/p/sub2srtpython/wiki/sub2srt-python-command-line.py%2520source/</link><description>&lt;pre&gt;--- v1
+++ v2
@@ -1,5 +1,5 @@
 #-------------------------------------------------------------------------------
-    # Name:        sub2srt-python
+    # Name:        sub2srt-python-command-line
     # Purpose:
     #
     # Author:      Bojan
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bojan</dc:creator><pubDate>Fri, 06 Jul 2012 10:26:22 -0000</pubDate><guid>https://sourceforge.netb2f3153c78f6d1d8321b1a331b4ee4f4dddde3c9</guid></item><item><title>WikiPage sub2srt-python-command-line.py source modified by Bojan</title><link>https://sourceforge.net/p/sub2srtpython/wiki/sub2srt-python-command-line.py%2520source/</link><description>#-------------------------------------------------------------------------------
    # Name:        sub2srt-python
    # Purpose:
    #
    # Author:      Bojan
    #
    # Created:     24/06/2012
    # Licence:     bsd
    #-------------------------------------------------------------------------------
    #!/usr/bin/env python

    import os
    import sys




    def conversion(a):
        #do the text
        start = a.split('}{',1) [0][1:]
        tem = a.split('}{',1) [1]
        end = tem.split('}',1)[0]
        text = a.split('}',2)[2]
        #replace | with newline
        text = text.replace('|','\n')
        start = timec(start)
        end = timec(end)
        #print (   "{0} --&gt; {1}\n{2}".format(start, end, text) )
        return "{0} --&gt; {1}\n{2}".format(start, end, text)

    def timec(ti):
        #conversion time
        sec = int(ti)/frames

        h = str( int((int(sec/60)-int(sec/60)%60)/60) )
        m = str( int(sec/60)%60 )
        s = str( int(sec%60) )

        c = str( round(sec%100,3) )
        c = (  c.split('.',1) [1]   )


        if c == "":
            #c must be string, not c = 0
            c = '0'

        if (len(h)==1):
            h = '0'+h

        if (len(m)==1):
            m = '0'+m

        if (len(s)==1):
            s = '0'+s

        #after decimal 3=300, not 003
        if (len(c)==1):
            c = c+'00'

        if (len(c)==2):
            c = c+'0'

        #print (   "{0}:{1}:{2},{3}".format(h, m,s,c)       )
        return "{0}:{1}:{2},{3}".format(h, m,s,c)




    def main():
        #0 = prog, ...

        if len(sys.argv) &lt; 4:
            print ('sub2srt-python input.sub output.srt fps')
            sys.exit()

        infile = sys.argv[1]
        fo = open(infile,'r')

        global frames
        frames = float(sys.argv[3])

        outf = sys.argv[2]
        if os.path.isfile(outf):
            os.remove(outf)
        of = open(outf,'a')


        for indx,line in enumerate(fo):
            of.write( str(indx+1) + '\n' + conversion(line)+ '\n' )

        fo.close()
        of.close()

    if __name__ == '__main__':
        main()
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bojan</dc:creator><pubDate>Fri, 06 Jul 2012 10:25:45 -0000</pubDate><guid>https://sourceforge.net0391dc3a738d6e78dd7863bc33b2ce867a8aff43</guid></item></channel></rss>