[PLDWWW] page changed: people:glen

"Elan Ruusamäe (glen)" glen at pld-linux.org
Sun Oct 12 17:13:42 CEST 2014


[Dropbox as picture share service] moved code to github

--- https://www.pld-linux.org/people/glen?rev=1406040843
+++ https://www.pld-linux.org/people/glen?rev=1413126822
@@ -250,107 +250,9 @@
  Any file saved to ''~/Pictures/Screenshots'' gets renamed based on timestamp and moved to ''~/Dropbox/Public'' folder.
  
  When the move is done, URL for the image is copied to clipboard and image viewer is opened so you can see your image before you paste the url to IM, e-mail, etc...
  
- Requirements: [[https://www.dropbox.com/install?os=lnx|dropboxd]] running, [[http://ftp.gnome.org/pub/GNOME/sources/libnotify/0.7/|libnotify]], [[https://github.com/rvoicilas/inotify-tools/wiki|inotify-tools]]
- 
- You should start the script at startup of your X session, example:
- <code ini ~/.config/autostart/dropbox-watch.desktop>
- [Desktop Entry]
- Type=Application
- Name=Dropbox watch
- Comment=Launch dropbox watcher script
- Icon=dropbox
- Exec=$HOME/.local/bin/dropbox-watch.sh
- </code>
- 
- <code bash ~/.local/bin/dropbox-watch.sh>
- #!/bin/sh
- # A script that watches ~/Pictures/Screenshots dir, and any new file is added there, it
- # is renamed so it would contain filename modify timestamp (uses safe
- # characters not to require urlencode) and moved to dropbox dir. Additionally
- # dropbox url is copied to clipboard and image viewer is opened to show that
- # screenshot.
- #
- # Author: Elan Ruusamäe <glen at delfi.ee>
- # Date: 2012-11-09
- # Updated: 2014-07-22 (test all tools, more filename filters)
- 
- watchdir=$HOME/Pictures/Screenshots
- viewer=xdg-open
- 
- # Config
- dropdir=$HOME/Dropbox/Public/ss
- dropuser=YOUR_DROPBOX_NUMERIC_USER_ID 
- dropurl=https://dl.dropboxusercontent.com/u/$dropuser/ss
- 
- if [ ! -d $dropdir ]; then
- 	echo >&2 "Dropbox dir $dropdir missing!"
- 	exit 1
- fi
- 
- if [ ! -d $watchdir ]; then
- 	echo >&2 "Watch dir $watchdir missing!"
- 	exit 1
- fi
- 
- if ! which $viewer 2>/dev/null; then
- 	echo >&2 "Can't find viewer: $viewer"
- 	exit 1
- fi
- 
- if ! which inotifywait 2>/dev/null; then
- 	echo >&2 "Can't find tool: inotifywait, install inotify-tools"
- 	exit 1
- fi
- 
- if ! which notify-send 2>/dev/null; then
- 	echo >&2 "Can't find tool: notify-send, install libnotify"
- 	exit 1
- fi
- 
- if ! which xclip 2>/dev/null; then
- 	echo >&2 "Can't find tool: xclip, install xclip"
- 	exit 1
- fi
- 
- inotifywait -m -e moved_to -e close_write $watchdir | while read path change filename; do
- 	case "$change" in
- 	CREATE|MOVED_TO|*CLOSE_WRITE*)
- 		file=$path/$filename
- 		;;
- 	*)
- 		continue
- 	esac
- 
- 	# reformat filename so it woult be nice url
- 	mtime=$(stat -c "%y" "$file")
- 	# Strip 'Screenshot - 04062013 - 11:30:49 AM.png'
- 	# strip 'Screenshot - 14.01.2013 - 15:04:02', and leave everything else part of the filename
- 	fn=$(echo "$filename" | sed -e 's,^Screenshot - [ .:0-9-]*[AP]M,,')
- 	# Strip 'Screenshot from 2013-02-13 23:49:07'
- 	# Strip 'Screenshot - 30.05.2013 - 11:48:58.png'
- 	fn=$(echo "$fn" | sed -re 's,^Screenshot( from)? [ .:0-9-]*,,')
- 
- 	# sanitize exts
- 	fn=$(echo "$fn" | sed -re 's/\.?(jpe?g|png)$//' -e 'y/ /_/')
- 	filename=$(date -d "$mtime" '+%Y-%m-%d_%H.%M.%S')${fn:+-$fn}.png
- 
- 	# bugfixes
- 	fn=$(echo "$fn" | sed -re 's/\.png\.png$/.png/')
- 
- 	url="$dropurl/$filename"
- 
- 	mv "$file" "$dropdir/$filename"
- 
- 	$viewer "$dropdir/$filename" &
- 
- 	# Copy URL to clipboard and notify the user
- 	echo -n "$url" | xclip -selection c
- 	notify-send --hint=int:transient:1 "Screenshot Uploaded" "Copied URL to clipboard:\n$url"
- done
- </code>
- 
+ See: https://github.com/glensc/dropbox-watch
  ===== PLD svn and Subversion under ac =====
  
  [[/AcInfo|Ac]] has old openssl that can't do [[wp>Server Name Indication|SNI]] properly, therefore accessing svn over https gives errors:
  


Diff URL:
  https://www.pld-linux.org/people/glen?do=diff&r1=1406040843&r2=1413126822
-- 
This mail was generated by DokuWiki at
https://www.pld-linux.org/


More information about the pld-cvs-commit mailing list