kaltura / KalturaGeneratedAPIClientsPython

Python auto generated clients libs which will then be built and test by Travis CI
GNU Affero General Public License v3.0
6 stars 15 forks source link

ParentEntryId Not Populated by Media->List #9

Open uvotguy opened 3 years ago

uvotguy commented 3 years ago

Running this on a Mac (Big Sur 11.5.1). Python version 3.8.3 x64 KalturaClient 17.5.0

The first entry in our catalog is dated 2018-01-05. Change the timestamp to start at whatever date you like and loop over all entries after said date. Our catalog has 1.6M entries with many many child (multi-source) videos. The following code finds nothing.

Please fix this.

=========================================================

from datetime import datetime from KalturaClient import from KalturaClient.Plugins.Core import from KalturaClient.Plugins.Quiz import * from KalturaClient.exceptions import KalturaException import globals

config = KalturaConfiguration(globals.kalturaPid) config.serviceUrl = "https://www.kaltura.com/" kalClient = KalturaClient(config) ks = kalClient.session.start( globals.kalturaSecret, globals.kalturaUser, KalturaSessionType.ADMIN, globals.kalturaPid, 86400, "disableentitlements") kalClient.setKs(ks)

timestamp = 1515128400; # 2018-01-05

entryFilter = KalturaMediaEntryFilter(); entryFilter.createdAtGreaterThanOrEqual = timestamp; entryFilter.orderBy = KalturaMediaEntryOrderBy.CREATED_AT_ASC;

pager = KalturaFilterPager(); pager.pageIndex = 1; pager.pageSize = 500;

done = False; ii = 0; while done == False:

entries = kalClient.media.list(entryFilter, pager);

try:
    entries = kalClient.media.list(entryFilter, pager);
except KalturaException as ex:
    if ex.args[1] == 'QUERY_EXCEEDED_MAX_MATCHES_ALLOWED':
        # Only 10,000 results allowed for each query (filter).
        # When exceeded, reset the timestamp and the pager
        # index.  Ugh!
        entryFilter.createdAtGreaterThanOrEqual = timestamp;
        pager.pageIndex = 1;
        continue;
except:
    print('Uh oh!');

if len(entries.objects) == 0:
    done = True;
    continue;

if ((ii % 10000) == 0):
    msg = '{0}'.format(ii);
    print(msg);

for entr in entries.objects:
    timestamp = entr.createdAt;
    if entr.parentEntryId != '':
        print('{0} : {1} : {2}'.format(entr.id, entr.parentEntryId, entr.name));

    ii += 1;
pager.pageIndex += 1;
kaltura-hooks commented 3 years ago

Hi @uvotguy,

Thank for you reporting an issue and helping improve Kaltura!

To get the fastest response time, and help the maintainers review and test your reported issues or suggestions, please ensure that your issue includes the following (please comment with more info if you have not included all this info in your original issue):

For general troubleshooting see: https://github.com/kaltura/platform-install-packages/blob/Jupiter-10.13.0/doc/kaltura-packages-faq.md#troubleshooting-help

If you only have a general question rather than a bug report, please close this issue and post at: http://forum.kaltura.org

Thank you in advance,