Beispiel #1
0
 def __init__(self, xml, path, **kwargs):
     xbmcgui.WindowXML(xml, path)
     self._settings = settings.Settings(_addonid, sys.argv)
     self._initialised = False
     self._home_lat_deg = self._lat_deg = kwargs['lat_deg']
     self._home_lon_deg = self._lon_deg = kwargs['lon_deg']
     self._zoom = kwargs['zoom']
     self._layertype = kwargs['layertype']
     self._centre_tilex, self._centre_tiley, self._home_pixelx, self._home_pixely = self.deg2num(
         self._lat_deg, self._lon_deg, self._zoom)
     self._home_column = self._centre_tilex
     self._home_row = self._centre_tiley
Beispiel #2
0
    def __init__(self):
        print "Initializing Rhapsody for XBMC"
        self.__vars = {}  #dict for app vars
        self.view_keeper = {
            'browseview': 'browse_newreleases',
            'frame': 'Browse',
            'view_id': 3350
        }

        self.__addon_id__ = 'script.audio.rhapsody'
        self.__addon_cfg__ = xbmcaddon.Addon(self.__addon_id__)
        self.__addon_path__ = self.__addon_cfg__.getAddonInfo('path')
        self.__addon_version__ = self.__addon_cfg__.getAddonInfo('version')
        self.__addon_icon__ = self.__addon_cfg__.getAddonInfo('icon')
        self.__addon_data__ = os.path.join(
            xbmc.translatePath('special://userdata/addon_data/'),
            self.__addon_id__)

        self.init_dirs()

        self.newreleases = None
        self.topalbums = None
        self.topartists = None
        self.toptracks = None
        self.lib_albums = None
        self.lib_artists = None
        self.hist_tracks = None
        self.srch_albums = None
        self.srch_artists = None
        self.srch_tracks = None
        self.srch_brdcst = None
        self.windowtracklist = None

        self.player = None
        self.playlist = None

        self.mem = member.Member(self)
        self.api = rhapapi.Api(self)
        self.cache = caching.Cache(self)
        self.img = image.Image(self.__addon_path__, self.__addon_data__, self)
        self.win = view.MainWin("main.xml",
                                self.__addon_path__,
                                'Default',
                                '720p',
                                app=self)
        self.srv = httpd.TinyWebServer(self)

        self.srv.create("localhost", 8090)
        self.srv.start()

        self.wait = False

        self.init_lists()
        self.init_vars()

        self.player = play.Player(xbmc.PLAYER_CORE_AUTO, app=self)
        self.playlist = self.player.playlist
        #self.win.toptracks = self.toptracks
        self.win.player = self.player
        self.win.playlist = self.playlist

        self.loadwin = xbmcgui.WindowXML("loading.xml", self.__addon_path__,
                                         'Default', '720p')
        self.loadwin.show()
Beispiel #3
0
__addon__ = xbmcaddon.Addon(id='plugin.video.megogo')
addon_name = __addon__.getAddonInfo('name')
addon_version = __addon__.getAddonInfo('version')
addon_path = xbmc.translatePath(__addon__.getAddonInfo('path')).decode('utf-8')
language = __addon__.getLocalizedString
source = 'http://raw.github.com/GeekEdem/zip/master/plugin.video.megogo/addon.xml'

sys.path.append(os.path.join(addon_path, 'resources', 'lib'))
from megogo2xbmc import getconfiguration
from sqlite import DataBase
db = DataBase()

xbmc.log('[%s]: Start plugin! Version: %s' % (addon_name, addon_version))

# ##################################	  Start Splash	    ####################################### #
splash = xbmcgui.WindowXML('splash.xml', addon_path)
splash.show()
xbmc.executebuiltin("ActivateWindow(busydialog)")

# ##################################		First run		####################################### #
if __addon__.getSetting('firstrun') == '0' or __addon__.getSetting(
        'firstrun') == '':
    __addon__.openSettings()
    __addon__.setSetting(id='firstrun', value='1')

# ##################################  SET UI LANGUAGE 'RU'	####################################### #
if __addon__.getSetting('language') == '0' or __addon__.getSetting(
        'language') == '':
    __addon__.setSetting(id='language', value='0')

# ##################################   WRITE TO DB ACCOUNT	####################################### #
Beispiel #4
0
GNU General Public License for more details.

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

__addon_id__ = 'script.audio.spotimc'

#Gather addon information
import os.path, xbmcaddon, xbmcgui, gc
addon_cfg = xbmcaddon.Addon(__addon_id__)
__addon_path__ = addon_cfg.getAddonInfo('path')
__addon_version__ = addon_cfg.getAddonInfo('version')

