could this not be a source of confuse? if a missing file is not an error, but 
a feature? what about if I write the file name wrong, will I find out the 
problem anymore?
I would prefere a None or an empty filename...
Andreas

Am Donnerstag, 20. Dezember 2007 21:03 schrieb Jonathan Isom:
> On Dec 20, 2007 1:52 PM, Duncan Webb <[EMAIL PROTECTED]> wrote:
> > Evan Hisey wrote:
> > > Duncan-
> > >   I had an idea about how to handle the generic game option. My python
> > > is not good enough to yet to handle the changes but I will outline the
> > > idea for you.
> > >
> > >  With line 73 uncommented the following works
> > > GAMES_ITEMS = [
> > >  ('NINTENDO', '/mnt/anime/NES',
> > >  ('GENERIC','/usr/bin/tuxnes','-1/dev/input/j0 -2/dev/input/j1
> > >  -u -rsdl','',[ 'NES','nes']))
> > >  ]
> > >
> > > But the following does not.
> > > GAMES_ITEMS = [
> > >      ('Kasteroids', '/etc/freevo/games/',
> > >                  ('GENERIC', '/usr/bin/kasteroids', '', '', ['kas']))
> > >  ]
> > >
> > > The problem is that the current generic.py passes the game selection
> > > to the play command and to do this requires a game file. I think a
> > > better solution would look to work like this:
> > > GAMES_ITEMS = [
> > >      ('Kasteroids', '',('GENERIC', '/usr/bin/kasteroids', '', '',
> > > None)) ]
> > > This way when genericitem.py is called it checks the the Suffix to see
> > > if it is needed or not. If the suffix is None then run the cmd+args
> > > instead of getting a file list. If I understand the _init_.py call to
> > > genericitem.py correct, it's default action is to call util.py and run
> > > a search to create a menu list of "games" to run.  If instead it
> > > checked for a suffix it will know if it should just run the cmd+args
> > > or do a listing. I have started looking at the code and it seems like
> > > it needs to be added to the games/_init_.py but I am not sure it may
> > > need to be added to game.py or genericitem.py
> > >
> > > Evan
> > >
> > > P.S> I am going to have make better dev setup for this one :(
> >
> > The solution may be very simple, if the size of the file is bigger than
> > 0 bytes then append the file.
> >
> > Index: src/games/genericitem.py
> > ===================================================================
> > --- src/games/genericitem.py    (revision 10218)
> > +++ src/games/genericitem.py    (working copy)
> > @@ -60,9 +60,7 @@
> >          self.name = os.path.splitext(os.path.basename(file))[0]
> >
> >          # find image for this file
> > -        # find image for this file
> > -        shot = imgpath + '/' + \
> > -               os.path.splitext(os.path.basename(file))[0] + ".png"
> > +        shot = imgpath + '/' +
> > os.path.splitext(os.path.basename(file))[0] + ".png"
> >          if os.path.isfile(shot):
> >              self.image = shot
> >          elif os.path.isfile(os.path.splitext(file)[0] + ".png"):
> > @@ -70,7 +68,8 @@
> >
> >          command = ['--prio=%s' % config.GAMES_NICE, cmd]
> >          command.extend(args.split())
> > -        #command.append(file)
> > +        if os.path.getsize(file) > 0:
> > +            command.append(file)
> >
> >          self.command = command
> >
> >
> > Duncan
>
> or if the file exists would work as well
>
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Microsoft
> > Defy all challenges. Microsoft(R) Visual Studio 2005.
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > _______________________________________________
> >
> > Freevo-users mailing list
> > Freevo-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/freevo-users
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Freevo-users mailing list
> Freevo-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freevo-users

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-users mailing list
Freevo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to