Exemplo n.º 1
0
        public void CanQueryFilesFromPatreonAPI()
        {
            var audibleAPI = new PatreonAPI();

            var queryBuilder = new PatreonQueryBuilder()
                               .FromCreator("cumtown")
                               .WithDefaultAuthKey();

            var audibleItems = audibleAPI
                               .Query(queryBuilder)
                               .Take(5);

            foreach (var audibleItem in audibleItems)
            {
            }
        }
Exemplo n.º 2
0
        public IEnumerable <PatreonMediaPost> Query(
            string creatorName)
        {
            var patreonAPI   = new PatreonAPI();
            var queryBuilder = new PatreonQueryBuilder()
                               .FromCreator("cumtown")
                               .WithDefaultAuthKey();

            var patreonItems = patreonAPI
                               .Query(queryBuilder);

            foreach (var patreonItem in patreonItems)
            {
                Debug.WriteLine($"\"ShowMediaItem\": {{");
                Debug.WriteLine($"  \"Source\":		\"patreon\",");
                Debug.WriteLine($"  \"Title\":		{patreonItem.Title},");
                Debug.WriteLine($"  \"Summary\":	{patreonItem.Summary},");
                Debug.WriteLine($"  \"DateTime\":	{patreonItem.DateTime:g},");
                Debug.WriteLine($"  \"FilePath\":	{patreonItem.FilePath}");
                Debug.WriteLine($"}},");
                Debug.WriteLine("");

                yield return(patreonItem);

                var create = new WebClient();

                var directoryInfo = new DirectoryInfo(
                    $@"C:\Cumtown\{patreonItem.DateTime.Year:0000}\{patreonItem.DateTime.Month:00}\");

                if (!directoryInfo.Exists)
                {
                    directoryInfo.Create();
                }

                create.DownloadFile(
                    patreonItem.FilePath,
                    directoryInfo.FullName +
                    $@"\CTF-{patreonItem.DateTime.Year:0000}-{patreonItem.DateTime.Month:00}-{patreonItem.DateTime.Day:00}.mp3");
                //create.
            }
        }