Jump to content
DFofanov

Зачитать все данные фильма в Emby, через API

Recommended Posts

DFofanov

Доброго времени суток знатоки!

Подскажите пожалуйста, через какую команду (набор команд) API можно закачать в Emby Server данные о видео (Размер, длительность, качество и т.д.)?
При первом запуске фильма Emby получает данные от файла и хранит их в блоке INFO, можно ли закачать эти данные один раз но для всех фильмов сразу?

 

Спасибо за помощь!

@@chef

Share this post


Link to post
Share on other sites
chef

Hi there.

I believe you are asking the best way to gather movie information from the API (all at once), is this correct?

You'll want to create an ItemQuery
with a 'Type' of 'Movie', and give that query to an ApiClient object.

This will return all movie items in list as a result.

Please let me know if I have misinterpreted your question, and I'll gladly try again to answer it properly.

@@rechigo

@@chef

Share this post


Link to post
Share on other sites
DFofanov

@@rechigo

@@chef

Разобрался в данном вопросе, вот накидал небольшой код на python-e

 Задача: Загрузить данные о медиафайле.

5e67ddd71f9e6_20200310213404.png

import requests
import logging
import json
import os

def get_request_emby(url):
    try:
        try:
            r = requests.get(url, headers=headers, timeout=60, stream=True)
            if r.ok:
                json_result = r.json()
        finally:
            r.connection.close()
            r.close()
    except:
        pass
    return json_result

def get_emby_video_info(ip, apy_key):   
    url = "http://" + ip + ":8096/emby/Items?api_key=" + apy_key + "&SortBy=PremiereDate%2CProductionYear%2CSortName&SortOrder=Descending&IncludeItemTypes=Movie&Recursive=true&Fields=BasicSyncInfo%2CMediaSourceCount%2CSortName%2CPrimaryImageAspectRatio%2CProductionYear&ImageTypeLimit=1&EnableImageTypes=Primary%2CBackdrop%2CThumb&StartIndex=0&Limit=1000&ParentId=1d342f3d0fe54cbeb251f22db1a62a35&GroupItemsIntoCollections=true"
    items = get_request_emby(url)
    for item in items['Items']:
        if item != None:
            url = "http://" + ip + ":8096/emby/Items/" + item['Id'] + "/PlaybackInfo?api_key=" + apy_key + "&StartTimeTicks=0&IsPlayback=false&AutoOpenLiveStream=false"
            mediaSources = get_request_emby(url)
            log.info("ID: " + item['Id'] + ", NAME: " + item['Name'] + ", PlaySessionId: " + mediaSources['PlaySessionId'])

def main():
    get_emby_video_info('emby ip','apy_key')

if __name__ == '__main__':
    main()

Share this post


Link to post
Share on other sites
rechigo
Posted (edited)

I manually sent the requests to the endpoints via an http client and I get back media info just fine, so this must be something with your python code (code throws errors when running)

 

I don't know much about python and I don't believe chef does either

 

@@TeamB might have some tips for you

Edited by rechigo

Share this post


Link to post
Share on other sites
TeamB

Fields=MediaStreams

Share this post


Link to post
Share on other sites
Luke

Please let us know if this helps. Thanks !

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...