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

Feature added: Issue #65 #204

Closed
wants to merge 1 commit into from

Conversation

AamerShareef
Copy link

@AamerShareef AamerShareef commented Jul 1, 2023

Added feature - Issue #65.

New flags added 🥳

--filename_add_original (or) -ao : Adds the original filename to the new filename
--filename_suffix : Adds a custom suffix to the new filename.

Sample Output:

1227c98e03af:/opt/phockup# ./phockup.py /mnt/test_input/ /mnt/test_output/ -y --filename_add_original --filename_suffix=NIKON

[2023-07-01 12:02:01] - [WARNING] - Dry-run phockup (does a trial run with no permanent changes)...
[2023-07-01 12:02:01] - [INFO] - /mnt/test_input/DSCF1904.JPG => /mnt/test_output/2023/05/18/20230518-041043_DSCF1904_NIKON.JPG
[2023-07-01 12:02:01] - [INFO] - Processed 1 files in 0.10 seconds. Average Throughput: 9.93 files/second
[2023-07-01 12:02:01] - [INFO] - Would have copied 1 files.

1227c98e03af:/opt/phockup# ./phockup.py /mnt/test_input/ /mnt/test_output/ -y --filename_add_original 
[2023-07-01 12:11:13] - [WARNING] - Dry-run phockup (does a trial run with no permanent changes)...
[2023-07-01 12:11:13] - [INFO] - /mnt/test_input/DSCF1904.JPG => /mnt/test_output/2023/05/18/20230518-041043_DSCF1904.JPG
[2023-07-01 12:11:13] - [INFO] - Processed 1 files in 0.09 seconds. Average Throughput: 10.63 files/second

1227c98e03af:/opt/phockup# ./phockup.py /mnt/test_input/ /mnt/test_output/ -y --filename_suffix=NIKON
[2023-07-01 12:12:14] - [WARNING] - Dry-run phockup (does a trial run with no permanent changes)...
[2023-07-01 12:12:15] - [INFO] - /mnt/test_input/DSCF1904.JPG => /mnt/test_output/2023/05/18/20230518-041043_NIKON.JPG
[2023-07-01 12:12:15] - [INFO] - Processed 1 files in 0.09 seconds. Average Throughput: 10.55 files/second
[2023-07-01 12:12:15] - [INFO] - Would have copied 1 files.

1227c98e03af:/opt/phockup# ./phockup.py /mnt/test_input/ /mnt/test_output/ -y
[2023-07-01 12:12:40] - [WARNING] - Dry-run phockup (does a trial run with no permanent changes)...
[2023-07-01 12:12:40] - [INFO] - /mnt/test_input/DSCF1904.JPG => /mnt/test_output/2023/05/18/20230518-041043.JPG
[2023-07-01 12:12:40] - [INFO] - Processed 1 files in 0.09 seconds. Average Throughput: 10.66 files/second
[2023-07-01 12:12:40] - [INFO] - Would have copied 1 files.

@AamerShareef
Copy link
Author

This is for issue #65 not 63 :)

@ivandokov
Copy link
Owner

Please add tests for the new features.

Copy link
Owner

@ivandokov ivandokov left a comment

Choose a reason for hiding this comment

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

Please take a look at the comments I left and the tests.

@@ -287,6 +287,28 @@ def parse_args(args=sys.argv[1:]):
"""
)

parser.add_argument(
'--filename_suffix',
Copy link
Owner

Choose a reason for hiding this comment

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

Please change the _ with a -


parser.add_argument(
'-ao',
'--filename_add_original',
Copy link
Owner

Choose a reason for hiding this comment

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

Please change the _ with a -

base_name=os.path.basename(original_filename)
f_name=os.path.splitext(base_name)[0]
target_filename=''.join(filename) + '_' + f_name
#debug
Copy link
Owner

Choose a reason for hiding this comment

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

Please remove this comment


if self.filename_suffix:
target_filename=target_filename + '_' + self.filename_suffix
# print(target_filename)
Copy link
Owner

Choose a reason for hiding this comment

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

Please remove this comment

@ivandokov
Copy link
Owner

I'm closing this PR as it needs to be updated to fit the current state of the code as it has conflicts. Also some of the features are already merged.

@ivandokov ivandokov closed this Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants