Search in sources :

Example 11 with Job

use of org.storymaker.app.model.Job in project storymaker by StoryMaker.

the class UploadWorker method start.

public void start(PublishJob publishJob) {
    //		// TODO guard against multiple calls if we are running already
    ////		ArrayList<Job> jobs = (ArrayList<Job>) (new JobTable(db)).getUnfinishedAsList(context, JobTable.TYPE_UPLOAD);
    //		Job job = (new JobTable(null)).getNextUnfinished(mContext, JobTable.TYPE_UPLOAD, publishJob, null); // FIXME this is grabbing incomplete jobs from previous runs, we should only run the ones from our current publishJob
    //		UploaderBase uploader = null;
    //		if (job != null) {
    //    		if (job.isSite(Auth.SITE_YOUTUBE)) {
    //    			uploader = new YoutubeUploader(mContext, this, job);
    //    		} else if (job.isSite(Auth.SITE_STORYMAKER)) {
    //                uploader = new StoryMakerUploader(mContext, this, job);
    //            } else if (job.isSite(Auth.SITE_FACEBOOK)) {
    //                uploader = new FacebookUploader(mContext, this, job);
    //            } else if (job.isSite(Auth.SITE_FLICKR)) {
    //                uploader = new FlickrUploader(mContext, this, job);
    //            } else if (job.isSite(Auth.SITE_SOUNDCLOUD)) {
    //                uploader = new SoundCloudUploader(mContext, this, job);
    //            } else if (job.isSite(Auth.SITE_SSH)) {
    //                uploader = new SSHUploader(mContext, this, job);
    //            } else if (job.isSite(Auth.SITE_ARCHIVE)) {
    //                uploader = new ArchiveUploader(mContext, this, job);
    //            } 
    //    		uploader.start();
    //		}
    // TODO guard against multiple calls if we are running already
    // FIXME extend this to multiple render jobs, for now its hard coded to 1 at a time
    Job job = publishJob.getUploadJobsAsList().get(0);
    UploaderBase uploader = null;
    if (job != null) {
        if (job.isSite(Auth.SITE_YOUTUBE)) {
            uploader = new YoutubeUploader(mContext, this, job);
        } else if (job.isSite(Auth.SITE_STORYMAKER)) {
            uploader = new StoryMakerUploader(mContext, this, job);
        } else if (job.isSite(Auth.SITE_FACEBOOK)) {
            uploader = new FacebookUploader(mContext, this, job);
        } else if (job.isSite(Auth.SITE_FLICKR)) {
            uploader = new FlickrUploader(mContext, this, job);
        } else if (job.isSite(Auth.SITE_SOUNDCLOUD)) {
            uploader = new SoundCloudUploader(mContext, this, job);
        } else if (job.isSite(Auth.SITE_SSH)) {
            uploader = new SSHUploader(mContext, this, job);
        } else if (job.isSite(Auth.SITE_ARCHIVE)) {
            uploader = new ArchiveUploader(mContext, this, job);
        } else if (job.isSite(Auth.SITE_S3)) {
            uploader = new S3Uploader(mContext, this, job);
        }
        uploader.start();
    }
}
Also used : SSHUploader(org.storymaker.app.publish.sites.SSHUploader) YoutubeUploader(org.storymaker.app.publish.sites.YoutubeUploader) FacebookUploader(org.storymaker.app.publish.sites.FacebookUploader) SoundCloudUploader(org.storymaker.app.publish.sites.SoundCloudUploader) ArchiveUploader(org.storymaker.app.publish.sites.ArchiveUploader) S3Uploader(org.storymaker.app.publish.sites.S3Uploader) PublishJob(org.storymaker.app.model.PublishJob) Job(org.storymaker.app.model.Job) FlickrUploader(org.storymaker.app.publish.sites.FlickrUploader) StoryMakerUploader(org.storymaker.app.publish.sites.StoryMakerUploader)

Example 12 with Job

use of org.storymaker.app.model.Job in project storymaker by StoryMaker.

the class ArchivePublisher method startRender.

public void startRender() {
    Timber.d("startRender");
    // TODO should detect if user is directly publishing to youtube so we don't double publish to there
    Job videoRenderJob = new Job(mContext, mPublishJob.getProjectId(), mPublishJob.getId(), JobTable.TYPE_RENDER, null, VideoRenderer.SPEC_KEY);
    mController.enqueueJob(videoRenderJob);
}
Also used : Job(org.storymaker.app.model.Job) PublishJob(org.storymaker.app.model.PublishJob)

Example 13 with Job

use of org.storymaker.app.model.Job in project storymaker by StoryMaker.

the class FacebookPublisher method startRender.

public void startRender() {
    Timber.d("startRender");
    Job videoRenderJob = new Job(mContext, mPublishJob.getProjectId(), mPublishJob.getId(), JobTable.TYPE_RENDER, null, VideoRenderer.SPEC_KEY);
    mController.enqueueJob(videoRenderJob);
}
Also used : Job(org.storymaker.app.model.Job) PublishJob(org.storymaker.app.model.PublishJob)

Example 14 with Job

use of org.storymaker.app.model.Job in project storymaker by StoryMaker.

the class FlickrPublisher method startRender.

@Override
public void startRender() {
    Timber.d("startRender()");
    Job videoRenderJob = new Job(mContext, mPublishJob.getProjectId(), mPublishJob.getId(), JobTable.TYPE_RENDER, null, VideoRenderer.SPEC_KEY);
    mController.enqueueJob(videoRenderJob);
}
Also used : Job(org.storymaker.app.model.Job) PublishJob(org.storymaker.app.model.PublishJob)

Example 15 with Job

use of org.storymaker.app.model.Job in project storymaker by StoryMaker.

the class FlickrPublisher method startUpload.

@Override
public void startUpload() {
    Timber.d("startUpload()");
    Job newJob = new Job(mContext, mPublishJob.getProjectId(), mPublishJob.getId(), JobTable.TYPE_UPLOAD, Auth.SITE_FLICKR, null);
    mController.enqueueJob(newJob);
}
Also used : Job(org.storymaker.app.model.Job) PublishJob(org.storymaker.app.model.PublishJob)

Aggregations

Job (org.storymaker.app.model.Job)20 PublishJob (org.storymaker.app.model.PublishJob)20 Project (org.storymaker.app.model.Project)2 IOException (java.io.IOException)1 ProjectTable (org.storymaker.app.model.ProjectTable)1 ArchiveUploader (org.storymaker.app.publish.sites.ArchiveUploader)1 AudioRenderer (org.storymaker.app.publish.sites.AudioRenderer)1 FacebookUploader (org.storymaker.app.publish.sites.FacebookUploader)1 FlickrUploader (org.storymaker.app.publish.sites.FlickrUploader)1 S3Uploader (org.storymaker.app.publish.sites.S3Uploader)1 SSHUploader (org.storymaker.app.publish.sites.SSHUploader)1 SoundCloudUploader (org.storymaker.app.publish.sites.SoundCloudUploader)1 StoryMakerUploader (org.storymaker.app.publish.sites.StoryMakerUploader)1 YoutubeUploader (org.storymaker.app.publish.sites.YoutubeUploader)1