Beispiel #1
0
        static void Recursive(DirectoryInfo currentDirectory, DirectoryInfo inputRoot, DirectoryInfo newModelsDirectory, string prefix)
        {
            Console.WriteLine("Processing " + currentDirectory.FullName);
            var files = currentDirectory.GetFiles();

            if (!files.Any(z => z.Name == Names.FaceFileName))
            {
                foreach (var d in currentDirectory.GetDirectories())
                {
                    Recursive(d, inputRoot, newModelsDirectory, prefix);
                }
                return;
            }
            var tutoFile = files.Where(z => z.Name == "local.tuto").FirstOrDefault();

            if (tutoFile == null)
            {
                Console.WriteLine("No tuto file is found. Press any key");
                Console.ReadKey();
                return;
            }

            var hash      = Videotheque.ComputeHash(currentDirectory, Names.FaceFileName, Names.HashFileName, true);
            var container = HeadedJsonFormat.Read <FileContainer>(tutoFile, "Tuto local file", 3);

            container.MontageModel.SetHash(hash);
            var relativePath = prefix + MyPath.RelativeTo(tutoFile.Directory.FullName, inputRoot.FullName);

            container.MontageModel.DisplayedRawLocation = relativePath;
            var fname = Path.Combine(newModelsDirectory.FullName, MyPath.CreateHierarchicalName(relativePath) + "." + Names.ModelExtension);

            HeadedJsonFormat.Write(new FileInfo(fname), container);
        }
Beispiel #2
0
        public VideothequeModel(Videotheque videotheque)
        {
            this.videotheque = videotheque;



            Search = new SearchViewModel();
            Search.PropertyChanged    += (s, a) => Filter();
            Search.RefreshRequested   += () => { videotheque.Reload(); UpdateSubdirectories(); };
            Search.SelectAllRequested += SelectAll;
            UpdateSubdirectories();

            PreWorks       = new AssemblySettings();
            SaveCommand    = new RelayCommand(Save, () => true);
            MakeAllCommand = new RelayCommand(() =>
            {
                var work   = Subdirectories.Where(z => z.Selected);
                var models = work.Select(x => x.Model);
                foreach (var e in models)
                {
                    Program.WorkQueue.Run(new MakeAll(e));
                }
            }
                                              );

            Func <bool> somethingSelected = () => Subdirectories.Any(z => z.Selected);


            AssembleSelectedCommand            = new RelayCommand(AssembleSelected, somethingSelected);
            AssembleSelectedWithOptionsCommand = new RelayCommand(AssembleWithOptions, somethingSelected);
            RemontageSelectedCommand           = new RelayCommand(MontageSelected, somethingSelected);
            RepairFaceSelectedCommand          = new RelayCommand(RepairFaceSelected, somethingSelected);

            UploadSelectedClipsCommand = new RelayCommand(UploadClips);
        }
Beispiel #3
0
 public MainModel(Videotheque videotheque)
 {
     Queue                        = new BatchWorkQueueViewModel(Program.WorkQueue);
     VideothequeModel             = new VideothequeModel(videotheque);
     VideothequeModel.OpenEditor += OpenEditor;
     Mode    = MainMode.Videotheque;
     Caption = videotheque.VideothequeSettingsFile.Name;
 }
Beispiel #4
0
        public MainViewModel(Videotheque videotheque, PublishingModel model, Func <IEnumerable <IMaterialSource> > sourcesFactory)
        {
            this.Model          = model;
            this.sourcesFactory = sourcesFactory;
            UpdateVideoCommand  = new RelayCommand(UpdateVideo);

            SaveCommand = new RelayCommand(Save);
            Reload();
        }
Beispiel #5
0
        public static int Summary(string[] args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine("Arguments missing, required: path to videotheque; output file with summaries");
                return(1);
            }
            var videotheque = Videotheque.Load(args[0], new ConsoleLoadingUI(), false, "..\\..\\..\\Tuto.Navigator\\bin\\Debug");

            Console.WriteLine("Videotheque loaded");
            Console.WriteLine();
            videotheque.CreateSummary(args[1]);
            return(1);
        }
        public static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                MessageBox.Show("This program should be called with an argument: the path to videotheque file");
                return;
            }

            videotheque = Videotheque.Load(args[0], null, true);
            OpenModel("LHPS");
            YoutubeApisProcessor.Initialize(videotheque.TempFolder);

            Application = new System.Windows.Application();
            var viewModel = new MainViewModel(videotheque, publishingModel, () => SourcesFactory());
            var window    = new MainWindow();

            window.DataContext = viewModel;
            Application.Run(window);
        }
