Bugs item #1621220, was opened at 2006-12-23 11:53
Message generated for change (Comment added) made by duncanwebb
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=446895&aid=1621220&group_id=46652

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: video
Group: 1.x svn (rel-1)
>Status: Pending
Resolution: Accepted
Priority: 5
Private: No
Submitted By: Gorka Olaizola (gorka)
Assigned to: Nobody/Anonymous (nobody)
Summary: Sum length of subitems and manual aspect

Initial Comment:
The attached patch adds the length of the subitems to the runtime information 
and adds a manual calculated aspect ratio if the file has no embedded aspect 
ratio.
It also corrects the removal of the line x.files = FileInformation() that I 
thought it was not important but without it Freevo crashes when showing the 
submenu of an item with subitems.

----------------------------------------------------------------------

>Comment By: Duncan Webb (duncanwebb)
Date: 2006-12-29 16:07

Message:
Logged In: YES 
user_id=104395
Originator: NO

Patch applied to rel-1 at r8857

A time starting with min(utes), ':', '/' are probably invalid.
if length.find(...) > 0:

May be best in all cases.

----------------------------------------------------------------------

Comment By: Gorka Olaizola (gorka)
Date: 2006-12-29 01:17

Message:
Logged In: YES 
user_id=309801
Originator: YES

I think that the code of my latest patch for calculation of runtime is
broken.

First: If the .fxd has only one file no runtime is shown.
Second: After I have read video/fxdhandler.py I think that if an .fxd file
has the runtime field, the length of the subitems should not be processed
at all because the runtime field of the .fxd is already the sum of the
runtime of all the files.

As I see there are 3 possible cases:

1. fxd exists and its associated videoitem has self.info['runtime']
2. item is an autojoined item that span 2 or more files or an .fxd with 2
or more files but without runtime field. The videoitem has the subitems
property in both cases with all the files that span that videoitem.
3. videoitem is one file or an .fxd with only one file but no runtime
field. These videoitems have no subitems property.

In the files I have (only .avi) the options 2 and 3 have only
self.info['length'].
Is it possible for these options to have self.info['runtime']? I think it
isn't but I'm not sure.

If an .fxd file exists that span 1 or more files the .fxd metadata is
shown in the menu. The information of the individual files is not
processed at all because is expected that the runtime field has the
runtime of all the files. The code that gets called is in fxdhandler.py
and the "autojoin" code in video/__init__.py is not called for filenames
that can be autojoined.

I've attached a patch that sets the code to this hypothesis. In my system
it works perfectly with autojoined files, retrieving info from imdb in
videoitems that are two autojoined files and in videoitems that have only
one file.

The only problem I can see is what happens if individual files not called
from a .fxd have self.info['runtime'] in the metadata. I think this case
is impossible but I bet even Dischi doesn't know.

I hope this is my latest patch for this issue :-). At least in my system
videoitems with multiple files seem to work correctly.
File Added: videoitem-calculate-proper-runtime.diff

----------------------------------------------------------------------

Comment By: Duncan Webb (duncanwebb)
Date: 2006-12-27 00:00

Message:
Logged In: YES 
user_id=104395
Originator: NO

FileInformation() put back in rel-1 at r8814

----------------------------------------------------------------------

Comment By: Gorka Olaizola (gorka)
Date: 2006-12-26 21:28

Message:
Logged In: YES 
user_id=309801
Originator: YES

In r8812 I get this traceback when showing the submenu. The shoppingcart
plugin needs a method found in the FileInformation class.

Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/freevo/main.py", line 285, in
eventhandler
    app.eventhandler(event)
  File "/usr/lib/python2.4/site-packages/freevo/menu.py", line 643, in
eventhandler
    for a in p.actions(menu.selected):
  File "/usr/lib/python2.4/site-packages/freevo/plugins/shoppingcart.py",
line 120, in actions
    elif hasattr(item, 'files') and item.files and
item.files.copy_possible() and \
AttributeError: 'list' object has no attribute 'copy_possible'


This patch corrects it:

--- src/video/__init__.py       (revision 8812)
+++ src/video/__init__.py       (working copy)
@@ -125,8 +125,8 @@
                         # create new name
                         name = file[:pos] + file[pos:].replace('1',
'1-%s' % end, 1)
                         x = VideoItem(name, parent)
+                        x.files = FileInformation()
                         x.set_url(file, True)
