Esempio n. 1
0
#                    resName,resID = q.groups()
                for q in re.finditer('\"(name)\"\:\"([^\"]+)\",\"orderedFriendlyName\"' ,entry2, re.DOTALL):
                    titleID,title = q.groups()

                baseURL = ''
                for q in re.finditer('\"(thumbnailSet)\"\:\{\"baseUrl\"\:\"([^\"]+)\"' ,entry2, re.DOTALL):
                    baseID,baseURL = q.groups()
                    baseURL = re.sub('\\\\', '', baseURL)

                thumbnailURL = ''
                for q in re.finditer('\"(name)\"\:\"height128\"\,\"streamVersion\"\:\d+\,\"url\"\:\"([^\"]+)\"' ,entry2, re.DOTALL):
                    thumbnailID,thumbnailURL = q.groups()
                    thumbnailURL = re.sub('\\\\', '', thumbnailURL)

                if thumbnailURL != '':
                    media = package.package(file.file(resID, title+ extensionValue, title+ extensionValue, self.VIDEO, '', baseURL+thumbnailURL+ '|' + urllib.urlencode({ 'User-Agent' : self.user_agent, 'Cookie' : cookieString })),folder.folder(folderName,folderName))
                else:
                    media = package.package(file.file(resID, title+ extensionValue, title+ extensionValue, self.VIDEO, '', ''),folder.folder(folderName,folderName))
                media.setMediaURL(mediaurl.mediaurl(downloadURL, '','',''))
                mediaFiles.append(media)

            # photos
            for s in re.finditer('\"mimeType\"\:\"image.*?\"userRole\"\:0' ,entry, re.DOTALL):
                processed = 1
                entry2 = s.group()
                for q in re.finditer('\"(download)\"\:\"([^\"]+)\",' ,entry2, re.DOTALL):
                    downloadID,downloadURL = q.groups()
                    downloadURL = re.sub('\\\\', '', downloadURL)
                    downloadURL = re.sub('\%20', '+', downloadURL)
#                for q in re.finditer('\&(resid)\=([^\&]+)\&' ,entry2, re.DOTALL):
#                    resName,resID = q.groups()
Esempio n. 2
0
 def getDownloadURL(self, docid):
     (media,pack) = self.getPlaybackCall(package.package(file.file(docid, docid, docid, self.VIDEO, '', ''),folder.folder('','')))
     return media[0].url
Esempio n. 3
0
                    elif fileType == 'image':
                        fileType = self.MEDIA_TYPE_PICTURE

                    if contentType == 'dir':
                        mediaFiles.append(
                            package.package(
                                0,
                                folder.folder(folderName + '/' + fileName,
                                              fileName)))
                    else:
                        thumbnail = self.protocol + self.domain + '/index.php/core/preview.png?file=' + folderName + '/' + fileName + '&x=50&y=50' + '|' + self.getHeadersEncoded(
                        )

                        mediaFiles.append(
                            package.package(
                                file.file(fileName, fileName, fileName,
                                          fileType, '', thumbnail),
                                folder.folder(folderName, folderName)))

            return mediaFiles
        else:
            for r in re.finditer('\[\{.*?\}\]', response_data, re.DOTALL):
                entry = r.group()

                for s in re.finditer('\{.*?\}', entry, re.DOTALL):
                    item = s.group()

                    fileID = ''
                    fileName = ''
                    fileType = ''
                    contentType = ''
                    etag = ''