Beispiel #7
0
        public static int Assemble(string[] args)
        {
            if (args.Length != 3)
            {
                Console.WriteLine("Arguments missing, required: path to videotheque; guid to assemble; path to desired output");
                return(1);
            }
            var videotheque = Videotheque.Load(args[0], new ConsoleLoadingUI(), false, "..\\..\\..\\Tuto.Navigator\\bin\\Debug");

            Console.WriteLine("Videotheque loaded");
            Console.WriteLine();

            Guid guid = Guid.Empty;

            try
            {
                guid = Guid.Parse(args[1]);
            }
            catch
            {
                Console.WriteLine("GUID '" + args[1] + "' is not a correct guid");
                return(1);
            }
            var model = videotheque.EditorModels.Where(z => z.Montage.Information.Episodes.Any(x => x.Guid == guid)).FirstOrDefault();

            if (model == null)
            {
                Console.WriteLine("GUID '" + args[1] + "' is not found in videotheque");
                return(1);
            }
            var episode = model.Montage.Information.Episodes.Where(z => z.Guid == guid).FirstOrDefault();

            var work = new AssemblyEpisodeWork(model, episode);

            Console.WriteLine(work.Name);
            Console.WriteLine("Press ESC to cancel");
            work.SubsrcibeByExpression(z => z.Progress, () => Console.Write("\r{0:0.00}%        ", work.Progress));


            var queue = new WorkQueue(videotheque.Data.WorkSettings);

            queue.Dispatcher = Dispatcher.CurrentDispatcher;
            queue.Run(new[] { work });
            while (work.Status == BatchWorkStatus.Running || work.Status == BatchWorkStatus.Pending)
            {
                Thread.Sleep(10);
                if (Console.KeyAvailable)
                {
                    if (Console.ReadKey(true).Key == ConsoleKey.Escape)
                    {
                        queue.CancelTask(null);
                        Environment.Exit(1);
                        return(1);
                    }
                }
            }

            if (work.Status == BatchWorkStatus.Success)
            {
                if (File.Exists(args[2]))
                {
                    File.Delete(args[2]);
                }
                File.Move(model.Locations.GetOutputFile(episode).FullName, args[2]);
                Environment.Exit(0);
                return(0);
            }


            var errors = work.WorkTree.Select(z => z.ExceptionMessage).Where(z => !string.IsNullOrEmpty(z)).ToList();

            foreach (var e in errors)
            {
                Console.WriteLine(e);
            }

            Environment.Exit(1);
            return(1);
        }
Beispiel #8
0
        public static void Main(string[] args)
        {
            //  NewMain(); return;


            string fname = null;

            if (args.Length > 0)
            {
                fname = args[0];
            }
            var application = new Application();

            application.ShutdownMode = ShutdownMode.OnExplicitShutdown;
            var wnd = new Tuto.Init.MainWindow();
            Func <Videotheque> start = () => Videotheque.Load(fname, wnd, false);
            var token = start.BeginInvoke(null, null);

            wnd.ShowDialog();
            videotheque = start.EndInvoke(token);
            if (videotheque == null)
            {
                MessageBox.Show("Cannot initialize Tuto");
                return;
            }

            if (Backdoor())
            {
                return;
            }


            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            //YoutubeApisProcessor.Initialize(videotheque.TempFolder);

            var mainWindow = new MainNavigatorWindow();

            WorkQueue            = new WorkQueue(videotheque.Data.WorkSettings);
            WorkQueue.Dispatcher = mainWindow.Dispatcher;
            var globalModel = new MainModel(videotheque);

            globalModel.VideothequeModel.FillQueue();

            mainWindow.DataContext = globalModel;
            mainWindow.WindowState = System.Windows.WindowState.Maximized;

            if (args.Length > 1)
            {
                mainWindow.RequestedModel = args[1];
            }

            string directoryName = args[0];

            if (File.Exists(args[0]))
            {
                directoryName = new FileInfo(args[0]).Directory.FullName;
            }

            application.ShutdownMode = ShutdownMode.OnMainWindowClose;
            application.Run(mainWindow);
            application.Shutdown();
        }