Auto-Video Site Using Wordpress

Status
Not open for further replies.


Ok another little update for you.

After 4 hours of fighting with the built in WP cron system, it still doesn't work even though it should, its fucked, I mean seriously everything works exactly like its supposed to but when it comes to performing the required action it doesn't do it and I know 100% the action works.

Basically the system works like this you add a hook to a function, then you start the CRON, when started it stores a value in the DB, it requires a user to visit your site after the time period, so if set to 1 hour after 1 hour it says oh ok we gotta do this, lets look up which function to call, it gets the function and performs it.

The system they have in place with the hooks and the database updating and everything works great until it gets to the function call, it just doesn't call it.

I tried everything so I sat down to think about the pro's and con's of using the WP cron system over using the one from your hosting provider and you know what there are a lot more pro's for me and you (Which I'll explain tomorrow - Closer to the release), for using your hosting providers cron job.

I'm sure in time I'll get the WP cron system to work seemlessly but for the first release of this you'll have to setup your own cron job.

Don't worry I've made it extremely easy, no real work on your part, all you need to do is login to your hosting provider, and say fire this script every (however often you want).

Anyway I'm not going to get too technical and I'm not going to fully explain this right now but I will tomorrow.

All you should know for right now is that for the first release you'll have to setup a cron job with your hosting provider, in a future release I'll have the WP cron system working seemlessly and make it so you can use whichever one is easier for you.

Yeah, that's why I did mine with a unix cron job. I screwed around with adding a hook for tubepress but couldn't get it to work, said F-it and just did the simple thing and went outside wordpress.

I'm very interest in playing with this when it's done though.
 
Ok guys I have only had 5 minutes today to work on this so I'm not going to release it until tomorrow because there are a few small bugs that I have noticed.

Last night I set this up on 3 different versions of wordpress those versions are as follows.

Version 2.3
Version 2.5
Version 2.6

Before I wen't to bed I put all those versions on different sites and set up the cron jobs for the automation feature.

Everything so far works great with those versions and the automation feature is going smoothly as well as the manual feature is working great.

I'm double checking everything on the database side right now and I have to add in an additional check to validate that the codes are being displayed correctly.

I'm double checking everything right now and tonight I'm going to test in IE 7 & IE 8.

After that I will post in this thread (Most likely tomorrow or really late tonight) with a link where you guys can download this and start working with it.
 
I forgot to mention too that here are some requirements for the plugin.

WP 2.3 or higher * I highly suggest 2.6 or higher.
PHP 5 - I'm doing what I can to try and get this to PHP 4.3 but we will see - Its just so much easier with PHP 5.

Other then that it should work just fine.
 
Here You Go But Please Read The Following

Ok so the plug is kinda ready and the link is at the bottom of this post but please please read this post in FULL before downloading and asking questions about it because I need to make a few things clear (I know its long but bear with it).

The first thing I need to say is that when I first started this plugin, I was not creating it for anyone other then myself on my own servers with my own setup.

It was about half way through when I thought a few others may find some use for it, at that point I changed a few things and made it so anyone can download and install it.

I also want to tell you that I really don't have all that much time to work on it, I created it to do 1 specific function, that function is to put a bit of content on the domains I had sitting around doing sweet fuck all, I didn't create this to try and make me lots of money.

Its sole goal is to add a touch of value to my empty domains and to enable those domains to pay for themselves year after year so I can keep them, this means I'll be happy if this plugin makes me as low as $20/year/domain.

That is a very realistic goal I've used similar methods to make just as much, sometimes more, but I like how this one works over all others I've used, plus I created it so I know exactly how to change something to make it better in the future.

Anyway with all that said I really did run out of time on it, this does not mean it does not work however it means the following.

1) About 90% of the source code is NOT well commented, the only file which is decently commented is the automate.php file used for the automation feature, as time goes on and I plug away at it here and there I'll put in much more comments to make it easier to tweak and to see where I was going with my code.