Esempio n. 4
0
    def getMediaPackage(self, entry, folderName='', contentType=2):

        resourceID = 0
        resourceType = ''
        title = ''
        fileSize = 0
        url = ''
        for r in re.finditer('\"mimeType\"\:\"([^\"]+)\"', entry, re.DOTALL):
            resourceType = r.group(1)
            break
        for r in re.finditer('\"name\"\:\"([^\"]+)\"', entry, re.DOTALL):
            title = r.group(1)
            try:
                title = title.decode('unicode-escape')
                title = title.encode('utf-8')
            except:
                pass
            break
        for r in re.finditer('\"size\"\:\s*(\d+)', entry, re.DOTALL):
            fileSize = r.group(1)
            break
        for r in re.finditer('\"@content.downloadUrl\"\:\"([^\"]+)\"', entry,
                             re.DOTALL):
            url = r.group(1)
            break
        for r in re.finditer('resid\=([^\"]+)\"', entry, re.DOTALL):
            resourceID = r.group(1)
            break

        # entry is a video
        if ('video' in resourceType and contentType in (0, 1, 2, 4, 7)):
            thumbnail = 'https://api.onedrive.com/v1.0/drive/items/' + str(
                resourceID) + '/thumbnails/0/small/content'
            #                    thumbnail = self.cache.getThumbnail(self, thumbnail,resourceID)
            mediaFile = file.file(resourceID,
                                  title,
                                  title,
                                  self.MEDIA_TYPE_VIDEO,
                                  '',
                                  thumbnail,
                                  size=fileSize)

            media = package.package(mediaFile, folder.folder(folderName, ''))
            media.setMediaURL(mediaurl.mediaurl(url, 'original', 0, 9999))
            return media

        # entry is a music file
        elif ('audio' in resourceType and contentType in (1, 2, 3, 4, 6, 7)):
            thumbnail = 'https://api.onedrive.com/v1.0/drive/items/' + str(
                resourceID) + '/thumbnails/0/small/content'
            #                    thumbnail = self.cache.getThumbnail(self, thumbnail,resourceID)

            mediaFile = file.file(resourceID,
                                  title,
                                  title,
                                  self.MEDIA_TYPE_MUSIC,
                                  '',
                                  thumbnail,
                                  size=fileSize)
            media = package.package(mediaFile, folder.folder(folderName, ''))
            media.setMediaURL(mediaurl.mediaurl(url, 'original', 0, 9999))
            return media

        # entry is a photo
        elif ('image' in resourceType and contentType in (2, 4, 5, 6, 7)):
            thumbnail = 'https://api.onedrive.com/v1.0/drive/items/' + str(
                resourceID) + '/thumbnails/0/small/content'
            #                    thumbnail = self.cache.getThumbnail(self, thumbnail,resourceID)
            mediaFile = file.file(resourceID,
                                  title,
                                  title,
                                  self.MEDIA_TYPE_PICTURE,
                                  '',
                                  thumbnail,
                                  size=fileSize)

            media = package.package(mediaFile, folder.folder(folderName, ''))
            media.setMediaURL(mediaurl.mediaurl(url, '', '', ''))
            return media

        # entry is unknown
        elif ('application' in resourceType):
            mediaFile = file.file(resourceID,
                                  title,
                                  title,
                                  self.MEDIA_TYPE_VIDEO,
                                  '',
                                  '',
                                  size=fileSize)

            media = package.package(mediaFile, folder.folder(folderName, ''))
            media.setMediaURL(mediaurl.mediaurl(url, 'original', 0, 9999))
            return media

        # all files (for saving to encfs)
        elif (contentType == 8):
            mediaFile = file.file(resourceID,
                                  title,
                                  title,
                                  self.MEDIA_TYPE_VIDEO,
                                  '',
                                  '',
                                  size=fileSize)

            media = package.package(mediaFile, folder.folder(folderName, ''))
            media.setMediaURL(mediaurl.mediaurl(url, '', '', ''))
            return media
Esempio n. 5
0
                    #let's log in
                    oc = owncloud.owncloud(PLUGIN_URL, addon, instanceName,
                                           user_agent)

            except:
                break

            if count == max_count:
                break
            count = count + 1

    elif instanceName != '':

        oc = owncloud.owncloud(PLUGIN_URL, addon, instanceName, user_agent)

    mediaFile = file.file(filename, title, '', 0, '', '')
    mediaFolder = folder.folder(directory, directory)
    url = oc.getPlaybackCall(cacheType,
                             package.package(mediaFile, mediaFolder))

    item = xbmcgui.ListItem(path=url)
    item.setInfo(type="Video",
                 infoLabels={
                     "Title": filename,
                     "Plot": filename
                 })
    xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)

