LibQuvi wrapper for python
Pull request Compare This branch is 38 commits behind metal3d:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Python Quvi

This is a first attempt to wrap libquvi into python.

How it is made ?

This is based on Cython. The main functions are defined into cpython.pxd file and Quvi class is developed into quvi.pyx file. Compilation is made with Cython using the simple command:

python build_ext

You can also compile .so file in you current directory:

python build_ext --inplace

To install library on system, you may use as root or by sudo:

python install

Remember you can use virtual_env to try quvi without impact on your system:

mkdir /tmp/py-virt
virtual_env /tmp/py-virt
source /tmp/py-virt/bin/activate
setup install

This will install quvi into a virtual environment. To deactivate virtual environment, in the same terminal session:



After having compiled quvi, you can use it as a python module. Module defines a class named Quvi. This is a simple usage:

import Quvi

q = Quvi()
print q.getproperties()

You will see a dict definition that have severals information given by libquvi.

It's possible to use multiprocessing module or threads module to handle several instances. See this example:

import quvi
from multiprocessing import Process

#this function will be called in thread
def getInfo(url):
    print q.getproperties()

#urls to parse
url = ""
url2 = ""

#processes list
processes = []
processes.append( Process(target=getInfo, args=(url,)) )
processes.append( Process(target=getInfo, args=(url2,)) )

#start and join threads
[p.start() for p in processes]
[p.join() for p in processes]

print "done"

Both url will be handle in a thread. So this will be about twice quicker than parsing each url one by one.

Why this python library ?

Because Quvi command line is really nice and I wanted to get youtube, dailymotion, vimeo (etc...) movies information into my python project. Calling "quvi" command line may be used, but having a real library implementation is the best way to have good performances.

Using Cython is pretty cool

What's next ?

For now, you can only get media information from a page you ask to parse. I will continue to develop this library to improved and use properties provided by C library (version, nextmediaurl...)

If you want to develop with me, fork the project on GitHub, then process some merge request :)