2) This plugin is very AJAX/JavaScript intensive so turn off JavaScript blockers & enable JavaScript before using it, you should get a red error message letting you know if you need to enable JavaScript, if you don't see it then you should be just fine.

3) I've created it so you can re-name the folder its in to anything you want, however you should know that I barely tested this aspect of the plugin, which means there is a chance that I missed something and if you re-name the folder its in you may run into an issue or two when using it, so my suggestion for this is to simply leave it in the folder it came with, that foldername should be called "ydata"

4) When you open the folder the files are in the files are not nicely seperated, another words they are all just there, the images are not in a images folder, the js scripts are not in a js folder. Again this was because I ran out of time & it was created for personal use, this obviously isn't a big deal but I thought I would toss it out there.

5)
This one brings me back to my code is NOT well commented, if your trying to tweak it you will see that a lot of my variable names are not all that meaninful. Again the cause of this is lack of time and I was building it for myself, as time goes on I'll fix this up.

6) Because its AJAX/JavaScript intensive I tried to make it so there would not be an issue if wordpress is installed under a sub-folder on your site, the plug should work just fine because of the way I built it if your installation is in a sub-folder on your site, however again this little aspect is currently not well tested so keep an eye out for any bugs that might pop up because of this.

7)
I can't remember the other personal notes I wanted to say so lets move on but keep reading this entire post its important.

------- INSTALLATION INSTRUCTIONS ---------

1) Download the zip file from the link at the bottom of this post
2) Extract the files to your computer
3) Place the "ydata" folder and all of its contents into the plugins directory of your wordpress installation
4) Login to the WP admin panel, click Plugins, and activate it.

------- SYSTEM REQUIREMENTS -----------

PHP 5 or higher
MySql 4.3 Or higher
Wordpress 2.6 (Read tested environments below)

------- TESTED ENVIRONMENTS -------------

FireFox 2 & 3
IE 7 & 8
Wordpress 2.3
Wordpress 2.5
Wordpress 2.6 - Recommend you upgrade to this newest version of WP

------- KNOWN ISSUES --------

Right now there isn't a lot of known issues because it seems to run really well under my own installation but as we all know different installations can result in unknown issues but if you run into any issues at all I want to hear about them so I can fix them.

1) I'll start off with the one which is most annoying, when your adding posts manually I enter in the current date and time the post was created at & when they are being added via the automation feature I randomize the data a little bit so they don't all appear to be added at specific intervals.

The annoying issue is that for the comment dates I use the publish date provided by the YouTube API, which means that if your post was created on November 24, 2008 some of your comments might be from July 24, 2007

See the issue the comment was left a year before the post was made? WTF...... I thought of using the earliest comment date for the posts publish date but then you will very well end up with no new posts or ones that are new but the dates are from 2007 or 2006.

Right now the best way around this is to simply not show the post date in your theme, you can show the comment dates if you want but eithier show the post date and don't show the comment dates or show the comment dates and don't show the post dates, that will help.

2) This is another thing that kinda annoys me and thats using broad terms, for instance if you type in "Cars" for the automated feature you'll get some music video and the movie "Cars" but not a lot of actual cars, I'm going to try to improve upon this in the future by adding in some filters but the best way now is to try and target down your keywords a little bit.

3) For the automated feature if you specify that you want between 100 and 200 comments, some of your posts may end up with less then 100 comments and this is because some videos just don't have between 100 and 200 comments.

4) The first info page you'll see is completely useless right now and has no relevent information so just ignore it, I was going to put in a full help thing here and maybe some dynamic update features here but didn't get around to it, thats another thing which is a work in progress (Again it was originally created with me in mind)

I think that covers the major things I noticed right now I'm sure a few more will be reported and pop up but just keep those in mind.
 
----------- WHAT THINGS MEAN & HOW TO USE THE PLUG ---------

1) When you activate the plugin it will create a new tab called "Ydata" this is where all the goods of the plug reside.

2) When you click on this tab you are presented with the info screen, as I just previously mentioned in the known features part of this post, right now this section is completely useless and has no relevent info so ignore it for now.

3) The automation page is the second (middle) sub-tab for this plugin and this is where the real goods come into play. Before you create a cron job you have to fill out this information.

The first thing you need to fill out is the input beside the word Post: this is the keyword which will be used to search for your videos, please only add 1 keyword into this and right beside it you'll have to choose a category in which you want to have this post show up into.

After that you can optionally specify some tags for this post if you want to, seperate them with a comma, I was going to use the tags which come with the video but never got around to it, again I'll probably toss that functionality in as time goes on.

Next is setting the comment range, here you specify a low number then a number higher then the low number so if I wanted all the comments for this keyword (posts) to be between 100 and 200 I would put 100 in the first box and 200 in the second. If you leave these blank you will probably get a message saying fill them out, but if you don't then it will default to grabbing comments between 50 and 100.

Once you've done that you can specify if you want to remove all swear words from the comments by checking the checkbox.

After your done click the Add Post Details button and once its done you should see it show up in the right sidebar and a message at the top saying hey its been added.

From there you can remove it if you don't want to use that keyword anymore.

Once you've entered 1 keyword then you can setup a cron job to run the automate.php file however often you want however every time the cron job runs it will make 1 post for each and every keyword you specify in this section.

So if I create 5 elements here and run the cron every hour it will create 5 posts an hour so keep that in mind. In the future I'm going to add in a max/day option and a bit more flexability with this automation feature.

4) The last sub-tab enables you to manually add videos, this one is pretty self-explanitory if you read everything upto this point, you simply search for some videos, they will be displayed as an image, click the image to preview the video, add some details and make the post.

5) This is an important one, once you got a few videos on your site, go to the main page (Not a single page) and you'll notice that you won't see the video player, instead you'll see a larger type of screenshot for this video, however if you go to the post page (single page) you no longer see the thumbnail, now you see the video player and can watch the video.

I've done this because if you place 10 video players on the same page and a user presses play and pause on 5 of them, things are going to get really slow for them. Its always better to place lots of thumbnails on a page and 1 video where required.

If you want to change this around you can do so easily, open up the file called "ydata.php" and near the top you can comment out the following line of code.

PHP:
add_action('the_content', 'change_post');
Or if you want to keep it there but change the image size and play with it a bit more then everything that effects this is inside of the change_post function which is shown below.

PHP:
function change_post() {
    global $wpdb,$post;

    if(!is_single()) {
      $image = $wpdb->get_var("SELECT image FROM ".$wpdb->prefix."ydata_options WHERE post_id = '".$post->ID."'");
      
      $replace = '<center><img src="'.stripslashes($image).'" alt="'.$post->post_title.'" /></center>';

      echo preg_replace("/<object(.*?)object>/i", $replace, $post->post_content);
    }
    else
    {
      echo $post->post_content;
    }
  }
This function does NOT re-save your post to the database, it simply intercepts the posts before they are displayed to the user, its a handy thing to have.

----------- CLOSING STATEMENTS & DL LINK ---------

I wen't over all this stuff so you know where I stand on it and to give you a bit of knowledge into the current status of the plugin.

Basically as I stated before right now its sole purpose is so that all the domains I have sitting there doing fuck all can make themselves at least $20/year so they can pay for themselves as time goes on.

I didn't have time to add in a lot of cool and helpful features, and the flexibility is basic but this is something that I plan on working with as time goes on, you know if I have a few hours here or a spare day over there then I'll fix up some of the code and add some better features and as time goes on it'll get better, how much time before it is the best plugin you'll ever use for empty domains is still unknown lol.

Also if you want support for the plugin don't coun't on me (right now at least) to respond to everyones questions and concerns and feature requests, I want to hear them all so by all means send the message just don't count on a quick responce.

Finally before I give you the link (I bet you all hate me for all the reading) if you want to know what something in the code does, shoot me off a message and ask, I'll do what I can to help explain it to you until I get it commented better.

If your interested in helping me advance this alot quicker let me know we will team up, you create this feature I'll create that one, we will combine it once were done thats great for me, also who knows if a few of us team up to work on seperate features we can pound out a commercial plugin to sell and make some coin from, we could work on others in the future, so don't be shy to ask or suggest or whatever else.