#Open the loading window
loadingwin = xbmcgui.WindowXML("loading-window.xml", __addon_path__,
                               "DefaultSkin")
loadingwin.show()

#Add the dll search path
import envutils
dll_dir = os.path.join(__addon_path__, "resources/dlls")
envutils.set_library_path(dll_dir)

#Add the libraries
libs_dir = os.path.join(__addon_path__, "resources/libs")
sys.path.insert(0, libs_dir)

#Add the skinutils module
sys.path.insert(0, os.path.join(libs_dir, "XbmcSkinUtils.egg"))

#Load font & include stuff
Beispiel #5
0
 def start_script(self, library_view="oldway", original_autorefresh=0):
     messy_exit = False
     utils.log("Library_view: %s" % library_view, xbmc.LOGNOTICE)
     early_exit = False
     movie_next = False
     prev_trigger = None
     self.video_window = xbmcgui.WindowXML("script_CExperience-video.xml",
                                           __addon__.getAddonInfo('path'),
                                           "Default", "720p")
     self.video_window.show()
     autorefresh_movie = False
     self.autorefresh = original_autorefresh
     self.original_autorefresh = original_autorefresh
     if library_view != "oldway":
         xbmc.executebuiltin("ActivateWindow(videolibrary,%s,return)" %
                             library_view)
         # wait until Video Library shows
         while not xbmc.getCondVisibility("Container.Content(movies)"):
             pass
         if extra_settings["enable_notification"]:
             xbmc.executebuiltin(
                 "Notification( %s, %s, %d, %s)" %
                 (header, __language__(32546), 300000, image))
         # wait until playlist is full to the required number of features
         utils.log(
             "Waiting for queue to be filled with %s Feature films" %
             number_of_features, xbmc.LOGNOTICE)
         count = 0
         while playlist.size() < number_of_features:
             if playlist.size() > count:
                 utils.log(
                     "User queued %s of %s Feature films" %
                     (playlist.size(), number_of_features), xbmc.LOGNOTICE)
                 header1 = header + " - Feature " + "%d" % playlist.size()
                 message = __language__(32543) + playlist[
                     playlist.size() - 1].getdescription()
                 if extra_settings["enable_notification"]:
                     xbmc.executebuiltin(
                         "Notification( %s, %s, %d, %s)" %
                         (header1, message, time_delay, image))
                 count = playlist.size()
                 xbmc.sleep(time_delay * 2)
             if not xbmc.getCondVisibility("Container.Content(movies)"):
                 early_exit = True
                 break
         utils.log("User queued %s Feature films" % playlist.size(),
                   xbmc.LOGNOTICE)
         if not early_exit:
             header1 = header + " - Feature " + "%d" % playlist.size()
             message = __language__(32543) + playlist[playlist.size() -
                                                      1].getdescription()
             if extra_settings["enable_notification"]:
                 xbmc.executebuiltin("Notification( %s, %s, %d, %s)" %
                                     (header1, message, time_delay, image))
             early_exit = False
     # If for some reason the limit does not get reached and the window changed, cancel script
     if playlist.size() < number_of_features and library_view != "oldway":
         if extra_settings["enable_notification"]:
             xbmc.executebuiltin(
                 "Notification( %s, %s, %d, %s)" %
                 (header, __language__(32544), time_delay, image))
         _clear_playlists()
     else:
         mpaa, audio, genre, movie, equivalent_mpaa, is_3d_movie = _get_queued_video_info(
             feature=0)
         plist = _store_playlist()  # need to store movie playlist
         self._play_trivia(mpaa, genre, plist, equivalent_mpaa)
         mplaylist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
         mplaylist.clear()
         jsonquery = '''{"jsonrpc": "2.0", "method": "Settings.SetSettingValue",  "params": { "setting": "screensaver.mode", "value": "None" }, "id": 1}'''
         jsonresponse = xbmc.executeJSONRPC(jsonquery)
         trigger_list = self.load_trigger_list()
         self.player.play(playlist)
         count = -1
         stop_check = 0
         paused = False
         # wait until fullscreen video is shown
         while not xbmc.getCondVisibility(
                 "Window.IsActive(fullscreenvideo)"):
             pass
         while (not playlist.getposition() == (playlist.size() - 1) or
                xbmcgui.Window(10025).getProperty("CinemaExperienceRunning")
                == "True"):
             if playlist.getposition() > count:
                 try:
                     utils.log(
                         "Item From Trigger List: %s" %
                         trigger_list[playlist.getposition()],
                         xbmc.LOGNOTICE)
                 except:
                     utils.log("Problem With Trigger List", xbmc.LOGNOTICE)
                 utils.log(
                     "Playlist Position: %s  Playlist Size: %s " %
                     ((playlist.getposition() + 1), (playlist.size())),
                     xbmc.LOGNOTICE)
                 if not playlist.getposition() == (playlist.size() - 1):
                     prev_trigger = Launch_automation().launch_automation(
                         trigger_list[playlist.getposition()], prev_trigger)
                     if trigger_list[playlist.getposition()] == "Movie":
                         if extra_settings["autorefresh"] and extra_settings[
                                 "autorefresh_movie"]:
                             self.auto_refresh("enable")
                             autorefresh_movie = True
                     else:
                         if extra_settings["autorefresh"]:
                             self.auto_refresh("disable")
                             autorefresh_movie = False
                     utils.log(
                         "[ script.cinema.experience ] - autorefresh_movie: %s"
                         % autorefresh_movie)
                     count = playlist.getposition()
                 else:
                     break  # Reached the last item in the playlist
             try:
                 #if not self.player.isPlayingVideo() and not is_paused:
                 if not xbmc.getCondVisibility(
                         "Window.IsActive(fullscreenvideo)"):
                     utils.log("Video may have stopped", xbmc.LOGNOTICE)
                     xbmc.sleep(
                         5000
                     )  # wait 5 seconds for fullscreen video to show up(during playback)
                     if not xbmc.getCondVisibility(
                             "Window.IsActive(fullscreenvideo)"
                     ):  # if fullscreen video does not show up, break and exit script
                         messy_exit = True
                         break
             except:
                 if xbmc.getCondVisibility("Container.Content(movies)"):
                     utils.log("Video Definitely Stopped", xbmc.LOGNOTICE)
                     messy_exit = True
                     break
         if not playlist.size(
         ) < 1 and not messy_exit:  # To catch an already running script when a new instance started
             utils.log(
                 "Playlist Position: %s  Playlist Size: %s " %
                 (playlist.getposition() + 1, (playlist.size())),
                 xbmc.LOGNOTICE)
             prev_trigger = Launch_automation().launch_automation(
                 trigger_list[playlist.getposition()], prev_trigger)
             if trigger_list[playlist.getposition()] == "Movie":
                 utils.log(
                     "Item From Trigger List: %s" %
                     trigger_list[playlist.getposition()], xbmc.LOGNOTICE)
                 if extra_settings["autorefresh"] and extra_setting[
                         "autorefresh_movie"]:
                     self.auto_refresh("enable")
                     autorefresh_movie = True
             else:
                 utils.log(
                     "Item From Trigger List: %s" %
                     trigger_list[playlist.getposition()], xbmc.LOGNOTICE)
                 if extra_settings["autorefresh"]:
                     self.auto_refresh("disable")
                     autorefresh_movie = False
             messy_exit = False
             xbmc.sleep(1000)
             self._wait_until_end()
             if extra_settings[
                     "autorefresh"] and self.original_autorefresh > 0:
                 self.auto_refresh("enable")
         else:
             if extra_settings[
                     "autorefresh"] and self.original_autorefresh > 0:
                 self.auto_refresh("enable")
             utils.log("User might have pressed stop", xbmc.LOGNOTICE)
             utils.log("Stopping Script", xbmc.LOGNOTICE)
             messy_exit = False
     return messy_exit
