Permalink
Browse files

Added new parameter /nolanguageinfilename

  • Loading branch information...
chripede committed Oct 5, 2010
1 parent 7ad3e82 commit 608422f565f84788eedc701b8e71e6bbc2f511d8
Showing with 161 additions and 148 deletions.
  1. +16 −7 VrokSubConsole/Classes.cs
  2. +141 −138 VrokSubConsole/Program.cs
  3. +4 −3 VrokSubConsole/Utils.cs
View
@@ -3,7 +3,8 @@
using CookComputing.XmlRpc;
using System.IO;
using System;
-namespace OSDbClient
+
+namespace VrokSub
{
public class imdbdata
@@ -135,19 +136,27 @@ public class MovieFile
public string oldSubtitle { get; set; }
public imdbdata imdbinfo { get; set; }
public string oldSubtitleLang { get; set; }
- public string GetSubtitleFileName()
+
+ public string GetSubtitleFileName(bool noLanguageInFilename)
{
- return Path.GetDirectoryName(filename) + "\\" + Path.GetFileNameWithoutExtension(filename) + "." + subRes.ISO639 + "." + subRes.SubFormat;
+ var path = Path.GetDirectoryName(filename) + "\\" + Path.GetFileNameWithoutExtension(filename);
+
+ if (!noLanguageInFilename)
+ path += "." + subRes.ISO639;
+
+ path += "." + subRes.SubFormat;
+
+ return path;
}
public string GetName()
{
return Path.GetFileNameWithoutExtension(filename);
}
- public void saveSubtitle(bool overwrite)
+ public void SaveSubtitle(bool overwrite, bool noLanguageInFilename)
{
- string filenameToWrite = GetSubtitleFileName();
+ string filenameToWrite = GetSubtitleFileName(noLanguageInFilename);
if (File.Exists(filenameToWrite))
{
if (overwrite)
@@ -159,7 +168,7 @@ public void saveSubtitle(bool overwrite)
return;
}
}
- FileStream fStream = new FileStream(GetSubtitleFileName(), FileMode.CreateNew);
+ FileStream fStream = new FileStream(GetSubtitleFileName(noLanguageInFilename), FileMode.CreateNew);
BinaryWriter bw = new BinaryWriter(fStream);
@@ -184,7 +193,7 @@ public void getOldSubtitle(List<string> subtitleFormats, List<langMap> theLangMa
if (file == filename) { continue; }
if (subtitleFormats.Contains(Path.GetExtension(file)))
{
- string l = Utils.parseLangCodeFromFile(file, theLangMap);
+ string l = Utils.ParseLangCodeFromFile(file, theLangMap);
if (bestOldSubFile == "")
{
bestOldSubFile = file;
Oops, something went wrong.

0 comments on commit 608422f

Please sign in to comment.