CarlQLange / fit

a basically psychic iTunes controller, kind of
5 stars 0 forks source link

Errors when trying to play a song #1

Open phistep opened 12 years ago

phistep commented 12 years ago

I'm trying to play a song thet definately is in my library, its all ascii caracters and no spaces in either artist or song name, Easy by Cro to be precise, and it fails with every method: The standard CLI, sox speech recognition and the server web interface. I'd really love to test/use this, but it just doesn't work for me. Unfortunately I don't know python to fix it myself.

I have installed all the necessary dependencies:

iMac:~ Ps0ke$ brew list
flac        hub     libsndfile  md5sha1sum  readline
fortune     lame        libvorbis   mercurial   sox
gdbm        libao       lynx        pkg-config  sqlite
git     libogg      mad     python3

The fit path is in my $PATH:

iMac:~ Ps0ke$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/Ps0ke/bin

All the necessary files are in there:

iMac:~ Ps0ke$ find ./bin
./bin
./bin/_fit
./bin/_fit/__init__.py
./bin/_fit/__pycache__
./bin/_fit/__pycache__/__init__.cpython-32.pyc
./bin/_fit/__pycache__/gspeech.cpython-32.pyc
./bin/_fit/__pycache__/recognise.cpython-32.pyc
./bin/_fit/gspeech.py
./bin/_fit/recognise.py
./bin/_fit/web
./bin/_fit/web/__init__.py
./bin/_fit/web/__pycache__
./bin/_fit/web/__pycache__/__init__.cpython-32.pyc
./bin/_fit/web/__pycache__/server.cpython-32.pyc
./bin/_fit/web/index.html
./bin/_fit/web/server.py
./bin/fit

Theres even a error message if no argument is given (I think you should fix that)

iMac:~ Ps0ke$ fit
Traceback (most recent call last):
  File "/Users/Ps0ke/bin/fit", line 189, in <module>
    main()
  File "/Users/Ps0ke/bin/fit", line 23, in main
    if sys.argv[1] == 'listen':
IndexError: list index out of range

The CLI:

iMac:~ Ps0ke$ fit "play easy by cro"
Traceback (most recent call last):
  File "/Users/Ps0ke/bin/fit", line 89, in artistnames
    lib["Tracks"][track]["Has Video"]
KeyError: 'Has Video'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/Ps0ke/bin/fit", line 189, in <module>
    main()
  File "/Users/Ps0ke/bin/fit", line 38, in main
    ar = bestmatch(action[1][1], artistnames)
  File "/Users/Ps0ke/bin/fit", line 124, in bestmatch
    for trackname in matchto():
  File "/Users/Ps0ke/bin/fit", line 91, in artistnames
    if lib["Tracks"][track]["Artist"] not in artists:
KeyError: 'Artist'

The server:

iMac:~ Ps0ke$ fit serve
Serving on port 5171.
Go to 127.0.0.1:5171/_fit/web in your browser!
{'inp': ['play easy by cro']}
Traceback (most recent call last):
  File "/Users/Ps0ke/bin/fit", line 89, in artistnames
    lib["Tracks"][track]["Has Video"]
KeyError: 'Has Video'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/Ps0ke/bin/fit", line 189, in <module>
    main()
  File "/Users/Ps0ke/bin/fit", line 38, in main
    ar = bestmatch(action[1][1], artistnames)
  File "/Users/Ps0ke/bin/fit", line 124, in bestmatch
    for trackname in matchto():
  File "/Users/Ps0ke/bin/fit", line 91, in artistnames
    if lib["Tracks"][track]["Artist"] not in artists:
KeyError: 'Artist'
localhost - - [25/Jan/2012 21:30:38] "POST / HTTP/1.1" 200 -
^CTraceback (most recent call last):
  File "/Users/Ps0ke/bin/fit", line 189, in <module>
    main()
  File "/Users/Ps0ke/bin/fit", line 27, in main
    server.serve()
  File "/Users/Ps0ke/bin/_fit/web/server.py", line 17, in serve
    httpd.serve_forever()
  File "/usr/local/Cellar/python3/3.2.2/lib/python3.2/socketserver.py", line 225, in serve_forever
    r, w, e = select.select([self], [], [], poll_interval)
KeyboardInterrupt

The listen:

