Skip to content

API framework and new web UI#4

Open
ov3rk1ll wants to merge 31 commits intoschnatterer:developfrom
ov3rk1ll:better-ui
Open

API framework and new web UI#4
ov3rk1ll wants to merge 31 commits intoschnatterer:developfrom
ov3rk1ll:better-ui

Conversation

@ov3rk1ll
Copy link

@ov3rk1ll ov3rk1ll commented Jul 22, 2020

Summay

I have been using this app for a file to get images but it's sometimes hard to quickly find the image you want.
So I decided to build a new web interface with thumbnails and some more information.
The communication is done via a JSON API to get a list of files and exit data.

The initial list groups the files by day so you can easily jump to a specific date and also let's you filter by file type.
pmcaFilesystemServer-better-ui-1

When clicking on a entry, you get more details from EXIF data, a larger preview and also a download button that opens the actual file
pmcaFilesystemServer-better-ui-2

ToDo

  • Videos don't have thumbnails yet. If those can't be generated at least serve a static fallback file
  • Reading EXIF from RAW files. This seems to somewhat fail at least on my a6000
  • Improve the EXIF data display in the UI
  • Test on other cameras. I only have access to an a6000 for testing so I can't validate all those features on other devices

@ov3rk1ll ov3rk1ll marked this pull request as draft July 22, 2020 11:22
@ov3rk1ll ov3rk1ll changed the title WIP: API framework and new web UI API framework and new web UI Jul 22, 2020
@ov3rk1ll ov3rk1ll marked this pull request as ready for review July 23, 2020 13:40
@schnatterer
Copy link
Owner

schnatterer commented Jul 23, 2020

Wow, it seems like your putting a lot of effort into this, nice!
Haven't had a chance to look into the code yet, but sounds like a wonderful addition from what you write.

I have just set off to an extensive holiday, trip so I probably won't have time to have a closer look for the next couple of weeks

Once I'm back I can try out on an A6500 and perform a thorough code review.

Ah and just an idea, unit tests would make your features more sustainable. I didn't write any in this project to begin with because I didn't have much time and needed the feature desperately 🙈
Also, I never thought it would be that useful for others. But that's up to you!

@ov3rk1ll
Copy link
Author

Thanks for your feedback.
Just let me know if there is anything you want to change after you had a chance to look that the feature.

Regarding unit tests: I have looked into this a bit but there are some strange limitations when I run them on my camera.
I'm unable to push test files and code coverage also returns no data.
Nevertheless will I write as many tests as possible for the new API but I might put them in a new pull request to keep the discussion separated.

ov3rk1ll added 5 commits July 27, 2020 13:18
Must be run via "connectedAndroidTest" command!

Pushing test files fails so we have to rely on existing files on the device.
Also, code coverage doesn't return any data.
@ov3rk1ll
Copy link
Author

I have now pushed all the unit tests I could think of for the new API.
There are no tests for the javascript I'm not really sure how that would work with the current setup.

There are some limitations when I run those tests on the actual camera:

  • Must be run via "connectedCheck" or "connectedAndroidTest" command
  • Pushing test files (via adb push) fails so we have to rely on existing files on the device.
    The test expect at least one image, video and raw file to work.
  • Code coverage doesn't return any data so tests would need to run in a emulator for that

The travis build now fails because of the "connectedCheck" command in the build script

@schnatterer
Copy link
Owner

Sounds great!
Regarding Travis two things come to mind:

  • Do the test run on an emulator? Then we could launch one during the build
  • Could we make them "proper" unit tests using robolectric. The question here is: do we really need a device for the unit tests?

@ov3rk1ll
Copy link
Author

ov3rk1ll commented Aug 3, 2020

I have no updated the project with some test files that get pushed to the emulator before running the tests.
I tried adding a emulator to the travis file but that seems to timeout/fail for now.

  • Could we make them "proper" unit tests using robolectric. The question here is: do we really need a device for the unit tests?

I don't have any experience with robolectric but the current unit tests do run in the emulator.

Given how "special" the Android OS on those cameras is, I'd suggest to run the tests on a actual hardware as well. At lease for release builds.

ov3rk1ll and others added 3 commits August 4, 2020 10:04
 - EXIF response for non existent file must be 404.
 - Calling EXIF on invalid file returns a valid response (200) with the json property "success" set to false
