Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jambalaya
Channel Surfer

Re: My Media - Your Music and Video on the Roku DVP

JT, since you are working on a new release I have another improvement suggestion. How about replacing the eye3D library with mutagen? The mutagen library handles tag reading on many file types (not just mp3's). I adapted a demo program to show the equivalent of the eye3D calls that you currently have in file2item:

#!/usr/bin/env python
# Full tag list for any given file.

import os
import sys

from optparse import OptionParser

def main(argv):
from mutagen import File

parser = OptionParser()
(options, args) = parser.parse_args(argv[1:])
if not args:
raise SystemExit(parser.print_help() or 1)

for filename in args:
print
print "--", filename
print

try: audio = File(filename, easy=True)
except AttributeError: print "Unknown file type"
except KeyboardInterrupt: raise
except Exception, err: print str(err)

try: print "Title = ", audio["title"][0]
except Exception: print
try: print "Description = ", audio["artist"][0]
except Exception: print
try: print "Album = ", audio["album"][0]
except Exception: print
try: print "Playtime = ", audio.info.length
except Exception: print
try: print "Bitrate = ", audio.info.bitrate
except Exception: print
try: print "Filetype = ", os.path.splitext(filename)[1][1:]
except Exception: print
try: print "Mimetype = ", audio.mime[0]
except Exception: print
try: print "Tracknum = ", audio["tracknumber"][0]
except Exception: print
try: print "Release Date = ", audio["date"][0]
except Exception: print

if __name__ == "__main__":
try: import mutagen
except ImportError:
# Run out of tools/
sys.path.append(os.path.abspath("../"))
import mutagen
main(sys.argv)


Here is sample output for both a .m4a and a .mp3 file. As you can see the library figures out the file type, so no need to have code branches:

-- C:\Documents and Settings\bis63083\My Documents\My Music\iTunes\iTunes Media\Music\ADELE\21\01 Rolling In the Deep.m4a

Title = Rolling In the Deep
Description = ADELE
Album = 21
Playtime = 228.345034014
Bitrate = 256000
Filetype = m4a
Mimetype = audio/mp4
Tracknum = 1/12
Release Date = 2011-02-22T08:00:00Z

-- C:\Documents and Settings\bis63083\My Documents\My Music\iTunes\iTunes Media\Music\Air Supply\Greatest Hits Live Now & Forever\01 Making Love Out of Nothing at All.mp3

Title = Making Love Out of Nothing at All
Description = Air Supply
Album = Greatest Hits Live Now & Forever
Playtime = 346.446854799
Bitrate = 128000
Filetype = mp3
Mimetype = audio/mp3
Tracknum = 1
Release Date =


I won't be offended if you think the change is too drastic to incorporate (especially since I am probably in the minority with my .m4a collection).
Cheers
-JB
0 Kudos
renojim
Community Streaming Expert

Re: My Media - Your Music and Video on the Roku DVP

JB, that looks good! I'll look into it more once the holidays are over. For the record and to give proper credit, el.wubo did the vast majority of the Python server code while I did most of the channel code. There's been several other contributors on one level or another. el.wubo has mostly moved on, but he does check in every once in a while.

I really need to finalize v2.0 and get everything into github, so that will be my New Year's resolution. Smiley LOL

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
renojim
Community Streaming Expert

Re: My Media - Your Music and Video on the Roku DVP

"jimcampbell100" wrote:
Interesting. I point to that URL, and it just says "None".

I see the images directory and file you reference when I browse the client directory on the NAS.

That's odd. I picked that file because it was sure to be there and it looks like you're able to find it, so I'm not sure why it's not coming up. Make sure you copied and pasted the URL properly, just replacing the IP address. You might also want to look at the my_media_log.txt file. There should be a line that reads "DEBUG:root:file ..\client\images/folder_square.jpg doesn't exist" if the server really tried to serve the file and it wasn't there.

"jimcampbell100" wrote:
Let me ask in case I'm doing something wrong - to install I just copied the entire contents of you zip to a directory on my NAS. From the command line I then execute the mymedia.py in the server directory. Anything else I need to do?

That's it.

"jimcampbell100" wrote:
To answer your question, my directories are setup as one top level Videos directory, with about 40 sub-directories, each with one movie each. There are a few images in each, front and back cover of the DVD case, for example.

That should be fine. I'll try to do a test myself with a configuration similar to yours just to make sure there's not something I'm missing.

"jimcampbell100" wrote:
Thanks again for the help!

No problem.

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
jimcampbell100
Channel Surfer

Re: My Media - Your Music and Video on the Roku DVP

Yes, I tried it again, and the url is correct.

When I use that url, I get the following in the console window where I run mymedia.py on the server:

192.168.1.190:58657 - - [22/Dec/2011 12:43:08] "HTTP/1.1 GET /media" - 200 OK
192.168.1.190:58657 - - [22/Dec/2011 12:43:09] "HTTP/1.1 GET /favicon.ico" - 404 Not Found

Nothing is added to the my_media_log.txt file when I enter that url.

Note that when I try to enter the url, the browser returns a page that actually says "None". It's not a typical 404 error.

Thanks!
0 Kudos
umbighouse
Visitor

Re: My Media - Your Music and Video on the Roku DVP

Jim-

Looks like you've been the proud owner of this project for the past year or so. I wanted to see how tough you think the following feature might be.

For video artwork, I've used other programs which will show a thumbnail of the video which appears to be an image of the first frame. Is this possible with MyMedia? If not out of the box, how tough would it be to autocreate a jpg in the video file's folder, naming it the same as the video with a .jpg extension?

This would add some visual interest so all the icons don't look the same.

OK, I'm getting greedy here, but here's another one...
How about we create a Movies folder (this would be different from Videos, which would be primarily private content). The Movies folder would be actual movies. How tough would it be to setup a "scraper" to reference a site like IMDB.com to pull down poster artwork?

The gears in my head heave been spinning! Hope all is well.

-umbighouse
0 Kudos
jimcampbell100
Channel Surfer

Re: My Media - Your Music and Video on the Roku DVP

"jimcampbell100" wrote:
Yes, I tried it again, and the url is correct.

When I use that url, I get the following in the console window where I run mymedia.py on the server:

192.168.1.190:58657 - - [22/Dec/2011 12:43:08] "HTTP/1.1 GET /media" - 200 OK
192.168.1.190:58657 - - [22/Dec/2011 12:43:09] "HTTP/1.1 GET /favicon.ico" - 404 Not Found

Nothing is added to the my_media_log.txt file when I enter that url.

Note that when I try to enter the url, the browser returns a page that actually says "None". It's not a typical 404 error.

Thanks!


I was actually using the name of my NAS vs the direct IP address as you told me (btw this works for loading the configuration page). When I switched to the IP address, I did see the image, and it did resize when I added that to the end of the url.
0 Kudos
jambalaya
Channel Surfer

Re: My Media - Your Music and Video on the Roku DVP

I don't know if anyone else has this problem, but my handbrake-encoded videos randomly exit after about half an hour or so. I can resume playing and the videos continue on normally until the next unexpected exit. There is nothing in the logs to indicate a problem. My videos are encoded with constant quality = 20 rather than constant bitrate, so on a hunch I edited the chunk size in mymedia.py from:

CHUNK_SIZE = 10 * 1024;


to:

CHUNK_SIZE = 16 * 1024;


So far, this appears to have fixed the early exit problem! Videos that previously exited early now play all the way through. Just offering this up in case someone else has similar symptoms.

JB
0 Kudos
renojim
Community Streaming Expert

Re: My Media - Your Music and Video on the Roku DVP

"jimcampbell100" wrote:
I was actually using the name of my NAS vs the direct IP address as you told me (btw this works for loading the configuration page). When I switched to the IP address, I did see the image, and it did resize when I added that to the end of the url.

Well I actually said to replace the IP address I used in my example with the IP of your NAS. I didn't know it had a name. I guess I should have said "IP address". Either way, it looks PIL is working properly, so now I'm at a loss. I tried replicating your setup and it worked fine. If you have 40 top level directories they should be getting split up into something like "A-F", "G-H", etc. I'm not sure what else to try except maybe to run the server on a computer and see if it makes a difference. One other thing, make sure you reboot your Roku just to make sure there's not something going on with it.

As I said before, this slow navigation thing is tough to track down. I have a directory where I've ripped all my Looney Tunes DVDs into individual cartoons, so there's a few hundred videos each with its own image and I can move from video to video about as quickly as I can push the buttons.

Sorry I can't be more help.
-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
renojim
Community Streaming Expert

Re: My Media - Your Music and Video on the Roku DVP

"umbighouse" wrote:
Jim-

Looks like you've been the proud owner of this project for the past year or so. I wanted to see how tough you think the following feature might be.

umbighouse! Good to hear from you!

"umbighouse" wrote:
For video artwork, I've used other programs which will show a thumbnail of the video which appears to be an image of the first frame. Is this possible with MyMedia? If not out of the box, how tough would it be to autocreate a jpg in the video file's folder, naming it the same as the video with a .jpg extension?

I suppose anything is possible, but I'd have to wonder how useful it would be to just show the first frame. It's hardly automatic, but I use ffmpeg to create frames every two seconds from the first 30 seconds of the video and then I manually look through them to find the frame I want to use for the video. You do know that naming a JPEG with the same name as the video will get that image to be displayed for the video, right?

"umbighouse" wrote:
OK, I'm getting greedy here, but here's another one...
How about we create a Movies folder (this would be different from Videos, which would be primarily private content). The Movies folder would be actual movies. How tough would it be to setup a "scraper" to reference a site like IMDB.com to pull down poster artwork?

Hmm... IMDB has been mentioned before. I'll have to look into what that would take. I don't have all that many movies, so it hasn't been all that interesting an idea, but I have thought about ripping all my DVDs. I don't think a Movies folder would be necessary, but that might not be a bad idea. Depending on how IMDB queries work, a lookup could be done for every video and if there's information returned it would get displayed, otherwise the video would just start playing. That might be a waste to do a lookup when there's not going to be a response, so the Movies folder idea might be better. Like I said, I'll have to look into it.

"umbighouse" wrote:
The gears in my head heave been spinning! Hope all is well.

-umbighouse

Hope all is well with you, too!
-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
renojim
Community Streaming Expert

Re: My Media - Your Music and Video on the Roku DVP

"jambalaya" wrote:
I don't know if anyone else has this problem, but my handbrake-encoded videos randomly exit after about half an hour or so. I can resume playing and the videos continue on normally until the next unexpected exit. There is nothing in the logs to indicate a problem. My videos are encoded with constant quality = 20 rather than constant bitrate, so on a hunch I edited the chunk size in mymedia.py from:

CHUNK_SIZE = 10 * 1024;


to:

CHUNK_SIZE = 16 * 1024;


So far, this appears to have fixed the early exit problem! Videos that previously exited early now play all the way through. Just offering this up in case someone else has similar symptoms.

JB

Interesting. You're the first to report this. I mostly watch videos that are shorter than an hour, but I've never seen this problem. I'll change the chunk size when I polish up v2.0. I'm not sure how that value was picked, but el.wubo may have had a reason or it may have been arbitrary.

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.