2011-03-03 10:50:33 +02:00
|
|
|
using System.Collections.Generic;
|
2011-02-26 06:07:22 +02:00
|
|
|
using System.Linq;
|
|
|
|
using NzbDrone.Core.Model;
|
|
|
|
|
2011-03-03 10:50:33 +02:00
|
|
|
namespace NzbDrone.Core.Helpers
|
2011-02-26 06:07:22 +02:00
|
|
|
{
|
|
|
|
public static class EpisodeSortingHelper
|
|
|
|
{
|
|
|
|
private static readonly List<EpisodeSortingType> SeparatorStyles = new List<EpisodeSortingType>
|
2011-04-10 05:44:01 +03:00
|
|
|
{
|
|
|
|
new EpisodeSortingType
|
|
|
|
{
|
|
|
|
Id = 0,
|
|
|
|
Name = "Dash",
|
|
|
|
Pattern = " - "
|
|
|
|
},
|
|
|
|
new EpisodeSortingType
|
|
|
|
{
|
|
|
|
Id = 1,
|
|
|
|
Name = "Space",
|
|
|
|
Pattern = " "
|
|
|
|
}
|
|
|
|
};
|
2011-02-26 06:07:22 +02:00
|
|
|
|
|
|
|
private static readonly List<EpisodeSortingType> NumberStyles = new List<EpisodeSortingType>
|
2011-04-10 05:44:01 +03:00
|
|
|
{
|
|
|
|
new EpisodeSortingType
|
|
|
|
{
|
|
|
|
Id = 0,
|
|
|
|
Name = "1x05",
|
2011-06-06 07:03:08 +03:00
|
|
|
Pattern = "%sx%0e",
|
|
|
|
EpisodeSeparator = "x"
|
|
|
|
|
2011-04-10 05:44:01 +03:00
|
|
|
},
|
|
|
|
new EpisodeSortingType
|
|
|
|
{
|
|
|
|
Id = 1,
|
|
|
|
Name = "01x05",
|
2011-06-06 07:03:08 +03:00
|
|
|
Pattern = "%0sx%0e",
|
|
|
|
EpisodeSeparator = "x"
|
2011-04-10 05:44:01 +03:00
|
|
|
},
|
|
|
|
new EpisodeSortingType
|
|
|
|
{
|
|
|
|
Id = 2,
|
|
|
|
Name = "S01E05",
|
2011-06-06 07:03:08 +03:00
|
|
|
Pattern = "S%0sE%0e",
|
|
|
|
EpisodeSeparator = "E"
|
2011-04-10 05:44:01 +03:00
|
|
|
},
|
|
|
|
new EpisodeSortingType
|
|
|
|
{
|
|
|
|
Id = 3,
|
|
|
|
Name = "s01e05",
|
2011-06-06 07:03:08 +03:00
|
|
|
Pattern = "s%0se%0e",
|
|
|
|
EpisodeSeparator = "e"
|
2011-04-10 05:44:01 +03:00
|
|
|
}
|
|
|
|
};
|
2011-02-26 06:07:22 +02:00
|
|
|
|
|
|
|
private static readonly List<EpisodeSortingType> MultiEpisodeStyles = new List<EpisodeSortingType>
|
2011-04-10 05:44:01 +03:00
|
|
|
{
|
|
|
|
new EpisodeSortingType
|
|
|
|
{
|
|
|
|
Id = 0,
|
|
|
|
Name = "Extend",
|
2011-06-06 07:03:08 +03:00
|
|
|
Pattern = "-%0e"
|
2011-04-10 05:44:01 +03:00
|
|
|
},
|
|
|
|
new EpisodeSortingType
|
|
|
|
{
|
|
|
|
Id = 1,
|
|
|
|
Name = "Duplicate",
|
2011-06-06 07:03:08 +03:00
|
|
|
Pattern = "%p%0s%x%0e"
|
2011-04-10 05:44:01 +03:00
|
|
|
},
|
|
|
|
new EpisodeSortingType
|
|
|
|
{
|
|
|
|
Id = 2,
|
|
|
|
Name = "Repeat",
|
2011-06-06 07:03:08 +03:00
|
|
|
Pattern = "%x%0e"
|
2011-05-14 07:13:21 +03:00
|
|
|
},
|
|
|
|
new EpisodeSortingType
|
|
|
|
{
|
|
|
|
Id = 3,
|
|
|
|
Name = "Scene",
|
2011-06-06 07:03:08 +03:00
|
|
|
Pattern = "-%x%0e"
|
2011-04-10 05:44:01 +03:00
|
|
|
}
|
|
|
|
};
|
2011-02-26 06:07:22 +02:00
|
|
|
|
|
|
|
public static List<EpisodeSortingType> GetSeparatorStyles()
|
|
|
|
{
|
|
|
|
return SeparatorStyles;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static List<EpisodeSortingType> GetNumberStyles()
|
|
|
|
{
|
|
|
|
return NumberStyles;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static List<EpisodeSortingType> GetMultiEpisodeStyles()
|
|
|
|
{
|
|
|
|
return MultiEpisodeStyles;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static EpisodeSortingType GetSeparatorStyle(int id)
|
|
|
|
{
|
|
|
|
return SeparatorStyles.Single(s => s.Id == id);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static EpisodeSortingType GetNumberStyle(int id)
|
|
|
|
{
|
|
|
|
return NumberStyles.Single(s => s.Id == id);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static EpisodeSortingType GetMultiEpisodeStyle(int id)
|
|
|
|
{
|
|
|
|
return MultiEpisodeStyles.Single(s => s.Id == id);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static EpisodeSortingType GetSeparatorStyle(string name)
|
|
|
|
{
|
|
|
|
return SeparatorStyles.Single(s => s.Name == name);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static EpisodeSortingType GetNumberStyle(string name)
|
|
|
|
{
|
|
|
|
return NumberStyles.Single(s => s.Name == name);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static EpisodeSortingType GetMultiEpisodeStyle(string name)
|
|
|
|
{
|
|
|
|
return MultiEpisodeStyles.Single(s => s.Name == name);
|
|
|
|
}
|
|
|
|
}
|
2011-04-10 05:44:01 +03:00
|
|
|
}
|