Search in sources :

Example 11 with Project

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

the class YoutubeUploader method start.

@Override
public void start() {
    Timber.d("start()");
    final SiteController controller = SiteController.getSiteController(YoutubeSiteController.SITE_KEY, mContext, mHandler, "" + mJob.getId());
    final Project project = mJob.getProject();
    final PublishJob publishJob = mJob.getPublishJob();
    final String path = publishJob.getLastRenderFilePath();
    final Auth auth = (new AuthTable()).getAuthDefault(mContext, Auth.SITE_YOUTUBE);
    if (path != null) {
        Handler mainHandler = new Handler(mContext.getMainLooper());
        Runnable myRunnable = new Runnable() {

            @Override
            public void run() {
                Timber.d("run()");
                // FIXME, this might not be wise to run on the main thread youtube, does the youtube SDK automatically run itself on a backgroundthread?
                HashMap<String, String> valueMap = publishJob.getMetadata();
                addValuesToHashmap(valueMap, project.getTitle(), project.getDescription(), path);
                controller.upload(auth.convertToAccountObject(), valueMap);
            }
        };
        mainHandler.post(myRunnable);
    } else {
        Timber.e("youtube upload failed, file path is null");
    }
}
Also used : Project(org.storymaker.app.model.Project) Auth(org.storymaker.app.model.Auth) AuthTable(org.storymaker.app.model.AuthTable) Handler(android.os.Handler) PublishJob(org.storymaker.app.model.PublishJob)

Example 12 with Project

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

the class SceneEditorActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Intent intent = getIntent();
    //project id
    int pid = intent.getIntExtra("pid", -1);
    ArrayList<Parcelable> parcelables = intent.getParcelableArrayListExtra(Constants.EXTRA_EXPORT_CLIPS);
    mSceneIndex = getIntent().getIntExtra("scene", 0);
    if (parcelables != null) {
        // FIXME this should be split into a method, probably in the model.Project class?
        mProject = new Project(this, 1);
        mProject.setTitle("export from liger");
        mProject.setTemplatePath("");
        mProject.setStoryType(Project.STORY_TYPE_VIDEO);
        mProject.save();
        Scene scene = new Scene(this, parcelables.size());
        scene.setTitle("ligerscene1");
        scene.setProjectId(mProject.getId());
        scene.setProjectIndex(0);
        scene.save();
        // FIXME convert export into project
        int i = 0;
        for (Parcelable p : parcelables) {
            // index, cliptype, path, mimetype
            FullMetadata m = ((FullMetadata) p);
            scene.setMedia(i, m.getFilePath(), m.getFilePath(), "video/mp4");
            i++;
        }
        scene.save();
        // FIXME load project
        mMPM = new MediaProjectManager(this, getApplicationContext(), mHandlerPub, mProject, scene);
    } else if (pid != -1) {
        // FIXME ugly
        mProject = (Project) (new ProjectTable()).get(getApplicationContext(), pid);
        Scene scene = null;
        if ((mSceneIndex != -1) && (mSceneIndex < mProject.getScenesAsArray().length)) {
            scene = mProject.getScenesAsArray()[mSceneIndex];
        }
        mMPM = new MediaProjectManager(this, getApplicationContext(), mHandlerPub, mProject, scene);
        mMPM.initProject();
    } else {
        // FIXME get rid of hardcoded clipCount = 5
        int clipCount = 5;
        String title = intent.getStringExtra("title");
        mProject = new Project(getApplicationContext(), clipCount);
        mProject.setTitle(title);
        mProject.save();
        mMPM = new MediaProjectManager(this, getApplicationContext(), mHandlerPub, mProject);
        mMPM.initProject();
    }
    try {
        if (mProject.getScenesAsList().size() > 1) {
            mTemplate = Template.parseAsset(this, mProject.getTemplatePath(), Project.getSimpleTemplateForMode(getApplicationContext(), mProject.getStoryType()));
        } else {
            mTemplate = Template.parseAsset(this, Project.getSimpleTemplateForMode(getApplicationContext(), mProject.getStoryType()));
        }
    } catch (Exception e) {
        Timber.e(e, "could not parse templates");
    }
    setContentView(R.layout.activity_scene_editor_no_swipe);
    // Set up the action bar.
    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    addPublishFragement();
    actionBar.setTitle(getString(R.string.tab_publish));
    if (intent.hasExtra("auto_capture") && intent.getBooleanExtra("auto_capture", false)) {
        openCaptureMode(0, 0);
    }
}
Also used : Project(org.storymaker.app.model.Project) MediaProjectManager(org.storymaker.app.media.MediaProjectManager) FullMetadata(scal.io.liger.model.FullMetadata) Intent(android.content.Intent) Parcelable(android.os.Parcelable) Scene(org.storymaker.app.model.Scene) ProjectTable(org.storymaker.app.model.ProjectTable) IOException(java.io.IOException) ActionBar(android.app.ActionBar)

Aggregations

Project (org.storymaker.app.model.Project)12 PublishJob (org.storymaker.app.model.PublishJob)9 SiteController (io.scal.secureshare.controller.SiteController)6 Auth (org.storymaker.app.model.Auth)6 AuthTable (org.storymaker.app.model.AuthTable)6 Handler (android.os.Handler)5 File (java.io.File)5 Intent (android.content.Intent)3 SharedPreferences (android.content.SharedPreferences)2 Parcelable (android.os.Parcelable)2 IOException (java.io.IOException)2 MediaProjectManager (org.storymaker.app.media.MediaProjectManager)2 Job (org.storymaker.app.model.Job)2 Media (org.storymaker.app.model.Media)2 ProjectTable (org.storymaker.app.model.ProjectTable)2 Scene (org.storymaker.app.model.Scene)2 FullMetadata (scal.io.liger.model.FullMetadata)2 ActionBar (android.app.ActionBar)1 AlertDialog (android.app.AlertDialog)1 DialogInterface (android.content.DialogInterface)1