# HG changeset patch # User Aleksej Bobylev # Date 1480264144 -7200 # Node ID 4cdf2b95ae572139ff89e39fd731a2812b7f67ae # Parent f2fe8c08dc89fe07aaf28dc144b428a35cc7dba2 Add yandex-disk (with custom desktop integration) diff -r f2fe8c08dc89 -r 4cdf2b95ae57 yandex-disk/description.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yandex-disk/description.txt Sun Nov 27 18:29:04 2016 +0200 @@ -0,0 +1,8 @@ +You can access photos, videos, and documents on Disk from anywhere in the world +where there's internet. + +The Yandex.Disk client console lets you: + + * synchronize files and folders with your Disk + * get public links to files and folders + * customize folder syncing diff -r f2fe8c08dc89 -r 4cdf2b95ae57 yandex-disk/receipt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yandex-disk/receipt Sun Nov 27 18:29:04 2016 +0200 @@ -0,0 +1,59 @@ +# SliTaz package receipt. + +PACKAGE="yandex-disk" +VERSION="0.1.5.978" +CATEGORY="misc" +SHORT_DESC="Yandex.Disk keeps your files with you at all times" +MAINTAINER="al.bobylev@gmail.com" +LICENSE="custom" +WEB_SITE="https://disk.yandex.ru/" +#TARBALL="$PACKAGE-$VERSION.deb" +COOKOPTS="!extradesktops" + +DEPENDS="gcc-lib-base glibc-base zlib" + +# Rules to configure and make the package. +compile_rules() +{ + # Get current (and the one) version + repo='http://repo.yandex.ru/yandex-disk/deb/pool/main/y/yandex-disk/' + url=$(wget -q -T10 -O- $repo | fgrep i386 | cut -d'"' -f2) + # for example, url='yandex-disk_0.1.5.978_i386.deb' + + version=$(echo $url | cut -d'_' -f2) + # for example, version='0.1.5.978' + [ -n "$version" ] || exit 1 + + # Hot changing VERSION in this receipt + sed -i "/^VERSION=/s/.*$/VERSION=\"$version\"/" $WOK/$PACKAGE/receipt + + TARBALL="$PACKAGE-$version.deb" + + # Get current package + [ -s $SRC/$TARBALL ] || wget -O $SRC/$TARBALL "$repo$url" + + # Extract filesystem from package + mkdir -p $install + dpkg-deb -x $SRC/$TARBALL $install + + # Add SliTaz desktop integration + cp -a $stuff/usr $install + + # Add translations for desktop integration + cd $stuff/po + make DESTDIR=$install install + make clean +} + +# Rules to gen a SliTaz package suitable for Tazpkg. +genpkg_rules() +{ + cook_copy_files yandex-disk copyright *.mo \ + publish unpublish test status *.desktop yandex-disk-helper + cook_copy_icons +} + +pre_remove() +{ + killall -q yandex-disk +} diff -r f2fe8c08dc89 -r 4cdf2b95ae57 yandex-disk/stuff/po/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yandex-disk/stuff/po/Makefile Sun Nov 27 18:29:04 2016 +0200 @@ -0,0 +1,37 @@ +# Makefile for yandex-disk-helper +# +LINGUAS = ru uk + +pot: + xgettext -o yandex-disk-helper.pot -L Shell -k -k_ \ + --package-name="Yandex.Disk helper" \ + ../usr/bin/yandex-disk-helper \ + ../usr/libexec/yandex-disk/publish \ + ../usr/libexec/yandex-disk/status \ + ../usr/libexec/yandex-disk/unpublish + +msgmerge: + @for l in $(LINGUAS); do \ + if [ -f "$$l.po" ]; then \ + echo "Updating $$l po file."; \ + msgmerge -U $$l.po $$p.pot; \ + fi; \ + done; + +msgfmt: + @for l in $(LINGUAS); do \ + if [ -f "$$l.po" ]; then \ + echo -e "Compiling $$l mo file...\n"; \ + mkdir -p mo/$$l/LC_MESSAGES; \ + msgfmt -o mo/$$l/LC_MESSAGES/yandex-disk-helper.mo $$l.po; \ + fi; \ + done; + +install: msgfmt + mkdir -p $(DESTDIR)/usr/share/locale + cp -a mo/* $(DESTDIR)/usr/share/locale + +clean: + rm -rf mo + rm -f *.mo + rm -f *.*~ diff -r f2fe8c08dc89 -r 4cdf2b95ae57 yandex-disk/stuff/po/ru.po --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yandex-disk/stuff/po/ru.po Sun Nov 27 18:29:04 2016 +0200 @@ -0,0 +1,84 @@ +# Russian translations for Yandex.Disk helper +# Copyright (C) 2016 Yandex +# This file is distributed under the same license as the Yandex.Disk helper package. +# Aleksej Bobylev , 2016. +# +msgid "" +msgstr "" +"Project-Id-Version: Yandex.Disk helper\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-11-27 17:09+0200\n" +"PO-Revision-Date: 2016-11-27 17:18+0200\n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"Last-Translator: Aleksej Bobylev \n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.6\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-KeywordsList: _\n" + +#: ../usr/bin/yandex-disk-helper:21 ../usr/libexec/yandex-disk/publish:11 +#: ../usr/libexec/yandex-disk/status:8 ../usr/libexec/yandex-disk/unpublish:8 +msgid "Yandex.Disk" +msgstr "Яндекс.Диск" + +#: ../usr/bin/yandex-disk-helper:82 +msgid "GB" +msgstr "ГБ" + +#: ../usr/bin/yandex-disk-helper:82 +msgid "MB" +msgstr "МБ" + +#: ../usr/bin/yandex-disk-helper:119 +msgid "Reconfigure" +msgstr "Перенастроить" + +#: ../usr/bin/yandex-disk-helper:120 +msgid "Start" +msgstr "Запустить" + +#: ../usr/bin/yandex-disk-helper:121 +msgid "Stop" +msgstr "Остановить" + +#: ../usr/bin/yandex-disk-helper:123 +msgid "Open local folder" +msgstr "Открыть локальную папку" + +#: ../usr/bin/yandex-disk-helper:124 +msgid "Open online folder" +msgstr "Открыть онлайн папку" + +#: ../usr/bin/yandex-disk-helper:135 +msgid "Welcome to Yandex.Disk!" +msgstr "Добро пожаловать в Яндекс.Диск!" + +#: ../usr/bin/yandex-disk-helper:137 +msgid "To use Yandex.Disk on this computer, you must first configure it." +msgstr "" +"Для того, чтобы использовать Яндекс.Диск на этом компьютере, его нужно " +"сначала настроить." + +#: ../usr/bin/yandex-disk-helper:180 +msgid "Add folder to bookmarks" +msgstr "Добавить папку в закладки" + +#: ../usr/bin/yandex-disk-helper:181 +msgid "Finish" +msgstr "Завершить" + +#: ../usr/libexec/yandex-disk/publish:13 +msgid "Folder:" +msgstr "Папка:" + +#: ../usr/libexec/yandex-disk/publish:15 +msgid "File:" +msgstr "Файл:" + +#: ../usr/libexec/yandex-disk/status:9 +msgid "Please wait..." +msgstr "Пожалуйста, подождите…" diff -r f2fe8c08dc89 -r 4cdf2b95ae57 yandex-disk/stuff/po/uk.po --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yandex-disk/stuff/po/uk.po Sun Nov 27 18:29:04 2016 +0200 @@ -0,0 +1,84 @@ +# Ukrainian translations for Yandex.Disk helper +# Copyright (C) 2016 Yandex +# This file is distributed under the same license as the Yandex.Disk helper package. +# Aleksej Bobylev , 2016. +# +msgid "" +msgstr "" +"Project-Id-Version: Yandex.Disk helper\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-11-27 17:09+0200\n" +"PO-Revision-Date: 2016-11-27 18:18+0200\n" +"Language: uk\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"Last-Translator: Aleksej Bobylev \n" +"Language-Team: \n" +"X-Generator: Poedit 1.8.6\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Poedit-KeywordsList: _\n" + +#: ../usr/bin/yandex-disk-helper:21 ../usr/libexec/yandex-disk/publish:11 +#: ../usr/libexec/yandex-disk/status:8 ../usr/libexec/yandex-disk/unpublish:8 +msgid "Yandex.Disk" +msgstr "Яндекс.Диск" + +#: ../usr/bin/yandex-disk-helper:82 +msgid "GB" +msgstr "ГБ" + +#: ../usr/bin/yandex-disk-helper:82 +msgid "MB" +msgstr "МБ" + +#: ../usr/bin/yandex-disk-helper:119 +msgid "Reconfigure" +msgstr "Переналаштувати" + +#: ../usr/bin/yandex-disk-helper:120 +msgid "Start" +msgstr "Запустити" + +#: ../usr/bin/yandex-disk-helper:121 +msgid "Stop" +msgstr "Зупинити" + +#: ../usr/bin/yandex-disk-helper:123 +msgid "Open local folder" +msgstr "Відкрити локальну папку" + +#: ../usr/bin/yandex-disk-helper:124 +msgid "Open online folder" +msgstr "Відкрити онлайн папку" + +#: ../usr/bin/yandex-disk-helper:135 +msgid "Welcome to Yandex.Disk!" +msgstr "Ласкаво просимо до Яндекс.Диску!" + +#: ../usr/bin/yandex-disk-helper:137 +msgid "To use Yandex.Disk on this computer, you must first configure it." +msgstr "" +"Для того, щоб скористатися Яндекс.Диском на цьому комп'ютері, необхідно " +"спочатку його налаштувати." + +#: ../usr/bin/yandex-disk-helper:180 +msgid "Add folder to bookmarks" +msgstr "Додати папку в закладки" + +#: ../usr/bin/yandex-disk-helper:181 +msgid "Finish" +msgstr "Завершити" + +#: ../usr/libexec/yandex-disk/publish:13 +msgid "Folder:" +msgstr "Папка:" + +#: ../usr/libexec/yandex-disk/publish:15 +msgid "File:" +msgstr "Файл:" + +#: ../usr/libexec/yandex-disk/status:9 +msgid "Please wait..." +msgstr "Будь ласка, зачекайте…" diff -r f2fe8c08dc89 -r 4cdf2b95ae57 yandex-disk/stuff/po/yandex-disk-helper.pot --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yandex-disk/stuff/po/yandex-disk-helper.pot Sun Nov 27 18:29:04 2016 +0200 @@ -0,0 +1,79 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Yandex.Disk helper\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-11-27 17:09+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../usr/bin/yandex-disk-helper:21 ../usr/libexec/yandex-disk/publish:11 +#: ../usr/libexec/yandex-disk/status:8 ../usr/libexec/yandex-disk/unpublish:8 +msgid "Yandex.Disk" +msgstr "" + +#: ../usr/bin/yandex-disk-helper:82 +msgid "GB" +msgstr "" + +#: ../usr/bin/yandex-disk-helper:82 +msgid "MB" +msgstr "" + +#: ../usr/bin/yandex-disk-helper:119 +msgid "Reconfigure" +msgstr "" + +#: ../usr/bin/yandex-disk-helper:120 +msgid "Start" +msgstr "" + +#: ../usr/bin/yandex-disk-helper:121 +msgid "Stop" +msgstr "" + +#: ../usr/bin/yandex-disk-helper:123 +msgid "Open local folder" +msgstr "" + +#: ../usr/bin/yandex-disk-helper:124 +msgid "Open online folder" +msgstr "" + +#: ../usr/bin/yandex-disk-helper:135 +msgid "Welcome to Yandex.Disk!" +msgstr "" + +#: ../usr/bin/yandex-disk-helper:137 +msgid "To use Yandex.Disk on this computer, you must first configure it." +msgstr "" + +#: ../usr/bin/yandex-disk-helper:180 +msgid "Add folder to bookmarks" +msgstr "" + +#: ../usr/bin/yandex-disk-helper:181 +msgid "Finish" +msgstr "" + +#: ../usr/libexec/yandex-disk/publish:13 +msgid "Folder:" +msgstr "" + +#: ../usr/libexec/yandex-disk/publish:15 +msgid "File:" +msgstr "" + +#: ../usr/libexec/yandex-disk/status:9 +msgid "Please wait..." +msgstr "" diff -r f2fe8c08dc89 -r 4cdf2b95ae57 yandex-disk/stuff/usr/bin/yandex-disk-helper --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yandex-disk/stuff/usr/bin/yandex-disk-helper Sun Nov 27 18:29:04 2016 +0200 @@ -0,0 +1,210 @@ +#!/bin/sh +# yandex-disk-helper - simple Yandex.Disk maintenance app +# Aleksei Bobylev , 2016 + + +# Settings for usage statistics bar: + +barw='48' # bar width in symbols +bars=' ' # bar symbol +barf='10' # bar font (Pango markup) +baru='background="#4277CA"' # style for 'used' part (Pango markup) +bart='background="#CA9342"' # style for 'trash' part (Pango markup) +bara='background="#CACACA"' # style for 'available' part (Pango markup) + + +# i18n +_() { gettext 'yandex-disk-helper' "$1"; } + +tmpid='/tmp/yandex-disk-notify.id' + +title="$(_ 'Yandex.Disk')" + +# Get untranslated status +statusC=$(LC_ALL=C yandex-disk status) + + +# Draw colored bar: used, trash, available, and print used % + +bar() { + echo "$statusC" | awk -vwidth="$barw" -vsym="$bars" -vfont="$barf" \ + -vusedstyle="$baru" -vtrashstyle="$bart" -vavailstyle="$bara" ' + # Convert argument in human-readable form like "23.7 MB" into bytes + function bytes() { + split($0, a, ": "); + split(a[2], s, " "); + if (s[2] == "KB") { return (sprintf("%.0f", s[1] * 1024)); } + if (s[2] == "MB") { return (sprintf("%.0f", s[1] * 1024 * 1024)); } + if (s[2] == "GB") { return (sprintf("%.0f", s[1] * 1024 * 1024 * 1024)); } + } + + # Draw bar using specified symbol + function bar(n) { + num = 1 * sprintf("%.0f", n); + out = ""; + if (num > 0) + for (i = 1; i <= num; i++) out = out sym; + return out; + } + + # Get sizes + /Total:/ { total = bytes(); } + /Used:/ { used = bytes(); } + /Trash size:/ { trash = bytes(); } + /Available:/ { avail = bytes(); } + + END { + # If daemon stopped, we got no values, then skip + if (total) { + # Calculate bar parts width in symbols + usedbar = width * (used - trash) / total; + trashbar = width * trash / total; + availbar = width * avail / total; + + usedpct = 100 * used / total; + + # Print complete bar + printf("", font); + printf("%s", usedstyle, bar(usedbar)); + printf("%s", trashstyle, bar(trashbar)); + printf("%s", availstyle, bar(availbar)); + printf(""); + printf(" %.1f %%", usedpct); + } + } +' +} + + +# Localize 'GB' and 'MB' at the end of line + +gbmb() { + local GB=$(_ 'GB') MB=$(_ 'MB') + sed "s|GB$|$GB|;s|MB$|$MB|" +} + + +# Display Yad window with Yandex.Disk status + +status() { + version=$(yandex-disk -v | head -n1) + copyright=$(yandex-disk -v | tail -n1) + + yandex-disk status | gbmb | \ + yad --window-icon='yandex-disk' --center \ + --title="$title" --width='500' --height='300' \ + --image='yandex-disk' \ + --text="\ +  +$version +$copyright + +$(bar)" \ + --text-align='center' \ + --text-info \ + --button='gtk-preferences:2' \ + --button='gtk-close' +} + + +# Display Yad window with Yandex.Disk preferences + +preferences() { + # Get the value of variable $dir + . "$HOME/.config/yandex-disk/config.cfg" + + yad --window-icon='yandex-disk' --center \ + --title="$title" --image='yandex-disk' --fixed \ + --form --columns="2" \ + --field="$(_ 'Reconfigure')!system-run:FBTN" "$0 configure" \ + --field="$(_ 'Start')!media-playback-start:FBTN" "$0 start" \ + --field="$(_ 'Stop')!media-playback-stop:FBTN" "$0 stop" \ + --field=" :LBL" "" \ + --field="$(_ 'Open local folder')!folder:FBTN" "pcmanfm $dir" \ + --field="$(_ 'Open online folder')!folder-remote:FBTN" "$BROWSER https://disk.yandex.ru/" \ + --button='gtk-close' \ + >/dev/null +} + + +# Display Yad window when Yandex.Disk not configured yet + +firstrun() { + yad --window-icon='yandex-disk' --center \ + --title="$title" --width='300' --image='yandex-disk' \ + --text="$(_ 'Welcome to Yandex.Disk!') + +$(_ 'To use Yandex.Disk on this computer, you must first configure it.')" || exit 0 + + $0 configure + exit 0 +} + + +# Check commands: start, stop, and configure + +case $1 in + start|stop) + answer=$(yandex-disk $1) + if [ -e "$tmpid" ]; then + # Replace existing notification + notify_id=$(head -n1 $tmpid) + notify-send -i 'yandex-disk' -r "${notify_id:-1}" -a tazweb "$title" "$answer" + else + # Make new notification + notify-send -i 'yandex-disk' -p -a tazweb "$title" "$answer" > "$tmpid" + fi + + # Remove tmpid if it expired 5 sec (notification closed by timeout); + # leave it if it updated (new notification was replaced the existing) + # For example: press Stop, wait a second, press Start: there should be the single notification + touch "$tmpid"; sleep 1; tmp_anchor=$(mktemp); sleep 4 + [ "$tmpid" -ot "$tmp_anchor" ] && rm "$tmpid" + rm "$tmp_anchor" + + exit 0 + ;; + + configure) + # Stop daemon before, because it will not get the same path instead + yandex-disk stop + + # Run configuration in the terminal window + answer=$(terminal -t "$title" -e yandex-disk setup) + + # Additional configuration in the YAD window + # Add bookmark if: checkbox checked and Finish pressed and bookmark absent yet + answer=$(yad --window-icon='yandex-disk' --center \ + --title="$title" --image='yandex-disk' --fixed \ + --form --always-print-result \ + --field="$(_ 'Add folder to bookmarks'):CHK" "true" \ + --button="$(_ 'Finish')") + [ $? -eq 0 ] || exit 0 + + case "$answer" in + *TRUE*) + . "$HOME/.config/yandex-disk/config.cfg" + bookmarks="$HOME/.config/gtk-3.0/bookmarks" + fgrep -q "$dir" "$bookmarks" && exit 0 + echo "file://$dir $title" >> "$bookmarks" + ;; + esac + + exit 0 + ;; +esac + + +# Run without commands + +# Is Yandex.Disk already configured? +[ ! -e "$HOME/.config/yandex-disk/iid" ] && firstrun + +# Display status +status +[ $? -ne 2 ] && exit 0 + +# Button Preferences pressed +preferences + +exit 0 diff -r f2fe8c08dc89 -r 4cdf2b95ae57 yandex-disk/stuff/usr/libexec/yandex-disk/publish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yandex-disk/stuff/usr/libexec/yandex-disk/publish Sun Nov 27 18:29:04 2016 +0200 @@ -0,0 +1,62 @@ +#!/bin/sh +# Publish file on the Yandex.Disk +# Aleksei Bobylev , 2016 + +# i18n +_() { gettext 'yandex-disk-helper' "$1"; } + +# Read configuration +. $HOME/.config/yandex-disk/config.cfg + +title="$(_ 'Yandex.Disk')" +if [ -d "$1" ]; then + type="$(_ 'Folder:')" +else + type="$(_ 'File:')" +fi +name=$(basename "$1") +tmpid='/tmp/yandex-disk-notify.id' + +# Start notification in background +/usr/libexec/yandex-disk/status "$1" & + +# Publish the file/folder using yandex-disk CLI +answer=$(yandex-disk publish "$1") +case $? in + 0) # OK + ;; + *) # Error + # Wait a bit for notification to share its id + sleep 1 + # Get notification id + notify_id=$(fgrep "$1" $tmpid | cut -d$'\t' -f2) + # Replace the notification with the error message + notify-send --icon='dialog-error' -r ${notify_id:-999} \ + "$title" "$name:\n$answer" + exit 1 + ;; +esac + +# New file that copied to synced Yandex.Disk folder +y="$dir/$(basename "$1")" +# Set GVFS attributes +gvfs-set-attribute "$1" -t stringv metadata::emblems yandex-disk +gvfs-set-attribute "$y" -t stringv metadata::emblems emblem-shared +gvfs-set-attribute "$y" -t string metadata::yandex-disk-origin "$1" +gvfs-set-attribute "$y" -t string metadata::yandex-disk-uri "$answer" + +# FIXME: PCManFM currently not update the emblem + +# Display YAD dialog where user can copy share URI or open it in default browser +echo $answer | \ +yad \ + --title="$title" \ + --window-icon='yandex-disk' \ + --image='yandex-disk' \ + --center \ + --width=400 \ + --text="$type $name +$(gettext 'yandex-disk-helper' 'Share URL:')" \ + --text-info --show-url \ + --button='gtk-open' --button='gtk-close' && +$BROWSER $answer diff -r f2fe8c08dc89 -r 4cdf2b95ae57 yandex-disk/stuff/usr/libexec/yandex-disk/status --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yandex-disk/stuff/usr/libexec/yandex-disk/status Sun Nov 27 18:29:04 2016 +0200 @@ -0,0 +1,44 @@ +#!/bin/sh +# Live status of the publishing on the Yandex.Disk +# Aleksei Bobylev , 2016 + +# i18n +_() { gettext 'yandex-disk-helper' "$1"; } + +title="$(_ 'Yandex.Disk')" +message="$(_ 'Please wait...')" +tmpid='/tmp/yandex-disk-notify.id' + +# Display initial notification +notify_id=$(notify-send -i 'yandex-disk' -p "$title" "$message") + +# Put the (filename and) notification id to tmp file +echo -e "$1\t$notify_id" >> $tmpid + +# Wait a bit (max 3s: avoid endless loop) before `yandex-disk status` will +# show 'Sync progress' +while [ wait != '###' ]; do + LC_ALL=C yandex-disk status | fgrep -q 'Sync progress' && break + sleep 1 + wait="$wait#" +done + +# Update notification in loop +while true; do + # Exit loop if 'Sync progress' (probably) gone + LC_ALL=C yandex-disk status | fgrep -q 'Sync progress' || break + + # Get localized progress + progress=$(yandex-disk status | head -n1) + # Replace notification with the new info + notify-send -i 'yandex-disk' -r "$notify_id" "$title" "$progress" + sleep 1 +done + +# Wait 5s: after that default time notification will gone +sleep 5 + +# Remove id from tmp file +sed -i "/\t$notify_id$/d" $tmpid +# Remove file if it empty +[ -s "$tmpid" ] || rm $tmpid diff -r f2fe8c08dc89 -r 4cdf2b95ae57 yandex-disk/stuff/usr/libexec/yandex-disk/test --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yandex-disk/stuff/usr/libexec/yandex-disk/test Sun Nov 27 18:29:04 2016 +0200 @@ -0,0 +1,8 @@ +#!/bin/sh +# Test if given file somewhere inside Yandex.Disk synced folder +# Aleksei Bobylev , 2016 + +# Read configuration +. $HOME/.config/yandex-disk/config.cfg + +echo "$1" | fgrep -q "$dir" diff -r f2fe8c08dc89 -r 4cdf2b95ae57 yandex-disk/stuff/usr/libexec/yandex-disk/unpublish --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yandex-disk/stuff/usr/libexec/yandex-disk/unpublish Sun Nov 27 18:29:04 2016 +0200 @@ -0,0 +1,19 @@ +#!/bin/sh +# Unpublish file from Yandex.Disk: revoke sharing of the selected file +# Aleksei Bobylev , 2016 + +# i18n +_() { gettext 'yandex-disk-helper' "$1"; } + +title="$(_ 'Yandex.Disk')" +name=$(basename "$1") + +# Unpublish file/folder using yandex-disk CLI +answer=$(yandex-disk unpublish "$1") + +# Display localized notification +notify-send -i 'yandex-disk' "$title" "$name:\n$answer" + +# Reset GVFS attributes +gvfs-set-attribute "$1" -t stringv metadata::emblems none +gvfs-set-attribute "$1" -t string metadata::yandex-disk-uri '' diff -r f2fe8c08dc89 -r 4cdf2b95ae57 yandex-disk/stuff/usr/share/applications/yandex-disk.desktop --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yandex-disk/stuff/usr/share/applications/yandex-disk.desktop Sun Nov 27 18:29:04 2016 +0200 @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=Yandex.Disk +Name[ru]=Яндекс.Диск +Name[uk]=Яндекс.Диск +Exec=yandex-disk-helper +Icon=yandex-disk +Categories=GTK;Network;FileTransfer; diff -r f2fe8c08dc89 -r 4cdf2b95ae57 yandex-disk/stuff/usr/share/file-manager/actions/yd-publish.desktop --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yandex-disk/stuff/usr/share/file-manager/actions/yd-publish.desktop Sun Nov 27 18:29:04 2016 +0200 @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=Action +Name=Publish on Yandex.Disk +Name[ru]=Опубликовать в Яндекс.Диск +Name[uk]=Опублікувати на Яндекс.Диск +Icon=yandex-disk +Profiles=PublishToYandex; +ShowIfRunning=/usr/bin/yandex-disk + +[X-Action-Profile PublishToYandex] +Exec=sh -c "/usr/libexec/yandex-disk/publish %f" diff -r f2fe8c08dc89 -r 4cdf2b95ae57 yandex-disk/stuff/usr/share/file-manager/actions/yd-unpublish.desktop --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yandex-disk/stuff/usr/share/file-manager/actions/yd-unpublish.desktop Sun Nov 27 18:29:04 2016 +0200 @@ -0,0 +1,12 @@ +[Desktop Entry] +Type=Action +Name=Withdraw from public access +Name[ru]=Убрать из публичного доступа +Name[uk]=Вилучити з публічного доступу +Icon=yandex-disk +Profiles=UnpublishFromYandex; +ShowIfRunning=/usr/bin/yandex-disk + +[X-Action-Profile UnpublishFromYandex] +ShowIfTrue=sh -c "/usr/libexec/yandex-disk/test %f" +Exec=sh -c "/usr/libexec/yandex-disk/unpublish %f" diff -r f2fe8c08dc89 -r 4cdf2b95ae57 yandex-disk/stuff/usr/share/icons/hicolor/16x16/apps/yandex-disk.png Binary file yandex-disk/stuff/usr/share/icons/hicolor/16x16/apps/yandex-disk.png has changed diff -r f2fe8c08dc89 -r 4cdf2b95ae57 yandex-disk/stuff/usr/share/icons/hicolor/48x48/apps/yandex-disk.png Binary file yandex-disk/stuff/usr/share/icons/hicolor/48x48/apps/yandex-disk.png has changed