Page 1 of 7 123 ... LastLast
Results 1 to 10 of 67

Thread: HOWTO: View NFO files

  1. #1
    Join Date
    Dec 2004
    Location
    Finland
    Beans
    398

    HOWTO: View NFO files

    Update 2007-08-16:

    Visit the new home page of NFO Viewer. This HOWTO is now obsolete.
    http://home.gna.org/nfoview/



    NFO files are "ASCII-art" with the cp437 codepage, which includes a lot line- and block characters. To view the "ASCII-art" of NFO files correctly, it is enough to use the right encoding and font. As you might not want to set your normal text editor for those settings or perhaps your normal text editor is too slow to start, you can use a separate application written by me for viewing NFO files. Unlike text editors, NFOview will also allow you to click on links that appear in the text. This HOWTO will will walk you through setting that up.

    The application I have written is very simple. It is not an editor, just a viewer. A text view widget in a window. No menubar, no toolbar, no statusbar, no buttons. Should be as fast as it gets with Python and GTK.

    Screenshot with some random NFO file:


    Part 1: Setting up nfoview

    1.1 Install packages "python" and "python-gtk2" if you don't have them already.

    1.2 Get the Lucida Console P font
    Code:
    cd ~/.fonts && wget http://home.online.no/~aageli/luconP.ttf
    Lucida Console P has support for all the cp437 codepage characters. monospace font works as well, but it doesn't have all the characters.

    1.3 Download the nfoview script
    http://users.tkk.fi/~otsaloma/scripts/nfoview

    Put it for example in ~/bin or some place that's in your $PATH and give it execute permissions.

    1.4 Test it
    Code:
    nfoview file.nfo
    1.5 Edit the settings in file ~/.nfoview if needed.

    Part 2: Setting up file-associations

    This section works at least in GNOME and should probably work in any desktop encironment that adheres to the FreeDesktop.org standards. In the instructions, just replace Nautilus with your preferred filemanager if you don't use GNOME.

    2.1 Add a mime-type for NFO files.

    Code:
    gedit ~/.local/share/mime/packages/Override.xml
    Make the file look the following (but don't remove other possible entries you might have):
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
    
    <mime-type type="text/x-extension-nfo">
    	<comment>NFO document</comment>
    	<glob pattern="*.nfo"/>
    </mime-type>
    
    </mime-info>
    Note: I'm not sure if that should best be "text/x-extension-nfo" or "application/x-extension-nfo" or perhaps something else.

    2.2 Rebuild the mime-type database. The changes should be instant-applied, but if not try logging out and logging back in.
    Code:
    update-mime-database ~/.local/share/mime
    2.3 Right click an NFO file in Nautilus. The mime-type should now be "text/x-extension-nfo".

    2.4 Add a desktop file.

    Code:
    gedit ~/.local/share/applications/nfoview.desktop
    Paste the following. Fix the path on the "Exec" line and add translations if you wish.
    Code:
    [Desktop Entry]
    Encoding=UTF-8
    Name=NFOview
    Comment=View NFO files
    MimeType=text/x-extension-nfo;
    Exec=/home/osmo/bin/nfoview
    Type=Application
    Terminal=false
    NoDisplay=true
    2.5 Right click an NFO file in Nautilus. You should now see an entry "Open with NFOview". If not, right click and go to Properties -> Open with -> Add -> Use other command.

    2.6 Set a mime-type icon.

    Place your preferred icon in your icon theme's folder as "scalable/mimetypes/gnome-mime-text-x-extension-nfo.png". You might need to refresh the icons by for example changing your icon theme to something else and then changing it back.

    Notes: Using the "scalable" directory will change the icon for 32x32 and 48x48 icons with GNOME 2.16 default icon theme. The most elegant way to add custom icons indepedent of the icon theme you're currently using would probably be to create a new icon theme with your custom icons and have that inherit whatever icon theme you wish to use.
    Last edited by ow50; August 16th, 2007 at 12:37 AM.

  2. #2
    Join Date
    Aug 2005
    Beans
    994

    Re: HOWTO: View NFO files

    works great!

    here's a screenshot of my custom colors/size:



    and here's a site with all the color codes, if anyone
    needs it: http://www.webdiner.com/annexe/hexcode/hexcode.htm

    been looking for a decent nfo viewer on linux
    for quite awhile - finally!

  3. #3
    Join Date
    Dec 2004
    Beans
    10

    Re: HOWTO: View NFO files

    I didn't see any existing directories for mime stuff for my default user in breezy - so although I created them as per the directions above, I can't seem to get gnome to recognize the association for nfo's. Any suggestions or alternate locations I might look to set the mime type?

  4. #4
    Join Date
    Dec 2004
    Location
    Finland
    Beans
    398

    Re: HOWTO: View NFO files

    Quote Originally Posted by Lukano
    I didn't see any existing directories for mime stuff for my default user in breezy - so although I created them as per the directions above, I can't seem to get gnome to recognize the association for nfo's. Any suggestions or alternate locations I might look to set the mime type?
    Do you mean the steps I numbered as 2.1 and 2.2?
    If yes, the path should be correct as far as I know. I am no expert on mime-types, I have just experimented and found the above to work. There is of course a global directory /usr/share/mime, but you should rather add custom mime-types to your home folder.

  5. #5
    Join Date
    Aug 2005
    Beans
    994

    Re: HOWTO: View NFO files

    I just right-clicked on a .nfo file & changed the assocation in properties>open with. "add" & pointed to the script. works everytime.

  6. #6
    Join Date
    Dec 2004
    Beans
    10

    Re: HOWTO: View NFO files

    Quote Originally Posted by bionnaki
    I just right-clicked on a .nfo file & changed the assocation in properties>open with. "add" & pointed to the script. works everytime.
    Well I got it working with the /usr/share instead of /home/user/ path.

  7. #7
    Join Date
    Aug 2005
    Location
    London, Canada
    Beans
    69

    Re: HOWTO: View NFO files

    Believe it or not, I created a similar program for Windows a couple years ago and it too was named nfoview. I guess coming up with interesting and original program names is harder than one might expect.

    Mine doesn't hold a candle to yours, however. It used the command line to display the file and the arrow keys to scroll. Anyway, I just thought the coincidence was interesting.

  8. #8
    Join Date
    Nov 2004
    Location
    Bern, Switzerland
    Beans
    578

    Re: HOWTO: View NFO files

    that's a nice nfo viewer, thanks

  9. #9
    Join Date
    Jul 2005
    Location
    Umeå, Sweden
    Beans
    90
    Distro
    Ubuntu 6.10 Edgy

    Re: HOWTO: View NFO files

    I've been using this script for a couple of months now. It's neat, but I've often wished I knew Python so I could fix a few things.

    As can be seen in the screenshot bionnaki posted, there are thin white lines beneath every line of text. It looks exactly the same for me. In Hoary there were no lines in exactly this way that I can remember, at least not with the font I used (I can't remember if I switched fonts because of this issue or because of some other reason) but there, in Hoary, I had the problem that if I scrolled up, usually in a jerky way, the white lines would appear.

    Curious about how difficult it would be to create an nfo viewer I made a GUI in Glade and it had no issues with white lines. So this might be an issue with just your script or with Python. But since I'm a terrible coder I didn't manage to make more than a pretty GUI with a preloaded nfo.

    It would be great if this script could be improved to fix the strange white line problem, and perhaps even get some basic checking of height and width of the nfo to set a window of correct proportions, as well as fix the output of badly done and damaged files, such as when there are empty lines at the end or when every other line empty. These files aren't common, but I get them every now and then.

    Oh, and if anyone's interested in getting rid of the thick border around the window, find the line window.set_border_width(12) and change 12 to 0.

    Edit: Making the cursor invisible would be great too. Anyone know how?
    Last edited by pmj; October 30th, 2005 at 06:23 PM.

  10. #10
    Join Date
    Dec 2004
    Location
    Finland
    Beans
    398

    Re: HOWTO: View NFO files

    Quote Originally Posted by pmj
    As can be seen in the screenshot bionnaki posted, there are thin white lines beneath every line of text....
    That is a font and font size issue. With the default font size in the script (9) and the default font (Lucida Console P) I don't get these lines, as you can see the screenshot in my first post. Once I deviate from the size of 9, I get those borders on all sides of all blocks. You could try other fonts if you have problems. I don't see any way this could be a code issue.

    Quote Originally Posted by pmj
    It would be great if this script could be improved to fix the strange white line problem, and perhaps even get some basic checking of height and width of the nfo to set a window of correct proportions, as well as fix the output of badly done and damaged files, such as when there are empty lines at the end or when every other line empty. These files aren't common, but I get them every now and then.
    Your suggestions are worth considering. I'll look into it. I have just gone with the simplest possible, as can be seen from the length of the script.

    Quote Originally Posted by pmj
    Oh, and if anyone's interested in getting rid of the thick border around the window, find the line window.set_border_width(12) and change 12 to 0.
    The 12 pixel border is a GNOME HIG issue, hence my choice to go with that.

    Quote Originally Posted by pmj
    Edit: Making the cursor invisible would be great too. Anyone know how?
    Probably
    text_view.set_editable(False)

Page 1 of 7 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •