Esempio n. 1
0
        public async Task DownloadAudio_CanDownloadAudio(string id, string videoPath)
        {
            string videoPathAndName = videoPath + $"//{id}.mp3";
            await target.DownloadAudioAsync(id, videoPathAndName);

            Assert.True(File.Exists(videoPathAndName));
            await CleanDirectory.DeleteFileAsync(videoPath, id + ".mp3");
        }
Esempio n. 2
0
        public async Task DownloadVideo_CanDownloadVideo(string id, string videoPath, string quality = "144p")
        {
            string videoPathAndName = videoPath + $"//{id}.mp4";
            await target.DownloadVideoAsync(id, quality, videoPathAndName);

            Assert.True(File.Exists(videoPathAndName));
            await CleanDirectory.DeleteFileAsync(videoPath, id + ".mp4");
        }
Esempio n. 3
0
        public BounceArchive(Task<string> path) {
            ArchiveRoot = new CleanDirectory {Path = path};

            ArchivedBounce = new Copy {
                FromPath = @"bounce",
                ToPath = ArchiveRoot.Files["bounce"],
            }.ToPath;
        }
Esempio n. 4
0
        public static object GetTargets(IParameters parameters)
        {
            var dir = new CleanDirectory {
                Path = GitCheckoutDirectory
            };

            return(new {
                Directory = dir
            });
        }
Esempio n. 5
0
        public static object GetTargets(IParameters parameters)
        {
            var dir = new CleanDirectory {
                Path = GitCheckoutDirectory
            };

            return new {
                Directory = dir
            };
        }
Esempio n. 6
0
        public BounceArchive(Task <string> path)
        {
            ArchiveRoot = new CleanDirectory {
                Path = path
            };

            ArchivedBounce = new Copy {
                FromPath = @"bounce",
                ToPath   = ArchiveRoot.Files["bounce"],
            }.ToPath;
        }
Esempio n. 7
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            //Configuration
            string videosPath         = env.WebRootPath + "\\DownloadedVideos";                                                 // Place where your videos will be saved on the server
            string ffmpegLocation     = env.WebRootPath + "\\ffmpeg.exe";                                                       //Location to your ffmpeg.exe
            string ffmpegDownloadLink = "https://drive.google.com/u/0/uc?id=1kuiOY4_uAZxgp04YoB6DGL-tWiv5T-VD&export=download"; //Location where ffmpeg.exe can be downloaded in case if it will be missing at server startup

            DownloaderConfiguration.SetSettings(ffmpegLocation, videosPath, ffmpegDownloadLink);

            services.AddControllers();
            services.AddCors();
            services.AddAntiforgery();
            services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
            .AddJwtBearer(options => {
                options.TokenValidationParameters = new TokenValidationParameters()
                {
                    ValidateIssuerSigningKey = true,
                    IssuerSigningKey         = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(Configuration.GetSection("AppSettings:TokenKey").Value)),
                    ValidateIssuer           = false,
                    ValidateAudience         = false,
                };
            });

            services.AddScoped <IYoutubeClient, YoutubeClient>();
            services.AddScoped <IYoutubeClientHelper>(s => new YoutubeClientHelper(new YoutubeClient(), DownloaderConfiguration.ffmpegLocation));
            services.AddScoped <IAuthRepository, AuthRepository>();
            services.AddScoped <IAccountPermissionChecker, AccountPermissionChecker>();
            services.AddScoped <IUserRepository, UserRepository>();

            services.AddDbContext <UserContext>(options =>
            {
                options.UseSqlServer(Configuration.GetConnectionString("Default"));
            });


            //Clear wwwroot/DownloadedVideos dir or create on if not exist
            if (File.Exists(DownloaderConfiguration.videoDownloadPath))
            {
                CleanDirectory.DeleteAllFiles(videosPath);
                CleanDirectory.DeleteAllSubDirs(videosPath);
            }
            else
            {
                Directory.CreateDirectory(videosPath);
            }
            //Check if ffmpeg exists if not download it
            if (!File.Exists(DownloaderConfiguration.ffmpegLocation))
            {
                WebClient web = new WebClient();
                web.DownloadFile(DownloaderConfiguration.ffmpegDownloadLink, DownloaderConfiguration.ffmpegLocation);
            }
        }
Esempio n. 8
0
        public static object RealTargets(IParameters buildParameters)
        {
            var version = buildParameters.Required <string>("version");

            var git = new GitCheckout {
                Repository = "git://github.com/refractalize/bounce.git",
                Directory  = "tmp2",
            };

            var asmInfoWithVersion = new RewriteFile {
                FilePath = "SolutionAssemblyInfo.cs",
                Rewriter = RewriteVersion(version),
            };

            var solution = new VisualStudioSolution {
                SolutionPath = "Bounce.sln",
                DependsOn    = new [] { asmInfoWithVersion }
            };

            var frameworkProject = solution.Projects["Bounce.Framework"];

            var downloadsDir = new CleanDirectory {
                Path = "Downloads",
            };

            var frameworkZip = new ZipFile {
                Directory   = frameworkProject.WhenBuilt(() => Path.GetDirectoryName(frameworkProject.OutputFile.Value)),
                ZipFileName = downloadsDir.Files[version.WhenBuilt(() => string.Format("Bounce.Framework.{0}.zip", version.Value))],
            };

            var gitTag = new GitTag {
                Directory = ".", Tag = version.WhenBuilt(() => "v" + version.Value)
            };
            var downloads = new All(frameworkZip, gitTag);

            return(new {
                Tests = new NUnitTests {
                    DllPaths = solution.Projects.Select(p => p.OutputFile),
                },
                Downloads = downloads,
                RewriteAsmInfo = asmInfoWithVersion,
            });
        }
Esempio n. 9
0
        public override async Task ExecuteResultAsync(ActionContext context)
        {
            await base.ExecuteResultAsync(context);

            await CleanDirectory.DeleteFile(FileName);
        }