Beispiel #1
0
        public override void DoExecute()
        {
            if (!UploadOlx && !DownloadOlx && !PatchOlx && !FullProcessingOlx)
            {
                Console.WriteLine("Use the options: --up, --down, --patch, --full. Or --help for help");
                return;
            }
            Console.WriteLine("Profile {0}", Profile);
            var profile     = Config.GetProfile(Profile);
            var credentials = Credentials.GetCredentials(Dir, Profile);

            if (DownloadOlx || FullProcessingOlx)
            {
                EdxInteraction.Download(Dir, Config, profile.EdxStudioUrl, credentials);
            }

            Console.WriteLine("Loading OLX");
            var edxCourse = EdxCourse.Load(Dir + "/olx");

            if (PatchOlx || FullProcessingOlx)
            {
                Console.WriteLine("Patching OLX...");
                Patch(new OlxPatcher(Dir + "/olx"), Config, profile, edxCourse);
                Console.WriteLine("Patched!");
            }

            if (UploadOlx || FullProcessingOlx)
            {
                EdxInteraction.Upload(Dir, edxCourse.CourseName, Config, profile.EdxStudioUrl, credentials);
            }
        }
Beispiel #2
0
        public override void DoExecute()
        {
            Console.WriteLine("Profile {0}", Profile);
            var profile     = Config.GetProfile(Profile);
            var credentials = Credentials.GetCredentials(Dir, Profile);

            EdxInteraction.Download(Dir, Config, profile.EdxStudioUrl, credentials);
        }
Beispiel #3
0
        public override void DoExecute()
        {
            var profile = Config.GetProfile(Profile);

            Console.WriteLine("Please, download course from Edx (tar.gz from Tools - Export menu) and save it in working directory");


            var tarGzPath = Dir.GetSingleFile(CourseTarGz ?? "*.tar.gz");

            EdxInteraction.ExtractEdxCourseArchive(Dir, tarGzPath);

            Console.WriteLine("Loading edx course...");
            var edxCourse = EdxCourse.Load(Dir + "/olx");

            if (edxCourse.CourseWithChapters.Chapters.Length != 0)
            {
                Console.WriteLine("List of chapters to be removed or replaced:");
                foreach (var chapterName in edxCourse.CourseWithChapters.Chapters.Select(x => x.DisplayName))
                {
                    Console.WriteLine("\t" + chapterName);
                }
                while (true)
                {
                    Console.WriteLine("Do you want to proceed? (y/n)");
                    var key = Console.ReadKey();
                    if (key.Key == ConsoleKey.Y)
                    {
                        break;
                    }
                    if (key.Key == ConsoleKey.N)
                    {
                        return;
                    }
                }
            }
            var video = LoadVideoInfo();

            VideoHistory.UpdateHistory(Dir, video);

            Console.WriteLine($"Loading ulearn course from {Config.ULearnCourseId}");
            var course = new CourseLoader().LoadCourse(new DirectoryInfo(Path.Combine(Dir, Config.ULearnCourseId)));

            Console.WriteLine($"Converting ulearn course \"{course.Id}\" to edx course");
            Converter.ToEdxCourse(
                course,
                Config,
                profile.UlearnUrl + SlideUrlFormat,
                profile.UlearnUrl + SolutionsUrlFormat,
                video.Records.ToDictionary(x => x.Data.Id, x => x.Guid.GetNormalizedGuid())
                ).Save(Dir + "/olx");

            EdxInteraction.CreateEdxCourseArchive(Dir, course.Id);

            Console.WriteLine($"Now you can upload {course.Id}.tar.gz to edx via Tools - Import menu");
        }
Beispiel #4
0
        public override void DoExecute()
        {
            Console.WriteLine("Profile {0}", Profile);
            var profile     = Config.GetProfile(Profile);
            var credentials = Credentials.GetCredentials(Dir, Profile);

            Console.WriteLine("Loading OLX");
            var edxCourse = EdxCourse.Load(Dir + "/olx");

            EdxInteraction.Upload(Dir, edxCourse.CourseName, Config, profile.EdxStudioUrl, credentials);
        }
Beispiel #5
0
        public override void DoExecute()
        {
            var profile     = Config.GetProfile(Profile);
            var credentials = Credentials.GetCredentials(Dir, Profile);

            EdxInteraction.Download(Dir, Config, profile.EdxStudioUrl, credentials);

            var edxCourse = EdxCourse.Load(Dir + "/olx");

            if (edxCourse.CourseWithChapters.Chapters.Length != 0)
            {
                Console.WriteLine("List of chapters to be removed or replaced:");
                foreach (var chapterName in edxCourse.CourseWithChapters.Chapters.Select(x => x.DisplayName))
                {
                    Console.WriteLine("\t" + chapterName);
                }
                while (true)
                {
                    Console.WriteLine("Do you want to proceed? (y/n)");
                    var key = Console.ReadKey();
                    if (key.Key == ConsoleKey.Y)
                    {
                        break;
                    }
                    if (key.Key == ConsoleKey.N)
                    {
                        return;
                    }
                }
            }
            var video = LoadVideoInfo();

            VideoHistory.UpdateHistory(Dir, video);

            Console.WriteLine("Loading uLearn course from {0}", Config.ULearnCourseId);
            var course = new CourseLoader().LoadCourse(new DirectoryInfo(Path.Combine(Dir, Config.ULearnCourseId)));

            Console.WriteLine("Converting uLearn course \"{0}\" to Edx course", course.Id);
            Converter.ToEdxCourse(
                course,
                Config,
                profile.UlearnUrl + SlideUrlFormat,
                profile.UlearnUrl + SolutionsUrlFormat,
                video.Records.ToDictionary(x => x.Data.Id, x => Utils.GetNormalizedGuid(x.Guid))
                ).Save(Dir + "/olx");

            EdxInteraction.Upload(Dir, course.Id, Config, profile.EdxStudioUrl, credentials);
        }
Beispiel #6
0
        public override void DoExecute()
        {
            Console.WriteLine("Profile {0}", Profile);
            var profile = Config.GetProfile(Profile);

            if (!SkipExtractingTarGz)
            {
                var tarGzPath = Dir.GetSingleFile(CourseTarGz ?? "*.tar.gz");
                EdxInteraction.ExtractEdxCourseArchive(Dir, tarGzPath);
            }

            Console.WriteLine("Loading OLX");
            var edxCourse = EdxCourse.Load(Dir + "/olx");

            Console.WriteLine("Patching OLX...");
            Patch(new OlxPatcher(Dir + "/olx"), Config, profile, edxCourse);
            Console.WriteLine("Patched!");
            EdxInteraction.CreateEdxCourseArchive(Dir, Config.ULearnCourseId);
        }
Beispiel #7
0
        public override void DoExecute()
        {
            if (!(Download ^ Upload))
            {
                Console.Out.WriteLine("Use one of options: download or upload");
                return;
            }

            Console.Out.WriteLine("Profile: {0}", Profile);
            var profile     = Config.GetProfile(Profile);
            var credentials = Credentials.GetCredentials(Dir, Profile, "uLearn");

            if (Download)
            {
                ULearnInteractor.Download(Dir, Force, Config, profile.UlearnUrl, credentials);
            }
            if (Upload)
            {
                ULearnInteractor.Upload(Dir, Config, profile.UlearnUrl, credentials);
            }
        }