Search in sources :

Example 1 with Job

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

the class PublisherBase method publishToStoryMaker.

public String publishToStoryMaker() {
    Job job = getPreferredUploadJob();
    Project project = mPublishJob.getProject();
    String title = project.getTitle();
    String desc = project.getDescription();
    String mediaEmbed = getEmbed(job);
    String[] categories = project.getCategories();
    String medium = getMedium();
    String mediaService = job.getSite();
    // TODO get the id from the preferred job to publish to facebook
    String mediaGuid = job.getResult();
    try {
        String ret = publishToStoryMaker(title, desc, mediaEmbed, categories, medium, mediaService, mediaGuid);
        return ret;
    } catch (IOException ioe) {
        Timber.e(ioe, "failed to publish due to an IOException");
    }
    return null;
}
Also used : Project(org.storymaker.app.model.Project) IOException(java.io.IOException) PublishJob(org.storymaker.app.model.PublishJob) Job(org.storymaker.app.model.Job)

Example 2 with Job

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

the class RenderWorker 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);
    ////	    SQLiteDatabase db = (new StoryMakerDB(context)).getWritableDatabase("foo");
    //		Job job = (new JobTable(null)).getNextUnfinished(mContext, JobTable.TYPE_RENDER, publishJob, null);
    //		RendererBase renderer = null;
    //		if (job != null) {
    //            if (job.isSpec(VideoRenderer.SPEC_KEY)) {
    //                renderer = new VideoRenderer(mContext, this, job);
    //            } else if (job.isSpec(AudioRenderer.SPEC_KEY)) {
    //                renderer = new AudioRenderer(mContext, this, job);
    //            } //else if (job.isSpec(Auth.SITE_STORYMAKER)) {
    //    //			renderer = new StoryMakerUploader(context, this, job);
    //    //		}
    //            renderer.start();
    //		}
    // TODO guard against multiple calls if we are running already
    //		Job job = (new JobTable(null)).getNextUnfinished(mContext, JobTable.TYPE_RENDER, publishJob, null);
    // this should just just grab the new job, ignore old ones for now 
    // FIXME extend this to multiple render jobs, for now its hard coded to 1 at a time
    ArrayList<Job> jobs = publishJob.getRenderJobsAsList();
    if (jobs != null && jobs.size() > 0) {
        Job job = jobs.get(0);
        RendererBase renderer = null;
        if (job != null) {
            if (job.isSpec(VideoRenderer.SPEC_KEY)) {
                renderer = new VideoRenderer(mContext, this, job);
            } else if (job.isSpec(AudioRenderer.SPEC_KEY)) {
                renderer = new AudioRenderer(mContext, this, job);
            }
            // FIXME need a slideshow renderer?
            renderer.start();
        }
    } else {
        jobFailed(null, null, 98129129, "No render job in db");
    }
}
Also used : AudioRenderer(org.storymaker.app.publish.sites.AudioRenderer) Job(org.storymaker.app.model.Job) PublishJob(org.storymaker.app.model.PublishJob)

Example 3 with Job

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

the class ArchivePublisher method startUpload.

public void startUpload() {
    Timber.d("startUpload");
    // FIXME hardcoded to youtube?
    Job newJob = new Job(mContext, mPublishJob.getProjectId(), mPublishJob.getId(), JobTable.TYPE_UPLOAD, Auth.SITE_ARCHIVE, null);
    mController.enqueueJob(newJob);
}
Also used : Job(org.storymaker.app.model.Job) PublishJob(org.storymaker.app.model.PublishJob)

Example 4 with Job

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

the class FacebookPublisher method startUpload.

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

Example 5 with Job

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

the class S3Publisher 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 job = new Job(mContext, mPublishJob.getProjectId(), mPublishJob.getId(), JobTable.TYPE_RENDER, null, VideoRenderer.SPEC_KEY);
    mController.enqueueJob(job);
}
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