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

PyTivo Video Manager HME App for pyhme

Discussion in 'Developers Corner' started by jbernardis, Apr 20, 2011.

  1. May 24, 2011 #81 of 735
    jcthorne

    jcthorne Active Member

    2,720
    3
    Jan 28, 2002
    Houston
    Yes it would be very helpful if there was a way to display episode numbers and sort in the correct order for tv shows. Short of editing each metadata file to add episode numbers to the titles, could it sort by episode number if its present and then by file name? ( I am more asking for discussion than resolution just yet as I am not sure the best way to go, just that tv series do not currently show the episode numbers nor sort in order. Open to suggestion here on how best to do this or use the tool.)
     
  2. May 24, 2011 #82 of 735
    txporter

    txporter One sec, almost done

    666
    0
    Sep 17, 2006
    Austin, TX
    Yeah, I agree. I have a mod'd version of pytivometathis that adds the episode number before the title, so my metadata looks like this:
    Code:
    seriesTitle : Torchwood
    title : Everything Changes
    episodeTitle : 101-Everything Changes
    originalAirDate : 2006-10-22T00:00:00Z
    description : WPC Gwen Cooper is at the scene of a brutal murder, when the "special ops," known only as Torchwood, arrive. After witnessing the group bring the dead man back to life, Gwen goes in pursuit of this mysterious organisation, only to see weirder things than she could ever imagine existed. Soon after, she begins to regret giving in to her curiosity, when she meets Captain Jack Harkness. 
    isEpisode : true
    seriesId : SH947230
    episodeNumber : 101
    vProgramGenre : Action and Adventure
    vProgramGenre : Drama
    vProgramGenre : Science-Fiction
    vSeriesGenre : Action and Adventure
    vSeriesGenre : Drama
    vSeriesGenre : Science-Fiction
    vDirector : Brian Kelly
    vWriter : Russell T. Davies
    vGuestStar : Paul Kasey
    vGuestStar : Mark Heal
    vGuestStar : Gary Shepheard
    vGuestStar : Gwilym Havard Davies
    vGuestStar : Cathryn Davies
    vGuestStar : Jams Thomas
    vGuestStar : Dion Davis
    vGuestStar : Gwyn Vaughan-Jones
    vGuestStar : Jason May
    vGuestStar : Tom Price
    vGuestStar : Guy Lewis
    vGuestStar : Rhys Swinburn
    vGuestStar : Olwen Medi
    vActor : John Barrowman
    vActor : Eve Myles
    vActor : Gareth David-Lloyd
    vActor : Naoko Mori
    vActor : Burn Gorman
    I have trouble reading through python code since I am not a programmer, but what I wrote before is not correct. I think it was displaying title:episodeTitle whereas I would like it to just be episodeTitle or to sort by filename.
     
  3. May 24, 2011 #83 of 735
    jcthorne

    jcthorne Active Member

    2,720
    3
    Jan 28, 2002
    Houston
    I never had much luck with pytivometathis and stuck with metagenerator. My metadata files only have episode data in the episodeNumber field. And in the file name but the file names are not all consistant from one tv series to the next. Although and alpha sort of the file name or episodeNumber either one would work in my case.

    I think perhaps would like to see video manager display the episode number and sort for it for items with isEpisode = true. That might work in both cases?

    Just noticed another difference between metagenerator data and yours from pytivometathis. for metagenerator, title and seriestitle are the same, only episode title contains the episode title information.
     
  4. May 24, 2011 #84 of 735
    txporter

    txporter One sec, almost done

    666
    0
    Sep 17, 2006
    Austin, TX
    Yes, metagenerator and pytivometathis do have different information in the different fields. I used to use metagenerator (and still do in the times when pytivometathis cannot grab the show correctly), which makes the alphabetical jumble even worse.

    I transcode all of my own shows, which makes the filename consist at least for me. That would be my preferred approach (which I believe is what pytivo does??). I think sorting by episodenumber might also work like you say. Not sure what my Movies folder would look like exactly...but that is sort of a mess anyhow. I have both .mpg and .mp4 files in that folder and pytivo currently sorts those lists separately (.mp4 sorted alphabetically first and then .mpg listed alphabetically). Dunno.
     
  5. May 24, 2011 #85 of 735
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    When I originally wrote this program, I was developing based on my own library which consists mostly of movies - no episode numbers there. However, I can see where this can be useful. I just want to find out how it should be done. I have to write my program to be general. I can't say I want to sort on episode numbers because that does not indicate what should happen to those files that do not have an episode number, or what about those files that don't even have a metafile?

    Here's what I presently do:

    1) If I have episode title and series title, then the string seriestitle:episodetitle is the key.
    2) If I only have episode title it is the key
    3) If I only have series title it is the key
    4) Otherwise the filename is the key.

    Once I've determined the key for everything, I sort into key order putting directories first.

    I can certainly add an option to sort on file name only beacuse that is a universal attribute. The question is how and where to consider the episode number. It probably makes sense to consider the episode number OR the episode name, but not both. SO I would propose adding two entries to the front of the above list

    -1) If I have episode number and series title, the the string series title:episode number is the key.
    0) If I only have the episode number, then it is the key.

    and then the above list. I can add an option to ignore the episode number too, to keep with the original algorithm

    This will create screwy things if the meta data is weird and you have some that have an episode number and some that don't for example. Garbage in - garbage out.

    There is another potential issue here: episode number is not always a numeric value. I've seen things like E01, or even S01E07. I don't think I want to parse this string to get the numeric values, so I'd like to treat it as a string. The problem with this is that "10" sorts before "2" which of course is not what you want. People would have to enter their episode numbers with a consistent length (e.g. 01, 02, 03, ... if there are more than 9).

    Would this suffice? Let me know. I'm probably not going to get to this until after Memorial Day, but this will give us a few days to better define the scope.
     
  6. May 24, 2011 #86 of 735
    txporter

    txporter One sec, almost done

    666
    0
    Sep 17, 2006
    Austin, TX
    I like your list and the ability to ignore episode number with a setting.

    How hard is it to add a setting for what metadata string to display on the Tivo? I organize most everything by series (I have a bunch of folders based on series name) since most of what we watch are TV shows rather than movies. I would prefer to set something so that I only see the episodeTitle for videos that have 'isEpisode : true' and only title for everything else.

    Then a similar setting could be made for sorting. Sort based on filenames or metadata.

    Thanks for your work! This is a really cool piece of software. I currently never pull anything with pytivo anymore. I only navigate to my shares when I want to look to see what is available. I then log in with my iphone to push the episodes that I want to watch. This shortcuts all of that. Very nice.
     
  7. May 24, 2011 #87 of 735
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    I'm glad it turned out useful. My original purpose was just to explore the HME and hopefullly provide an example that others might benefit from. I think that wmcbrine has done us all a big favor by porting all of this to python. It really provides a nice application development environment.
     
  8. May 24, 2011 #88 of 735
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    I can certainly think about alternate display formats. Right now the sort value and the display text are basically the same thing. I was thinking I'd have to separate these two to have the various sort options, and if I'm going to separate them, it shouldn't prove too tough to have alternatives for display. Again, I'll think on it for a few days while I'm at the shore; we'll probably have something towards the middle to end of next week. I want to explore reneg's issue too - that has be perplexed right now, so I've got to do some debugging there.
     
  9. May 24, 2011 #89 of 735
    reneg

    reneg Member

    699
    0
    Jun 19, 2002
    I think you can check the force_alpha option from the pyTivo.conf file which is a per share option (see get_files in plugin.py). Ideally, I'd like to see episodeTitle & episodeNumber displayed if possible. I make a one line change in the pytivo template to display filename instead of title since my filenames contain SxxExx data so I don't have to drill down another level to see episode number data.

    Streambaby has an option, sort.filename=true
     
  10. May 24, 2011 #90 of 735
    reneg

    reneg Member

    699
    0
    Jun 19, 2002
    Maybe this will help, I put a few prints. I hit the channel down key once, and then pressed the select key on the top entry on the second page. I think the problem is in drawScreenList.
    Code:
    C:\pyhme>c:\python26\python start.py
    HME Server for Python 0.19
    Not using Zeroconf:
    Tue May 24 20:07:06 2011 Server Starts
    192.168.1.92:51674 - - [24/May/2011 20:07:24] "GET /vidmgr/icon.png HTTP/1.0" 20
    0 -
    192.168.1.92:51752 - - [24/May/2011 20:07:36] "GET /vidmgr/ HTTP/1.1" 200 -
    192.168.1.92:51752 - - [24/May/2011 20:07:36] Starting HME: vidmgr
    Enter pressShares: shareSelection =  0  shareOffset =  0
    Exit  pressShares: shareSelection =  0  shareOffset =  12
    Enter pressShares: shareSelection =  0  shareOffset =  12
    Enter drawScreenList: shareSelection =  0  shareOffset =  12
    Exit  pressShares: shareSelection =  0  shareOffset =  12
    Enter pressShares: shareSelection =  0  shareOffset =  12
    Exit  pressShares: shareSelection =  0  shareOffset =  12
    192.168.1.92:51752 - - [24/May/2011 20:08:28] Ending HME: vidmgr
    192.168.1.92:51756 - - [24/May/2011 20:08:29] "GET /vidmgr/icon.png HTTP/1.0" 20
    0 -
    
     
  11. May 24, 2011 #91 of 735
    jbernardis

    jbernardis New Member

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

    I figured it out and it is a simple 1 line fix. The problem is, that I am also making major changes to the program to allow for various display and sorting options. I don't want to deliver these yet because 1) I am not quite finished, and 2) I want to do a LOT of testing before I deliver.

    In the meantime, you can make the fix yourself if you are comfortable with it. In the createListing subroutine, a few lines below the cmplist routine, you will see a line like this:
    Code:
    root = self.share[self.shareSelection]['path']
    change this to

    Code:
    root = self.share[self.shareSelection+self.shareOffset]['path']
    
    Be careful not to change indentation and you should be in business.

    I will be delivering this in a few days.
     
  12. May 24, 2011 #92 of 735
    reneg

    reneg Member

    699
    0
    Jun 19, 2002
    Thanks. That fixed the listings, but the sub-title needs a tweak too in drawScreenList:
    Code:
    		self.SubTitleView.set_text(self.share[self.shareSelection]['name'] + ":" + self.currentDir,
    								font=self.fonts.fnt20,
    								colornum=0xffffff, flags=RSRC_VALIGN_BOTTOM)
    
    to
    Code:
    		self.SubTitleView.set_text(self.share[self.shareOffset+self.shareSelection]['name'] + ":" + self.currentDir,
    								font=self.fonts.fnt20,
    								colornum=0xffffff, flags=RSRC_VALIGN_BOTTOM)
    
     
  13. May 24, 2011 #93 of 735
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    You're absolutely right - thanks for finding this.

    But that's not the only other place - two places at the beginning of DelVideo, and the two places where pushVideo is called from need the same fix.

    Damn - I'd like to deliver this instead of just telling you to just make these changes, but I have made significant other changes to the code for the other requests and I can't release it at this time.

    All I can say at this point is I will try to get this out by Wednesday, Thursday at the latest. In the meantime all I can tell the community at large is that this is only an issue if you have more than 1 page of shares. If this is your situation, you don't need to make any changes - wait for the update.
     
  14. May 24, 2011 #94 of 735
    reneg

    reneg Member

    699
    0
    Jun 19, 2002
    No rush, I can wait.

    I do have a feature request to consider. Could you check for a background image in each directory as you navigate into it and load it if there is one present? For TV series, I think I'd rather have one background image of the series vs an image for each episode.
     
  15. May 25, 2011 #95 of 735
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    You can already do that - if you have a file named folder.jpg - either in the same directory with the files or in a .meta subdirectory, then it will use that. Of course of you have an image file for a specific video, it will use THAT before using the folder file.
     
  16. May 25, 2011 #96 of 735
    jbernardis

    jbernardis New Member

    1,072
    0
    Oct 21, 2003
    Princeton NJ
    Alright - I worked on this sooner that I had planned because I wanted to get the fix out there. I haven't released it yet, but I want to hear people's thoughts.

    With the new logic, you can specify two new options in the config.ini file, display= and sort=

    sort controls how the video files are sorted. If it is omitted or is given a value of "normal" then the present mechanism will be used. To be specific, it is as follows:

    • title:episodetitle
      episodetitle
      title
      filename

    If you specify 'fileonly' then only the filename is used

    If you specify 'episodenumber' then the above list is preceded by

    • title:episodenumber
      episodenumber


    For display, if you specify 'fileonly; then only the file name is displayed

    if you specify 'episodetitle' then the following list is used:

    • episodetitle
      title
      filename

    if you specify 'episodenumname' then the following list is used:

    • episodenumber - episodetitle
      episodetitle
      title
      filename

    otherwise, the algorithm of today is used:

    • title:episodetitle
      episodetitle
      title
      filename


    The lists all show the order of processing. I start at the top of the list. If I do not have ALL of the meta items to build that string, I move down to the next entry in the list.
     
  17. May 25, 2011 #97 of 735
    reneg

    reneg Member

    699
    0
    Jun 19, 2002
    Oops, there it is right in the readme.

    Your sorting & display options seem flexible enough. Will try them when it's available
     
  18. May 25, 2011 #98 of 735
    jcthorne

    jcthorne Active Member

    2,720
    3
    Jan 28, 2002
    Houston
    You have been busy! WOW. The options presented surely cover what I need and sounds like most of the others. This is great. Look forward to the update!
     
  19. May 26, 2011 #99 of 735
    orangeboy

    orangeboy yes, I AM orangeboy!

    4,083
    0
    Apr 19, 2004
    East Moline, IL
    I'm glad to see that it appears you've changed your perspective a bit since starting this project! Thank you for making this available! :up:
     
  20. windracer

    windracer joined the 10k club

    11,580
    3
    Jan 3, 2003
    St. Pete, FL
    I'm willing to beta test the sorting changes as well. Most of my episodic videos filenames are using the SxxExx nomenclature so they sort "alphabetically" in episode order (using force_alpha = true in pyTivo.conf).
     

Share This Page