Should shorten build times drastically and make TDD more efficient.

Also simplify exception and file handling in tests.
@schnatterer
Copy link
Owner

@ov3rk1ll I changed the unit tests to run without emulator via robolectric.
This increases the CI build significantly (3 min instead o 12). Also the tests should run faster locally.
Please have a look if everything still runs as intended.

Next stop is manual test on my device and code review.
Do you still consider the state of this PR as WIP? Or is it ready to merge from your side?

@schnatterer schnatterer force-pushed the better-ui branch 2 times, most recently from 9b5d898 to ee0c575 Compare August 29, 2020 13:09
@schnatterer
Copy link
Owner

Getting started with the JavaScript part, I introduced webpack to get JavaScript modules with clearer scoping and dependencies, which also builds a single js dependency for less HTTP requests at runtime.
Using modules and scopes now finally allows for unit testing our JS code.

There were some global variables that made the whole process challenging for me. I'm not sure if I converted all globals properly.
For example, meta here.
Maybe you could check if everything still works? At least there now is the option of finding and fixing those issues in a more efficient way using unit tests 😉

Also, jquery is horrible for getting tests bootstrapped, but my proof of concept should give an idea how it could work.

@schnatterer
Copy link
Owner

Hi @ov3rk1ll , Did I ask too many questions 🙈 ?

Are you planning to continue working on this? If not, could I ask you to answer my question on the Java code and maybe have a quick review of my changes to JavaScript? I can then merge the PR and decide how to go on from there myself.

Either way, thanks for your efforts up to this point!

@ov3rk1ll
Copy link
Author

@schnatterer I sadly had absolutely no time to work on this over the last months so it's definitely not the number of questions.

I'll try to get back to you with the information in the next few days but I can't really say how much time I'll have to work on this.

@schnatterer
Copy link
Owner

@ov3rk1ll thanks for getting back to me.
I'm in no hurry, if you're still motivated to continue, take your time.
I just want to make sure our work gets merged eventually.

@oresamp
Copy link

oresamp commented Oct 28, 2022

Hey Guys

I just tried to install it on my Sony Alpha 7II - i built it in Android Studio on Mac OS and tried to install on camera, but i got many errors. At the same time, i haven't any problem when installing from the app list.

for example,

Traceback (most recent call last):
File "pmca-gui.py", line 78, in do
File "pmca\commands\usb.py", line 300, in installCommand
File "pmca\commands\usb.py", line 73, in installApp
Exception: Communication error 100: Error completed`

I understand that you are planning to do a little optimisation, but i would like to have it installed the way it is.
Probably, you need help with testing?

*tried to build it on windows - the same

@schnatterer
Copy link
Owner

Hi @oresamp, I built it back then and running it on my 6500 ever since. Building it with a contemporary version of the Android tools might be difficult now 😐
I didn't have a lot of free time on my hands since, and probably won't have too soon.
I might be able to upload the apk as a preview, if I can dump it off my camera.

@schnatterer
Copy link
Owner

schnatterer commented Feb 10, 2023

FWIW I dumped the apk of this PR that I've been using on my camera for years and uploaded it as a pre-release.
So, for the time being - if you're happy running a pre-release you can find the apk here.

Feedback welcome, but I cant promise anything.
CC @oresamp @nrk

@schnatterer schnatterer force-pushed the develop branch 4 times, most recently from 01756cd to 0b9169b Compare February 10, 2023 13:52
@oresamp
Copy link

oresamp commented Apr 1, 2023

@schnatterer I finally tried the apk you attached. I have the same error as before in October.

Traceback (most recent call last):
File "pmca-gui.py", line 78, in do
File "pmca\commands\usb.py", line 300, in installCommand
File "pmca\commands\usb.py", line 73, in installApp
Exception: Communication error 100: Error completed`

this happens both with this apk and the previous one, which was part of Sony-PMCA-RE. I suggest it got the same apk now.

@schnatterer
Copy link
Owner

schnatterer commented May 31, 2023

@oresamp have you tried installing it via adb?

  • Install the open memories tweak app and start it on your camera.
  • Enable wifi
  • Enable adb
  • on your computer, open a console and type
adb tcpip 5555
adb connect <ip address as shown on camera>:5555
adb push your.apk
# If this fails you might want to try the following
adb install -t your.apk

