Beispiel #1
0
def soundRecordStart():
    _extension = 'mp3'
    _file = util.fileName(_pathFilesMobileApi, _extension)
    _droid.recorderStartMicrophone(_file)
    #time.sleep(5)
    #_droid.recorderStop()
    return "Recording...<br>Use /soundRecordStop to stop"
Beispiel #2
0
def soundRecord10():
    _extension = 'mp3'
    _file = util.fileName(_pathFilesMobileApi, _extension)
    _droid.recorderStartMicrophone(_file)
    time.sleep(10)
    _droid.recorderStop()
    return "Recorded 10 last seconds"
Beispiel #3
0
def showphoto2():
    _extension = 'jpg'
    _file = util.fileName(_pathFilesMobileApi, _extension)
    _return = _droid.cameraStartPreview(10, 100, _pathFilesMobileApi)
    _droid.cameraInteractiveCapturePicture(_file)
    _droid.cameraStopPreview()
    return 'Photo captured'  #send_file(_file, mimetype='image/jpg')
Beispiel #4
0
def videoRecordStart():
    _extension = 'mp4'
    _file = util.fileName(_pathFilesMobileApi, _extension)
    _duration = 10
    _videoSize = 4  #0=160x120, 1=320x240, 2=352x288, 3=640x480, 4=800x480
    _droid.recorderCaptureVideo(_file, _duration,
                                True)  #self,targetPath,duration=0,videoSize=1
    return "Recording...<br>Use /videoRecordStop to stop"
Beispiel #5
0
def photo():
    _extension = 'jpg'
    _file = util.fileName(_pathFilesMobileApi, _extension)
    _droid.cameraCapturePicture(_file)
    #res('200 OK',[('Content-type','image/jpeg')])
    #return [file(_pathFilesMobileApi).read()]
    #r = Response(response="TEST OK", status=200, mimetype="application/xml")
    #r.headers["Content-Type"] = "image/jpg; charset=utf-8"
    return "ok"
Beispiel #6
0
def handlerListTorrent():
    xbmcplugin.setContent(_handleId, 'movies')
    autoplay = []
    autoplayIndex = 0
    watchlog.init(_watchedFolder, _path)
    data = transmission.get(_transmissionUrl, _params['hashString'])[0]
    files = sorted(data['files'], key=lambda k: k['name'])
    for file in files:
        if not file['wanted']:
            continue
        contextMenuItems = []
        contextCmd = 'RunPlugin(' + _baseUrl + '?' + urllib.urlencode(
            {
                'handler': 'AutoPlay',
                'autoplayIndex': str(autoplayIndex)
            }) + ')'
        contextMenuItems.append(('Auto Play', contextCmd))
        path = os.path.abspath(_transmissionDownloadsFolder +
                               file['name']).encode('utf8')
        url = 'file://' + urllib.pathname2url(path)
        name = util.fileName(urllib.unquote(url))
        if util.fileExt(path.lower()) not in ['avi', 'mkv', 'mp4']:
            continue
        infoLabels = {}
        if watchlog.isWatched(_watchedFolder, _baseUrl,
                              _params['hashString'] + '|' + name):
            infoLabels['playcount'] = 1
            contextCmd = 'RunPlugin(' + _baseUrl + '?' + urllib.urlencode(
                {
                    'handler': 'Watched',
                    'item': _params['hashString'] + '|' + name,
                    'watched': 'false'
                }) + ')'
            contextMenuItems.append(('UnWatched', contextCmd))
        else:
            infoLabels['playcount'] = 0
            contextCmd = 'RunPlugin(' + _baseUrl + '?' + urllib.urlencode(
                {
                    'handler': 'Watched',
                    'item': _params['hashString'] + '|' + name,
                    'watched': 'true'
                }) + ')'
            contextMenuItems.append(('Watched', contextCmd))
        item = xbmcgui.ListItem(name, iconImage=_pathImg + 'video.png')
        item.addContextMenuItems(contextMenuItems, replaceItems=True)
        item.setInfo(type="Video", infoLabels=infoLabels)
        params = {
            'handler': 'Play',
            'url': url,
            'name': name,
            'hashString': _params['hashString'],
            'item': _params['item']
        }
        url = _baseUrl + '?' + urllib.urlencode(params)
        autoplay.append(params)
        autoplayIndex = autoplayIndex + 1
        xbmcplugin.addDirectoryItem(handle=_handleId,
                                    url=url,
                                    isFolder=True,
                                    listitem=item)
    xbmcplugin.endOfDirectory(_handleId)
    util.objToFile(autoplay, _path + '/autoplay')
Beispiel #7
0
def showphoto():
    _extension = 'jpg'
    _file = util.fileName(_pathFilesMobileApi, _extension)
    _droid.cameraCapturePicture(_file)
    return send_file(_file, mimetype='image/jpg')