Esempio 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)
Esempio 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)
Esempio 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
Esempio 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
Esempio n. 5
0
 def setInfo(self,song):
     D = {};
     D["DSP_AVERAGE_MAGNITUDE"] = song[EnumSong.EQUILIZER]
     PyBASS.setSongInfo(D);
Esempio 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();
Esempio n. 7
0
 def media_getTime(self):
     return int(PyBASS.getPosition())
Esempio n. 8
0
 def mediaforward(self):
     """Go forward 1s"""
     
     PyBASS.setPosition(PyBASS.getPosition() + 1)
Esempio n. 9
0
 def mediaStop(self):
     PyBASS.setPosition(0);
     PyBASS.pause(); 
Esempio n. 10
0
 def setVolume(self, value):
     PyBASS.setVolume(max(0.0, min(1.0, value / 100.0)))
Esempio n. 11
0
 def media_setTime(self, seconds):
     PyBASS.setPosition(seconds)
Esempio n. 12
0
 def media_getTime(self):
     return int(PyBASS.getPosition())
Esempio n. 13
0
 def mediabackward(self):
     """Go backward 1s"""
     PyBASS.setPosition(PyBASS.getPosition() - 1)
Esempio n. 14
0
    def mediaforward(self):
        """Go forward 1s"""

        PyBASS.setPosition(PyBASS.getPosition() + 1)
Esempio n. 15
0
 def mediaPause(self):
     PyBASS.pause()
Esempio n. 16
0
 def mediaUnload(self):
     PyBASS.unload();
Esempio n. 17
0
 def mediaStop(self):
     PyBASS.setPosition(0)
     PyBASS.pause()
Esempio 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()
Esempio n. 19
0
 def mediaPause(self):  
     PyBASS.pause();
Esempio n. 20
0
 def getInfo(self):
     return PyBASS.getSongInfo()
Esempio n. 21
0
 def mediabackward(self):
     """Go backward 1s"""
     PyBASS.setPosition(PyBASS.getPosition() - 1)
Esempio n. 22
0
 def setInfo(self, song):
     D = {}
     D["DSP_AVERAGE_MAGNITUDE"] = song[EnumSong.EQUILIZER]
     PyBASS.setSongInfo(D)
Esempio n. 23
0
 def media_setTime(self,seconds):
     PyBASS.setPosition(seconds)
Esempio 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
Esempio n. 25
0
 def setVolume(self,value):
     PyBASS.setVolume(max(0.0,min(1.0,value/100.0)));
Esempio n. 26
0
    def Release(self):
        """ unload the VLC player entirely
            delete the media, player and instance
        """

        PyBASS.bass_free()
Esempio n. 27
0
 def getInfo(self):
     return PyBASS.getSongInfo();
Esempio n. 28
0
 def mediaUnload(self):
     PyBASS.unload()
Esempio 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;
Esempio 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
Esempio n. 31
0
 def Release(self):
     """ unload the VLC player entirely
         delete the media, player and instance
     """    
      
     PyBASS.bass_free()
Esempio n. 32
0
 def mediaPlay(self):  
     PyBASS.play();
Esempio 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
Esempio n. 34
0
 def mediaPlay(self):
     PyBASS.play()