1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

announcing jukebox - an mp3 player for pyhme

Discussion in 'Developers Corner' started by jbernardis, Dec 26, 2011.

  1. Apr 20, 2012 #61 of 153
    species8472jj

    species8472jj New Member

    56
    0
    Dec 23, 2009
    That was one problem - thank you. I just removed those server/port lines, so it just defaults to the pytivo. But I still have a problem. The original problem is when I would play a track, the time index would hang at 0:00. Now, the progress bar does tick away, however I am not getting any sound. I tried multiple tracks, and I keep getting the same result. Thanks in advance for the help.
     
  2. Apr 20, 2012 #62 of 153
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    Now that's an interesting problem. Jukebox does not actually play the song. It just sends the stream url to the tivo, and then updates its display based on status messages that the tivo sends. The fact that the progress bar ticks away indicates that the tivo THINKS it is playing the file. If you are not getting any sound, the problem is probably with the tivo. There was a suggestion earlier to reboot the tivo - perhaps that would help here.
     
  3. Apr 21, 2012 #63 of 153
    species8472jj

    species8472jj New Member

    56
    0
    Dec 23, 2009
    First of all, your response time is lightning fast. I really appreciate all the help you've given me.

    Second, rebooting the TiVo worked. Big Thank you. I love
    Harmonium, and this is a new and improved version of it.

    Third, where do I find the lyrics feature? I don't see an option when I'm playing tracks.

    And fourth, a couple minor suggestions. One minor feature Harmonium had is when you have large list of songs and hit the "1" key it would take you 10% through the list, "2" key to about 20% through the list and so on.

    Another thing in Harmonium is when an artist had a "the" before their name such as The B-52's, Harmonium would alphabetize that as "B" for B-52's as opposed to "T" for the.

    These are a couple nice perks Harmonium has.


    And finally - very nice application. Great work and thank you.
     
  4. Apr 21, 2012 #64 of 153
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    The lyrics feature is via the info button - just press it while a song is playing and its lyrics will show up. You can also press it while browsing the catalog, and the lyrics for the currently viewed song will be retrieved.

    It isn't perfect, there will/may be songs it cannot find lyrics for, and for those, you can create your own local lyrics file. The details are in the README file starting about line 156.

    Your suggestions are noted. I already do those things for vidmgr, my other pyhme app, so porting the logic shouldn't be too bad.

    Glad you like it, and glad we got it working.
     
  5. Apr 21, 2012 #65 of 153
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    species8472jj:

    A question about the removal of articles (a, an, the) from band names. Is this juat about alphabetization? Or is this also about recognizing that a song with artist "Clash" should be combined with a song by artist "The Clash"?

    If it's just sorting, then it should be relatively easy to do. Using the above esample, you'd have two groups in the list - "Clash" and "The Clash".

    If it's a request to combine the two, then that's a little tougher, and it raises questions about which name should rule. Should I choose "Clash" or "The Clash".

    Right now I'm leaning towards just the sorting. This approach has the added advantage that it will show you where your metadata is inconsistent. The second approach will hide the inconsistencies.

    P.S. Using the number keys to step through the list in a percentage fashion has already been implemented by "borrowing" about 10 lines of code from vidmgr. It is still to be tested, though, so don't go looking for it yet.
     
  6. Apr 21, 2012 #66 of 153
    species8472jj

    species8472jj New Member

    56
    0
    Dec 23, 2009
    To answer your question, I am thinking about the removal of articles just for alphabetizing.

    I have a lot of artists with "the", so if you can remove the articles as you said, I think that would work great.

    Thanks!
     
  7. Apr 21, 2012 #67 of 153
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    I have just uploaded version 1.oj with the recently requested features. Here is the extract from the changelog file:

    Version 1.0j - 4/21/2012
    - Added support for using number keys to navigate through long menus (1=10%, 2=20%, etc)
    - Added the ability to ignore leading articles (a, an, the) in artist names so that "The Beatles" sorts with the B's
    - added ignorearticles ini file option to control above stripping of articles
     
  8. Apr 23, 2012 #68 of 153
    lrhorer

    lrhorer New Member

    6,922
    0
    Aug 31, 2003
    San...
    The Beatles? Oh, come on, Jeff. At least use the names of real bands when citing an example. No band would ever call themselves "The Beatles". I mean really...

    ;)
     
  9. Apr 23, 2012 #69 of 153
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    I guess it shows my age. If it makes it look any better, I also have music in my collection from Green Day and (gulp) Avril Lavigne. :)
     
  10. Apr 26, 2012 #70 of 153
    species8472jj

    species8472jj New Member

    56
    0
    Dec 23, 2009
    I finally got to try the lyrics via pressing the info button. Unfortunately, what happened was it would literally just exit out of Jukebox.

    Looking at the DOS window, I do seen an error...

    "Error: character mapping must return integer, None, or unicode"

    If you have any suggestions, that would be great.
     
  11. Apr 26, 2012 #71 of 153
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    Can you give me the whole traceback that appears in the DOS window. The error message is great, but the traceback will help to pinpoint the code location. Also, since it was in the lyrics section, if you can give me the EXACT song title and artist name it would be helpful.
     
  12. Apr 27, 2012 #72 of 153
    lrhorer

    lrhorer New Member

    6,922
    0
    Aug 31, 2003
    San...
    I keep having these moments of geriatric depression when I see something come from a "new kid". The first one was over 30 years ago. I heard a 9 year old turn to her mother and say, "Mommy, did you know Paul McCartney was with another band before he was with Wings?"

    Now I really feel old.
     
  13. Apr 28, 2012 #73 of 153
    species8472jj

    species8472jj New Member

    56
    0
    Dec 23, 2009
    Right now, I am having two problems, and I don't know why I am having such a hard time.

    1) This was my original problem. The progress bar would tick away, and there would be no sound. The response was to reboot my Tivo and that worked. It happened again, and it seem to be very random, so I would try Harmonium every time it happened, and that has played successfully every time. One other thing I noticed. When I would go into Jukebox, and go through the menus, I noticed if I heard the TiVo chirp as I moved down, it would play fine. If I did not hear the TiVo chirp as I moved from item to item, it would tick away and play no music. Since may TiVo HD screens don't have that chirp, I didn't think anything of it. It may be nothing, but it may help diagnose the problem.

    2) As mentioned before, if I hit the "info" button for lyrics, Jukebox just exits.
    Please see the entire traceback below leading to the error. The song I tried was 10,000 Maniacs - What's the matter here?
    I've tried others with the same result.

    C:\PYHME>call start.py
    HME Server for Python 0.19
    Sat Apr 28 14:39:06 2012 JukeBox version 1.0h module initializing
    Sat Apr 28 14:39:06 2012 Server Starts
    Registering: jukebox
    192.168.1.150:35922 - - [28/Apr/2012 14:39:24] "GET /jukebox/ HTTP/1.1" 200 -
    192.168.1.150:35922 - - [28/Apr/2012 14:39:24] Starting HME: jukebox
    Jukebox thread entering startup
    Sat Apr 28 14:39:24 2012 Starting cache file load
    Sat Apr 28 14:39:25 2012 Starting sort
    Sat Apr 28 14:39:25 2012 Finished - 4855 music files, 669 albums, 364 album arti
    sts, 672 track artists
    Jukebox thread activating
    Server address = 192.168.1.100:9032
    ----------------------------------------
    Exception happened during processing of request from ('192.168.1.150', 35922)
    Traceback (most recent call last):
    File "C:\Python27\lib\SocketServer.py", line 582, in process_request_thread
    self.finish_request(request, client_address)
    File "C:\Python27\lib\SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
    File "C:\PYHME\start.py", line 141, in __init__
    client_address, server)
    File "C:\Python27\lib\SocketServer.py", line 639, in __init__
    self.handle()
    File "C:\Python27\lib\BaseHTTPServer.py", line 337, in handle
    self.handle_one_request()
    File "C:\Python27\lib\BaseHTTPServer.py", line 325, in handle_one_request
    method()
    File "C:\PYHME\start.py", line 232, in do_GET
    self._page(True)
    File "C:\PYHME\start.py", line 186, in _page
    appinst.mainloop()
    File "C:\PYHME\hme.py", line 1139, in mainloop
    while self.active and self.get_event():
    File "C:\PYHME\hme.py", line 1192, in get_event
    handle(keynum, rawcode)
    File "C:\PYHME\jukebox\__init__.py", line 383, in handle_key_press
    self.nowPlaying.handle_key_press(keynum, rawcode)
    File "C:\PYHME\jukebox\NowPlaying.py", line 421, in handle_key_press
    self.app.showLyrics(self.playingSong)
    File "C:\PYHME\jukebox\__init__.py", line 342, in showLyrics
    self.lyricView.loadLyrics(song)
    File "C:\PYHME\jukebox\LyricView.py", line 76, in loadLyrics
    self.lyrString = GetLyrics(song.getArtistName(), song.getTitle())
    File "C:\PYHME\jukebox\GetLyrics.py", line 121, in GetLyrics
    lArtist = makeASCII(artist).lower().translate(transTable).split()
    TypeError: character mapping must return integer, None or unicode
    ----------------------------------------
     
  14. Apr 28, 2012 #74 of 153
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    I am really lost as to what is happening here. I am trying to form a URL from the Artist and Title, so I strip out non-ascii characters, translate to lowercase, remove punctuation characters, and finally split into a list of words that will later be joined with '+' characters. I've tried this interactively both with Ascii characters and non-ascii characters. The worst case I can think of is where makeASCII removes every character returning an empty string, but even that behaves as expected.

    What version of python are you using? On Linux, or windows?

    I have something I want to try, but I don't want to release it generally until we have had an opportunity to see if it solves your problem. If you want to help me out here, send me a PM with your email address, and I'll send you back one new source file to try. If it works for you, I'll update git.
     
  15. Apr 28, 2012 #75 of 153
    species8472jj

    species8472jj New Member

    56
    0
    Dec 23, 2009
    I sent you a PM with my email - always glad to help.

    I am using Python on 2.7, and I'm on Windows 7.
     
  16. Apr 29, 2012 #76 of 153
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    Bill,

    I am still having a bit of trouble with the code in this area. Most recently I got the following traceback out of your code when trying to set_text using a set of lyrics I received from azlyrics.com:

    Code:
    Adding lyric contect ( I really donât mind what happens now and then )
    ----------------------------------------
    Exception happened during processing of request from ('192.168.1.103', 1052)
    Traceback (most recent call last):
    
      File "/usr/local/pyhme/jukebox/LyricView.py", line 114, in paint
        flags=self.flags)
      File "/usr/local/pyhme/hme.py", line 1033, in set_text
        self.set_resource(Text(self.app, message, font, color, colornum), flags)
      File "/usr/local/pyhme/hme.py", line 713, in __init__
        self.put(_CMD_RSRC_ADD_TEXT, 'iis', font.id, color.id, text)
      File "/usr/local/pyhme/hme.py", line 553, in put
        _pack('ii' + format, cmd, self.id, *params))
      File "/usr/local/pyhme/hme.py", line 506, in _pack
        return ''.join([func[i](value) for i, value in zip(format, values)])
      File "/usr/local/pyhme/hme.py", line 466, in _pack_string
        return _pack_vdata(value.encode('utf-8'))
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 12: ordinal not in range(128)
    ----------------------------------------
    
    The offending character is the strange looking character in the word don't in the first line above - I assume it's some non-ascii character that looks like an apostrophy??

    In any event, short of stripping non-ASCII characters out of the data I get from the web, what can I do to get past this issue?
     
  17. Apr 29, 2012 #77 of 153
    wmcbrine

    wmcbrine Ziphead

    10,362
    22
    Aug 2, 2003
    Um... figure out what character set it's actually in, and convert it from that to Unicode before you send it to the screen.

    Here's what I do in several places in pyTivo:

    Code:
    # Try decoding it as UTF-8, fall back to system character set
    if type(val) == str:
        try:
            val = val.decode('utf8')
        except:
            if sys.platform == 'darwin':
                val = val.decode('macroman')
            else:
                val = val.decode('iso8859-1')
    For your purposes you'd probably want to leave out the 'darwin' (i.e. Mac OS X) part, since you're not dealing with local files.
     
  18. Apr 29, 2012 #78 of 153
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    Thanks - that did the trick. I try utf8 (which is what it was) and then iso8859-1, and if they both fail, I strip out anything that is non-ascii as an absolute last-ditch tactic.
     
  19. Apr 29, 2012 #79 of 153
    wmcbrine

    wmcbrine Ziphead

    10,362
    22
    Aug 2, 2003
    iso8859-1 won't fail... well, I guess technically you could run into characters in the 128-160 gap, and it might complain then. So, it might be better to use windows-1252. Anyway, the point is, these are 8-bit encodings -- so any byte value is a valid character. With UTF-8, on the other hand, a random sequence is more likely to be invalid than valid. That's why I test for UTF-8, and then fall through to (untested) iso8859-1.
     
  20. Apr 30, 2012 #80 of 153
    species8472jj

    species8472jj New Member

    56
    0
    Dec 23, 2009
    I have a little more insight in a "problem" I have been having with Jukebox.

    The problem basically is that when I played a song, the progress bar would tick away, however there was no sound. The resolution was to reboot my TiVo, and it worked.

    However, I realized that sometimes when I went into Jukebox, it would work (i.e. the songs had sound). And sometimes it would not work (i.e. the songs had no sound at all).

    I also noticed that when I moved from item to item in Jukebox's menus, if I heard the TiVo "chirp", I would hear sound when music is playing. If I didn't hear the "chirp", I would not hear sound when music is playing. I didn't think much of it since the HD Tivo interface does not have the "chirp" (or whatever you call that TiVo sound).

    I am using the TiVo Premier, so I went in and changed my menus from the HD menus to the SD menus. When I did that, I went in and out of Jukebox many, many times, and it worked each time.

    I believe Harmonium's interface is SD, and I know that Jukebox's interface is HD, so I don't know if that has anything to do with it. And I have not had this issue with Harmonium on either the SD or HD menus on Tivo.

    I'm not pretending to know something I don't - this is just what I've noticed, and I'm putting it out there to see if it makes any sense.

    Of course, this could be a load of bunk and my Tivo (or the Tivo interface in general) is just quirky.
     

Share This Page