Custom Plugins

Everything else

Moderators: justauser, MysteryFCM

Mike01
Posts: 3
Joined: Mon Aug 11, 2008 12:18 pm

Custom Plugins

Postby Mike01 » Mon Aug 11, 2008 12:23 pm

First, let me say that i love GreatNews. Think it is the best RSS reader I have ever tried.

I am interested in building on some added functionality. Most of what I want to do is accomplished by grabbing data out of the SQLite database, however I have run into a little snag with the Description field in the News_Item table.

It is saved as a BLOB. When I select that out, and grab the bytes, I have not figured out how to turn it into any meaningful data. I am assuming that is what GN uses to preview the news story.

I am developing using C#. Any advice that could help me to grab the text out of the Description field would be GREATLY appreciated.

Thanks,

Mike01

MysteryFCM
Posts: 143
Joined: Tue Feb 21, 2006 1:56 pm
Location: Tyneside, UK
Contact:

Re: Custom Plugins

Postby MysteryFCM » Mon Aug 11, 2008 3:38 pm

I'm not familiar with C# but something along the lines of the following should work;

Code: Select all

Byte[] byteBLOBData = new Byte[0];
byteBLOBData = (Byte[])(row["[b]DB_ROW[/b]"]);
String s = System.Text.Encoding.UTF8.GetString(byteBLOBData);


Where DB_ROW is the field
Regards
Steven Burn
I.T. Mate / hpHosts
it-mate.co.uk / hosts-file.net

Mike01
Posts: 3
Joined: Mon Aug 11, 2008 12:18 pm

Re: Custom Plugins

Postby Mike01 » Mon Aug 11, 2008 4:25 pm

Yea, that was what I tried. Here is an example of the string returned after I convert the bytes using System.Encoding...

"????????q?G????O|?x?< 9?????c??????M5#?????x?k????*??b?w?I{n?Y?~@?T[?.?k??mcA??Z????.r?U?[?C?<?????-??jH?????z?`h?k??%g?0???????????%?E??"?b>????,?Up&?F?j}muv?????

MysteryFCM
Posts: 143
Joined: Tue Feb 21, 2006 1:56 pm
Location: Tyneside, UK
Contact:

Re: Custom Plugins

Postby MysteryFCM » Mon Aug 11, 2008 4:31 pm

How about this?

Code: Select all

byte[] byteBLOBData = (Byte[])(row["[b]DB_ROW[/b]"]);
String s = System.Text.Encoding.UTF8.GetString(byteBLOBData);


Or using something like this directly in the SQL?

http://www.firebirdfaq.org/faq250/
Regards
Steven Burn
I.T. Mate / hpHosts
it-mate.co.uk / hosts-file.net

Mike01
Posts: 3
Joined: Mon Aug 11, 2008 12:18 pm

Re: Custom Plugins

Postby Mike01 » Mon Aug 11, 2008 4:36 pm

Well, I will keep trying things.. but is it possible to grab actual text from that field? Is that the field that populates the bottom pane on GN? Does GN do something (encrypt, compress) that data for which no matter what I do I will be missing a piece of the puzzle? here is my actual code:

Code: Select all

            SQLiteConnection cn = new SQLiteConnection(@"Data Source=C:\Program Files\CurioStudio\GreatNews\newsfeed.db");
            SQLiteCommand cmd = new SQLiteCommand("SELECT Description FROM NEWS_ITEM", cn);
            cn.Open();
            SQLiteDataReader r = cmd.ExecuteReader();


            while (r.Read())
            {
                byte[] c = (byte[])r.GetValue(0);
                Console.WriteLine(System.Text.Encoding.UTF8.GetString(c));
            }
            cn.Close();

MysteryFCM
Posts: 143
Joined: Tue Feb 21, 2006 1:56 pm
Location: Tyneside, UK
Contact:

Re: Custom Plugins

Postby MysteryFCM » Mon Aug 11, 2008 4:56 pm

I didn't realize you were pulling it directly from GN's database :oops: (for some reason, I thought you were trying to display your own feed in GN). I could be wrong, but looking at the DB, I believe GN encrypts the data.

Unfortunately in this case, only Jack (GN's developer) can answer this for you and he's not logged in since the beginning of July.
Regards
Steven Burn
I.T. Mate / hpHosts
it-mate.co.uk / hosts-file.net


Return to “General”

Who is online

Users browsing this forum: No registered users and 3 guests