def __init__(self, exts, hard_order=False):
        self.exts = {}
        self.hard_order = hard_order
        order = 0

        for ext in exts:
            name = ext
            
            if hard_order:
                name = str(order) + name
                order = order + 1
                
            try:
                self.exts[name] = get_extension(ext)
            except ExtensionUnknownError,e:
                printerr("Error importing extenstion %s: %s", (name, str(e)))                
                raise InvalidExtension(ext)

            # Add dependencies
            if not hard_order:
                for dep in self.exts[ext].deps:
                    if dep not in self.exts.keys():
                        try:
                            self.exts[dep] = get_extension(dep)
                        except:
                            raise InvalidDependency(ext, dep)
Beispiel #2
0
    def __init__(self, exts, hard_order=False):
        self.exts = {}
        self.hard_order = hard_order
        order = 0

        for ext in exts:
            name = ext

            if hard_order:
                name = str(order) + name
                order = order + 1

            try:
                self.exts[name] = get_extension(ext)
            except ExtensionUnknownError, e:
                printerr("Error importing extenstion %s: %s", (name, str(e)))
                raise InvalidExtension(ext)

            # Add dependencies
            if not hard_order:
                for dep in self.exts[ext].deps:
                    if dep not in self.exts.keys():
                        try:
                            self.exts[dep] = get_extension(dep)
                        except:
                            raise InvalidDependency(ext, dep)
    def __init__ (self, exts):
        self.exts = {}
        for ext in exts:
            try:
                self.exts[ext] = get_extension (ext)
            except ExtensionUnknownError:
                raise InvalidExtension (ext)

            # Add dependencies
            for dep in self.exts[ext].deps:
                if dep not in self.exts.keys ():
                    try:
                        self.exts[dep] = get_extension (dep)
                    except:
                        raise InvalidDependency (ext, dep)
    def start_vlc_v2(self):
        import sys, os
        sys.path.insert(0, os.path.join("..","..",".."))

        import extensions
        extensions.load_extension("vlc")
        
        global instance
        instance=extensions.get_extension("vlc").get_default_instance()

        os.mkfifo("temp")

        m=instance.media_new("temp")
        p=instance.media_player_new()
        p.set_media(m)
        p.play()

        
        fifo=open("temp",'wb',0)
        def proc_shell():
            pass
        proc_shell.stdin=fifo
        proc=proc_shell

        
        return proc
    def start_vlc_imem(self):
        import sys, os
        sys.path.insert(0, os.path.join("..","..",".."))

        import extensions
        extensions.load_extension("vlc")
        
        global instance
        instance=extensions.get_extension("vlc").Instance('-vvv')

        import imem

        global q
        q=Queue.Queue()

        mm=imem.Media_Cast(instance, create_request())
        p=instance.media_player_new()

        p.set_media(mm.get_media())

        def play():
            p.play()
        
        import threading
        threading.Timer(5, p.play, ()).start()
            


        return q
    def __init__(self, exts):
        self.exts = {}

        for ext in exts:
            name = ext  
            try:
                self.exts[name] = get_extension(ext)
            except ExtensionUnknownError:
                raise InvalidExtension(ext)
Beispiel #7
0
 def determine_deps(self, ext):
     for dep in self.exts[ext].deps:
         if dep not in self.exts.keys():
             try:
                 self.exts[dep] = get_extension(dep)
                 if self.exts[dep].deps:
                     self.determine_deps(dep)
             except:
                 raise InvalidDependency(ext, dep)
    def start_vlc_imem(self):
        import sys, os
        sys.path.insert(0, os.path.join("..","..",".."))

        import extensions
        extensions.load_extension("vlc")
        
        self.instance=extensions.get_extension("vlc").Instance('-vvv')
        self.player=self.instance.media_player_new()
Beispiel #9
0
def init():
    global plugin
    import plugin
    import extensions
    extensions.load_extension("vlc")
    global vlc
    vlc = extensions.get_extension("vlc")

    global root
Beispiel #10
0
    def start_vlc_imem(self):
        import sys, os
        sys.path.insert(0, os.path.join("..", "..", ".."))

        import extensions
        extensions.load_extension("vlc")

        self.instance = extensions.get_extension("vlc").Instance('-vvv')
        self.player = self.instance.media_player_new()
Beispiel #11
0
 def determine_deps (self, ext):
     for dep in self.exts[ext].deps:
         if dep not in self.exts.keys ():
             try:
                 self.exts[dep] = get_extension (dep)
                 if self.exts[dep].deps:
                     self.determine_deps (dep)
             except:
                 raise InvalidDependency (ext, dep)
