Exemplo n.º 1
0
 def invoke(self,plugin_path):
     #plugin_path = "D:\\Dropbox\\Scripting\\PyQt\\console-player\\src\\user\\plugins\\"
     PyBASS.bass_init();    
     
     # get all dlls in the plugins folder and attempt to load them
     for plugin in [ p for p in os.listdir(plugin_path) if fileGetExt(p).lower()=='dll' ]:
         
         path = os.path.join(plugin_path,plugin);
         
         val = PyBASS.load_plugin(path);
         print "Loading Plugin: %s %s"%(plugin,val==0)
Exemplo n.º 2
0
    def invoke(self, plugin_path):
        #plugin_path = "D:\\Dropbox\\Scripting\\PyQt\\console-player\\src\\user\\plugins\\"
        PyBASS.bass_init()

        # get all dlls in the plugins folder and attempt to load them
        for plugin in [
                p for p in os.listdir(plugin_path)
                if fileGetExt(p).lower() == 'dll'
        ]:

            path = os.path.join(plugin_path, plugin)

            val = PyBASS.load_plugin(path)
            print "Loading Plugin: %s %s" % (plugin, val == 0)
Exemplo n.º 3
0
 def mediaState(self):
         
     s = PyBASS.status();
     
     #if s == vlc.State.NothingSpecial:
     #    return MP_NOTHINGSPECIAL
     #elif s == vlc.State.Opening:
     #    return MP_OPENING
     if s == PyBASS.P_STALLED:
         return MP_BUFFERING
     elif s == PyBASS.P_PLAYING:
         return MP_PLAYING
     elif s == PyBASS.P_PAUSED:
         return MP_PAUSED 
     #elif s == PyBASS.P_STOPPED:
     #    return MP_STOPPED
     elif s == PyBASS.P_STOPPED:
         return MP_ENDED
     #elif s == vlc.State.Error:
     #    return MP_ERROR
     else:
         print "Unknown State: %s"%s
         return MP_UNKOWN
Exemplo n.º 4
0
    def mediaState(self):

        s = PyBASS.status()

        #if s == vlc.State.NothingSpecial:
        #    return MP_NOTHINGSPECIAL
        #elif s == vlc.State.Opening:
        #    return MP_OPENING
        if s == PyBASS.P_STALLED:
            return MP_BUFFERING
        elif s == PyBASS.P_PLAYING:
            return MP_PLAYING
        elif s == PyBASS.P_PAUSED:
            return MP_PAUSED
        #elif s == PyBASS.P_STOPPED:
        #    return MP_STOPPED
        elif s == PyBASS.P_STOPPED:
            return MP_ENDED
        #elif s == vlc.State.Error:
        #    return MP_ERROR
        else:
            print "Unknown State: %s" % s
            return MP_UNKOWN
Exemplo n.º 5
0
 def setInfo(self,song):
     D = {};
     D["DSP_AVERAGE_MAGNITUDE"] = song[EnumSong.EQUILIZER]
     PyBASS.setSongInfo(D);
Exemplo n.º 6
0
 def getVolume(self):
     # return the current volume as a value from 0 (off or mute) to 100 (full on)
     return PyBASS.getVolume();
Exemplo n.º 7
0
 def media_getTime(self):
     return int(PyBASS.getPosition())
Exemplo n.º 8
0
 def mediaforward(self):
     """Go forward 1s"""
     
     PyBASS.setPosition(PyBASS.getPosition() + 1)
Exemplo n.º 9
0
 def mediaStop(self):
     PyBASS.setPosition(0);
     PyBASS.pause(); 
Exemplo n.º 10
0
 def setVolume(self, value):
     PyBASS.setVolume(max(0.0, min(1.0, value / 100.0)))
Exemplo n.º 11
0
 def media_setTime(self, seconds):
     PyBASS.setPosition(seconds)
Exemplo n.º 12
0
 def media_getTime(self):
     return int(PyBASS.getPosition())
Exemplo n.º 13
0
 def mediabackward(self):
     """Go backward 1s"""
     PyBASS.setPosition(PyBASS.getPosition() - 1)
Exemplo n.º 14
0
    def mediaforward(self):
        """Go forward 1s"""

        PyBASS.setPosition(PyBASS.getPosition() + 1)
Exemplo n.º 15
0
 def mediaPause(self):
     PyBASS.pause()
Exemplo n.º 16
0
 def mediaUnload(self):
     PyBASS.unload();
Exemplo n.º 17
0
 def mediaStop(self):
     PyBASS.setPosition(0)
     PyBASS.pause()
Exemplo n.º 18
0
 def getVolume(self):
     # return the current volume as a value from 0 (off or mute) to 100 (full on)
     return PyBASS.getVolume()
Exemplo n.º 19
0
 def mediaPause(self):  
     PyBASS.pause();
Exemplo n.º 20
0
 def getInfo(self):
     return PyBASS.getSongInfo()
Exemplo n.º 21
0
 def mediabackward(self):
     """Go backward 1s"""
     PyBASS.setPosition(PyBASS.getPosition() - 1)
Exemplo n.º 22
0
 def setInfo(self, song):
     D = {}
     D["DSP_AVERAGE_MAGNITUDE"] = song[EnumSong.EQUILIZER]
     PyBASS.setSongInfo(D)
Exemplo n.º 23
0
 def media_setTime(self,seconds):
     PyBASS.setPosition(seconds)
