use of org.storymaker.app.model.Project in project storymaker by StoryMaker.
the class SoundCloudUploader method start.
// FIXME move the render file checks into base class
@Override
public void start() {
// TODO Auto-generated constructor stub
final SiteController controller = SiteController.getSiteController(SoundCloudSiteController.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, SoundCloudSiteController.SITE_KEY);
// FIXME deal with lack of auth credentials here
if (Utils.stringNotBlank(path) && (new File(path)).exists()) {
Handler mainHandler = new Handler(mContext.getMainLooper());
Runnable myRunnable = new Runnable() {
// facebook seems to freak out if our service's looper is dead when it tries to send message back
@Override
public void run() {
jobProgress(mJob, 0, mContext.getString(R.string.uploading_to_soundcloud));
HashMap<String, String> valueMap = publishJob.getMetadata();
addValuesToHashmap(valueMap, project.getTitle(), project.getDescription(), path);
controller.upload(auth.convertToAccountObject(), valueMap);
}
};
mainHandler.post(myRunnable);
} else {
Timber.d("Can't upload to SoundCloud, last rendered file doesn't exist.");
// TODO get this error back to the activity for display
// FIXME move to strings.xml
jobFailed(null, ERROR_NO_RENDER_FILE, "Can't upload to SoundCloud, last rendered file doesn't exist.");
}
}
use of org.storymaker.app.model.Project in project storymaker by StoryMaker.
the class ProjectsActivity method initListView.
public void initListView(ListView list) {
list.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
final Project project = mListProjects.get(arg2);
AlertDialog.Builder builder = new AlertDialog.Builder(ProjectsActivity.this);
builder.setMessage(R.string.delete_project_).setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
deleteProject(project);
}
}).setNegativeButton(android.R.string.no, null).show();
return false;
}
});
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Project project = mListProjects.get(position);
Intent intent = null;
intent = new Intent(ProjectsActivity.this, SceneEditorActivity.class);
intent.putExtra("template_path", project.getTemplatePath());
intent.putExtra("story_mode", project.getStoryType());
intent.putExtra("pid", project.getId());
intent.putExtra("title", project.getTitle());
startActivity(intent);
}
});
refreshProjects();
}
use of org.storymaker.app.model.Project in project storymaker by StoryMaker.
the class FlickrUploader method start.
@Override
public void start() {
Timber.d("start()");
final SiteController controller = SiteController.getSiteController(FlickrSiteController.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_FLICKR);
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 flickr, does the flickr SDK automatically run itself on a backgroundthread?
HashMap<String, String> valueMap = publishJob.getMetadata();
// need to extract raw photos
// what happened to STORY_TYPE_PHOTO?
// TODO: currently checking preferences, will revisit when ui is updated
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(mContext);
boolean uploadPhotos = sharedPref.getBoolean("pphotoformat", false);
if ((publishJob.getProject().getStoryType() == Project.STORY_TYPE_ESSAY) && uploadPhotos) {
ArrayList<Media> photos = publishJob.getProject().getMediaAsList();
String photoString = "";
for (Media photo : photos) {
photoString = photoString + photo.getPath() + ";";
}
// drop trailing ;
photoString = photoString.substring(0, photoString.length() - 1);
valueMap.put(FlickrSiteController.PHOTO_SET_KEY, photoString);
}
addValuesToHashmap(valueMap, project.getTitle(), project.getDescription(), path);
controller.upload(auth.convertToAccountObject(), valueMap);
}
};
mainHandler.post(myRunnable);
} else {
Timber.e("flickr upload failed, file path is null");
}
}
use of org.storymaker.app.model.Project in project storymaker by StoryMaker.
the class S3Uploader method start.
// FIXME move the render file checks into base class
@Override
public void start() {
// TODO Auto-generated constructor stub
final SiteController controller = SiteController.getSiteController(S3SiteController.SITE_KEY, mContext, mHandler, "" + mJob.getId());
final Project project = mJob.getProject();
final PublishJob publishJob = mJob.getPublishJob();
final String path = publishJob.getLastRenderFilePath();
// FIXME deal with lack of auth credentials here
if (Utils.stringNotBlank(path) && (new File(path)).exists()) {
Handler mainHandler = new Handler(mContext.getMainLooper());
Runnable myRunnable = new Runnable() {
// facebook seems to freak out if our service's looper is dead when it tries to send message back
@Override
public void run() {
jobProgress(mJob, 0, mContext.getString(R.string.uploading));
HashMap<String, String> valueMap = publishJob.getMetadata();
addValuesToHashmap(valueMap, project.getTitle(), project.getDescription(), path);
// controller.upload(auth.convertToAccountObject(), valueMap);
controller.upload(null, valueMap);
}
};
mainHandler.post(myRunnable);
} else {
Timber.d("Can't upload to S3, last rendered file doesn't exist.");
// TODO get this error back to the activity for display
// FIXME move to strings.xml
jobFailed(null, ERROR_NO_RENDER_FILE, "Can't upload to S3, last rendered file doesn't exist.");
}
}
use of org.storymaker.app.model.Project in project storymaker by StoryMaker.
the class SSHUploader method start.
// FIXME move the render file checks into base class
@Override
public void start() {
// TODO Auto-generated constructor stub
final SiteController controller = SiteController.getSiteController(SSHSiteController.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, SSHSiteController.SITE_KEY);
if (Utils.stringNotBlank(path) && (new File(path)).exists()) {
// FIXME move to strings.xml
jobProgress(mJob, 0, "Uploading to SSH server...");
HashMap<String, String> valueMap = publishJob.getMetadata();
addValuesToHashmap(valueMap, project.getTitle(), project.getDescription(), path);
controller.upload(auth.convertToAccountObject(), valueMap);
} else {
Timber.d("Can't upload to SSH, last rendered file doesn't exist.");
// TODO get this error back to the activity for display
// FIXME move to strings.xml
jobFailed(null, ERROR_NO_RENDER_FILE, "Can't upload to SSH server, last rendered file doesn't exist.");
}
}
Aggregations