thouters.be

- Thomas' Webjar full of joy -

Quthis: Queue this! Draft

Author: Thomas Langewouters
description:Schedule software actions to real world events
Date: 2008/03/27

Note

This is is a draft description of a software program that does not exist yet. I wrote this article to share this idea and (possibly) gain momentum behind it, I think this should be set up as a modular system with easy to create plugins.

Introducing Quthis

Image choosing "Quthis..." from a context menu in your desktop environment. The Quthis window pops up, which allows you to plan actions on the selected text or file.

You can build a list of things to do sequentially, and make the task's run-time depend on circumstances.

You selected text

  • Download these URL's to disk, if/when Skymeter says this month's downloads didn't exceed half the ISP's limit
  • Unrar the resulting files using a password

Or

  • Download these URL's to disk
  • Match .md5 or signature with file(s)

You selected a file

  • Transcode to iPod-mp4 (or Rockbox MPEG 1) when I'm not running on battery
  • Move the (trancoded!) file to a folder on my iPod, when it's conneced.
  • Sync this folder to my backup box when I jack-in to my desktop computer over gigabit LAN.

Macro implementation

daemon:One per user

This idea integrates into a GUI desktop. I mixed conditions and operations in the following description, they are strictly separated in the underlying

Curl Download

what?:libcurl download agent

Conditions

  • Only download this file using my Access Point at home: use DBUS to get the WLAN ID.
  • Make a DBUS call to a Skymeter version that reads the ISP's download volume meters every two hours.

Pending File operations

what?:move/copy file to external storage

This plugin is able to keep an offline folder tree of an external volume (only explicit requested volumes). It can build folder tree of a certain device, the depth of which can be set by the user. This makes it possible to select a path on the device if it's offline.

The device's USB or SCSI id is saved along with the file tree, to locate the mount point afterwards.

File operations would use GIO.

Note

Quthis does NOT focus on synchronisation. Synch ops would be implemented as wrapper plugin for an external program (like Conduit, Rsync or Unison).

Transcode

what?:run a ffmpeg/mencoder command

The destination folder, where transcoded files are put, is of importance here.

Micro implementation

daemon:One per destination folder

To distinguish this fork my main idea, I refer to this non-GUI-desktop idea as "qulite".

This is a simple (download or transcode only) subset of the Quthis idea. It could be implemented as a client/server architecture. It focuses heavily around a download manager idea, with a Qulite daemon handling business specific to a folder.

Job folder storage

Qulite uses dot-files in the work folder to store data and job states.

  • .wsock UNIX domain socket used by the work daemon of the folder.
  • .job.jobnum, a textfile that describes a single task.
  • .msg.123, logged message number 123, maybe containing a 404 from the curl download client.

The Jobfile

General format

# specify the type of this job
type [group|curl|unrar]
priority n  (less is more)
# DEPRECATED: parent 0|jobnum
state halt|run|hold|done|fail
[fail messagenum]
[comment An optional comment]

Download Job

# specify the type of this job
type curl
priority 1
parent 1
status halt
state hold
curl url http://blabla/
curl part

Unrar Job

# specify the type of this job
type unrar
priority 1
parent 0
state fail
# .msg.2.fail contains "invalid CRC"
fail 2
# specifying a comment for groups comes in handy
comment This is a group of rarfiles to extract
# this is a unrar job that needs a password
unrar password thisisasecretword

Client commands

The client is used for interaction with the worker process, communication happens through the UNIX SOCKET .wsock in the work folder.

  • qulite a[dd] [filename]

    $ qulite a[dd]
    > n[ame] ....
    > e[xtract] [password]
    > url ...
    > url ...
    > s[top]|r[un] [priority]
    > ^D
    
  • qulite h[alt] a[ll]|jobnum

  • qulite c[ontinue] a[ll]|jobnum

  • qulite d[elete] jobnum

  • qulite li[st]|lc[ompact]

    job prio    name                        progress    status
    4   X       Lugradio Season 1           [1/10]       active
     1  0       lugradios1e1.mp3            done
     2  0       lugradios1e2.mp3            @20%
     3  0       lugradios1e3.mp3            queued
     ...
    
  • qulite lo[g]

  • qulite s[tatus]

    Folder: /home/thomas/downloads/
    Worker: running (2) threads:
            - unrar dinges1.part1.rar
            - curl dinges2.part1.rar
    Groups: 2
    Jobs:   19
    
  • qulite e[xtract] [jubnum|filespec]

  • qulite g[roup] filespec

  • qulite p[riority] jobnum [gt|lt] jobnum:

    $qulite kerneltarball gt ubuntuiso
    
  • qulite w[orker] path-to-workfolder