Exemplo n.º 24
0
 def updateDSP(self, dict_dsp):
     if "updateDSPBlock" in PyBASS.__dict__:
         #print "pybass dsp update"
         PyBASS.updateDSPBlock(dict_dsp)
         for key, val in dict_dsp.items():
             self.DSP_SETTINGS[key] = val
Exemplo n.º 25
0
 def setVolume(self,value):
     PyBASS.setVolume(max(0.0,min(1.0,value/100.0)));
Exemplo n.º 26
0
    def Release(self):
        """ unload the VLC player entirely
            delete the media, player and instance
        """

        PyBASS.bass_free()
Exemplo n.º 27
0
 def getInfo(self):
     return PyBASS.getSongInfo();
Exemplo n.º 28
0
 def mediaUnload(self):
     PyBASS.unload()
Exemplo n.º 29
0
 def updateDSP(self,dict_dsp):
     if "updateDSPBlock" in PyBASS.__dict__:
         #print "pybass dsp update"
         PyBASS.updateDSPBlock(dict_dsp);
         for key,val in dict_dsp.items():
             self.DSP_SETTINGS[key] = val;
Exemplo n.º 30
0
    def mediaLoad(self, file, play=False):
        ret = False
        try:
            #print os.stat(file)
            #if isPosix: print "    . Path Fix"
            self.mediaUnload()
            # remove the old file

            isExist = os.path.exists(file)
            #attempt to fix the file path if on a case sensitive file system
            if not isExist and isPosix:
                # although MpGlobal.Player also does a path fix
                # we do need to check here just in case.
                newFilePath = UnixPathCorrect(file)
                if os.path.exists(newFilePath):
                    file = newFilePath
                    isExist = True
                    debug("Path Correction: \n%s" % file)

            if not isPosix:
                path = toUTF16(file)
            else:
                path = file

            if isExist:
                # TODO - File load error
                # python claims the file exists but sometimes
                # the load still fails, claiming the path does not exist.
                # by simply re encoding the file path and checking
                # if the file exists again solves the issue. strange.

                for i in range(5):
                    path_utf16 = toUTF16(file)
                    fex = PyBASS.utf16_fexists(path_utf16)
                    if fex:
                        ret = PyBASS.load(path_utf16, 1)
                        if i > 0:
                            print "Loaded on %d-th attempt" % i
                        PyBASS.setDSPBlock(self.DSP_SETTINGS)
                        #print self.DSP_SETTINGS
                        break
                else:
                    print "for fell thru on load."
                    raise IOError("Failed to load file")
            else:
                print "file not found"
                #debug(" *** File Not Found;")
                #debug("PATH: %s"%file)
        except IOError:
            raise IOError("Failed to load file")
        except Exception as e:

            print "VLC instance Error: %s" % (e.args)
            #self.__media__
            #self.__media__ = None;

        #if isPosix: print "    . if-Play"
        if play:
            self.mediaPlay()
        elif ret:  # if loaded successfully
            # initial state is STOPPED which is used as ENDED
            # start then pause to get the state away from stopped
            PyBASS.play()
            PyBASS.pause()

        return ret
Exemplo n.º 31
0
 def Release(self):
     """ unload the VLC player entirely
         delete the media, player and instance
     """    
      
     PyBASS.bass_free()
Exemplo n.º 32
0
 def mediaPlay(self):  
     PyBASS.play();
Exemplo n.º 33
0
    def mediaLoad(self,file,play=False):
        ret = False;
        try:
            #print os.stat(file)
            #if isPosix: print "    . Path Fix"
            self.mediaUnload(); # remove the old file
            
            isExist = os.path.exists(file)
            #attempt to fix the file path if on a case sensitive file system
            if not isExist and isPosix: 
                # although MpGlobal.Player also does a path fix
                # we do need to check here just in case.
                newFilePath = UnixPathCorrect(file)
                if os.path.exists(newFilePath):
                    file = newFilePath
                    isExist = True
                    debug( "Path Correction: \n%s"%file )
                    
            if not isPosix:        
                path = toUTF16(file)  
            else:
                path = file;

            if isExist:
                # TODO - File load error
                # python claims the file exists but sometimes 
                # the load still fails, claiming the path does not exist.
                # by simply re encoding the file path and checking
                # if the file exists again solves the issue. strange.

                for i in range(5):
                    path_utf16 = toUTF16(file);
                    fex = PyBASS.utf16_fexists(path_utf16)
                    if fex:
                        ret = PyBASS.load(path_utf16,1);
                        if i > 0: 
                            print "Loaded on %d-th attempt"%i
                        PyBASS.setDSPBlock( self.DSP_SETTINGS )
                        #print self.DSP_SETTINGS
                        break;
                else:
                    print "for fell thru on load."
                    raise IOError("Failed to load file");
            else:
                print "file not found"
                #debug(" *** File Not Found;")
                #debug("PATH: %s"%file)
        except IOError:
            raise IOError("Failed to load file");
        except Exception as e:
            
            print "VLC instance Error: %s"%(e.args)
            #self.__media__
            #self.__media__ = None;
        
        
        #if isPosix: print "    . if-Play"
        if play :
            self.mediaPlay()
        elif ret: # if loaded successfully
            # initial state is STOPPED which is used as ENDED
            # start then pause to get the state away from stopped
            PyBASS.play();
            PyBASS.pause();
   
        return ret
Exemplo n.º 34
0
 def mediaPlay(self):
     PyBASS.play()