MCPcopy
hub / github.com/blacktwin/JBOPS / transcode_work

Function transcode_work

utility/media_manager.py:526–572  ·  view source on GitHub ↗

Parameters ---------- user (object): User object holding user stats sectionID {int): Library key ratingKey (int): Item rating key -------

(sectionID, operator, value)

Source from the content-addressed store, hash-verified

524 return rating_lst
525
526def transcode_work(sectionID, operator, value):
527 """
528 Parameters
529 ----------
530 user (object): User object holding user stats
531 sectionID {int): Library key
532 ratingKey (int): Item rating key
533
534 -------
535 """
536 count = 25
537 start = 0
538 transcoding_lst = []
539 transcoding_count = {}
540
541 while True:
542
543 # Getting all watched history for userFrom
544 tt_history = tautulli_server.get_history(section_id=sectionID, start=start, length=count,
545 transcode_decision="transcode")
546
547 if all([tt_history]):
548 start += count
549 for item in tt_history:
550 if transcoding_count.get(item['rating_key']):
551 transcoding_count[item['rating_key']] += 1
552 else:
553 transcoding_count[item['rating_key']] = 1
554
555 continue
556 elif not all([tt_history]):
557 break
558 start += count
559
560 sorted_transcoding = sorted(transcoding_count.items(), key=lambda x: x[1], reverse=True)
561 for rating_key, transcode_count in sorted_transcoding:
562 if operator(transcode_count, int(value)):
563 _meta = tautulli_server.get_metadata(rating_key)
564 if _meta:
565 metadata = Metadata(_meta)
566 metadata.transcode_count = transcode_count
567 transcoding_lst.append(metadata)
568 else:
569 print("Metadata error found with rating_key: ({})".format(rating_key))
570
571
572 return transcoding_lst
573
574
575def action_show(items, selector, date, users=None):

Callers 1

media_manager.pyFile · 0.85

Calls 3

MetadataClass · 0.70
get_historyMethod · 0.45
get_metadataMethod · 0.45

Tested by

no test coverage detected