{ "info": { "author": "Paul Heasley", "author_email": "paul@phdesign.com.au", "bugtrack_url": null, "classifiers": [], "description": "# flickr-rsync\n\n> Its like rsync for Flickr!\n\nA python script to manage synchronising a local directory of photos with Flickr based on an rsync interaction pattern.\n\n## Installation\n\n### Via PyPI\n\nInstall from the python package manager by\n```\n$ pip install flickr-rsync\n```\n\n### From GitHub repo\n\nClone the GitHub repo locally\n\nTo install globally:\n```\n$ python setup.py install\n```\n\nTo install for the current user only:\n```\n$ python setup.py install --user\n```\n\n## Authenticating with Flickr\n\nTwo keys are provided by Flickr, an api key and a secret. To make your application aware of these keys there are two methods:\n* provide `--api-key` and `--api-secret` arguments to the command line\n* create a config file in $HOME/.flickr-rsync.ini with the following entries\n\n```\nAPI_KEY = xxxxxxxxxxxxxxxxxxx\nAPI_SECRET = yyyyyyyyyyyyyy\n```\n\nwhere x's and y's are replaced by the values provided by Flickr.\n\n## Listing files\n\nThe `--list-only` flag will print a list of files in the source storage provider, this can either be Flickr by specifying the `src` as `Flickr` or a local file system path. Use `--sort-files` to sort the files alphabetically. This feature is useful for manually creating a diff between your local files and Flickr files.\n\ne.g. List all files in Flickr photo sets\n\n```\n$ flickr-rsync flickr --list-only\n```\n\nOr List all files in a local folder\n\n```\n$ flickr-rsync ~/Pictures --list-only\n```\n\n### Tree view vs. csv view\n\nYou can change the output from a tree view to a comma separated values view by using `--list-format=tree` or `--list-format=csv`. By default the tree view is used.\n\ne.g. Print in tree format\n\n```\n$ flickr-rsync flickr --list-only --list-format=tree\n\n\u251c\u2500\u2500\u2500 2017-04-24 Family Holiday\n\u2502 \u251c\u2500\u2500\u2500 IMG_2546.jpg [70ebf9]\n\u2502 \u251c\u2500\u2500\u2500 IMG_2547.jpg [3d3046]\n\u2502 \u251c\u2500\u2500\u2500 IMG_2548.jpg [2f2385]\n\u2502 \u2514\u2500\u2500\u2500 IMG_2549.jpg [d8e946]\n\u2502 \n\u2514\u2500\u2500\u2500 2017-04-16 Easter Camping\n \u251c\u2500\u2500\u2500 IMG_2515.jpg [aabe74]\n \u251c\u2500\u2500\u2500 IMG_2516.jpg [0eb4f2]\n \u2514\u2500\u2500\u2500 IMG_2517.jpg [4fe908]\n```\n\nOr csv format\n\n```\n$ flickr-rsync flickr --list-only --list-format=csv\n\nFolder, Filename, Checksum\n2017-04-24 Family Holiday, IMG_2546.jpg, 70ebf9be4d8301e94c65582977332754\n2017-04-24 Family Holiday, IMG_2547.jpg, 3d3046b37ba338793a762ab7bd83e85c\n2017-04-24 Family Holiday, IMG_2548.jpg, 2f23853abeb742551043a3514ba4315b\n2017-04-24 Family Holiday, IMG_2549.jpg, d8e946e73700b9c2890d3681c3c0fa0b\n2017-04-16 Easter Camping, IMG_2515.jpg, aabe74b06c3a53e801893347eb6bd7f5\n2017-04-16 Easter Camping, IMG_2516.jpg, 0eb4f2519f6562ff66069618637a7b10\n2017-04-16 Easter Camping, IMG_2517.jpg, 4fe9085b9f320a67988f84e85338a3ff\n```\n\n## Listing folders\n\nTo just list the top level folders (without all the files). use `--list-folders`. \n\n```\n$ flickr-rsync ~/Pictures --list-folders\n```\n## Syncing files\n\ne.g. To copy all files from Flickr to a local folder\n\n```\n$ flickr-rsync flickr ~/Pictures/flickr\n```\n\nOr to copy all files from a local folder up to Flickr\t\n\n```\n$ flickr-rsync ~/Pictures/flickr flickr\n```\n\nYou can even copy from a local folder to another local folder\n\n```\n$ flickr-rsync ~/Pictures/from ~/Pictures/to\n```\n\nFiles are matched by folder names and file names. E.g. if you have a Flickr photoset called `2017-04-16 Easter Camping` and a file called `IMG_2517.jpg`, and you are trying to copy from a folder with `2017-04-16 Easter Camping\\IMG_2517.jpg` it will assume this file is the same and will not try to copy it.\n\n### Will never delete!\n\n`flickr-rsync` will never delete any files, either from Flickr or your local system, it is append only. It will not overwrite any files either, if a file with the same name exists in the same photoset / folder, it will be skipped.\n\n## Filtering\n\nFiltering is done using regular expressions. The following four options control filtering the files:\n\n* `--include=` specifies a pattern that **file names** must match to be included in the operation\n* `--include-dir=` specifies a pattern that **folder names** must match to be included in the operation\n* `--exclude=` specifies a pattern that **file names** must NOT match to be included in the operation\n* `--exclude-dir=` specifies a pattern that **folder names** must NOT match to be included in the operation\n\nNote that filtering by folders is more performant than by file names, prefer folder name filtering where possible.\n\nAlso note that exclude filters take preference and will override include filters.\n\n### Root files\n\nNote that filtering does not apply to root files, root files (files in the target folder if local file system, or files not in a photoset on Flickr) are excluded by default. To include them, use `--root-files`.\n\n## Options\n\nAll options can be provided by either editing the config file `flickr-rsync.ini` or using the command line interface.\n\n```\nusage: flickr-rsync [-h] [-l] [--list-format {tree,csv}] [--list-sort]\n [--include REGEX] [--include-dir REGEX] [--exclude REGEX]\n [--exclude-dir REGEX] [--root-files] [-n]\n [--throttling SEC] [--retry NUM] [--api-key API_KEY]\n [--api-secret API_SECRET] [--tags \"TAG1 TAG2\"] [-v]\n [--version]\n [src] [dest]\n\nA python script to manage synchronising a local directory of photos to flickr\n\npositional arguments:\n src the source directory to copy or list files from, or\n FLICKR to specify flickr\n dest the destination directory to copy files to, or FLICKR\n to specify flickr\n\noptional arguments:\n -h, --help show this help message and exit\n -l, --list-only list the files in --src instead of copying them\n --list-format {tree,csv}\n output format for --list-only, TREE for a tree based\n output or CSV\n --list-sort sort alphabetically when --list-only, note that this\n forces buffering of remote sources so will be slower\n --list-folders lists only folders (no files, implies --list-only)\n -c, --checksum calculate file checksums for local files. Print\n checksum when listing, use checksum for comparison\n when syncing\n --include REGEX include only files matching REGEX. Defaults to\n media file extensions only\n --include-dir REGEX include only directories matching REGEX\n --exclude REGEX exclude any files matching REGEX, note this takes\n precedent over --include\n --exclude-dir REGEX exclude any directories matching REGEX, note this\n takes precedent over --include-dir\n --root-files includes roots files (not in a directory or a\n photoset) in the list or copy \n -n, --dry-run in sync mode, don't actually copy anything, just\n simulate the process and output\n --throttling SEC the delay in seconds (may be decimal) before each\n network call\n --retry NUM the number of times to retry a network call before\n failing\n --api-key API_KEY flickr API key\n --api-secret API_SECRET\n flickr API secret\n --tags \"TAG1 TAG2\" space seperated list of tags to apply to uploaded\n files on flickr\n -v, --verbose increase verbosity\n --version show program's version number and exit\n```\n\n### Config and token file discovery\n\nThe config file `flickr-rsync.ini` and Flickr token file `flickr-rsync.token` are searched for in the following locations in order:\n* `/flickr-rsync.ini`\n* `/.flickr-rsync.ini`\n* `/flickr-rsync.ini`\n* `/.flickr-rsync.ini`\n* `/flickr-rsync.ini`\n* `/.flickr-rsync.ini`\n\n## Developing\n\nEither install using the 'standalone' method or install in development mode so source files are symlinked\n```\n$ python setup.py develop\n```\n\nThen to uninstall\n```\n$ python setup.py develop --uninstall\n```\n\n## Debugging\n\nUse pdb\n\n```\npython -m pdb ./flickr_rsync/__main__.py \n```\n\nSet a breakpoint\n\n```\nb ./flickr_rsync/flickr_storage.py:74\n```\n\nThen `c(ontinue)` or `n(ext)` to step over or `s(tep)` to step into. \n\n`l(ist)` to show current line and 11 lines of context.\n\n`p(print)` or `pp` (pretty print) to print a variable. E.g.\n\n```\np dir(photo)\npp photo.__dict__\n```\n\nTo print all properties of variable photo.\n\n`q(uit)` to exit.\n\nCheckout https://medium.com/instamojo-matters/become-a-pdb-power-user-e3fc4e2774b2\n\n## Deploying\n\nBased on [http://peterdowns.com/posts/first-time-with-pypi.html](http://peterdowns.com/posts/first-time-with-pypi.html)\n\n1. Create a new GitHub release (e.g. v1.1.1)\n2. Update `flickr_rsync/_version.py` with the new version number (e.g. 1.1.1)\n3. Push to PyPI\n```\n$ python setup.py sdist upload\n```\n\n## Running tests\n\n```\n$ python setup.py test -q\n```\nOr\n```\n$ python -m unittest discover -s tests -p '*_test.py'\n```\n\n## Tips\n\nTo list just root files only:\n```\n$ flickr-rsync flickr --exclude-dir '.*' --root-files --list-only\n```\n\n### Videos\nMovies should work, but flickr doesn't seem to return the original video when you download it again, it returns a \nprocessed video that may have slightly downgraded quality and will not have the same checksum.\n\n## Troubleshooting\n\n#### I get a Version conflict error with the six python package when installing on my Mac\n\nIf you're running Mac OSX El Capitan and you get the following error when running `python setup.py test`\n\n```\npkg_resources.VersionConflict: (six 1.4.1 (/System/Library/Frameworks/Python.fra\nmework/Versions/2.7/Extras/lib/python), Requirement.parse('six>=1.9'))\n```\n\nDo the following:\n```\n$ sudo pip install --ignore-installed six\n```\n\nMore details [https://github.com/pypa/pip/issues/3165](https://github.com/pypa/pip/issues/3165)\n\n#### I get an error 'The Flickr API keys have not been set'\n\nTo access Flickr this application needs API keys, go to http://www.flickr.com/services/apps/create/apply to sign up for a free personal API key\n\n#### I get an error 'The Flickr API keys have not been set' but I've set them in my config (ini) file\n\nGetting an error `The Flickr API keys have not been set` but you've set them in the config file? Perhaps the application can't find the config file location. Use `-v` or `--verbose` option to print the location of the config file being used.\n\n#### Why are some files are not being shown in the file list / sync?\n\nBy default only media files are included in file listings and sync operations. Media files are defined as `\\.(jpg|jpeg|png|gif|tiff|tif|bmp|psd|svg|raw|wmv|avi|mov|mpg|mp4|3gp|ogg|ogv|m2ts)$`. Use `--include=.*` to include all files.\n\n#### I get an error 'The filename, directory name or volume label syntax is incorrect'\n\nIf you're seeing an error like this\n\n```\nWindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\\\Users\\\\xxx\\\\Pictures\" --list-only/*.*'\n```\n\nEnsure that you are not using single quotes `'` around a folder path in windows, instead use double quotes `\"`. e.g.\n\n```\n$ flickr-rsync \"C:\\Users\\xxx\\Pictures\" --list-only\n```\n\n#### When I try list list in a local folder called 'flickr' it lists my remote flickr files\n\nflickr-rsync uses the keyword `flickr` as a src or dest to denote pulling the list from flickr. If you have a folder called flickr, just give it a relative or absolute path make it obvious that it's a file path, e.g.\n\n```\n$ flickr-rsync ./flickr --list-only\n```\n#### If I add tags, they get changed by flickr, e.g. 'extn=mov becomes extnmov'.\nInternally flickr removes all whitespace and special characters, so 'extn mov' and 'extn=mov' match 'extnmov'. You can \nedit a tag using this URL:\nhttps://www.flickr.com/photos/{username}/tags/{tagname}/edit/\nor go here to manage all tags:\nhttps://www.flickr.com/photos/{username}/tags\nAnd in future put double quotes around your tag to retain special characters\n\n## Release notes\n\n### v1.0.5 (21 Mar 2018)\n* Support for videos\n* Add tag to maintain original extension \n\n### v1.0.4 (2 Nov 2017)\n* Improve retry and throttling, now uses exponential backoff\n* Use python logging framework, outputs log messages to stderr\n\n### v1.0.3 (16 Sep 2017)\n* Flickr converts .jpeg to .jpg extensions, so consider them the same when comparing for sync\n\n\n## TODO\n\n* Handle nested directories (merge with separator) (apply --include-dir after merging)\n* List duplicate files\n* Use checksum matching to avoid uploading duplicate files\n* Multi-threading - is it needed?\n* Webpage for successful Flickr login\n* Optimise - why does sort files seem to run faster?!\n* Fix duplicate albums issue\n* Why does it make 3 api calls for every photo in --list-only --list-sort mode?\n* --mirror. Yep, delete photos from target, but don't make it easy\n* --init to setup a new .ini file and walk through auth process\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/phdesign/flickr-rsync/archive/v1.0.5.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://www.phdesign.com.au/flickr-rsync", "keywords": "flickr", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "flickr-rsync", "package_url": "https://pypi.org/project/flickr-rsync/", "platform": "", "project_url": "https://pypi.org/project/flickr-rsync/", "project_urls": { "Download": "https://github.com/phdesign/flickr-rsync/archive/v1.0.5.tar.gz", "Homepage": "http://www.phdesign.com.au/flickr-rsync" }, "release_url": "https://pypi.org/project/flickr-rsync/1.0.5/", "requires_dist": null, "requires_python": "", "summary": "A python script to manage synchronising a local directory of photos with flickr based on an rsync interaction pattern", "version": "1.0.5" }, "last_serial": 3690960, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "973177907bdfdcdb2c95d970a7aac3af", "sha256": "250678f57fbbd7c777bd603dff8cd3b363633adab19dbe6df1e1a6299e989fb8" }, "downloads": -1, "filename": "flickr-rsync-1.0.1.tar.gz", "has_sig": false, "md5_digest": "973177907bdfdcdb2c95d970a7aac3af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16971, "upload_time": "2017-06-30T11:44:23", "url": "https://files.pythonhosted.org/packages/d2/3b/5b3e3671c8bbf2e45ce5dc8346da2d74da17b5a742d9df9600ea725245f3/flickr-rsync-1.0.1.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "9b30496d3be8e5e7c2386395fb8674cb", "sha256": "79dff1732b76bd13930ed9088951dc3bfc48de3b012f7c8eca968d4e6720ad4a" }, "downloads": -1, "filename": "flickr-rsync-1.0.4.tar.gz", "has_sig": false, "md5_digest": "9b30496d3be8e5e7c2386395fb8674cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18656, "upload_time": "2017-11-15T20:10:51", "url": "https://files.pythonhosted.org/packages/0b/4e/01b7dcdf8441cacef1a61c13ab974cd963f3663a78dc46680a58b7e2ee6b/flickr-rsync-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "03f686315c6729e72a8a60150b7afb50", "sha256": "a77863bcc08513a71c7921d29916231096b5d04e0f2611f9a7f63a6a2038ec06" }, "downloads": -1, "filename": "flickr-rsync-1.0.5.tar.gz", "has_sig": false, "md5_digest": "03f686315c6729e72a8a60150b7afb50", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20091, "upload_time": "2018-03-21T10:29:22", "url": "https://files.pythonhosted.org/packages/b3/12/bb0396b30cc09dedd2c940fd394b3ea6121add9991f3a3dccb115beb1b11/flickr-rsync-1.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "03f686315c6729e72a8a60150b7afb50", "sha256": "a77863bcc08513a71c7921d29916231096b5d04e0f2611f9a7f63a6a2038ec06" }, "downloads": -1, "filename": "flickr-rsync-1.0.5.tar.gz", "has_sig": false, "md5_digest": "03f686315c6729e72a8a60150b7afb50", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20091, "upload_time": "2018-03-21T10:29:22", "url": "https://files.pythonhosted.org/packages/b3/12/bb0396b30cc09dedd2c940fd394b3ea6121add9991f3a3dccb115beb1b11/flickr-rsync-1.0.5.tar.gz" } ] }