summaryrefslogtreecommitdiff
path: root/plugins/shotwell-publishing
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/shotwell-publishing')
-rw-r--r--plugins/shotwell-publishing/PhotosPublisher.vala22
-rw-r--r--plugins/shotwell-publishing/YouTubePublishing.vala7
-rw-r--r--plugins/shotwell-publishing/YoutubeUploader.vala5
-rw-r--r--plugins/shotwell-publishing/meson.build2
4 files changed, 26 insertions, 10 deletions
diff --git a/plugins/shotwell-publishing/PhotosPublisher.vala b/plugins/shotwell-publishing/PhotosPublisher.vala
index b592317..67c3ecb 100644
--- a/plugins/shotwell-publishing/PhotosPublisher.vala
+++ b/plugins/shotwell-publishing/PhotosPublisher.vala
@@ -111,6 +111,7 @@ internal class PublishingParameters {
}
private class MediaCreationTransaction : Publishing.RESTSupport.GooglePublisher.AuthenticatedTransaction {
+ // SCOPE: photoslibrary.appendonly
private const string ENDPOINT_URL = "https://photoslibrary.googleapis.com/v1/mediaItems:batchCreate";
private string[] upload_tokens;
private string[] titles;
@@ -154,6 +155,7 @@ private class MediaCreationTransaction : Publishing.RESTSupport.GooglePublisher.
}
private class AlbumCreationTransaction : Publishing.RESTSupport.GooglePublisher.AuthenticatedTransaction {
+ // SCOPE: photoslibrary.appendonly
private const string ENDPOINT_URL = "https://photoslibrary.googleapis.com/v1/albums";
private string title;
@@ -179,6 +181,7 @@ private class AlbumCreationTransaction : Publishing.RESTSupport.GooglePublisher.
}
private class AlbumDirectoryTransaction : Publishing.RESTSupport.GooglePublisher.AuthenticatedTransaction {
+ // SCOPE: photoslibrary.readonly.appcreateddata
private const string ENDPOINT_URL = "https://photoslibrary.googleapis.com/v1/albums";
public AlbumDirectoryTransaction(Publishing.RESTSupport.GoogleSession session, string? token) {
@@ -244,8 +247,15 @@ public class Publisher : Publishing.RESTSupport.GooglePublisher {
if (!is_running())
return;
+
var json = Json.from_string (txn.get_response());
var object = json.get_object ();
+ // Work-around for Google sometimes sending an empty JSON object '{}' instead of
+ // not setting the nextPageToken on the previous page
+ if (object.get_size() == 0) {
+ break;
+ }
+
if (!object.has_member ("albums")) {
throw new Spit.Publishing.PublishingError.MALFORMED_RESPONSE("Album fetch did not contain expected data");
}
@@ -279,7 +289,10 @@ public class Publisher : Publishing.RESTSupport.GooglePublisher {
debug("EVENT: fetching album information failed; response = '%s'.",
txn.get_response());
- if (txn.get_status_code() == 403 || txn.get_status_code() == 404) {
+ if (txn.get_status_code() == 403) {
+ debug("Lacking permission to download album list, showing publishing options anyway");
+ show_publishing_options_pane();
+ } else if (txn.get_status_code() == 404) {
do_logout();
} else {
// If we get any other kind of error, we can't recover, so just post it to the user
@@ -345,10 +358,13 @@ public class Publisher : Publishing.RESTSupport.GooglePublisher {
yield do_upload();
} catch (Error err) {
- debug("EVENT: creating album failed; response = '%s'.",
+ debug("EVENT: creating album failed; status = '%u', response = '%s'.", txn.get_status_code(),
txn.get_response());
- if (txn.get_status_code() == 403 || txn.get_status_code() == 404) {
+ if (txn.get_status_code() == 403) {
+ get_host().install_static_message_pane(_("Could not create album, Shotwell is lacking permission to do so. Please re-authenticate and grant Shotwell the required permission to create new media and albums"),
+ Spit.Publishing.PluginHost.ButtonMode.CLOSE);
+ } else if (txn.get_status_code() == 404) {
do_logout();
} else {
// If we get any other kind of error, we can't recover, so just post it to the user
diff --git a/plugins/shotwell-publishing/YouTubePublishing.vala b/plugins/shotwell-publishing/YouTubePublishing.vala
index f0a9866..13e4afd 100644
--- a/plugins/shotwell-publishing/YouTubePublishing.vala
+++ b/plugins/shotwell-publishing/YouTubePublishing.vala
@@ -44,9 +44,6 @@ public class YouTubeService : Object, Spit.Pluggable, Spit.Publishing.Service {
namespace Publishing.YouTube {
-private const string DEVELOPER_KEY =
- "AIzaSyB6hLnm0n5j8Y6Bkvh9bz3i8ADM2bJdYeY";
-
private enum PrivacySetting {
PUBLIC,
UNLISTED,
@@ -330,9 +327,9 @@ internal class PublishingOptionsPane : Spit.Publishing.DialogPane, GLib.Object {
private PrivacyDescription[] create_privacy_descriptions() {
PrivacyDescription[] result = new PrivacyDescription[0];
- result += new PrivacyDescription(_("Public listed"), PrivacySetting.PUBLIC);
- result += new PrivacyDescription(_("Public unlisted"), PrivacySetting.UNLISTED);
+ result += new PrivacyDescription(_("Public"), PrivacySetting.PUBLIC);
result += new PrivacyDescription(_("Private"), PrivacySetting.PRIVATE);
+ result += new PrivacyDescription(_("unlisted"), PrivacySetting.UNLISTED);
return result;
}
diff --git a/plugins/shotwell-publishing/YoutubeUploader.vala b/plugins/shotwell-publishing/YoutubeUploader.vala
index 47c6051..eb3507f 100644
--- a/plugins/shotwell-publishing/YoutubeUploader.vala
+++ b/plugins/shotwell-publishing/YoutubeUploader.vala
@@ -18,7 +18,10 @@ internal class Publishing.YouTube.UploadTransaction : Publishing.RESTSupport.Goo
public override async void execute_async() throws Spit.Publishing.PublishingError {
// Collect parameters
- var slug = publishable.get_param_string(Spit.Publishing.Publishable.PARAM_STRING_BASENAME);
+ var slug = publishable.get_param_string(Spit.Publishing.Publishable.PARAM_STRING_COMMENT);
+ if (slug == null || slug == "") {
+ slug = publishable.get_param_string(Spit.Publishing.Publishable.PARAM_STRING_BASENAME);
+ }
// Set title to publishing name, but if that's empty default to filename.
string title = publishable.get_publishing_name();
if (title == "") {
diff --git a/plugins/shotwell-publishing/meson.build b/plugins/shotwell-publishing/meson.build
index a93726b..962195c 100644
--- a/plugins/shotwell-publishing/meson.build
+++ b/plugins/shotwell-publishing/meson.build
@@ -18,7 +18,7 @@ shotwell_publishing_resources = gnome.compile_resources('publishing-resource',
shared_module('shotwell-publishing',
shotwell_publishing_sources + shotwell_publishing_resources,
dependencies : [gtk, soup, gexiv2, gee, sw_plugin, json_glib,
- webkit, sw_plugin_common_dep, xml, gcr,
+ sw_plugin_common_dep, xml, gcr,
gcr_ui, authenticator_dep, secret],
c_args : ['-DPLUGIN_RESOURCE_PATH="/org/gnome/Shotwell/Publishing"',
'-DGCR_API_SUBJECT_TO_CHANGE'],