Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding file creation and modified date support + more debugging output #47

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mfyz
Copy link

@mfyz mfyz commented Nov 6, 2018

  1. created files were having "now()" to their creation and modified timestamps. used flickr photo meta data to update after file creation on the fs.

  2. added photo number, total photos in that page and page indicators aside of the album/photoset currently downloading for better understanding to the progress of the download. Example:

[file -  90/500 at the page 1/2 - photo set: Auto Upload] 2,647,529   2.01MB/s

@TheFox
Copy link
Owner

TheFox commented Nov 7, 2018

Cool, thank you for your Pull Request.

Please change the variables to Camel Case. For example, $total_photos has to be $totalPhotos.

For a complete list of all failed checks see: https://travis-ci.org/TheFox/flickr-cli/jobs/451572044

@mfyz
Copy link
Author

mfyz commented Nov 9, 2018

@TheFox clean build. Let me know if need more tweaks.

SimpleXMLElement $photo,
string $destinationPath,
string $basename = null,
string $debugInfo
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting a default value in the 3rd argument and then setting no default argument in the 4th should be avoided. This is in general not best practice. Either setting also a default value for $debugInfo or switch: ... string $debugInfo, string $basename = null). Since $destinationPath and $basename are both path related I would prefer to also set a default value for $debugInfo.

You see, this line

$photo = $this->downloadPhoto($photo, $destinationPath, $id, "");

doesn't look very nice. Because the empty string "" can be avoided.

Having a default value and a caller like this,

$photo = $this->downloadPhoto($photo, $destinationPath, $id);

also looks nicer.


// update the timstamps of the file
$update_date = (int) $photo->dates['lastupdate'];
$taken_date = strtotime((string) $photo->dates['taken']);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use

strval($photo->dates['taken'])

instead of

(string) $photo->dates['taken']

here. The same goes for (int). Use intval() instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants