Textpattern Forum

You are not logged in. Register | Login | Help

#1 2012-02-23 21:03:23

jameslomax
Member
From: UK
Registered: 2005-05-09
Posts: 391
Website

automatic posting instead of manual editing?

Is there any script, plug in, or mysql hack that would enable TXP to build automatic posts?

What I mean is: you don’t go into the Write tab and make, say, ten posts for the next ten days – but a script, plug in or mysql hack does it for you.

I’d find it very useful.

It would add a powerful feature to TXP to expand and build a site, based on individual posts.

Offline

#2 2012-02-23 21:57:24

milosevic
Member
From: Madrid, Spain
Registered: 2005-09-19
Posts: 341

Re: automatic posting instead of manual editing?

It is not my expertise, but once I buildt a site (currently offline) that way. I prepared a spreadsheet with Excell following de textpattern articles table structure (look at it with phpmyadmin or with the plugin rss_admin_db_manager), then I used a desktop software called navicat (but there are tons of similar applications) to insert the content directly to the textpattern database. You can do it without Navicat or similars, just with phpMyAdmin, but I don’t know SQL so for me it was easyer to use a visual interface than mySQL commands.

Any way, before trying any direct data inject to the database, make a backup!

Last edited by milosevic (2012-02-23 21:59:46)


<txp:rocks/>

Offline

#3 2012-02-23 23:19:03

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,176
Website

Re: automatic posting instead of manual editing?

Can you provide more detail on what you mean? Where does the content of the article come from? Or are you talking about scheduling posts for the future?


My Plugins

Piwik Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#4 2012-02-24 05:11:47

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 549
Website

Re: automatic posting instead of manual editing?

Check out the examples for aks_cron. He’s doing something along those lines, modifying existing articles, but you can create new articles as well. Example: Cron script that uses RSS to create new articles and insert them into the TXP database.

Last edited by maruchan (2012-02-24 05:12:28)

Offline

#5 2012-02-24 09:20:11

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: automatic posting instead of manual editing?

James, another keyword to look for is XML-RPC (or XMLRPC). TXP comes with an XML-RPC-Server (needs to be activated in admin). XML-RPC-clients/-editors are able to post articles to TXP without using the web backend. Trap: TXP sections are not supported by XML-RPC AFAIK.


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#6 2012-02-24 14:05:48

jakob
Moderator
From: Germany
Registered: 2005-01-20
Posts: 1,893
Website

Re: automatic posting instead of manual editing?

Aside from what the others have said about pre-preparing posts with a post-date in the future, a few more ideas.

  • Another way to bring in articles if your source is an rss-feed as maruchan mentioned is to use smd_xml or another import from rss plugin.
  • If your articles have a fairly simple structure, you could use jmd_csv to import from an excel file and set future post dates (note: the plugin requires a slight change to set custom post dates, see that thread).
  • One final half-baked idea if you’re thinking mostly of your photos rather than your essays. If you use Adobe Lightroom or similar for managing your photos, it is possible to create export scripts from Adobe Lightroom that will upload the image file (resized if required) and a file with the image metadata (I’ve done this several years ago for a non-txp site before. I believe there’s also a script that will update an online database). I recently experimented with the as yet not publicly released rah_flat which imports from files to the database on a file by file basis and is configurable for different types of files. Theoretically, it might be possible to make Lightroom (etc.) export a file with your image title, name, etc. in a specific format to a particular directory on your homepage and have rah_flat automatically import that as an article. My guess is it would require some experimentation, but it may be a way of publishing photos to your site directly from Lightroom.

TXP Builders – finely-crafted code, design and txp

Offline

#7 2012-03-02 15:32:53

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: automatic posting instead of manual editing?

jakob wrote:

One final half-baked idea if you’re thinking mostly of your photos rather than your essays. If you use Adobe Lightroom or similar for managing your photos, it is possible to create export scripts from Adobe Lightroom that will upload the image file (resized if required) and a file with the image metadata (I’ve done this several years ago for a non-txp site before. I believe there’s also a script that will update an online database). I recently experimented with the as yet not publicly released rah_flat which imports from files to the database on a file by file basis and is configurable for different types of files. Theoretically, it might be possible to make Lightroom (etc.) export a file with your image title, name, etc. in a specific format to a particular directory on your homepage and have rah_flat automatically import that as an article. My guess is it would require some experimentation, but it may be a way of publishing photos to your site directly from Lightroom.

i wonder if there is something like this for uploading sound files too?

Offline

#8 2012-03-02 18:54:22

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 549
Website

Re: automatic posting instead of manual editing?

