Beispiel #1
0
def master_control():
    options = [
        "Send to Master Control", "Stream with Master Control",
        "Master Control Queue"
    ]
    c = kodi.dialog_select("Master Control Menu", options)
    if c is False: return
    if c == 2:
        kodi.execute_url("plugin://master.control?mode=queue")
    elif c == 1:
        from scrapecore import scrapers
        resolved_url = scrapers.get_scraper_by_name(
            kodi.args['service']).resolve_url(kodi.args['raw_url'])
        if not resolved_url: return
        from mastercontrol import api as master_control
        stream_url = master_control.get_streaming_url(resolved_url)
        kodi.play_url(stream_url)
    elif c == 0:
        ids = kodi.arg('ids', decode='json')
        from commoncore import trakt
        from mastercontrol import api as master_control
        if kodi.args['media'] == 'movie':
            media = 'movie'
            title = "%s (%s)" % (kodi.args['title'], kodi.args['year'])
            filename = kodi.vfs.clean_file_name(title)
            destination = ''
        else:
            media = 'tvshow'
            destination = kodi.vfs.join(kodi.args['title'],
                                        "Season %s" % kodi.args['season'])
            title = "%s - S%02dE%02d" % (kodi.args['title'],
                                         int(kodi.args['season']),
                                         int(kodi.args['episode']))
            filename = kodi.vfs.clean_file_name(title)

        from scrapecore import scrapers
        resolved_url = scrapers.get_scraper_by_name(
            kodi.args['service']).resolve_url(kodi.args['raw_url'])
        if not resolved_url: return
        video = {
            "type": media,
            "filename": filename,
            "url": resolved_url,
            "title": title,
            "addon": kodi.get_id(),
            "destination": destination,
            "trakt_id": kodi.args['trakt_id']
        }
        response = master_control.enqueue(video)
        kodi.log(response)
        message = 'Failed Adding to Queue %s.' % (title)
        try:
            if response['status'] == 200:
                message = 'Added to Queue %s.' % (title)
        except:
            pass
        kodi.notify(kodi.get_name(), message)
 def update(self):
     if enable_updates:
         if not self.last_run or time.time(
         ) - self.last_run > self.update_interval:
             self.last_run = time.time()
             plugin_url = kodi.build_plugin_url(
                 {
                     "mode": "update_addons",
                     "quiet": "quiet"
                 }, kodi.get_id())
             kodi.execute_url(plugin_url)
Beispiel #3
0
# -*- coding: utf-8 -*-
'''*
	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
*'''

if __name__ == '__main__':
    from commoncore import kodi
    kodi.execute_url("plugin://plugin.video.tva.neo/?mode=auth_realdebrid")