Beispiel #6
0
#  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, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#

__scriptname__ = "MythBox for XBMC"
__author__ = "*****@*****.**"
__url__ = "http://mythbox.googlecode.com"
__hg_url__ = "https://mythbox.googlecode.com/hg/"
__credits__ = "bunch of ppl"

if __name__ == '__main__':
    print __scriptname__

    # WinPDB debugger
    #import rpdb2
    #rpdb2.start_embedded_debugger('xxx')

    import os, sys, xbmcaddon
    scriptDir = xbmcaddon.Addon('script.mythbox').getAddonInfo('path')
    sys.path.append(os.path.join(scriptDir, 'resources', 'src'))

    import xbmcgui
    import xbmc
    splash = xbmcgui.WindowXML('mythbox_splash.xml', scriptDir)
    splash.show()

    from mythbox.bootstrapper import BootStrapper
    BootStrapper(splash).run()
Beispiel #7
0
import sys
import xbmcaddon
import xbmcgui
import xbmc

__addon__ = xbmcaddon.Addon()
__addonname__ = __addon__.getAddonInfo('name')
__icon__ = __addon__.getAddonInfo('icon')
__path__ = __addon__.getAddonInfo('path')

mygui = xbmcgui.WindowXML('script-%s-main.xml' % __addonname__, __path__)
mygui.doModal()
del mygui