i wonder if there is something like this for uploading sound files too?

Are you using Audition? Do you want to end up with individual articles for each sound file, or would it be enough to post a prettified XML feed on your site?

Offline

#9 2012-03-02 19:00:06

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: automatic posting instead of manual editing?

maruchan wrote:

Are you using Audition? Do you want to end up with individual articles for each sound file, or would it be enough to post a prettified XML feed on your site?

well fairly general needs right now, but on my main site i use custom fields to either input an absolute url, or i use the txp files tab and it references the file number. then that gets parsed into my mp3 player, with a download link as well.

i’m not using audition (most often i use Goldwave), but would be willing to adopt it if i could make use of some of adobe’s scripts

Last edited by mrtunes (2012-03-02 19:00:27)

Offline

#10 2012-03-02 21:02:35

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 549
Website

Re: automatic posting instead of manual editing?

Here’s a script I modified that will automatically create an XML feed from a folder full of MP3 files. All you’d have to do is mount the SYSDIR folder in this script as an SSH folder on your local machine, for example via ExpanDrive, and export MP3s from Goldwave to that folder. Then set this script to run on your web server every few minutes via cron. I just tried it and it worked great.

#!/bin/bash

#           DO WHAT THE F*** YOU WANT TO PUBLIC LICENSE
#                   Version 2, December 2004
#
#Copyright (C) 2004 Sam Hocevar
# 14 rue de Plaisance, 75014 Paris, France
#Everyone is permitted to copy and distribute verbatim or modified
#copies of this license document, and changing it is allowed as long
#as the name is changed.
#
#           DO WHAT THE F*** YOU WANT TO PUBLIC LICENSE
#  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
#
# 0. You just DO WHAT THE F*** YOU WANT TO.
#

# SCRIPT DESCRIPTION:
# GENERATE RSS FEED OF MP3 FILES IN ANY FOLDER.

SYSDIR="/home/example/www/mymp3s" # Folder where you're keeping your files
HTTPLINK="http://www.example.com//mymp3s" # Public HTTP address to same folder, no slash at the end
FEEDTITLE="My MP3 RSS Feed" # Self-explanatory...
FEEDLINK="http://www.example.com/mymp3s" # Content for RSS feed's main "link" attribute.
FEEDDESC="MP3"
RSSDIR="/home/example/www/mymp3rss" # Whatever folder you'd like to use to store your XML feed. Can be same as SYSDIR above, too.
#DESC="`date`" 



function testing_variables {
        if [ ! -d ${RSSDIR} ]; then
                echo -e 'ERROR: $RSSDIR does not exists!\nPlease create a directory and set the right path for $RSSDIR variable!'
                exit 1
        fi

        if [ ! -d ${SYSDIR} ]; then
                echo -e 'ERROR: $SYSDIR does not exists!\nPlease create a directory and set the right path for $SYSDIR variable!'
        fi
}

function rss_header {
### RSS HEADER
echo "<!--?xml version=\"1.0\"?-->
<rss version="\"2.0\"">
  <channel>
        <title>${FEEDTITLE}</title>
        <link>${FEEDLINK}</link>
        <description>${FEEDDESC}</description>" > $1
}

function rss_body {
#RSS BODY
for FILES in `find ${SYSDIR} -type f -name "*.mp3" | xargs ls -t | grep -i ${2}`; do
NAME="`basename $FILES`"
#PARENTDIR="`dirname $FILES | awk -F "/" '{print $NF}'`"

echo "  <item>
                <title>${NAME}</title>
                <link>${HTTPLINK}/${2}/${NAME}</link>
<!--                <description>${DESC}</description> -->
        </item>" >> ${1}
done
}

function rss_footer {
### RSS FOOTER
echo "</channel></rss>" >> ${1}
}


### Main code ###

for FILES in `find ${SYSDIR} -type f -name "*.mp3" | xargs ls -t`; do
        PARENTDIR="`dirname $FILES | awk -F "/" '{print $NF}'`"

        rss_header ${RSSDIR}/${PARENTDIR}.xml
        rss_body   ${RSSDIR}/${PARENTDIR}.xml ${PARENTDIR}
        rss_footer ${RSSDIR}/${PARENTDIR}.xml
done

From there you can read the items into Textpattern via smd_xml. If you want to get fancy there are probably ways to pull in ID3 info from the files, too, so you’re not just stuck with filename and link.

Anyway, this would pretty much be like: “Export from Goldwave, done”-easy.

Last edited by maruchan (2012-03-02 21:06:05)

Offline

Board footer

Powered by FluxBB