Beispiel #12
0
    def __init__(self, exts):
        self.exts = {}
        for ext in exts:
            try:
                self.exts[ext] = get_extension(ext)
            except ExtensionUnknownError as e:
                raise InvalidExtension(ext, e.message)

            # Add dependencies
            self.determine_deps(ext)
Beispiel #13
0
    def __init__ (self, exts):
        self.exts = {}
        for ext in exts:
            try:
                self.exts[ext] = get_extension (ext)
            except ExtensionUnknownError as e:
                raise InvalidExtension (ext, e.message)

            # Add dependencies
            self.determine_deps (ext)
Beispiel #14
0
    def load_all_extensions(self):
        extensions = {}
        dir = os.path.dirname(os.path.realpath(__file__))
        for files in os.listdir(dir + "/extensions"):
            if files.endswith(".py"):
                ext = files[:-3]
                try:
                    extensions[ext] = get_extension(ext)
                except ExtensionUnknownError:
                    # Do nothing here, because we ignore errors during showing "help" ;)
                    pass

        return extensions.keys()
Beispiel #15
0
    def load_all_extensions (self):
        extensions = {}
        dir = os.path.dirname(os.path.realpath(__file__))
        for files in os.listdir(dir + "/extensions"):
            if files.endswith(".py"):
                ext = files[:-3]
                try:
                    extensions[ext] = get_extension(ext)
                except ExtensionUnknownError:
                    # Do nothing here, because we ignore errors during showing "help" ;)
                    pass

        return extensions.keys()
FILTERS = None
HTTP_SETTINGS = {
    "User-Agent":
    "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
}
PLAYER = None
CHANNEL_NAME_ID_DICT = {}
global vlc
vlc = None

if __name__ == "__main__":
    pass
else:
    import extensions
    global vlc
    vlc = extensions.get_extension('vlc')
    if not vlc:
        raise Exception("VLC extension not loaded.")


def thread_reader(queue):
    pass


import threading


def create_player():
    global PLAYER
    if not PLAYER:
        PLAYER = vlc.get_default_instance().media_player_new()
            self.p=self.streamers[self.cur].packets.get(True, 5)
        except Queue.Empty:
            print("Empty queue for longer than 5 seconds!")
            return
        if self.p[3] and len(self.p[3]) == 4:
            self.p[3]=transform_time(transform_time(self.p[3],-1*self.offset_start), self.offset)
        data="".join(filter(None, self.p))
        self.q.put(data)
        if "onMetaData" in self.p[5]:
            d=read_metadata(self.p[5])
            if "tlPreciseTime" in d and "StreamTitle" in d:
                correctedtime=self.streamers[self.cur].start_time+int(d["tlPreciseTime"])
                self.songchanges.put((correctedtime, d["StreamTitle"]))
            print(d)
            return True
        return False  

import sys, os
sys.path.insert(0, os.path.join("..","..",".."))

import extensions
extensions.load_extension("vlc")

instance=extensions.get_extension("vlc").Instance('-vvv')

zz=MediaHandler(instance, create_request())
player=instance.media_player_new()
player.set_media(zz.get_media())
player.play()
zz.loop()        
            return
        if self.p[3] and len(self.p[3]) == 4:
            self.p[3] = transform_time(
                transform_time(self.p[3], -1 * self.offset_start), self.offset)
        data = "".join(filter(None, self.p))
        self.q.put(data)
        if "onMetaData" in self.p[5]:
            d = read_metadata(self.p[5])
            if "tlPreciseTime" in d and "StreamTitle" in d:
                correctedtime = self.streamers[self.cur].start_time + int(
                    d["tlPreciseTime"])
                self.songchanges.put((correctedtime, d["StreamTitle"]))
            print(d)
            return True
        return False


import sys, os
sys.path.insert(0, os.path.join("..", "..", ".."))

import extensions
extensions.load_extension("vlc")

instance = extensions.get_extension("vlc").Instance('-vvv')

zz = MediaHandler(instance, create_request())
player = instance.media_player_new()
player.set_media(zz.get_media())
player.play()
zz.loop()
CHANNELS=None
FILTERS=None
HTTP_SETTINGS={"User-Agent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
               }
PLAYER=None
CHANNEL_NAME_ID_DICT={}
global vlc
vlc=None

if __name__=="__main__":
    pass
else:
    import extensions
    global vlc
    vlc = extensions.get_extension('vlc')
    if not vlc:
        raise Exception("VLC extension not loaded.")


def thread_reader(queue):
    pass

import threading

def create_player():
    global PLAYER
    if not PLAYER:
        PLAYER=vlc.get_default_instance().media_player_new()
        vlc.libvlc_audio_set_delay(PLAYER, AUDIO_DELAY)