For adb install see @dan-r's post.

@oresamp
Copy link

oresamp commented Jun 16, 2023

@schnatterer unfortunately for me is :
adb: error: failed to copy 'info.schnatterer.pmcaFilesystemServer-1.apk' to 'device': remote Read-only file system

@schnatterer
Copy link
Owner

@oresamp What about adb install?

@oresamp
Copy link

oresamp commented Jun 17, 2023

@schnatterer
Tried also. Push, install, reboot.. All what I can find.

I'm thinking about API Version
Android Debug Bridge version 1.0.41 Version 34.0.3-10161052 Installed as /opt/homebrew/bin/adb Running on Darwin 22.5.0 (arm64)

but it's interesting, that some people cannot also install from Sony-PMCA-RE with the same error:

@JetErorr
Copy link

Sony A6000 PAL: I installed the stable 0.2.0 and noticed there was no GUI, so I decided to try the 0.3.0-pre.

1: Sony-PMCA-RE

I also ran into this error:

File "pmca-gui.py", line 78, in do
File "pmca\commands\usb.py", line 300, in installCommand
File "pmca\commands\usb.py", line 73, in installApp
Exception: Communication error 100: Error completed

( The pmca\ file path suggests that some uncaught error in the installation logic was eventually caught by the PMCA-RE usb driver. )

2: adb (via OpenMemories-Tweak, over wifi)
With adb install, I saw an error about the INSTALL_FAILED_TEST_ONLY.
I tried adb push + shell install, but I saw an error saying something about INSUFFICIENT_SPACE.

I was looking around for fixes online, so the camera turned off a couple of times meanwhile.
I tried the adb install (not push + install) again and it threw an error saying that I have the app already installed (I'm not sure if it meant the stable 0.2.0 I already had or if somehow the 0.3.0-pre made it through)
So I deleted the version I had (no idea which one), and did the adb install again (not push + install) and the app was installed successfully.

I can use the GUI pretty flawlessly.

What could have worked:
Rebooting the device (or letting it hibernate and waking it up)
Installing the old version, letting it fail due to the old version, uninstalling the old version

Hope this helps.

@dan-r
Copy link

dan-r commented Oct 25, 2023

I wasn't able to install with PMCA-RE either, and when I tried installing with ADB I got INSTALL_FAILED_TEST_ONLY. I was able to successfully install with

adb install -t NAME.apk

Looks like something wrong in the manifest?

https://stackoverflow.com/questions/25274296/adb-install-fails-with-install-failed-test-only

@schnatterer
Copy link
Owner

schnatterer commented Oct 31, 2023

Thanks, @dan-r , that sounds plausible. I uploaded a dev version which I installed on my camera using Android Studio. So it might well have the test attribute 💡 I'll update my instructions posted above.

@oresamp
Copy link

oresamp commented Nov 1, 2023

adb install -t NAME.apk

works!
Thank you

@leonardcoutinho
Copy link

Thanks for your app, I was able to install on my Nex 5r with -t parameter in adb. If you alrealdy have an older version of app you have to remove it before install with -t command.

@kishorpatel82
Copy link

I wasn't able to install with PMCA-RE either, and when I tried installing with ADB I got INSTALL_FAILED_TEST_ONLY. I was able to successfully install with

adb install -t NAME.apk

Looks like something wrong in the manifest?

https://stackoverflow.com/questions/25274296/adb-install-fails-with-install-failed-test-only

I have tried by unpacking apk, removing test attributes in AndroidManifest.xml file and packing it again. new apk still gives same error in pcma gui v0.17.

seems video is not possible to run in "v0.3.0-pre" which was possible to run in "v0.2.0"

@fvgsmd
Copy link

fvgsmd commented Apr 14, 2024

I tried to install it on a5100 through the pmca gui

Installation crashes with this error:
Traceback (most recent call last):
File "pmca-gui.py", line 78, in do
File "pmca\commands\usb.py", line 300, in installCommand
File "pmca\commands\usb.py", line 73, in installApp
Exception: Communication error 100: Error completed

Then tried over adb with: adb install -t NAME.apk
This was successful! Thanks guys

@Rational-pi
Copy link

@schnatterer
So one a5100 user tested, one Nex 5r user also and it is great on my a6000
could this be merged ?

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.