Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 10, 2016, 02:27:05 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: SrtStrip 1.3.4.0  (Read 3617 times)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,290
    • View Profile
    • Miles Ahead Software
    • Donate to Member
SrtStrip 1.3.4.0
« on: October 15, 2010, 01:47:54 PM »
Someone on another board requested a program to strip those Italic and other angle bracket tags from .srt subtitle files(e.g. <i>some dialog between</i>)

http://www.favessoft.com/downloads.html

SrtStrip 1.0

It's command line based. It's only designed to remove those one character
open and close tags(e.g. <x> and </x>.)

See the Readme.txt for particulars.

There are other ways to remove the tags, such as using an editor, but the person requesting the command line app had several hundreds or even thousands of sub files and loading one at a time would be a chore.  With this utility, you can process all the .srt files in a folder by opening a command prompt in that folder and running this command line:

for %s in (*.srt) do SrtStrip %s

for each filename.srt you'll get an output file named filename.srt.strip

Since every now and then I run into subs where the italic tags just show on screen
I thought I'd knock it off.

I tried using sed but to get that Linux streaming edit stuff to work on Windows you really need to set up bash or another shell.  Otherwise it takes longer to figure out how to work around the incompatibilities than to just program it from scratch. For a one-off it's not worth it.

Anyway, for what it does, it seems to work pretty well. It's just rudimentary. No real error checking.  It checks to see if the output file already exists in the current folder, and if so, deletes it before processing the input.

edit: since it's command line based, no gui for screen shot, but here's the program icon. :)

SrtStrip.png
« Last Edit: December 24, 2012, 02:53:13 PM by MilesAhead »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,290
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: SrtStrip 1.1
« Reply #1 on: October 16, 2010, 11:52:01 AM »
SrtStrip 1.1 I improved the regular expression replace(not my forte) so that the substitution for each line is a single pass.  Latest is on my site for download.

It's just a simple compiled AHK script.  Here's the source in case you need to filter out additional tag types:


#NoEnv
#NoTrayIcon
SendMode Input

If 0 < 1
{
MsgBox, 64, SrtStrip Usage, SrtStrip Copyright (c) 2010 www.FavesSoft.com`n`nUsage: SrtStrip filename.srt`n`nOutput is subtitle filename.srt.strip stripped of <> tags
ExitApp
}

InFile := %0%
OutFile := InFile . ".strip"
 IfExist,%OutFile%
    FileDelete,%OutFile%

Loop, read, %InFile%,%OutFile%
{
    result := RegExReplace(A_LoopReadLine,"</?.>")
FileAppend,%result%`n
}


MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,290
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: SrtStrip 1.2
« Reply #2 on: February 19, 2011, 05:48:01 PM »
SrtStrip 1.2 is available for download via the link in the first post. I've added removal of tags that use an opening and closing curly brace on a line such as {a6}. Anything that opens with a '{' and ends with a '}' on the same line will be removed from the output copy. As before the output filename is the input filename with ".strip" appended.

The input file is not altered.


MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,290
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: SrtStrip 1.31
« Reply #3 on: September 03, 2012, 02:58:17 PM »
SrtStrip 1.31 SrtStrip has been updated.  Changes:

1) if the input file is named subs.srt the output file will be named subs_strip.srt  rather than the old way of tacking on .strip as another extension. This gets rid of the Explorer warning dialog when renaming the output file and changing the extension back to .srt.

2) Angle bracket tag removal was limited to single character tags such as italics.  Now any tag beginning with a less than bracket and ending with a greater than bracket on the same line will be removed. One example would be font size setting tags.

edit: same version number. I uploaded a new zip that contains source,exe,readme, and custom icon.
« Last Edit: September 04, 2012, 10:01:09 PM by MilesAhead »

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,290
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: SrtStrip 1.32
« Reply #4 on: December 20, 2012, 12:06:24 PM »
SrtStrip 1.32 Now filters out filenames with "_strip.srt" on the end.  This avoids reading the output files as input. This could happen if used with the For command on the command line, as in:  For %s in (*.srt) do SrtStrip %s

Conceivably one of the filename_strip.srt output files could get sucked back in as input. :)
Now the app just quits if this is detected.

I could change it to use an input and output folder without changing the filename but to be honest it's not the type of app that gets much use.  Just good to have in cases where the .srt file is full of Italic tags.  :)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,290
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: SrtStrip 1.3.3.0
« Reply #5 on: December 21, 2012, 02:28:49 PM »
SrtStrip 1.3.3.0 I reworked this to output filename.srt.strip as it avoids clashes with wild cards. Also it now expects .srt files to be dropped on the program shortcut.  This makes it easy to strip .srt files in an entire folder sub-tree via Explorer search. The output file will end up in the same folder as the input but with .strip appended.  See Readme.txt for details.  Run with no params for usage dialog.

At present the program reports no count of files processed. Since it is written in AHK_L it's not a true console app. The processing is done silently.  But it is just a hack after all. :)


MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,290
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: SrtStrip 1.3.4.0
« Reply #6 on: December 24, 2012, 02:53:36 PM »
SrtStrip 1.3.4.0 Now displays dialog with count of files stripped on completion.