#if mode == 'options' or mode == 'buildstrm' or mode == 'clearauth':
#    addMenu(PLUGIN_URL+'?mode=clearauth','<<'+addon.getLocalizedString(30018)+'>>')
#    addMenu(PLUGIN_URL+'?mode=buildstrm','<<'+addon.getLocalizedString(30025)+'>>')
Esempio n. 6
0
                            oc = owncloud.owncloud(PLUGIN_URL,addon,instanceName, user_agent)

                    except:
                        break

                    if count == max_count:
                        break
                    count = count + 1

    elif instanceName != '':

            oc = owncloud.owncloud(PLUGIN_URL,addon,instanceName, user_agent)



    mediaFile = file.file(filename, title, '', 0, '','')
    mediaFolder = folder.folder(directory,directory)
    url = oc.getPlaybackCall(cacheType,package.package(mediaFile,mediaFolder ))

    item = xbmcgui.ListItem(path=url)
    item.setInfo( type="Video", infoLabels={ "Title": filename , "Plot" : filename } )
    xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)

#if mode == 'options' or mode == 'buildstrm' or mode == 'clearauth':
#    addMenu(PLUGIN_URL+'?mode=clearauth','<<'+addon.getLocalizedString(30018)+'>>')
#    addMenu(PLUGIN_URL+'?mode=buildstrm','<<'+addon.getLocalizedString(30025)+'>>')



xbmcplugin.endOfDirectory(plugin_handle)
Esempio n. 7
0
 def getDownloadURL(self, docid):
     (media, pack) = self.getPlaybackCall(
         package.package(file.file(docid, docid, docid, self.VIDEO, '', ''),
                         folder.folder('', '')))
     return media[0].url
        if (not xbmcvfs.exists(str(encfs_source) + encryptedPath +str(title))):
            url = service.getDownloadURL(filename)
            service.downloadPicture(url, str(encfs_source) + encryptedPath +str(title))

        item = xbmcgui.ListItem(path=encfs_target + dencryptedPath)
        xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)

        playbackMedia = False

    else:
        playbackMedia = True

    # file ID provided
    #if we don't have the docid, search for the video for playback
    if (playbackMedia and filename != '' and mode == 'audio'):
        mediaFile = file.file(filename, title, '', service.MEDIA_TYPE_MUSIC, '','')
        mediaFolder = folder.folder(folderID,'')
        (mediaURLs,package) = service.getPlaybackCall(package=package.package(mediaFile,mediaFolder))
    elif (playbackMedia and filename != ''):
        mediaFile = file.file(filename, title, '', 0, '','')
        mediaFolder = folder.folder(folderID,'')
        (mediaURLs,package) = service.getPlaybackCall(package=package.package(mediaFile,mediaFolder))
    # search
    elif playbackMedia and mode == 'search':

            if title == '':

                try:
                    dialog = xbmcgui.Dialog()
                    title = dialog.input(addon.getLocalizedString(30110), type=xbmcgui.INPUT_ALPHANUM)
                except:
Esempio n. 9
0
                    baseID, baseURL = q.groups()
                    baseURL = re.sub('\\\\', '', baseURL)

                thumbnailURL = ''
                for q in re.finditer(
                        '\"(name)\"\:\"height128\"\,\"streamVersion\"\:\d+\,\"url\"\:\"([^\"]+)\"',
                        entry2, re.DOTALL):
                    thumbnailID, thumbnailURL = q.groups()
                    thumbnailURL = re.sub('\\\\', '', thumbnailURL)

                if thumbnailURL != '':
                    media = package.package(
                        file.file(
                            resID, title + extensionValue,
                            title + extensionValue, self.VIDEO, '',
                            baseURL + thumbnailURL + '|' +
                            urllib.urlencode({
                                'User-Agent': self.user_agent,
                                'Cookie': cookieString
                            })), folder.folder(folderName, folderName))
                else:
                    media = package.package(
                        file.file(resID, title + extensionValue,
                                  title + extensionValue, self.VIDEO, '', ''),
                        folder.folder(folderName, folderName))
                media.setMediaURL(mediaurl.mediaurl(downloadURL, '', '', ''))
                mediaFiles.append(media)

            # photos
            for s in re.finditer('\"mimeType\"\:\"image.*?\"userRole\"\:0',
                                 entry, re.DOTALL):
                processed = 1
