On Dec 21, 2007 3:00 AM, Duncan Webb <[EMAIL PROTECTED]> wrote:
> Andreas Dick wrote:
> > 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?
>
> Yes, see below.
>
> > I would prefer a None or an empty filename...
>
> The wiki says that for Linux games create an empty file.
> http://doc.freevo.org/GamesConfig#head-c20066cd58b43b24c1ade7ea73ecd339a0d5b381
>
>
> > 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 won't work, I tried it, the reason is that the file needs to exist
> for the games module to call generic item.
>
> The only problem that I see with this solution is if a games needs the
> file argument even if it is empty.
>
> The "None" solution would be best but this means fixing
> games/__init__.py and games/genericitem.py, the file is tightly bound
> between the two modules and would mean a redesign of genericitem.
>
> Duncan

That is what I thought after more looking. Looks to me like
genericitem needs two classes. One for items that need files like
emulators and one for items that do not like linux games. Modifiy the
games/_init_.py to check for the None and call the correct class
depending o if it si there or not.

Evan

-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to