Vimeo Tools VimeoData
This module contains the class VimeoData, which is used to display information about a Vimeo account and its videos, folders and albums.
- class VimeoData(connection, data_file=None)
Bases:
object- Parameters
connection (VimeoConnection) –
data_file (Optional[str]) –
- property account: dict
Get account infos. :rtype:
dict:return: dict
- property account_data: dict
Get account infos. :rtype:
dict:return: dict
- property account_json: str
Get account infos. :rtype:
str:return: str (json)
- get_count(what, refresh=False)
Get the number of items (videos or albums). :type what:
Literal[‘videos’, ‘albums’, ‘projects’] :param what: What to fetch. Either ‘videos’ or ‘albums’ (==’showcases’).- Return type
int- Parameters
what (Literal['videos', 'albums', 'projects']) –
refresh (bool) –
- get_folders(returning='objects', refresh=False)
Get all folders. :rtype:
Union[Dict[str,Any],List[Dict[str,Any]],List[VimeoFolder],str] :return: list of VimeoFolder objects- Parameters
returning (Literal['objects', 'object', 'folder', 'folders', 'dict', 'list', 'code', 'codes', 'uri', 'uris', 'json']) –
refresh (bool) –
- Return type
Union[Dict[str, Any], List[Dict[str, Any]], List[VimeoFolder], str]
- get_showcases(returning='objects', refresh=False)
Fetch albums from Vimeo. returns a list of VimeoShowcase objects by default
- Parameters
returning (
Literal[‘objects’, ‘object’, ‘showcase’, ‘showcases’, ‘album’, ‘albums’, ‘dict’, ‘list’, ‘code’, ‘codes’, ‘uri’, ‘uris’, ‘json’]) – str, default: ‘item’ - ‘object’, ‘objects, ‘album’ or ‘albums’: returns a list of VimeoVideo objects - ‘dict’: returns a dict as provided by the Vimeo API - ‘list’: returns a list of dict as provided by the Vimeo API in the ‘data’ key - ‘json’: returns a json stringrefresh (bool) –
- Return type
Union[Dict[str, Any], List[Dict[str, Any]], List[VimeoShowcase], str]
Obviously, returning the list of VimeoShowcase objects takes more time than returning the list of dicts.
- Return type
Union[Dict[str,Any],List[Dict[str,Any]],List[VimeoShowcase],str]- Parameters
returning (Literal['objects', 'object', 'showcase', 'showcases', 'album', 'albums', 'dict', 'list', 'code', 'codes', 'uri', 'uris', 'json']) –
refresh (bool) –
- get_videos(returning='objects', refresh=False)
Fetch videos from Vimeo. returns a list of VimeoVideo objects by default
- Parameters
returning (
Literal[‘object’, ‘objects’, ‘video’, ‘videos’, ‘code’, ‘codes’, ‘uri’, ‘uris’, ‘dict’, ‘list’, ‘json’]) – str, default: ‘item’ - ‘item’, ‘items, ‘video’ or ‘videos’: returns a list of VimeoVideo objects - ‘dict’: returns a dict as provided by the Vimeo API - ‘list’: returns a list of dict as provided by the Vimeo API in the ‘data’ key - ‘json’: returns a json stringrefresh (bool) –
- Return type
Union[Dict[str, Any], List[Dict[str, Any]], List[VimeoVideo], str]
Obviously, returning the list of VimeoVideo objects takes more time than returning the list of dicts.
- Return type
Union[Dict[str,Any],List[Dict[str,Any]],List[VimeoVideo],str]- Parameters
returning (Literal['object', 'objects', 'video', 'videos', 'code', 'codes', 'uri', 'uris', 'dict', 'list', 'json']) –
refresh (bool) –
- get_videos_from_showcase(showcase, returning='objects')
Fetch the videos from an album.
This method should be obsolete, as it is now possible to get the videos from an album directly from the VimeoShowcase object.
- Parameters
album_code – str
returning (
Literal[‘object’, ‘objects’, ‘dict’, ‘list’, ‘json’, ‘code’, ‘codes’, ‘uri’, ‘uris’]) – str, default: ‘dict’showcase (Union[str, VimeoShowcase]) –
- Return type
Union[List[Dict[str,Any]],List[str],List[VimeoVideo],str]- Returns
list of dict
Example: vimeo_client.get_videos_from_album(album=’123456’, returning=’list’)
- get_videos_with_tag(tag, returning='objects', refresh=False)
- Return type
Union[VimeoVideo,List[Dict[str,Any]],List[str],str]- Parameters
tag (str) –
returning (Literal['object', 'objects', 'dict', 'list', 'json', 'code', 'codes', 'uri', 'uris']) –
refresh (bool) –
- info()
Return a string with information about the account and informations about the videos, folders and albums.
Be warned that this method will make a lot of requests to the Vimeo API, so it may take a while to complete.
- Return type
str- Returns
str
- items_property(property, what='videos', refresh=False)
Fetch the property of the items specified in ‘what’.
- Parameters
property (
str) – This parameter supports the same dot notation as the Vimeo API.refresh (
bool) – boolwhat (Literal['videos', 'albums', 'projects']) –
- Return type
List[str]- Returns
list of str
- load(file=PosixPath('vimeo_data.json'), format=None, refresh=False)
Load the data from a file.
- Parameters
file (
Union[Path,str]) – Path or strformat (
Optional[Literal[‘json’, ‘pickle’]]) – ‘jsrefresh (
bool) – bool
- Return type
None- Returns
None
- property nb_folders: int
Get the number of folders.
- Return type
int
- property nb_showcases: int
Get the number of showcases. :rtype:
int:return: int
- property nb_videos: int
Get the number of videos. :param refresh: bool :rtype:
int:return: int
- refresh(what='all')
Refresh data.
- Parameters
what (
Literal[‘videos’, ‘albums’, ‘showcases’, ‘account’, ‘all’]) – strlive – bool
- Return type
None- Returns
None
Fetching data from the API (live)
- reload(file=PosixPath('vimeo_data.json'), format=None, refresh=False)
Load the data from a file.
- Parameters
file (
Union[Path,str]) – Path or strformat (
Optional[Literal[‘json’, ‘pickle’]]) – ‘jsrefresh (
bool) – bool
- Return type
None- Returns
None
Alias for load.
Its purpose is to reload the data from a file if the data might have been modified, but the object is still the same (such as in a module from which functions are imported, but the data object is not created anew each time)
- save(file=PosixPath('vimeo_data.json'), format=None, refresh=False)
- Return type
None- Parameters
file (Union[Path, str]) –
format (Optional[Union[Literal['json', 'pickle'], ~typing.List[~typing.Literal['json', 'pickle']]]]) –
refresh (bool) –
- show_account(mode='default', ignore_keys=[], show_keys=[], indent=0, refresh=False, returning='str')
- Return type
Union[str,List[str]]- Parameters
mode (str) –
ignore_keys (List[str]) –
show_keys (List[str]) –
indent (int) –
refresh (bool) –
returning (Literal['str', 'lines']) –
- show_folders(mode='default', ignore_keys=[], show_keys=[], indent=0, refresh=False, returning='str')
- Return type
Union[str,List[str]]- Parameters
mode (str) –
ignore_keys (List[str]) –
show_keys (List[str]) –
indent (int) –
refresh (bool) –
returning (Literal['str', 'lines']) –
- show_showcases(mode='default', ignore_keys=[], show_keys=[], indent=0, refresh=False, returning='str')
- Return type
Union[str,List[str]]- Parameters
mode (str) –
ignore_keys (List[str]) –
show_keys (List[str]) –
indent (int) –
refresh (bool) –
returning (Literal['str', 'lines']) –
- show_videos(mode='default', ignore_keys=[], show_keys=[], indent=0, refresh=False, returning='str')
- Return type
Union[str,List[str]]- Parameters
mode (str) –
ignore_keys (List[str]) –
show_keys (List[str]) –
indent (int) –
refresh (bool) –
returning (Literal['str', 'lines']) –
- property showcase_codes: List[str]
Fetch the codes of all videos. :type refresh:
bool:param refresh: bool :rtype:List[str] :return: list of str
- property showcase_uris: List[str]
Fetch the uris of all videos. :type refresh:
bool:param refresh: bool :rtype:List[str] :return: list of str
- property showcases: List[VimeoShowcase]
Get all showcases. :rtype:
List[VimeoShowcase] :return: list of VimeoShowcase objectsThis property is always refreshed.
- update_data(what, data)
Update data in the VimeoData object
- Return type
None- Parameters
what (Literal['account', 'videos', 'albums', 'projects']) –
data (Union[Dict[str, Any], List[Dict[str, Any]]]) –
- property video_codes: List[str]
Fetch the codes of all videos. :type refresh:
bool:param refresh: bool :rtype:List[str] :return: list of str
- property video_uris: List[str]
Fetch the uris of all videos. :type refresh:
bool:param refresh: bool :rtype:List[str] :return: list of str
- property videos: List[VimeoVideo]
Get all videos. :rtype:
List[VimeoVideo] :return: list of VimeoVideo objectsRefresh is implicitely False.