Ticket #3741 (new enhancement)

Opened 8 years ago

Last modified 8 years ago

PTP external filesystem (download files from photocameras)

Reported by: cdslow Owned by:
Priority: major Milestone: Future Releases
Component: mc-vfs Version: master
Keywords: ptp gphoto2 extfs Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

I wrote external filesystem script for PTP using gphoto2.
It will be nice to have it included in MC.

Attachments

ptp+ (2.6 KB) - added by cdslow 8 years ago.
PTP filesystem for Midnight Commander using gphoto2
ptp+.input (113.0 KB) - added by cdslow 8 years ago.
Test input for ptp+
ptp+.output (25.5 KB) - added by cdslow 8 years ago.
Test output for ptp+

Change History

comment:1 Changed 8 years ago by andrew_b

  • Component changed from mc-core to mc-vfs

comment:2 Changed 8 years ago by and

perl "monkeys" do alot of bikeshed :), so please pimp it up first.

# perlcritic --brutal ./ptp+
Code is not tidy at line 1, column 1.  See page 33 of PBP.  (Severity: 1)
No package-scoped "$VERSION" variable found at line 1, column 1.  See page 404 of PBP.  (Severity: 2)
Code before strictures are enabled at line 12, column 1.  See page 429 of PBP.  (Severity: 5)
Code before warnings are enabled at line 12, column 1.  See page 431 of PBP.  (Severity: 4)
16384 is not one of the allowed literal values (0, 1, 2). Use the Readonly or Const::Fast module or the "constant" pragma instead at line 13, column 24.  Unnamed numeric literals make code less maintainable.  (Severity: 2)
Long number not separated with underscores at line 13, column 24.  See page 59 of PBP.  (Severity: 2)
Magic variable "$ENV" should be assigned as "local" at line 15, column 14.  See pages 81,82 of PBP.  (Severity: 4)
Too many arguments at line 23, column 1.  See page 182 of PBP.  (Severity: 3)
Subroutine prototypes used at line 23, column 1.  See page 194 of PBP.  (Severity: 5)
Subroutine "list_file" does not end with "return" at line 23, column 1.  See page 197 of PBP.  (Severity: 4)
Builtin function called with parentheses at line 26, column 14.  See page 13 of PBP.  (Severity: 1)
Return value of flagged function ignored - print at line 27, column 5.  See pages 208,278 of PBP.  (Severity: 1)
Subroutine "count_files" does not end with "return" at line 30, column 1.  See page 197 of PBP.  (Severity: 4)
"local" variable not initialized at line 34, column 5.  See page 78 of PBP.  (Severity: 3)
Builtin function called with parentheses at line 37, column 5.  See page 13 of PBP.  (Severity: 1)
Quotes used with a noisy string at line 37, column 18.  See page 53 of PBP.  (Severity: 2)
Magic punctuation variable $! used in interpolated string at line 37, column 37.  See page 79 of PBP.  (Severity: 2)
Regular expression without "/s" flag at line 42, column 9.  See pages 240,241 of PBP.  (Severity: 2)
Regular expression without "/x" flag at line 42, column 9.  See page 236 of PBP.  (Severity: 3)
Regular expression without "/m" flag at line 42, column 9.  See page 237 of PBP.  (Severity: 2)
Builtin function called with parentheses at line 45, column 5.  See page 13 of PBP.  (Severity: 1)
Return value of "close" ignored at line 45, column 5.  Check the return value of "close" for success.  (Severity: 2)
Return value of flagged function ignored - close at line 45, column 5.  See pages 208,278 of PBP.  (Severity: 1)
Subroutine "list" does not end with "return" at line 50, column 1.  See page 197 of PBP.  (Severity: 4)
"local" variable not initialized at line 52, column 5.  See page 78 of PBP.  (Severity: 3)
Builtin function called with parentheses at line 58, column 5.  See page 13 of PBP.  (Severity: 1)
Close filehandles as soon as possible after opening them at line 58, column 5.  See page 209 of PBP.  (Severity: 4)
Quotes used with a noisy string at line 58, column 18.  See page 53 of PBP.  (Severity: 2)
Magic punctuation variable $! used in interpolated string at line 58, column 37.  See page 79 of PBP.  (Severity: 2)
Cascading if-elsif chain at line 66, column 9.  See pages 117,118 of PBP.  (Severity: 3)
Use character classes for literal metachars instead of escapes at line 66, column 12.  See page 247 of PBP.  (Severity: 1)
Regular expression without "/s" flag at line 66, column 12.  See pages 240,241 of PBP.  (Severity: 2)
Regular expression without "/x" flag at line 66, column 12.  See page 236 of PBP.  (Severity: 3)
Regular expression without "/m" flag at line 66, column 12.  See page 237 of PBP.  (Severity: 2)
Regular expression without "/s" flag at line 71, column 15.  See pages 240,241 of PBP.  (Severity: 2)
Regular expression without "/x" flag at line 71, column 15.  See page 236 of PBP.  (Severity: 3)
Regular expression without "/m" flag at line 71, column 15.  See page 237 of PBP.  (Severity: 2)
Use character classes for literal metachars instead of escapes at line 73, column 29.  See page 247 of PBP.  (Severity: 1)
Regular expression without "/s" flag at line 73, column 29.  See pages 240,241 of PBP.  (Severity: 2)
Regular expression without "/x" flag at line 73, column 29.  See page 236 of PBP.  (Severity: 3)
Regular expression without "/m" flag at line 73, column 29.  See page 237 of PBP.  (Severity: 2)
Split long regexps into smaller qr// chunks at line 75, column 29.  See page 261 of PBP.  (Severity: 3)
Regular expression without "/s" flag at line 75, column 29.  See pages 240,241 of PBP.  (Severity: 2)
Regular expression without "/x" flag at line 75, column 29.  See page 236 of PBP.  (Severity: 3)
Regular expression without "/m" flag at line 75, column 29.  See page 237 of PBP.  (Severity: 2)
Regular expression without "/s" flag at line 82, column 29.  See pages 240,241 of PBP.  (Severity: 2)
Regular expression without "/x" flag at line 82, column 29.  See page 236 of PBP.  (Severity: 3)
Regular expression without "/m" flag at line 82, column 29.  See page 237 of PBP.  (Severity: 2)
Builtin function called with parentheses at line 89, column 5.  See page 13 of PBP.  (Severity: 1)
Return value of "close" ignored at line 89, column 5.  Check the return value of "close" for success.  (Severity: 2)
Return value of flagged function ignored - close at line 89, column 5.  See pages 208,278 of PBP.  (Severity: 1)
Subroutine prototypes used at line 92, column 1.  See page 194 of PBP.  (Severity: 5)
Quotes used with a string containing no non-whitespace characters at line 96, column 27.  See page 53 of PBP.  (Severity: 2)
Magic punctuation variable $! used in interpolated string at line 96, column 38.  See page 79 of PBP.  (Severity: 2)
Subroutine prototypes used at line 99, column 1.  See page 194 of PBP.  (Severity: 5)
Always unpack @_ first at line 99, column 1.  See page 178 of PBP.  (Severity: 4)
Quotes used with a string containing no non-whitespace characters at line 103, column 27.  See page 53 of PBP.  (Severity: 2)
Magic punctuation variable $! used in interpolated string at line 103, column 38.  See page 79 of PBP.  (Severity: 2)
3 is not one of the allowed literal values (0, 1, 2). Use the Readonly or Const::Fast module or the "constant" pragma instead at line 109, column 31.  Unnamed numeric literals make code less maintainable.  (Severity: 2)

comment:3 follow-up: ↓ 5 Changed 8 years ago by zaytsev

Oh god, I'd rewrite it in Python rather than deal with Perl critics ;-)

comment:4 follow-up: ↓ 6 Changed 8 years ago by mooffie

@Vadim: have a look at #3730. Could you provide a sample input file, and make the script testable?

Because right now we have to rely on your word that your script works, and we'll not be able to modify it, for whatever reason, and make sure it still works.

@Andrew / @Yury: what do you say about blocking any new extfs scripts till #3730 or equivalent gets in?

comment:5 in reply to: ↑ 3 Changed 8 years ago by and

Replying to zaytsev:

Oh god, I'd rewrite it in Python rather than deal with Perl critics ;-)

With "monks" you can build living space, with pythons you will crush to death only.
So no Python please. LOL

Changed 8 years ago by cdslow

PTP filesystem for Midnight Commander using gphoto2

Changed 8 years ago by cdslow

Test input for ptp+

Changed 8 years ago by cdslow

Test output for ptp+

comment:6 in reply to: ↑ 4 Changed 8 years ago by cdslow

Replying to mooffie:

@Vadim: have a look at #3730. Could you provide a sample input file, and make the script testable?

Done.

Note: See TracTickets for help on using tickets.