Skip to content
This repository has been archived by the owner on Jul 29, 2020. It is now read-only.

Commit

Permalink
Added new parameter /nolanguageinfilename
Browse files Browse the repository at this point in the history
  • Loading branch information
chripede committed Oct 5, 2010
1 parent 7ad3e82 commit 608422f
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 148 deletions.
23 changes: 16 additions & 7 deletions VrokSubConsole/Classes.cs
Expand Up @@ -3,7 +3,8 @@
using CookComputing.XmlRpc;
using System.IO;
using System;
namespace OSDbClient

namespace VrokSub
{

public class imdbdata
Expand Down Expand Up @@ -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)
Expand All @@ -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);

Expand All @@ -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;
Expand Down

0 comments on commit 608422f

Please sign in to comment.