This file is indexed.

/usr/bin/lastcd is in ears 1.0.1-2.1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/python

import sys
import os
import time
import getopt

import lastfm
import lastfm.client
import lastfm.marshaller

USAGE = """\
usage: lastcd [--stdout] [--debug] [--help]"""

if __name__ == '__main__':
    shortopts = 'sdh'
    longopts = [
        'stdout',
        'debug',
        'help',
        ]

    try:
        opts, args = getopt.getopt(sys.argv[1:], shortopts, longopts)
    except getopt.GetoptError, e:
        print >>sys.stderr, 'lastcd: %s' % e
        print >>sys.stderr, USAGE
        sys.exit(1)

    debug = False
    stdout = False

    for opt, arg in opts:
        if opt in ('--stdout', '-s'):
            stdout = True
        elif opt in ('--debug', '-d'):
            debug = True
        elif opt in ('--help', '-h'):
            print USAGE
            sys.exit(0)

    cli = lastfm.client.Client('lastcd')
    cli.open_log(debug)

    songs = []
    for f in [file(name) for name in args] or [sys.stdin]:
        songs += lastfm.marshaller.load_documents(f)

    total_len = 0
    for s in songs:
        total_len += s['length']

    # We will simulate things as if the last track in our input just finished
    # playing right now.

    pos = time.time() - total_len

    subs = []
    for s in songs:
        l = s['length']
        if l:
            if l >= lastfm.MIN_LEN and l <= lastfm.MAX_LEN:
                date = pos + l / 2
                s['time'] = time.gmtime(pos)
                subs.append(s)
            pos = pos + l
        else:
            print >>sys.stderr, 'lastcd: track has zero length'
            sys.exit(1)

    if not subs:
        print >>sys.stderr, 'lastcd: no usable tracks found'
        sys.exit(1)

    if stdout:
        lastfm.marshaller.dump_documents(subs, sys.stdout)
    else:
        try:
            cli.log.info('Sending %s song(s) to daemon' % len(subs))
            cli.submit_many(subs)
        except IOError, e:
            print >>sys.stderr, 'lastcd: error writing: %s' % e