-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #377 from MarkSummerville/25
Updates from latest round of bug fixing
- Loading branch information
Showing
35 changed files
with
798 additions
and
551 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
using System; | ||
using System.Xml; | ||
|
||
namespace TVRename | ||
{ | ||
abstract class ActionListXML : ActionListExporter | ||
{ | ||
protected ActionListXML(ItemList theActionList) : base(theActionList) | ||
{ | ||
} | ||
|
||
public override void Run() | ||
{ | ||
if (Active()) | ||
{ | ||
try | ||
{ | ||
|
||
XmlWriterSettings settings = new XmlWriterSettings(); | ||
settings.Indent = true; | ||
settings.NewLineOnAttributes = true; | ||
using (XmlWriter writer = XmlWriter.Create(Location(), settings)) | ||
{ | ||
writer.WriteStartDocument(); | ||
|
||
writer.WriteStartElement("TVRename"); | ||
XMLHelper.WriteAttributeToXML(writer, "Version", "2.1"); | ||
writer.WriteStartElement(name()); | ||
|
||
|
||
foreach (Item action in TheActionList) | ||
{ | ||
if (isOutput(action)) | ||
{ | ||
ActionCopyMoveRename acmr = (ActionCopyMoveRename)action; | ||
writer.WriteStartElement("Item"); | ||
|
||
XMLHelper.WriteAttributeToXML(writer, "Operation", acmr.Name); | ||
XMLHelper.WriteAttributeToXML(writer, "FromFolder", acmr.From.DirectoryName); | ||
XMLHelper.WriteAttributeToXML(writer, "FromName", acmr.From.Name); | ||
XMLHelper.WriteAttributeToXML(writer, "ToFolder", acmr.To.DirectoryName); | ||
XMLHelper.WriteAttributeToXML(writer, "ToName", acmr.To.Name); | ||
XMLHelper.WriteAttributeToXML(writer, "ShowName", acmr.Episode.TheSeries.Name); | ||
XMLHelper.WriteAttributeToXML(writer, "Season", acmr.Episode.AppropriateSeasonNumber); | ||
XMLHelper.WriteAttributeToXML(writer, "Episode", acmr.Episode.NumsAsString()); | ||
|
||
writer.WriteEndElement(); //Item | ||
} | ||
|
||
} | ||
|
||
writer.WriteEndElement(); // Name | ||
writer.WriteEndElement(); // tvrename | ||
writer.WriteEndDocument(); | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
Logger.Error(e); | ||
} | ||
} | ||
} | ||
|
||
protected abstract bool isOutput(Item a); | ||
protected abstract string name(); | ||
|
||
} | ||
|
||
class RenamingXML : ActionListXML | ||
{ | ||
public RenamingXML(ItemList theActionList) : base(theActionList) | ||
{ | ||
} | ||
|
||
protected override bool isOutput(Item a) | ||
{ | ||
return (a is ActionCopyMoveRename cmr) && ((cmr.Operation == ActionCopyMoveRename.Op.Rename)); | ||
} | ||
public override bool ApplicableFor(TVSettings.ScanType st) => true; | ||
|
||
public override bool Active() => TVSettings.Instance.ExportRenamingXML; | ||
protected override string Location() => TVSettings.Instance.ExportRenamingXMLTo; | ||
protected override string name() => "Renaming"; | ||
|
||
} | ||
|
||
class CopyMoveXML : ActionListXML | ||
{ | ||
public CopyMoveXML(ItemList theActionList) : base(theActionList) | ||
{ | ||
} | ||
|
||
public override bool ApplicableFor(TVSettings.ScanType st) => true; | ||
|
||
protected override bool isOutput(Item a) | ||
{ | ||
return (a is ActionCopyMoveRename cmr) && ((cmr.Operation != ActionCopyMoveRename.Op.Rename)); | ||
} | ||
|
||
public override bool Active() => TVSettings.Instance.ExportFOXML; | ||
protected override string Location() => TVSettings.Instance.ExportFOXMLTo; | ||
protected override string name() => "FindingAndOrganising"; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
|
||
namespace TVRename | ||
{ | ||
// ReSharper disable once InconsistentNaming | ||
internal class MissingCSV : ActionListExporter | ||
{ | ||
public MissingCSV(ItemList theActionList) : base(theActionList) | ||
{ | ||
} | ||
|
||
public override bool Active() => TVSettings.Instance.ExportMissingCSV; | ||
protected override string Location() => TVSettings.Instance.ExportMissingCSVTo; | ||
|
||
public override bool ApplicableFor(TVSettings.ScanType st) | ||
{ | ||
return (st==TVSettings.ScanType.Full ); | ||
} | ||
|
||
public override void Run() | ||
{ | ||
if (!Active()) return; | ||
|
||
try | ||
{ | ||
|
||
using (System.IO.StreamWriter file = new System.IO.StreamWriter(Location())) | ||
{ | ||
file.WriteLine("Show Name,Season,Episode,Episode Name,Air Date,Folder,Nice Name,thetvdb.com Code"); | ||
|
||
foreach (Item action in this.TheActionList) | ||
{ | ||
if (action is ItemMissing im) | ||
{ | ||
ProcessedEpisode pe = im.Episode; | ||
DateTime? dt = pe.GetAirDateDT(true); | ||
file.WriteLine($"\"{pe.TheSeries.Name}\",{pe.AppropriateSeasonNumber},{pe.NumsAsString()},\"{pe.Name}\",{dt:G},\"{action.TargetFolder}\",\"{im.Filename }\",{pe.SeriesID}"); | ||
} | ||
|
||
} | ||
|
||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
Logger.Error(e); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.