Пример #1
0
    def _create_mux_client(self):
        configuration = mux_python.Configuration()
        configuration.username = '******'  # settings.MUX_TOKEN_ID
        # settings.MUX_TOKEN_SECRET
        configuration.password = '******'

        assets_api = mux_python.AssetsApi(mux_python.ApiClient(configuration))
        return assets_api
Пример #2
0
    def setup(self):
        # Authentication Setup
        os.environ['MUX_TOKEN_ID'] = self.token_id
        os.environ['MUX_TOKEN_SECRET'] = self.token_secret

        self.configuration = mux_python.Configuration()
        self.configuration.username = os.environ['MUX_TOKEN_ID']
        self.configuration.password = os.environ['MUX_TOKEN_SECRET']

        # API Client Initialization
        self.assets_api = mux_python.AssetsApi(mux_python.ApiClient(self.configuration))
Пример #3
0
def index(request):
    if request.user.is_authenticated and not UserModel.objects.filter(userName=request.user.username).exists():
        UserModel.objects.create(highScore=0, userName=request.user.username)
    # if not (UserModel.objects.filter(userName="******").exists()):
    #    UserModel.objects.create(highScore=0, userName="******")

    configuration = mux_python.Configuration()

    configuration.username = "******"
    configuration.password = "******"
    assets_api = mux_python.AssetsApi(mux_python.ApiClient(configuration))


    '''print("Listing Assets: \n")
    try:
        list_assets_response = assets_api.list_assets()
        for asset in list_assets_response.data:
            print('Asset ID: ' + asset.id)
            print('Status: ' + asset.status)
            print('Duration: ' + str(asset.duration) + "\n")
    except ApiException as e:
        print("Exception when calling AssetsApi->list_assets: %s\n" % e)'''
    return render(request, 'index.html')
Пример #4
0
import os
import sys
import time
import mux_python
from mux_python.rest import NotFoundException

# Authentication Setup
configuration = mux_python.Configuration()
configuration.username = os.environ['MUX_TOKEN_ID']
configuration.password = os.environ['MUX_TOKEN_SECRET']

# API Client Initialization
assets_api = mux_python.AssetsApi(mux_python.ApiClient(configuration))

try:
    assets_api.get_asset("HELLO")
except NotFoundException as e:
    print("Cound not find asset!")
    print("Error Type: " + e.error_type)
    print("Error Messages: " + ", ".join(e.error_messages))
Пример #5
0
import os
import mux_python
from mux_python.rest import ApiException
# import videosinfo
import pickle
import json

configuration = mux_python.Configuration()

#Configure HTTP basic authorization: accessToken
configuration.username = os.environ.get('MUX_TOKEN_ID')
configuration.password = os.environ.get('MUX_TOKEN_SECRET')

#create an instance of the API class
api_instance = mux_python.AssetsApi(mux_python.ApiClient(configuration))

with open('videosinfo.py', 'rb') as file:
    videos = pickle.loads(file.read())

print(videos)
playback_ids = {}
for name, url in videos.items():
    temp_id = name
    start = temp_id.find('_') + 1
    end = temp_id.find('.mp4', start)
    video_id = temp_id[start:end]
    print(video_id)
    create_asset_request = mux_python.CreateAssetRequest(
        input=url,
        playback_policy=["signed"],
        passthrough="yt_video_id:" + video_id)