Anyway I'm tired of typing and I bet your extremely tired of reading so here you go - finally the awaited link to the download.

AmpleGains - Ydata Plugin

P.S. I have no idea why I called it Ydata, I'm sure I'll change it and it really means nothing, again its on of those things where I planned to create it for personal use.
 
Alright even though a lot of this plugin is used for an empty domain and used for autoblogging it can still be a very powerful thing to use on your existing websites that you don't want to auto-blog with but can add some videos to inhance the experince.

Check out this post I made on one of my sites I want to try and keep clean.

http://www.celebrityarchives.ca/watch-the-new-hancock-trailer/

This post was made using the plugin as you can see I removed the comment dates which makes it seem very valid that the comments were left in a timely manner.

I kept the post date and removed the comment dates (In my own theme files not the plugin), I believe that this is the best method of use for the date issue stated above.

Also I just remembered that the YouTube API enables you to create your own custom looking video players which plays the videos.

So in essence and this is another thing I could work on, maybe even with some assistance is to create a few generic well formed and good looking custom players using the YouTube API.

This way the videos on your site will seem like you uploaded them, you could make this plugin seem completely independent of YouTube.

Fuck I think I'm going to look at the API and try to create a custom player for the site I linked to above before I put too many YouTube videos on it.

I'll keep you all posted.
 
I just noticed something else that I don't think I can fix but I thought I would let you know about.

When using the auto-feature you may come across a video or two which does not play.

The comments, title, ect... everything gets added just fine the player displays just fine, and the image displays just fine.

However when you click play it may say "Video no longer available"

This means the video has been removed from YouTube and has not been taken out of the YouTube API yet.

Not sure if I can test for this yet.
 
Aequitas:

Do you have a debugging mode I can turn on somewhere? I get all the way to where I hit "Post video" in manual mode, and I hit it, it cranks for a second, then leaves me at a screen with just the video on it and the search bar above it. Seems like a success, but then, I have no trace of the post anywhere. Very curious.

Josh
 
Aequitas:

Do you have a debugging mode I can turn on somewhere? I get all the way to where I hit "Post video" in manual mode, and I hit it, it cranks for a second, then leaves me at a screen with just the video on it and the search bar above it. Seems like a success, but then, I have no trace of the post anywhere. Very curious.

Josh

No I didn't put in a debug mode, this seems like an issue with the AJAX.

Basically when you do a manual search your presented with a list of video images, you click on 1 then you will see the video you can preview with some options to fill out on the side.

When you click the add video link, you should see another message saying please wait.....then after that you will see a message saying video has been added.

Try it and wait it shouldn't take longer then 30 seconds for it to complete if it takes longer then that then check your site to see if the video has been added.

If it hasen't then your experincing a AJAX issue, in the ajax.js file when you click the addVideo button the function addVideo() gets fired which calls the addVideo.php file.

That may help a bit with debugging.

Also check to make sure that your running on PHP 5 because this file requires the use of the php function simplexml_load_file()
 
Fantastic, I'll be testing this out tomorrow. If all goes well I can ditch a scraper I started working on a couple of days ago after wanting more functionality out of Tubepress.
 
I just noticed something else that I don't think I can fix but I thought I would let you know about.

When using the auto-feature you may come across a video or two which does not play.

The comments, title, ect... everything gets added just fine the player displays just fine, and the image displays just fine.

However when you click play it may say "Video no longer available"

This means the video has been removed from YouTube and has not been taken out of the YouTube API yet.

Not sure if I can test for this yet.

No, it has nothing to do with the plugin. Youtube has some videos that have copyright, and they do not allow you to play them on another domain other than youtube.com
You can embed them normally, but they don't play. The only way to tell is from the youtube's video page, where the embed code is grayed out.
 
Sounds great man! Gonna have a play later. Have you tried it on mu? (If not I'll give it a go and let ya know.)
 
Status
Not open for further replies.