Esempio n. 1
0
 def questions(self, id):
     interface.Loader.show()
     try:
         questions = api.Api.supportList(id)
         directory = interface.Directory()
         for question in questions:
             directory.add(label=question['title'],
                           action='supportQuestion',
                           parameters={'id': question['id']},
                           folder=False,
                           icon='help')
         directory.finish()
     except:
         self._error()
     interface.Loader.hide()
Esempio n. 2
0
 def categories(self):
     interface.Loader.show()
     try:
         categories = api.Api.supportCategories()
         directory = interface.Directory()
         for category in categories:
             label = interface.Format.bold(
                 category['name'] + ': ') + category['description'].replace(
                     '.', '')
             directory.add(label=label,
                           action='supportQuestions',
                           parameters={'id': category['id']},
                           folder=True,
                           icon='help')
         directory.finish()
     except:
         self._error()
     interface.Loader.hide()
Esempio n. 3
0
 def navigator(self):
     directory = interface.Directory()
     directory.add(label=35314,
                   action='supportCategories',
                   folder=True,
                   icon='help')
     directory.add(label=35313,
                   action='supportBugs',
                   folder=False,
                   icon='bug')
     directory.add(label=35315,
                   action='supportGuide',
                   folder=False,
                   icon='bulb')
     directory.add(label=35321,
                   action='backupReaper',
                   folder=True,
                   icon='settings')
     directory.finish()
Esempio n. 4
0
	def directoryList(self):
		directory = interface.Directory(content = interface.Directory.ContentAddons)
		items = self.mDebrid.items()
		itemsNew = [[], [], [], [], []]

		for item in items:
			info = []
			icon = None
			index = 0

			try: status = item['status']
			except: status = None

			if not status == None and not status == core.Core.StatusUnknown:
				color = None
				if status == core.Core.StatusError:
					color = interface.Format.colorBad()
					icon = 'downloadsfailed.png'
					statusLabel = 'Failure'
					index = 0
				elif status == core.Core.StatusMagnetError:
					color = interface.Format.colorBad()
					icon = 'downloadsfailed.png'
					statusLabel = 'Magnet'
					index = 0
				elif status == core.Core.StatusMagnetConversion:
					color = interface.Format.colorMedium()
					icon = 'downloadsbusy.png'
					statusLabel = 'Conversion'
					index = 1
				elif status == core.Core.StatusFileSelection:
					color = interface.Format.colorMedium()
					icon = 'downloadsbusy.png'
					statusLabel = 'Selection'
					index = 1
				elif status == core.Core.StatusQueued:
					color = interface.Format.colorMedium()
					icon = 'downloadsbusy.png'
					statusLabel = 'Queued'
					index = 1
				elif status == core.Core.StatusBusy:
					color = interface.Format.colorExcellent()
					icon = 'downloadsbusy.png'
					statusLabel = 'Busy'
					index = 2
				elif status == core.Core.StatusFinished:
					color = interface.Format.colorSpecial()
					icon = 'downloadscompleted.png'
					statusLabel = 'Finished'
					index = 3
				elif status == core.Core.StatusVirus:
					color = interface.Format.colorBad()
					icon = 'downloadsfailed.png'
					statusLabel = 'Virus'
					index = 0
				elif status == core.Core.StatusCompressing:
					color = interface.Format.colorMain()
					icon = 'downloadsbusy.png'
					statusLabel = 'Compressing'
					index = 4
				elif status == core.Core.StatusUploading:
					color = interface.Format.colorMain()
					icon = 'downloadsbusy.png'
					statusLabel = 'Uploading'
					index = 4
				elif status == core.Core.StatusDead:
					color = interface.Format.colorBad()
					icon = 'downloadsfailed.png'
					statusLabel = 'Dead'
					index = 0
				info.append(interface.Format.fontColor(statusLabel, color))

			if status == core.Core.StatusBusy:
				try:
					colors = interface.Format.colorGradient(interface.Format.colorMedium(), interface.Format.colorExcellent(), 101) # One more, since it goes from 0 - 100
					percentage = int(item['transfer']['progress']['completed']['percentage'])
					info.append(interface.Format.fontColor('%d%%' % percentage, colors[percentage]))
				except:
					tools.Logger.error()
					pass

				try:
					if item['transfer']['speed']['bits'] > 0:
						info.append(item['transfer']['speed']['description'])
				except: pass
				try:
					if item['transfer']['progress']['remaining']['time']['seconds'] > 0:
						info.append(item['transfer']['progress']['remaining']['time']['description'])
				except: pass

			try:
				if item['size']['bytes'] > 0:
					info.append(item['size']['description'])
			except: pass

			label = interface.Format.bold(item['name'])
			label += interface.Format.newline()
			label += ' | '.join(info)

			itemJson = tools.Converter.jsonTo(item)

			context = []
			context.append({'label' : 32072, 'command' : 'Container.Refresh'})
			context.append({'label' : 33371, 'command' : tools.System.commandPlugin(action = 'realdebridListAction', parameters = {'item' : itemJson})})

			itemsNew[index].append({'item' : itemJson, 'label' : label, 'context' : context, 'icon' : icon})

		for item in itemsNew:
			for i in item:
				directory.add(label = i['label'], action = 'realdebridListAction', parameters = {'item' : i['item']}, context = i['context'], folder = True, icon = i['icon'], iconDefault = 'DefaultAddonProgram.png')

		directory.finish()