How to use item_link method in autotest

Best Python code snippet using autotest_python

get_meta.py

Source:get_meta.py Github

copy

Full Screen

1import xbmc2import xbmcaddon3import xbmcgui4import json5from ..plugin import Plugin6from .tmdb_plugin import tmdb_api, TMDB7from ..DI import DI8class Meta(Plugin):9 name = "meta"10 description = "Process Item Metadata"11 priority = 20112 def get_metadata(self, item):13 liz = item.get("list_item")14 if liz is None:15 liz = xbmcgui.ListItem(item.get("title", "Unknown Title"))16 if xbmcaddon.Addon().getSettingBool("full_meta"):17 if "infolabels" in item:18 liz.setInfo("video", infoLabels=item["infolabels"])19 liz.setCast(item.get("cast", ""))20 else:21 xbmcaddon.Addon().setSetting("item_meta", "false")22 if not xbmcaddon.Addon().getSettingBool("item_meta"):23 return item24 content = item.get("content")25 if content is None:26 return item27 if content == "tvshow":28 content = "tv"29 if "tmdb_id" in item:30 _id = item["tmdb_id"]31 elif "tmdb" in item:32 _id = item["tmdb"]33 elif "imdb" in item:34 _id = tmdb_api.tmdb_from_imdb(item["imdb"])35 elif "imdb_id" in item:36 _id = tmdb_api.tmdb_from_imdb(item["imdb_id"])37 if _id is None:38 return item39 40 try:41 from_cache = False42 new_item = None43 tmdb = TMDB()44 url = f"tmdb/{content}/{_id}"45 if xbmcaddon.Addon().getSettingBool("use_cache") and not "tmdb/search" in url:46 new_item = DI.db.get(url)47 if new_item:48 new_item = json.loads(new_item[0])49 from_cache = True50 if from_cache is False:51 new_item = json.loads(tmdb.get_list(url))52 if new_item is None:53 return item54 link = item.get("link")55 if link and from_cache is False:56 link = self.process_links(link.replace("play_video/", ""))57 thumbnail = new_item.get("thumbnail")58 liz.setArt({"icon": thumbnail, "thumb": thumbnail, "poster": thumbnail, "fanart": new_item.get("fanart")})59 liz.setInfo("video", infoLabels=new_item["infolabels"])60 liz.setCast(new_item.get("cast", ""))61 new_item["link"] = f"play_video/{link}"62 new_item["is_dir"] = item["is_dir"]63 if xbmcaddon.Addon().getSettingBool("use_cache") and not "tmdb/search" in url:64 DI.db.set(url, json.dumps(new_item))65 new_item["list_item"] = liz66 return new_item67 68 except Exception as e:69 xbmc.log(f"Error Processing Meta: {e}", xbmc.LOGINFO)70 return item71 72 def process_links(self, link):73 import base6474 link_decoded = json.loads(base64.urlsafe_b64decode(link))75 item_link = link_decoded.get("link")76 if type(item_link) == list:77 if "search" not in item_link:78 item_link.append("search(Search Using Microjen Scrapers)")79 elif item_link and item_link != "search":80 item_link = [item_link, "search(Search Using Microjen Scrapers)"]81 elif item_link is None:82 item_link = "search"83 link_decoded["link"] = item_link84 return base64.urlsafe_b64encode(bytes(json.dumps(link_decoded), "utf-8")).decode("utf-8")...

Full Screen

Full Screen

items_for_test.py

Source:items_for_test.py Github

copy

Full Screen

1SITE_ID = "tester"2items = {3 "1": {"site_id": SITE_ID, "item_id": "1",4 "item_link": "http://example.com/item?id=1",5 "item_name": "Turk"},6 "3": {"site_id": SITE_ID, "item_id": "3",7 "item_link": "http://example.com/item?id=3",8 "item_name": "Harry Potter I"},9 "2": {"site_id": SITE_ID, "item_id": "2",10 "item_link": "http://example.com/item?id=2",11 "item_name": "Lord of Ring I"},12 "8": {"site_id": SITE_ID, "item_id": "8",13 "item_link": "http://example.com/item?id=8",14 "item_name": "Best Books"},15 "11": {"site_id": SITE_ID, "item_id": "11",16 "item_link": "http://example.com/item?id=11",17 "item_name": "Meditation"},18 "15": {"site_id": SITE_ID, "item_id": "15",19 "item_link": "http://example.com/item?id=15",20 "item_name": "SaaS Book"},21 "17": {"site_id": SITE_ID, "item_id": "17",22 "item_link": "http://example.com/item?id=17",23 "item_name": "Who am I"},24 "21": {"site_id": SITE_ID, "item_id": "21",25 "item_link": "http://example.com/item?id=21",26 "item_name": "Kill A Bird"},27 "22": {"site_id": SITE_ID, "item_id": "22",28 "item_link": "http://example.com/item?id=22",29 "item_name": "The Rule of 22s"},30 "23": {"site_id": SITE_ID, "item_id": "23",31 "item_link": "http://example.com/item?id=23",32 "item_name": "The Rule of 22s"}, # This item name is intended to be the same as item 2233 "24": {"site_id": SITE_ID, "item_id": "24",34 "item_link": "http://example.com/item?id=24",35 "item_name": "The Rule of 22s"}, # This item name is intended to be the same as item 2236 "29": {"site_id": SITE_ID, "item_id": "29",37 "item_link": "http://example.com/item?id=29",38 "item_name": "Soo..."},39 "30": {"site_id": SITE_ID, "item_id": "30",40 "item_link": "http://example.com/item?id=30",41 "item_name": "Not Recommended by Item 1"} # please DO NOT let item 1 recommend this one42 }43import pymongo44import settings45def getApiKey(site_id):46 connection = pymongo.Connection(settings.mongodb_host)47 return connection["tjb-db"]["sites"].find_one({"site_id": site_id})["api_key"]48for item in items.values():49 item["api_key"] = getApiKey(item["site_id"])...

Full Screen

Full Screen

item_links.py

Source:item_links.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2"""3 awsecommerceservice4 This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).5"""6import awsecommerceservice.models.item_link7class ItemLinks(object):8 """Implementation of the 'ItemLinks' model.9 TODO: type model description here.10 Attributes:11 item_link (list of ItemLink): TODO: type description here.12 """13 # Create a mapping from Model property names to API property names14 _names = {15 "item_link":'ItemLink'16 }17 def __init__(self,18 item_link=None):19 """Constructor for the ItemLinks class"""20 # Initialize members of the class21 self.item_link = item_link22 @classmethod23 def from_dictionary(cls,24 dictionary):25 """Creates an instance of this model from a dictionary26 Args:27 dictionary (dictionary): A dictionary representation of the object as28 obtained from the deserialization of the server's response. The keys29 MUST match property names in the API description.30 Returns:31 object: An instance of this structure class.32 """33 if dictionary is None:34 return None35 # Extract variables from the dictionary36 item_link = None37 if dictionary.get('ItemLink') != None:38 item_link = list()39 for structure in dictionary.get('ItemLink'):40 item_link.append(awsecommerceservice.models.item_link.ItemLink.from_dictionary(structure))41 # Return an object of this model...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful