'Usage: downfile <remotefile> [localpath] - download a remote file.
remotefile - remote file at Baidu Yun (after app root directory at Baidu Yun)
localpath - local path.
if it ends with \'/\' or \'\\', it specifies the local directory
if it specifies an existing directory, it is the local directory
if not specified, the local directory is the current directory \'.\'
otherwise, it specifies the local file name
To stream a file using downfile, you can use the \'mkfifo\' trick with omxplayer etc.:
mkfifo /tmp/omx
bypy.py downfile <remotepath> /tmp/omx &
omxplayer /tmp/omx'

def downfile(self, remotefile, localpath=u''):

    localfile = localpath
    if (not localpath):
        localfile = os.path.basename(remotefile)
    elif ((localpath[(-1)] == u'\\') or (localpath[(-1)] == u'/') or os.path.isdir(localpath)):
        localfile = joinpath(localpath, os.path.basename(remotefile))
    else:
        localfile = localpath
    pcsrpath = get_pcs_path(remotefile)
    return self.__downfile(pcsrpath, localfile)
