{"action":"created","issue":{"url":"https://api.github.com/repos/owncloud/gallery/issues/387","labels_url":"https://api.github.com/repos/owncloud/gallery/issues/387/labels{/name}","comments_url":"https://api.github.com/repos/owncloud/gallery/issues/387/comments","events_url":"https://api.github.com/repos/owncloud/gallery/issues/387/events","html_url":"https://github.com/owncloud/gallery/pull/387","id":108551392,"number":387,"title":"New occ commands to manage thumbnails","user":{"login":"oparoz","id":323220,"avatar_url":"https://avatars.githubusercontent.com/u/323220?v=3","gravatar_id":"","url":"https://api.github.com/users/oparoz","html_url":"https://github.com/oparoz","followers_url":"https://api.github.com/users/oparoz/followers","following_url":"https://api.github.com/users/oparoz/following{/other_user}","gists_url":"https://api.github.com/users/oparoz/gists{/gist_id}","starred_url":"https://api.github.com/users/oparoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oparoz/subscriptions","organizations_url":"https://api.github.com/users/oparoz/orgs","repos_url":"https://api.github.com/users/oparoz/repos","events_url":"https://api.github.com/users/oparoz/events{/privacy}","received_events_url":"https://api.github.com/users/oparoz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/owncloud/gallery/labels/2%20-%20Developing","name":"2 - Developing","color":"ededed"},{"url":"https://api.github.com/repos/owncloud/gallery/labels/enhancement","name":"enhancement","color":"02e10c"}],"state":"open","locked":false,"assignee":{"login":"oparoz","id":323220,"avatar_url":"https://avatars.githubusercontent.com/u/323220?v=3","gravatar_id":"","url":"https://api.github.com/users/oparoz","html_url":"https://github.com/oparoz","followers_url":"https://api.github.com/users/oparoz/followers","following_url":"https://api.github.com/users/oparoz/following{/other_user}","gists_url":"https://api.github.com/users/oparoz/gists{/gist_id}","starred_url":"https://api.github.com/users/oparoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oparoz/subscriptions","organizations_url":"https://api.github.com/users/oparoz/orgs","repos_url":"https://api.github.com/users/oparoz/repos","events_url":"https://api.github.com/users/oparoz/events{/privacy}","received_events_url":"https://api.github.com/users/oparoz/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/owncloud/gallery/milestones/14","html_url":"https://github.com/owncloud/gallery/milestones/9.0-next","labels_url":"https://api.github.com/repos/owncloud/gallery/milestones/14/labels","id":1226544,"number":14,"title":"9.0-next","description":"","creator":{"login":"oparoz","id":323220,"avatar_url":"https://avatars.githubusercontent.com/u/323220?v=3","gravatar_id":"","url":"https://api.github.com/users/oparoz","html_url":"https://github.com/oparoz","followers_url":"https://api.github.com/users/oparoz/followers","following_url":"https://api.github.com/users/oparoz/following{/other_user}","gists_url":"https://api.github.com/users/oparoz/gists{/gist_id}","starred_url":"https://api.github.com/users/oparoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oparoz/subscriptions","organizations_url":"https://api.github.com/users/oparoz/orgs","repos_url":"https://api.github.com/users/oparoz/repos","events_url":"https://api.github.com/users/oparoz/events{/privacy}","received_events_url":"https://api.github.com/users/oparoz/received_events","type":"User","site_admin":false},"open_issues":15,"closed_issues":0,"state":"open","created_at":"2015-07-26T22:29:05Z","updated_at":"2015-10-13T07:02:49Z","due_on":null,"closed_at":null},"comments":45,"created_at":"2015-09-27T18:08:40Z","updated_at":"2015-10-13T14:34:12Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/owncloud/gallery/pulls/387","html_url":"https://github.com/owncloud/gallery/pull/387","diff_url":"https://github.com/owncloud/gallery/pull/387.diff","patch_url":"https://github.com/owncloud/gallery/pull/387.patch"},"body":"Sunday Funday!\r\n\r\nHere are some command some of you may find useful to manage your thumbnails: \r\n\r\n## Create thumbnails\r\n\r\nSolution for https://github.com/owncloud/core/issues/17536\r\n\r\n### Documentation\r\n\r\n[Create thumbnails](https://github.com/owncloud/gallery/wiki/Create-Thumbnails)\r\n\r\n### Specs\r\n\r\n* Collect user(s) or path info from the list of command arguments\r\n* Die if encryption is enabled\r\n* Compute path to analyse\r\n* Only work with folders starting with `/<user>/files`\r\n* Scan the given path using Cache\\Scanner in order to work with reliable data\r\n* Update the DB cache\r\n* Generate previews **only for media types supported by the Gallery and for which we have a preview provider**\r\n* Collect stats\r\n\r\n#### Stats\r\n\r\n* # of folders\r\n* # of files\r\n* # of images\r\n* # of previews generated\r\n* # of failed previews (listed)\r\n* Time to complete request\r\n* Last scanned file\r\n* Size of processed data\r\n\r\n### TODO\r\n- [x] Quit if encryption is enabled\r\n- [x] Only scan a mounted volume if previews are enabled for that storage location\r\n- [x] Restrict scan to `/<user>/files`\r\n- [x] Add some stats\r\n- [x] Add a switch to force the regeneration of thumbnails\r\n- [ ] ~~Offer a safer scanning option, with transactional locking. I'm hoping this will solve the error 1205 problems and not create more problems when trying to generate thumbnails~~\r\n- [x] Presents stats even if operation was cancelled\r\n- [ ] Add tests \r\n\r\n### Possible extensions\r\n\r\nFor future PRs\r\n* Make coffee\r\n* Support mimetype as a filter\r\n\r\n## Delete thumbnails\r\n\r\n### Documentation\r\n\r\n[Delete thumbnails](https://github.com/owncloud/gallery/wiki/Delete-Thumbnails)\r\n\r\n### Specs\r\n\r\n* Collect user(s) or path info from the list of command arguments\r\n* We do not care about encryption\r\n* Wipe the thumbnails folders if we're asked to remove thumbnails for one, a few or all users\r\n* Compute path to analyse in all other cases\r\n* Search for files **of media type supported by Gallery and for which we have a preview provider** and delete as we go\r\n* Collect stats\r\n\r\n#### Stats\r\n\r\n* # of images\r\n* # of thumbnails deleted\r\n* # of failed deletion (listed)\r\n* Time to complete request\r\n* Saved space\r\n\r\n### Possible extensions\r\n\r\nFor future PRs\r\n* There could be an option to delete thumbnails for all files. This would only be useful if the providers were changed in between the time the thumbnails were generated and the time at which the command is run\r\n\r\n### TODO\r\n\r\n- [x] Find an easy way to update the cache without re-scanning\r\n- [x] Fix bug in core which prevents the use of a shared folder as the path (sub-folders work) https://github.com/owncloud/core/issues/19544 (8.1+)\r\n- [x] Ask confirmation before launching the operation as we're deleting files from the system\r\n- [ ] Add tests \r\n\r\n## Notes\r\nOf course, it would be much more useful to be able to run that from a cron, from the user's settings panel, etc. so don't hesitate to improve this solution ;)\r\n\r\n@mmattel @setnes @EricReiche @jospoortvliet @DeepDiver1975 @icewind1991 @Xenopathic @demattin @thedd @patman15 @africanforest @MorrisJobke @PVince81 @libasys @mbazdell @blackm "},"comment":{"url":"https://api.github.com/repos/owncloud/gallery/issues/comments/147733693","html_url":"https://github.com/owncloud/gallery/pull/387#issuecomment-147733693","issue_url":"https://api.github.com/repos/owncloud/gallery/issues/387","id":147733693,"user":{"login":"oparoz","id":323220,"avatar_url":"https://avatars.githubusercontent.com/u/323220?v=3","gravatar_id":"","url":"https://api.github.com/users/oparoz","html_url":"https://github.com/oparoz","followers_url":"https://api.github.com/users/oparoz/followers","following_url":"https://api.github.com/users/oparoz/following{/other_user}","gists_url":"https://api.github.com/users/oparoz/gists{/gist_id}","starred_url":"https://api.github.com/users/oparoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oparoz/subscriptions","organizations_url":"https://api.github.com/users/oparoz/orgs","repos_url":"https://api.github.com/users/oparoz/repos","events_url":"https://api.github.com/users/oparoz/events{/privacy}","received_events_url":"https://api.github.com/users/oparoz/received_events","type":"User","site_admin":false},"created_at":"2015-10-13T14:34:12Z","updated_at":"2015-10-13T14:34:12Z","body":"@mmattel - Regarding the PHP error you get, you need this: https://github.com/owncloud/gallery/pull/422\r\n\r\nAnd regarding the quiet mode, it turns out it wasn't entirely my fault. It is managed by Symfony at a global level and it prevents their question helper from printing questions... at least in the older version of the component shipping in `core`.\r\nI've fixed the stats so that they print, no matter what.\r\n\r\n"}}