Esempio n. 10
0
                    else:
                        thumbnail = (
                            self.protocol
                            + self.domain
                            + "/index.php/core/preview.png?file="
                            + folderName
                            + "/"
                            + fileName
                            + "&x=50&y=50"
                            + "|"
                            + self.getHeadersEncoded()
                        )

                        mediaFiles.append(
                            package.package(
                                file.file(fileName, fileName, fileName, fileType, "", thumbnail),
                                folder.folder(folderName, folderName),
                            )
                        )

            return mediaFiles
        else:
            for r in re.finditer("\[\{.*?\}\]", response_data, re.DOTALL):
                entry = r.group()

                for s in re.finditer("\{.*?\}", entry, re.DOTALL):
                    item = s.group()

                    fileID = ""
                    fileName = ""
                    fileType = ""
Esempio n. 11
0
                    #fileName = urllib.unquote(fileName)

                    if fileType == 'video':
                        fileType = self.MEDIA_TYPE_VIDEO
                    elif fileType == 'audio':
                        fileType = self.MEDIA_TYPE_MUSIC
                    elif fileType == 'image':
                        fileType = self.MEDIA_TYPE_PICTURE


                    if contentType == 'dir':
                        mediaFiles.append(package.package(0,folder.folder(folderName+'/'+fileName,fileName)) )
                    else:
                        thumbnail = self.protocol + self.domain +'/index.php/core/preview.png?file='+folderName+ '/'+fileName + '&x=50&y=50'+'|' + self.getHeadersEncoded()

                        mediaFiles.append(package.package(file.file(fileName, fileName, fileName, fileType, '', thumbnail),folder.folder(folderName,folderName)) )

            return mediaFiles
        else:
            for r in re.finditer('\[\{.*?\}\]' ,response_data, re.DOTALL):
                entry = r.group()

                for s in re.finditer('\{.*?\}' ,entry, re.DOTALL):
                    item = s.group()

                    fileID = ''
                    fileName = ''
                    fileType = ''
                    contentType = ''
                    etag = ''
                    thumbnail = ''
Esempio n. 12
0
    def getMediaPackage(self, entry, folderName='',contentType=2):

                resourceID = 0
                resourceType = ''
                title = ''
                fileSize = 0
                url = ''
                for r in re.finditer('\"mimeType\"\:\"([^\"]+)\"' ,
                             entry, re.DOTALL):
                  resourceType = r.group(1)
                  break
                for r in re.finditer('\"name\"\:\"([^\"]+)\"' ,
                             entry, re.DOTALL):
                  title = r.group(1)
                  try:
                            title = title.decode('unicode-escape')
                            title = title.encode('utf-8')
                  except:
                            pass
                  break
                for r in re.finditer('\"size\"\:\s*(\d+)' ,
                             entry, re.DOTALL):
                  fileSize = r.group(1)
                  break
                for r in re.finditer('\"@content.downloadUrl\"\:\"([^\"]+)\"' ,
                             entry, re.DOTALL):
                  url = r.group(1)
                  break
                for r in re.finditer('resid\=([^\"]+)\"' ,
                             entry, re.DOTALL):
                  resourceID = r.group(1)
                  break

                # entry is a video
                if ('video' in resourceType and contentType in (0,1,2,4,7)):
                    thumbnail = 'https://api.onedrive.com/v1.0/drive/items/'+str(resourceID)+'/thumbnails/0/small/content'
#                    thumbnail = self.cache.getThumbnail(self, thumbnail,resourceID)
                    mediaFile = file.file(resourceID, title, title, self.MEDIA_TYPE_VIDEO, '', thumbnail, size=fileSize)

                    media = package.package(mediaFile,folder.folder(folderName,''))
                    media.setMediaURL(mediaurl.mediaurl(url, 'original', 0, 9999))
                    return media

                # entry is a music file
                elif ('audio' in resourceType and contentType in (1,2,3,4,6,7)):
                    thumbnail = 'https://api.onedrive.com/v1.0/drive/items/'+str(resourceID)+'/thumbnails/0/small/content'
#                    thumbnail = self.cache.getThumbnail(self, thumbnail,resourceID)

                    mediaFile = file.file(resourceID, title, title, self.MEDIA_TYPE_MUSIC, '', thumbnail, size=fileSize)
                    media = package.package(mediaFile,folder.folder(folderName,''))
                    media.setMediaURL(mediaurl.mediaurl(url, 'original', 0, 9999))
                    return media

                # entry is a photo
                elif ('image' in resourceType and contentType in (2,4,5,6,7)):
                    thumbnail = 'https://api.onedrive.com/v1.0/drive/items/'+str(resourceID)+'/thumbnails/0/small/content'
#                    thumbnail = self.cache.getThumbnail(self, thumbnail,resourceID)
                    mediaFile = file.file(resourceID, title, title, self.MEDIA_TYPE_PICTURE, '', thumbnail, size=fileSize)

                    media = package.package(mediaFile,folder.folder(folderName,''))
                    media.setMediaURL(mediaurl.mediaurl(url, '','',''))
                    return media

                # entry is unknown
                elif ('application' in resourceType):
                    mediaFile = file.file(resourceID, title, title, self.MEDIA_TYPE_VIDEO, '', '', size=fileSize)

                    media = package.package(mediaFile,folder.folder(folderName,''))
                    media.setMediaURL(mediaurl.mediaurl(url, 'original', 0, 9999))
                    return media

                # all files (for saving to encfs)
                elif (contentType == 8):
                    mediaFile = file.file(resourceID, title, title, self.MEDIA_TYPE_VIDEO, '', '', size=fileSize)

                    media = package.package(mediaFile,folder.folder(folderName,''))
                    media.setMediaURL(mediaurl.mediaurl(url, '','',''))
                    return media
Esempio n. 13
0
                req = urllib2.Request(url, None, self.getHeadersList())
                try:
                  response = urllib2.urlopen(req)
                except urllib2.URLError, e:
                  xbmc.log(self.addon.getAddonInfo('name') + ': ' + str(e), xbmc.LOGERROR)
                  return
                response_data = response.read()

            # video-entry
            for r in re.finditer('"gal_thumb":"([^\"]+)"\,.*?type\=\'video\'.*?"file_filename":"([^\"]+)","al_title":"([^\"]+)".*?alias\=([^\"]+)"' ,response_data, re.DOTALL):
                img,filename,title,fileID = r.groups()
                img = re.sub('\\\\', '', img)
                img = 'http://static.firedrive.com/'+img


                mediaFiles.append(file.file(fileID, title, title, self.VIDEO, '', img))

            for r in re.finditer('"gal_thumb":"([^\"]+)"\,.*?type\=\'audio\'.*?"file_filename":"([^\"]+)","al_title":"([^\"]+)".*?alias\=([^\"]+)"' ,response_data, re.DOTALL):
                img,filename,title,fileID = r.groups()
                img = re.sub('\\\\', '', img)
                img = 'http://static.firedrive.com/'+img

#                videos[title] = {'url': self.PLUGIN_URL+'?mode=playAudio&instance='+self.instanceName+'&filename=' + fileID+'&title=' + title, 'thumbnail' : img}
                mediaFiles.append(file.file(fileID, title, title, self.AUDIO, '', img))

            for r in re.finditer('"gal_thumb":"([^\"]+)"\,.*?type\=\'other\'.*?"file_filename":"([^\"]+)","al_title":"([^\"]+)".*?alias\=([^\"]+)"' ,response_data, re.DOTALL):
                img,filename,title,fileID = r.groups()
                img = re.sub('\\\\', '', img)
                img = 'http://static.firedrive.com/'+img

#                videos[title] = {'url': self.PLUGIN_URL+'?mode=playVideo&instance='+self.instanceName+'&filename=' + fileID+'&title=' + title, 'thumbnail' : img}