-                        x.files = []
                         for f in [ file ] + add_file:
                             x.files.append(f)
                             x.subitems.append(VideoItem(f, x))

----------------------------------------------------------------------

Comment By: Duncan Webb (duncanwebb)
Date: 2006-12-25 23:39

Message:
Logged In: YES 
user_id=104395
Originator: NO

Thanks, the correction is now in svn rel-1 at r8805.

I have just done a quick test, the runtime field comes directly from the
fxd file and AFAICS is a string of minutes. rel-1 has now been updated to
check this and break.

Here's an example that can cause this.
<?xml version="1.0" ?>
<freevo>
  <movie title="Video Sequence">
    <cover-img
source="http://url/to/cover/provider";>MyMovie.jpg</cover-img>
    <video>
      <file id="part01" name="My Video, Part 1">clips001.avi</file>
      <file id="part02" name="My Video, Part 2">clips003.avi</file>
      <file id="part03" name="My Video, Part 3">clips004.avi</file>
      <file id="part04" name="My Video, Part 4">clips005.avi</file>
      <file id="part05" name="My Video, Part 5">clips006.avi</file>
      <file id="part06" name="My Video, Part 6">clips007.avi</file>
      <file id="part07" name="My Video, Part 7">clips008.avi</file>
      <file id="part08" name="My Video, Part 8">clips009.avi</file>
      <file id="part09" name="My Video, Part 9">clips010.avi</file>
      <file id="part10" name="My Video, Part 10">clips011.avi</file>
      <file id="part11" name="My Video, Part 11">clips012.avi</file>
      <file id="part12" name="My Video, Part 12">clips013.avi</file>
      <file id="part13" name="My Video, Part 13">clips014.avi</file>
      <file id="part14" name="My Video, Part 14">clips015.avi</file>
      <file id="part15" name="My Video, Part 15">clips016.avi</file>
    </video>
    <info>
      <genre>Genre</genre>
      <runtime>123 minutes</runtime>
      <rating>8/10</rating>
      <tagline>The best movie ever!</tagline>
      <plot>Some video clips from my dv camera</plot>
    </info>
  </movie>
</freevo>


----------------------------------------------------------------------

Comment By: Gorka Olaizola (gorka)
Date: 2006-12-25 22:37

Message:
Logged In: YES 
user_id=309801
Originator: YES

Yes, the patch to the __init__.py file corrects those lines that now don't
work properly with virtual joined menu entries.

With "x.files = []", at least on my system, Freevo crashes when requesting
the submenu in a virtual joined menu entry.
I think the original line some revisions ago was "x.files =
FileInformation()", not x.files = []. The line "x.set_url(file, False)"
should be True also to show information about the joined files.

With the patch applied to the latest revision of rel-1 all works correctly
on my system.

----------------------------------------------------------------------

Comment By: Duncan Webb (duncanwebb)
Date: 2006-12-25 21:57

Message:
Logged In: YES 
user_id=104395
Originator: NO

- x.set_url(file, False)
+ x.set_url(file, True)

This part of the patch was rejected because I had spotted the removal of
x.files = FileInformation() and added the empty list back.

Is this is what is missing?

BTW you learn from the tips and I'm no Python expert either :) Wasn't
blaming anybody


----------------------------------------------------------------------

Comment By: Gorka Olaizola (gorka)
Date: 2006-12-25 14:45

Message:
Logged In: YES 
user_id=309801
Originator: YES

It seems that the part of the patch that modifies video/__init__.py is not
applied to r8796.

Thanks for the tips about better coding. I don't know too much python and
I've based my code in the one that is already written. The isinstance()
parts, and so, were in the code before I add my part. So blame another one
about bad coding :-D

----------------------------------------------------------------------

Comment By: Duncan Webb (duncanwebb)
Date: 2006-12-23 13:43

Message:
Logged In: YES 
user_id=104395
Originator: NO

Nice patch, thanks

The patch has been applied to rel-1 at r8794, with some minor
modifications.

You don't mind if I make some comments?
if s.info['runtime'] and s.info['runtime'] != 'None':
can be shortened to:
if s.info['runtime']:
because, while None is not the same as 0 (zero) they both evaluate to
False.

The if isinstance(): calls are simplier when they are try: except:
blocks.

tehe, unusually had spotted the x.files = [] error, should have mentioned
it. You may get a conflict when svn update is run.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=446895&aid=1621220&group_id=46652

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to