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

Requiring using the launcher is silly #7

Open
pfalcon opened this issue Oct 25, 2019 · 6 comments
Open

Requiring using the launcher is silly #7

pfalcon opened this issue Oct 25, 2019 · 6 comments
Labels
enhancement New feature or request

Comments

@pfalcon
Copy link

pfalcon commented Oct 25, 2019

Failing with #6, we're proceeding with python3.7 -m venv .... Looking at setup.py there're bunch of dvr-* entrypoint. But running them have no effect:

(.venv) dvrip$ dvr-info
Usage:  info
(.venv) dvrip$ dvr-info 192.168.1.10
Usage:  info
(.venv) dvrip$ dvr-info -h 192.168.1.10
Usage:  info

That's apparently because "calling conventions" for subcommands have changed, and nowadays

	if host() is None:
		usage()

is always true.

@pfalcon pfalcon changed the title dvr-* (dvr-info, etc.) tools no longer seem to work dvr-* (dvr-info, etc.) tools no longer seem to work if called directly Oct 25, 2019
@pfalcon
Copy link
Author

pfalcon commented Oct 25, 2019

But from #6 (comment) we know that "calling conventions" are still exec'ing individual dvr-* executables!

Now the reason behind funkiness like:

		environ[DVR_HOST] = host
		environ[DVR_SERV] = str(serv)
		environ[DVR_USERNAME] = username
		environ[DVR_PASSWORD] = password

becomes clear - dvrip.cmd.__init__ parses command line options (with getopt! In 2019 with python3.7!), and passes their values via child process environment!

@pfalcon
Copy link
Author

pfalcon commented Oct 25, 2019

There's a bit more funkiness for reverse engineers among us:

	port = environ.get('DVR_PORT', '34567')
...
		environ[DVR_SERV] = str(serv)

So, dvr command can take port from DVR_PORT envvar, but will pass it to downstream commands via DVR_SERV. And for majority of people, "serv" is abbreviation of "server", though of course reverse engineers among us will find out, that in this case, it's abbreviation of "service" (as in: textual name of a port number).

@alexshpilkin alexshpilkin changed the title dvr-* (dvr-info, etc.) tools no longer seem to work if called directly Requiring using the launcher is silly Oct 26, 2019
@alexshpilkin
Copy link
Owner

The dvr-* commands never did work standalone. I admit that my attempt to factor out some of the boilerplate into the dvr launcher came out a bit silly, but... it made sense at the time, and I haven’t gotten around to fixing it. (I should.)

You don’t have to reverse engineer anything, you can just ask :)

@alexshpilkin alexshpilkin added the enhancement New feature or request label Oct 26, 2019
@pfalcon
Copy link
Author

pfalcon commented Oct 26, 2019

The dvr-* commands never did work standalone. I admit that my attempt to factor out some of the boilerplate into the dvr launcher came out a bit silly,

If you take votes on this, I'd suggest to drop individual dvr-* commands and exactly use "launcher" with subcommands. You know, OS command namespace is not made of rubber, so dropping 1 new command into user environment is generally better than dropping a dozen (depends of course, with a dozen you get "free" shell completion for those commands).

Likewise, I'd second suggestion to make it runnable using Python's -m switch. Because dvr runs with whatever Python version is hardcoded into it, whereas with -m, user chooses which version to run, and that may be useful.

@pfalcon
Copy link
Author

pfalcon commented Oct 26, 2019

You don’t have to reverse engineer anything, you can just ask :)

Thanks for quick replies, but I'm that kind of guy who thinks that looking at the code is easier than asking stupid questions ;-). It's only when there're too many questions, some have to be asked.

I also probably should elaborate why this bunch of comments/tickets posted. I just looked at https://github.com/topics/xmeye , and got following thoughts: "There seems to be a club of folks who hack on that Sofia protocol, but each seem to duplicate work. Why would be that?" and "One of the project seems to be ahead of others in terms of project organization, let's look into that first. Uggh, still not stellar (well, just doesn't really work for me). But given all the effort put into the project already, perhaps the author would be interested in feedback on some problem spots".

Dunno how well the last part goes ;-). But I definitely would need to give myself reasons why I'd join "duplicate effort" club, and the idea that doing that aloud might help wider community (because otherwise I of course just hack up yet another crappy tool which doesn't work for anybody else but me). Sorry if that's not the case ;-).

@Vasiliy1992
Copy link

Is there a command to turn off the DVR?
Can you tell me how to safely turn off the DVR before turning off the power?

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

No branches or pull requests

3 participants