Exemplo n.º 1
0
        public void GetVideosInFolder(VimeoFolder folder, string fields = "name,uri", int per_page = 100, string direction = "desc", string sort = "alphabetical")
        {
            string folderCollectionTag = VimeoFolder.CollectionTag[(int)folder.collectionType];

            StartCoroutine(PagedRequest(per_page, "/me/" + folderCollectionTag + "/" + folder.id + "/videos?fields=" + fields + "&direction=" + direction + "&sort=" + sort));
            //StartCoroutine("Request", "/me/" + folderCollectionTag + "/" + folder.id + "/videos?fields=" + fields + "&direction=" + direction + "&page=" + page + "&per_page=" + per_page + "&sort=" + sort);
        }
Exemplo n.º 2
0
 public void AddVideoToFolder(VimeoVideo video, VimeoFolder folder)
 {
     if (folder.id > 0 && video.uri != null) {
         IEnumerator coroutine = Put("/me/folders/" + folder.id + "/videos?uris=" + video.uri);
         StartCoroutine(coroutine);
     }
 }
Exemplo n.º 3
0
 public void AddVideoToFolder(VimeoVideo video, VimeoFolder folder)
 {
     if (folder.id > 0 && video.uri != null)
     {
         string      folderCollectionTag = VimeoFolder.CollectionTag[(int)folder.collectionType];
         IEnumerator coroutine           = Put("/me/" + folderCollectionTag + "/" + folder.id + "/videos?uris=" + video.uri);
         StartCoroutine(coroutine);
     }
 }
Exemplo n.º 4
0
 public void SignOut()
 {
     vimeoSignIn = false;
     signInError = false;
     SetVimeoToken(null);
     vimeoVideos.Clear();
     currentVideo = null;
     vimeoFolders.Clear();
     currentFolder = null;
 }
        public void SignOut()
        {
            SetVimeoToken(null);
            vimeoVideos.Clear();
            vimeoFolders.Clear();

            currentVideo      = null;
            currentFolder     = null;
            currentFolderType = VimeoFolder.Collection.Undefined;
            vimeoSignIn       = false;
            signInError       = false;
        }
Exemplo n.º 6
0
        private void GetFoldersComplete(string response)
        {
            var settings = target as VimeoSettings;

            settings.vimeoFolders.Clear();

            api.OnRequestComplete -= GetFoldersComplete;

            if (!EditorApplication.isPlaying)
            {
                DestroyImmediate(settings.gameObject.GetComponent <VimeoApi>());
            }

            var json       = JSON.Parse(response);
            var folderData = json["data"];

            string folder_prefix = "";

            if (settings is VimeoPlayer)
            {
                var player = target as VimeoPlayer;
                player.vimeoFolders.Add(new VimeoFolder("---- Find a video ----", null));
                player.vimeoFolders.Add(new VimeoFolder("Get video by ID or URL", "custom"));
                player.vimeoFolders.Add(new VimeoFolder("Most recent videos", "recent"));

                if (player.currentFolder == null || !player.currentFolder.IsValid())
                {
                    if (player.vimeoVideoId != null && player.vimeoVideoId != "")
                    {
                        player.currentFolder = player.vimeoFolders[1];
                    }
                    else
                    {
                        player.currentFolder = player.vimeoFolders[0];
                    }
                }
                folder_prefix = "Projects / ";
            }
            else
            {
                settings.vimeoFolders.Add(new VimeoFolder("No project", null));
            }

            for (int i = 0; i < folderData.Count; i++)
            {
                VimeoFolder folder = new VimeoFolder(folder_prefix + folderData[i]["name"], folderData[i]["uri"]);
                settings.vimeoFolders.Add(folder);
            }
        }
Exemplo n.º 7
0
        protected void GetVideosInFolder(VimeoFolder folder)
        {
            var settings = target as VimeoSettings;

            if (!settings.Authenticated())
            {
                return;
            }
            InitAPI();

            settings.vimeoVideos.Clear();
            settings.vimeoVideos.Add(
                new VimeoVideo("Loading...", null)
                );

            api.OnRequestComplete += GetVideosComplete;
            api.OnError           += OnRequestError;

            api.GetVideosInFolder(folder);
        }
Exemplo n.º 8
0
 public void GetVideosInFolder(VimeoFolder folder)
 {
     StartCoroutine("Request", "/me/folders/" + folder.id + "/videos?per_page=100");
 }
Exemplo n.º 9
0
 public void GetVideosInFolder(VimeoFolder folder, string fields = "name,uri", int per_page = 100)
 {
     StartCoroutine("Request", "/me/folders/" + folder.id + "/videos?fields=" + fields + "&per_page=" + per_page);
 }
Exemplo n.º 10
0
        private void GetFoldersComplete(string response)
        {
            var settings = target as VimeoSettings;

            settings.vimeoFolders.Clear();
            settings.currentFolder = null;

            api.OnRequestComplete -= GetFoldersComplete;

#if UNITY_EDITOR
            if (!EditorApplication.isPlaying)
#endif
            {
                DestroyImmediate(settings.gameObject.GetComponent <VimeoApi>());
            }

            var json       = JSONNode.Parse(response);
            var folderData = json["data"];

            string folder_prefix = "";

            string currentFolderType_LowerCase = settings.currentFolderType.ToString().ToLower();

            if (IsSelectExisting(settings))
            {
                target.vimeoFolders.Add(new VimeoFolder("---- Select a folder ----", null, VimeoFolder.Collection.Undefined));
                target.vimeoFolders.Add(new VimeoFolder("Get video by ID or URL", "custom", VimeoFolder.Collection.Undefined));
                target.vimeoFolders.Add(new VimeoFolder("Most recent videos", "recent", VimeoFolder.Collection.Undefined));

                if (target.currentFolder == null || !target.currentFolder.IsValid())
                {
                    if (target.currentVideo != null && target.currentVideo.id > 0)
                    {
                        target.currentFolder = target.vimeoFolders[1];
                    }
                    else
                    {
                        target.currentFolder = target.vimeoFolders[0];
                    }
                }

                folder_prefix = target.currentFolderType.ToString() + " / ";
            }
            else if (folderData.Count == 0)
            {
                settings.vimeoFolders.Add(new VimeoFolder("No " + currentFolderType_LowerCase, null, VimeoFolder.Collection.Undefined));
            }
            else
            {
                settings.vimeoFolders.Add(new VimeoFolder("---- Select a " + currentFolderType_LowerCase + " ----", null, VimeoFolder.Collection.Undefined));
            }

            for (int i = 0; i < folderData.Count; i++)
            {
                VimeoFolder folder = new VimeoFolder(folder_prefix + folderData[i]["name"], folderData[i]["uri"], target.currentFolderType);
                settings.vimeoFolders.Add(folder);
            }

            if (OnFetchComplete != null)
            {
                OnFetchComplete.Invoke("");
            }

            Debug.Log("[VimeoFetcher] Completed with " + (settings.vimeoFolders.Count - 1) + " existing folders");
        }