CDLibrary - a driver to Dacal CD Library 2 devices

Aug. 18, 2010
comments

This Linux Driver allows you to access CD Library 2 devices connected on the USB ports either via http or the filesystem. Below is a picture of such a device. Each device can hold 150 CD/DVD/Blue-Ray dimensioned discs.

Features

  • plug&play recognizes connected devices
  • list unique device ids
  • open specified slots
  • close slots
  • http interface mode
  • file system interface mode

Download

Dependencies

Install

cdlibrary console is a python package installable by any of the following commands:

cd cdlibrary; python setup.py install
easy_install cdlibrary

Once you have the package installed (as root) you need to add a daemon script:

sudo su - 
wget http://hg.codeflow.org/cdlibrary/archive/tip.tar.gz
tar xzvf tip.tar.gz
cp cdlibrary-*/cdlibd /etc/init.d
update-rc.d -f cdlibd defaults

you can also use the code below as a start script:

import sys
from cdlibrary import http, filesystem
   
daemon = filesystem.daemon
#daemon = http.daemon

if __name__ == '__main__':
    command = sys.argv[1]
    if command == 'start':
        daemon.start()
    elif command == 'stop':
        daemon.stop()
    elif command ==  'restart':
        daemon.stop()
        daemon.start()
    elif command == 'debug':
        daemon.debug()

Usage

/init.d/cdlibd start|stop|restart|debug

HTTP Interface

  • http://yourhost:8000/list -- lists the device IDs in json format
  • http://yourhost:8000/open/device-id/123 -- opens the slot 123
  • http://yourhost:8000/close/device-id -- closes the slot of this device

File System Interface

  • ls /mnt/cdlibrary -- lists the device IDs as directory listing
  • echo 123 > /mnt/cdlibrary/device-id -- opens slot 123
  • echo close > /mnt/cdlibrary/device-id -- closes the slot of this device

License

GNU GPLv3 or later, Copyright 2009 Florian Bösch