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");
}
}
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);
}
}
Aggregations