private Option <string> LocateNfoFile(Movie movie)
        {
            string path       = movie.MediaVersions.Head().MediaFiles.Head().Path;
            string movieAsNfo = Path.ChangeExtension(path, "nfo");
            string movieNfo   = Path.Combine(Path.GetDirectoryName(path) ?? string.Empty, "movie.nfo");

            return(Seq.create(movieAsNfo, movieNfo)
                   .Filter(s => _localFileSystem.FileExists(s))
                   .HeadOrNone());
        }
Beispiel #2
0
 public static Seq <B> map <A, B>(Seq <A> list, Func <A, B> map) =>
 list.Select(map);
Beispiel #3
0
 public static TryOptionAsync <Seq <B> > Traverse <A, B>(this Seq <TryOptionAsync <A> > ma, Func <A, B> f) =>
 TraverseParallel(ma, f);
Beispiel #4
0
 public static async Task <Seq <B> > rightsUnsafeAsync <CHOICE, CH, A, B>(Seq <CH> ma)
     where CHOICE : struct, ChoiceUnsafeAsync <CH, A, B> =>
 Seq(await rightsUnsafeAsync <CHOICE, CH, A, B>(ma.AsEnumerable()));
Beispiel #5
0
 public static HashSet <Seq <B> > Traverse <A, B>(this Seq <HashSet <A> > ma, Func <A, B> f) =>
 toHashSet(CollT.AllCombinationsOf(ma.Map(xs => xs.ToList()).ToArray(), f)
           .Map(xs => Seq(xs)));
Beispiel #6
0
 public static Option <A> headOrNone <A>(Seq <A> list) =>
 list.HeadOrNone();
Beispiel #7
0
 public static Seq <V> zip <T, U, V>(Seq <T> list, Seq <U> other, Func <T, U, V> zipper) =>
 Seq(list.Zip(other, zipper));
Beispiel #8
0
 public static T reduceBack <T>(Seq <T> list, Func <T, T, T> reducer) =>
 reduce(rev(list), reducer);
Beispiel #9
0
 public static double sum(Seq <double> list) =>
 fold(list, 0.0, (s, x) => s + x);
Beispiel #10
0
 public static float sum(Seq <float> list) =>
 fold(list, 0.0f, (s, x) => s + x);
Beispiel #11
0
 public static int sum(Seq <int> list) =>
 fold(list, 0, (s, x) => s + x);
Beispiel #12
0
 public static A sum <MonoidA, A>(Seq <A> list) where MonoidA : struct, Monoid <A> =>
 mconcat <MonoidA, A>(list);
Beispiel #13
0
 public static Seq <B> choose <A, B>(Seq <A> list, Func <int, A, Option <B> > selector) =>
 map(filter(map(list, selector), t => t.IsSome), t => t.Value);
Beispiel #14
0
 public static Seq <A> filter <A>(Seq <A> list, Func <A, bool> predicate) =>
 list.Where(predicate);
Beispiel #15
0
 public static Seq <B> map <A, B>(Seq <A> list, Func <int, A, B> map) =>
 Seq(zip(list, Seq(Range(0, Int32.MaxValue)), (t, i) => map(i, t)));
Beispiel #16
0
 public static S foldBackUntil <S, T>(Seq <T> list, S state, Func <S, T, S> folder, Func <S, bool> predstate) =>
 foldUntil(rev(list), state, folder, predstate: predstate);
Beispiel #17
0
 public static T reduce <T>(Seq <T> list, Func <T, T, T> reducer) =>
 match(headOrNone(list),
       Some: x => fold(tail(list), x, reducer),
       None: () => failwith <T>("Input list was empty")
       );
Beispiel #18
0
 public static Seq <A> flatten <A>(Seq <Seq <A> > ma) =>
 ma.Bind(identity);
Beispiel #19
0
 public static Seq <S> scanBack <S, T>(Seq <T> list, S state, Func <S, T, S> folder) =>
 scan(rev(list), state, folder);
Beispiel #20
0
 public static decimal sum(Seq <decimal> list) =>
 fold(list, (decimal)0, (s, x) => s + x);
Beispiel #21
0
 public static A head <A>(Seq <A> list) =>
 list.Head;
Beispiel #22
0
 public static Seq <T> rev <T>(Seq <T> list) =>
 Seq(list.Reverse());
 public static TryOptionAsync <A> choice <A>(Seq <TryOptionAsync <A> > xs) =>
 xs.IsEmpty
         ? new TryOptionAsync <A>(() => OptionalResult <A> .None.AsTask())
         : xs.Head.BiBind(
     Succ: x => xs.Head,
     Fail: () => choice(xs.Tail));
Beispiel #24
0
 public static Seq <T> append <T>(Seq <T> lhs, Seq <T> rhs) =>
 lhs.IsEmpty      ? rhs
   : lhs.Tail.IsEmpty ? lhs.Head.Cons(rhs)
   : Seq(lhs.ConcatFast(rhs));
Beispiel #25
0
 public static OptionUnsafe <Seq <B> > Sequence <A, B>(this Seq <A> ta, Func <A, OptionUnsafe <B> > f) =>
 ta.Map(f).Sequence();
Beispiel #26
0
 public static Seq <T> append <T>(Seq <T> x, Seq <Seq <T> > xs) =>
 headOrNone(xs).IsNone
         ? x
         : append(x, append(xs.First(), xs.Skip(1)));
Beispiel #27
0
 public static Reader <Env, Seq <B> > Sequence <Env, A, B>(this Seq <A> ta, Func <A, Reader <Env, B> > f) =>
 ta.Map(f).Sequence();
Beispiel #28
0
 public static S foldBack <S, T>(Seq <T> list, S state, Func <S, T, S> folder) =>
 list.FoldBack(state, folder);
Beispiel #29
0
 public static S foldBackWhile <S, T>(Seq <T> list, S state, Func <S, T, S> folder, Func <S, bool> predstate) =>
 foldWhile(rev(list), state, folder, predstate: predstate);
Beispiel #30
0
 public static Seq <A> tail <A>(Seq <A> list) =>
 list.Tail;