Beispiel #1
0
    public static string GetAllVideosData(int page, string id, int index)
    {
        bool                  HasMoreVideos = true;
        StringBuilder         sb            = new StringBuilder();
        DailyMotionAPIManager Manager       = new DailyMotionAPIManager();

        page = Playlist.GetPage(index) + page - 1;

        try
        {
            var playlist = Manager.GetPlaylist(id, page, Playlist.MaxDownloadedVideos);

            for (int i = 0; i < playlist.Videos.Count(); i++)
            {
                if (playlist.TotalVideosCount <= (Playlist.MaxDownloadedVideos * (page - 1)) + 1 + i)
                {
                    HasMoreVideos = false;
                }

                sb.Append(playlist.Videos.ElementAt <Video>(i).ToPlaylistHTML(id, (Playlist.MaxDownloadedVideos * (page - 1)) + 1 + i, false));
            }
        }
        catch (Exception ex) { ErrorLogger.Log(ex); }

        if (HasMoreVideos == false)
        {
            return("<!--NOMORE-->" + sb.ToString());
        }

        return(sb.ToString());
    }
Beispiel #2
0
    public static string GetCustomersData(int pageIndex)
    {
        ResultPage            result  = null;
        DailyMotionAPIManager Manager = new DailyMotionAPIManager();

        if (string.IsNullOrWhiteSpace(Query))
        {
            result = Manager.GetDefaultPage(pageIndex, LimitPerPage, CurrentCulture); //No query, display default page
        }
        else
        {
            result = Manager.Search(Query, pageIndex, LimitPerPage, CurrentCulture);
        }

        StringBuilder sb = new StringBuilder();

        foreach (var video in result.Videos)
        {
            sb.Append(video.ToListHTML());
        }

        return(sb.ToString());
    }