iMac:~ Ps0ke$ fit listen
Start talking!
Heard you.
Traceback (most recent call last):
  File "/Users/Ps0ke/bin/fit", line 189, in <module>
    main()
  File "/Users/Ps0ke/bin/fit", line 24, in main
    action = recognise.parse(gspeech.hearandinterpret(), definitions)
  File "/Users/Ps0ke/bin/_fit/gspeech.py", line 36, in hearandinterpret
    r = interpret(hear())
  File "/Users/Ps0ke/bin/_fit/gspeech.py", line 18, in interpret
    return json.loads(resp)["hypotheses"][0]["utterance"]
IndexError: list index out of range
CarlQLange commented 12 years ago

First things first:

Theres even a error message if no argument is given (I think you should fix that)

Whoops. ;)

The problem with listen is that it didn't actually understand you - again I just need to handle that better. Thanks for bringing it to my attention.

Now, I think your actual problem is to do with your iTunes library. I'm curious - is your computer's language set to something other than English?

Could you run head -n 50 ~/Music/iTunes/iTunes\ Music\ Library.xml and paste it in here?

phistep commented 12 years ago
Now, I think your actual problem is to do with your iTunes library.
I'm curious - is your computer's language set to something other than English?

Well, my setup is a little, let's say unusual: I live in Germany, so my iTunes Store is German, but my Mac's main language is English, but my regional settings (time format, calender etc.) are set to German format. So this should actually be no problem, but with iTunes you never know.

Could you run `head -n 50 ~/Music/iTunes/iTunes\ Music\ Library.xml` and paste it in here?

Sure :)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Major Version</key><integer>1</integer>
    <key>Minor Version</key><integer>1</integer>
    <key>Date</key><date>2012-01-27T20:10:04Z</date>
    <key>Application Version</key><string>10.5.3</string>
    <key>Features</key><integer>5</integer>
    <key>Show Content Ratings</key><true/>
    <key>Music Folder</key><string>file://localhost/Users/Ps0ke/Music/iTunes/iTunes%20Music/</string>
    <key>Library Persistent ID</key><string>379FB6C366A68092</string>
    <key>Tracks</key>
    <dict>
        <key>1627</key>
        <dict>
            <key>Track ID</key><integer>1627</integer>
            <key>Name</key><string>Dumpweed</string>
            <key>Artist</key><string>Blink-182</string>
            <key>Composer</key><string>Mark Hoppus</string>
            <key>Album</key><string>Enema Of The State</string>
            <key>Genre</key><string>Alternative &#38; Punk</string>
            <key>Kind</key><string>AAC audio file</string>
            <key>Size</key><integer>5164072</integer>
            <key>Total Time</key><integer>143893</integer>
            <key>Disc Number</key><integer>1</integer>
            <key>Disc Count</key><integer>1</integer>
            <key>Track Number</key><integer>1</integer>
            <key>Track Count</key><integer>12</integer>
            <key>Year</key><integer>2002</integer>
            <key>Date Modified</key><date>2009-12-12T17:14:47Z</date>
            <key>Date Added</key><date>2009-12-12T17:14:15Z</date>
            <key>Bit Rate</key><integer>256</integer>
            <key>Sample Rate</key><integer>44100</integer>
            <key>Play Count</key><integer>53</integer>
            <key>Play Date</key><integer>3403346132</integer>
            <key>Play Date UTC</key><date>2011-11-05T12:55:32Z</date>
            <key>Rating</key><integer>80</integer>
            <key>Album Rating</key><integer>80</integer>
            <key>Album Rating Computed</key><true/>
            <key>Persistent ID</key><string>E0DEA7FFCC631EF0</string>
            <key>Track Type</key><string>File</string>
            <key>File Type</key><integer>1295270176</integer>
            <key>Location</key><string>file://localhost/Users/Ps0ke/Music/iTunes/iTunes%20Music/Blink-182/Enema%20Of%20The%20State/01%20Dumpweed.m4a</string>
            <key>File Folder Count</key><integer>4</integer>
            <key>Library Folder Count</key><integer>1</integer>
        </dict>
        <key>1629</key>
        <dict>
            <key>Track ID</key><integer>1629</integer>
CarlQLange commented 12 years ago

And is this song, that you're trying to play Easy by Cro - is that tagged correctly in iTunes? It has an artist and a title tag?