Page 1 of 1

Importing Text Flat Files from Blosxom

Posted: Wed Jul 31, 2019 4:38 pm
by miksmith
Hi

Im taking the plunge and moving away from a long-lived blosxom installation which is just insecure now. I have a directory full of text files (one file per blog post) and want to import them into FlatPress.

They are almost entirely straight text, with the odd bit of HTML introduced every now and then, along with hyperlinks and embedded images. In the first instance Id just be happy with getting all the text imported and can do some regex manipulation along the way.

Whats the easiest way to move the existing files to FlatPress?

thanks

mike

Re: Importing Text Flat Files from Blosxom

Posted: Fri Aug 02, 2019 12:54 pm
by Arvid
Mike, welcome to FlatPress :)

How does Blosxom store its entries' metadata (such as the date, subject etc.)?

FlatPress has the entries as text files under fp-content/content/[year]/[month]. The file name contains the entry's date formatted as entry[yy][mm][dd]-[hh][ii][ss].txt. Looking into the file, you see some metadata ahead of the content:

Code: Select all

VERSION|fp-1.1|SUBJECT|The entry subject|CONTENT|The content...
VERSION is the FlatPress version the entry was created under, SUBJECT is, well, the subject :D , and CONTENT is the entry content with BBCode (HTML will be parsed as well).

A simple way to see that all in action is just to set up a test blog with FP and fiddle around with the text files.

For migrating, you'd need a script that creates the file structure under fp-content/content/[year]/[month]. (If your entries don't spread over too many years, you could just create this structure manually.) When all entry files are created in their respective year/month subfolder, you'd just copy the whole file structure into your FlatPress directory. To let FP know about its new contents, rebuild the index in die Admin Panel (Maintain > Rebuild index).

Let us know if you need further help and how migration works out for you!
(The greatest outcome for the community would be a converter Blosxom-FlatPress to be used by anyone.)

All the best
Arvid

Re: Importing Text Flat Files from Blosxom

Posted: Tue Aug 27, 2019 4:54 pm
by miksmith
Thanks for the help! Im working on some import instructions for Blosxom. One query...

-each file is appended with:
|AUTHOR|miksmith|DATE|1566926569|CATEGORIES|1,2|

How is the DATE calculated?

thanks

Re: Importing Text Flat Files from Blosxom

Posted: Wed Aug 28, 2019 6:19 am
by Arvid
Hi,
miksmith wrote: Tue Aug 27, 2019 4:54 pm -each file is appended with:
|AUTHOR|miksmith|DATE|1566926569|CATEGORIES|1,2|

How is the DATE calculated?
This is the UNIX time stamp (seconds since 1970-01-01) of the entry's creation date. (check https://www.unixtimestamp.com/).
1566926569 would be 2019-08-27, 17:22:49 (UTC).

Regards
Arvid

Re: Importing Text Flat Files from Blosxom

Posted: Fri Sep 27, 2019 2:42 pm
by miksmith
We now have a working Blosxom to Flatpress converter :) The process is broadly this:

-download your Blosxom files, including all the sub-directories for categories, but make sure to maintain the date/time filestamp of individual files - this is used to timestamp the entry for Flatpress. WinSCP does this (Filezilla doesnt)
-make sure the categories only ONE DIRECTORY DEEP. Move any sub-sub-directories up to the top level
-rename all the directories to numbers. These are used to tag the entries and can then be recreated within FlatPress
-copy the script.py and template files to the directory the folders are stored in
-edit the template file to have the header/footer you want. The content, date and categories will be changed for the entries
-run the script
-a new fp-content directory will be created with all your entries
-copy this to your flatpress site and rebuild the index

The script does the following
-rename s the file to entry<date>-<time>.txt based upon the date modified date
-copies the file to a new subfolder in FlatPress /content folder based upon year and month
-cuts the first line from the file (and deletes the first line break)
-prefixes the file with:
VERSION|fp-1.1|SUBJECT|<first line from file>|CONTENT|
-suffixes with:
|AUTHOR|miksmith|DATE|<1566926569>|CATEGORIES|<orig_dir_name>|

BIG shout out to James O'Connor for putting the script together after we'd worked out what to do!

Re: Importing Text Flat Files from Blosxom

Posted: Fri Sep 27, 2019 4:26 pm
by miksmith
Small bug fixed which concerned the CATEGORY tag and variances between OSs

Re: Importing Text Flat Files from Blosxom

Posted: Wed Jan 01, 2020 1:43 pm
by Arvid
I felt free to add the importer tool to our fp-extras repository: https://github.com/flatpressblog/flatpr ... r/fp-tools