Example #1
0
 /// <summary>
 /// Internal function returning file with given id
 /// </summary>
 /// <param name="file_id">file id</param>
 /// <returns>RawFile</returns>
 internal object GetFileById(int file_id, int level)
 {
     VideoLocal vl = RepoFactory.VideoLocal.GetByID(file_id);
     if (vl != null)
     {
         RawFile rawfile = new RawFile(vl, level);
         return rawfile;
     }
     else
     {
         return APIStatus.notFound404();
     }
 }
Example #2
0
        /// <summary>
        /// Handle /api/file/unsort
        /// </summary>
        /// <returns>List<RawFile></returns>
        private object GetUnsort()
        {
            Request request = this.Request;
            Entities.JMMUser user = (Entities.JMMUser)this.Context.CurrentUser;
            API_Call_Parameters para = this.Bind();

            List<object> lst = new List<object>();

            List<VideoLocal> vids = RepoFactory.VideoLocal.GetVideosWithoutEpisode();

            foreach (VideoLocal vl in vids)
            {
                if (para.offset == 0)
                {
                    RawFile v = new RawFile(vl, para.level);
                    lst.Add(v);
                    if (para.limit != 0) { if (lst.Count >= para.limit) { break; } }
                }
                else { para.offset -= 1; }
            }

            return lst;
        }
Example #3
0
        private object GetUnsort(int max_limit)
        {
            ObjectList dir = new ObjectList("unsort", ObjectList.ListType.FILE);
            List<object> lst = new List<object>();

            List<VideoLocal> vids = RepoFactory.VideoLocal.GetVideosWithoutEpisode();

            foreach (VideoLocal vl in vids)
            {
                try
                {
                    RawFile v = new RawFile(vl, 0);
                    lst.Add(v);
                }
                catch { }

                if (max_limit != -1)
                {
                    if (lst.Count >= max_limit)
                    {
                        break;
                    }
                }
            }

            dir.Add(lst);
            return dir;
        }
Example #4
0
        private object GetFromFile(int uid, string vl_Id)
        {
            int id;
            if (!int.TryParse(vl_Id, out id)) { return APIStatus.badRequest("bad group id"); }

            VideoLocal vi = RepoFactory.VideoLocal.GetByID(id);

            RawFile rf = new RawFile(vi, 0);

            return rf;
        }